From a994b7afde252261f10cad5f8dbfab75cd49c2e8 Mon Sep 17 00:00:00 2001 From: Liu Yang Date: Sat, 5 Jan 2013 13:47:33 +0800 Subject: [PATCH] Add round(x)/round(y) at the end of calculating the origin of arrow to avoid blurring drawing. --- Classes/Popover/WEPopoverContainerView.m | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Classes/Popover/WEPopoverContainerView.m b/Classes/Popover/WEPopoverContainerView.m index 1319c10..6c3ba72 100755 --- a/Classes/Popover/WEPopoverContainerView.m +++ b/Classes/Popover/WEPopoverContainerView.m @@ -201,7 +201,8 @@ - (void)determineGeometryForSize:(CGSize)theSize anchorRect:(CGRect)anchorRect d //Cap the arrow offset xArrowOffset = MAX(xArrowOffset, properties.leftBgMargin + properties.arrowMargin); xArrowOffset = MIN(xArrowOffset, theSize.width - properties.rightBgMargin - properties.arrowMargin - upArrowImage.size.width); - + //x offset should be round to avoid blurring + xArrowOffset = roundf(xArrowOffset); theArrowRect = CGRectMake(xArrowOffset, yArrowOffset, upArrowImage.size.width, upArrowImage.size.height); break; @@ -225,7 +226,8 @@ - (void)determineGeometryForSize:(CGSize)theSize anchorRect:(CGRect)anchorRect d //Cap the arrow offset xArrowOffset = MAX(xArrowOffset, properties.leftBgMargin + properties.arrowMargin); xArrowOffset = MIN(xArrowOffset, theSize.width - properties.rightBgMargin - properties.arrowMargin - downArrowImage.size.width); - + //x offset should be round to avoid blurring + xArrowOffset = roundf(xArrowOffset); theArrowRect = CGRectMake(xArrowOffset , yArrowOffset, downArrowImage.size.width, downArrowImage.size.height); break; @@ -249,7 +251,8 @@ - (void)determineGeometryForSize:(CGSize)theSize anchorRect:(CGRect)anchorRect d //Cap the arrow offset yArrowOffset = MAX(yArrowOffset, properties.topBgMargin + properties.arrowMargin); yArrowOffset = MIN(yArrowOffset, theSize.height - properties.bottomBgMargin - properties.arrowMargin - leftArrowImage.size.height); - + //y offset should be round to avoid blurring + yArrowOffset = roundf(yArrowOffset); theArrowRect = CGRectMake(xArrowOffset, yArrowOffset, leftArrowImage.size.width, leftArrowImage.size.height); break; @@ -273,7 +276,8 @@ - (void)determineGeometryForSize:(CGSize)theSize anchorRect:(CGRect)anchorRect d //Cap the arrow offset yArrowOffset = MAX(yArrowOffset, properties.topBgMargin + properties.arrowMargin); yArrowOffset = MIN(yArrowOffset, theSize.height - properties.bottomBgMargin - properties.arrowMargin - rightArrowImage.size.height); - + //y offset should be round to avoid blurring + yArrowOffset = roundf(yArrowOffset); theArrowRect = CGRectMake(xArrowOffset, yArrowOffset, rightArrowImage.size.width, rightArrowImage.size.height); break;