Created
February 25, 2010 15:55
-
-
Save jverkoey/314659 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 10d435690793854734c1e343491d3525ecb86745 Mon Sep 17 00:00:00 2001 | |
From: Jeff Verkoeyen <[email protected]> | |
Date: Sat, 13 Feb 2010 18:14:08 -0500 | |
Subject: [PATCH] Older SDKs (pre 3.2) seem to flip the shadow y offset, but 3.2 doesn't. | |
This fixes the TTStyle for shadows on 3.2. | |
--- | |
src/TTStyle.m | 10 +++++++++- | |
1 files changed, 9 insertions(+), 1 deletions(-) | |
diff --git a/src/TTStyle.m b/src/TTStyle.m | |
index 5be3bd0..3c20acf 100644 | |
--- a/src/TTStyle.m | |
+++ b/src/TTStyle.m | |
@@ -1190,8 +1190,16 @@ static const NSInteger kDefaultLightSource = 125; | |
CGContextRef ctx = UIGraphicsGetCurrentContext(); | |
CGContextSaveGState(ctx); | |
+ CGSize shadowOffset; | |
+#ifdef __IPHONE_3_2 | |
+ shadowOffset = CGSizeMake(_offset.width, _offset.height); | |
+#else | |
+ // On older SDKs it seems that the shadow vertical offset is upside down. Strange. | |
+ shadowOffset = CGSizeMake(_offset.width, -_offset.height); | |
+#endif | |
+ | |
[context.shape addToPath:context.frame]; | |
- CGContextSetShadowWithColor(ctx, CGSizeMake(_offset.width, -_offset.height), _blur, | |
+ CGContextSetShadowWithColor(ctx, shadowOffset, _blur, | |
_color.CGColor); | |
CGContextBeginTransparencyLayer(ctx, nil); | |
[self.next draw:context]; | |
-- | |
1.6.6+GitX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment