From c52e6788e681cdcc19171e464509b2f92e8c251a Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov <Timur.Pocheptsov@cern.ch> Date: Mon, 26 Mar 2012 18:09:34 +0000 Subject: [PATCH] Disable quartz shadows - even GUI is jerky because of them (picker views, animations etc.) git-svn-id: http://root.cern.ch/svn/root/trunk@43488 27541ba8-7e3a-0410-8455-c3a389f83636 --- graf2d/ios/src/IOSPainter.cxx | 16 ++-- test/ios/RootBrowser/HorizontalPickerView.mm | 1 + test/ios/RootBrowser/LineInspector.xib | 91 +++++++++++++++++--- test/ios/RootBrowser/ROOTObjectController.mm | 6 -- test/ios/RootBrowser/SelectionView.mm | 9 +- 5 files changed, 95 insertions(+), 28 deletions(-) diff --git a/graf2d/ios/src/IOSPainter.cxx b/graf2d/ios/src/IOSPainter.cxx index be94f2a2b69..c654be736a3 100644 --- a/graf2d/ios/src/IOSPainter.cxx +++ b/graf2d/ios/src/IOSPainter.cxx @@ -159,12 +159,12 @@ void Painter::SetStrokeParameters()const CGContextSetLineWidth(fCtx, 5.f); return; } - +*/ if (fPainterMode == kPaintShadow) { CGContextSetRGBStrokeColor(fCtx, shadowColor[0], shadowColor[1], shadowColor[2], shadowColor[3]); CGContextSetLineWidth(fCtx, 5.f); return; - }*/ + } if (gVirtualX->GetLineWidth() > 1.f) CGContextSetLineWidth(fCtx, gVirtualX->GetLineWidth()); @@ -231,12 +231,14 @@ void Painter::SetPolygonParameters()const CGContextSetRGBFillColor(fCtx, pinkColor[0], pinkColor[1], pinkColor[2], pinkColor[3]); return; } - +*/ if (fPainterMode == kPaintShadow) { // SetStrokeParameters(); CGContextSetRGBFillColor(fCtx, shadowColor[0], shadowColor[1], shadowColor[2], shadowColor[3]); + CGContextSetRGBStrokeColor(fCtx, shadowColor[0], shadowColor[1], shadowColor[2], shadowColor[3]); + return; - }*/ + } const Float_t alpha = 1.f;//must be in gVirtualX. Float_t red = 1.f, green = 1.f, blue = 1.f;//White by default. @@ -443,7 +445,7 @@ void Painter::SetMarkerColor()const SetMarkerFillColor(fCtx, gVirtualX->GetMarkerColor()); } else if (fPainterMode == kPaintShadow) { CGContextSetRGBFillColor(fCtx, shadowColor[0], shadowColor[1], shadowColor[2], shadowColor[3]); - }/* else if (fPainterMode == kPaintSelected) { + } /*else if (fPainterMode == kPaintSelected) { CGContextSetRGBFillColor(fCtx, pinkColor[0], pinkColor[1], pinkColor[2], pinkColor[3]); }*/ } else { @@ -452,10 +454,10 @@ void Painter::SetMarkerColor()const } else if (fPainterMode == kPaintShadow) { CGContextSetRGBStrokeColor(fCtx, shadowColor[0], shadowColor[1], shadowColor[2], shadowColor[3]); CGContextSetLineWidth(fCtx, 5.f); - } /*else if (fPainterMode == kPaintSelected) { + }/* else if (fPainterMode == kPaintSelected) { CGContextSetRGBStrokeColor(fCtx, pinkColor[0], pinkColor[1], pinkColor[2], pinkColor[3]); CGContextSetLineWidth(fCtx, 5.f); - } */ + }*/ } } diff --git a/test/ios/RootBrowser/HorizontalPickerView.mm b/test/ios/RootBrowser/HorizontalPickerView.mm index 013034bb44a..45c28b978a4 100644 --- a/test/ios/RootBrowser/HorizontalPickerView.mm +++ b/test/ios/RootBrowser/HorizontalPickerView.mm @@ -137,6 +137,7 @@ const CGFloat markerPos = 100.f; [self notify]; } +//____________________________________________________________________________________________________ - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { if (!decelerate) { diff --git a/test/ios/RootBrowser/LineInspector.xib b/test/ios/RootBrowser/LineInspector.xib index a58997a20c3..7bae908e209 100644 --- a/test/ios/RootBrowser/LineInspector.xib +++ b/test/ios/RootBrowser/LineInspector.xib @@ -1,14 +1,14 @@ <?xml version="1.0" encoding="UTF-8"?> <archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10"> <data> - <int key="IBDocument.SystemTarget">1280</int> - <string key="IBDocument.SystemVersion">11C74</string> - <string key="IBDocument.InterfaceBuilderVersion">1938</string> - <string key="IBDocument.AppKitVersion">1138.23</string> - <string key="IBDocument.HIToolboxVersion">567.00</string> + <int key="IBDocument.SystemTarget">1296</int> + <string key="IBDocument.SystemVersion">11D50b</string> + <string key="IBDocument.InterfaceBuilderVersion">2182</string> + <string key="IBDocument.AppKitVersion">1138.32</string> + <string key="IBDocument.HIToolboxVersion">568.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> - <string key="NS.object.0">933</string> + <string key="NS.object.0">1179</string> </object> <object class="NSArray" key="IBDocument.IntegratedClassDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -44,6 +44,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{15, 190}, {40, 70}}</string> <reference key="NSSuperview" ref="985740265"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="522099918"/> <string key="NSReuseIdentifierKey">_NS:241</string> <bool key="IBUIOpaque">NO</bool> @@ -82,6 +83,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{195, 190}, {40, 70}}</string> <reference key="NSSuperview" ref="985740265"/> + <reference key="NSWindow"/> <string key="NSReuseIdentifierKey">_NS:241</string> <bool key="IBUIOpaque">NO</bool> <string key="targetRuntimeIdentifier">IBIPadFramework</string> @@ -106,6 +108,7 @@ <int key="NSvFlags">292</int> <string key="NSFrame">{{55, 190}, {140, 70}}</string> <reference key="NSSuperview" ref="985740265"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="155047516"/> <string key="NSReuseIdentifierKey">_NS:212</string> <reference key="IBUIBackgroundColor" ref="586102906"/> @@ -114,6 +117,7 @@ </object> <string key="NSFrameSize">{250, 280}</string> <reference key="NSSuperview"/> + <reference key="NSWindow"/> <reference key="NSNextKeyView" ref="472788398"/> <string key="NSReuseIdentifierKey">_NS:195</string> <object class="NSColor" key="IBUIBackgroundColor"> @@ -225,7 +229,7 @@ <string>19.IBPluginDependency</string> <string>4.IBPluginDependency</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>LineInspector</string> <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string> @@ -252,9 +256,76 @@ <nil key="sourceID"/> <int key="maxID">22</int> </object> - <object class="IBClassDescriber" key="IBDocument.Classes"/> + <object class="IBClassDescriber" key="IBDocument.Classes"> + <object class="NSMutableArray" key="referencedPartialClassDescriptions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBPartialClassDescription"> + <string key="className">LineInspector</string> + <string key="superclassName">UIViewController</string> + <object class="NSMutableDictionary" key="actions"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>decLineWidth</string> + <string>incLineWidth</string> + </object> + <object class="NSArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>id</string> + <string>id</string> + </object> + </object> + <object class="NSMutableDictionary" key="actionInfosByName"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>decLineWidth</string> + <string>incLineWidth</string> + </object> + <object class="NSArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="IBActionInfo"> + <string key="name">decLineWidth</string> + <string key="candidateClassName">id</string> + </object> + <object class="IBActionInfo"> + <string key="name">incLineWidth</string> + <string key="candidateClassName">id</string> + </object> + </object> + </object> + <object class="NSMutableDictionary" key="outlets"> + <string key="NS.key.0">lineWidthPicker</string> + <string key="NS.object.0">LineWidthPicker</string> + </object> + <object class="NSMutableDictionary" key="toOneOutletInfosByName"> + <string key="NS.key.0">lineWidthPicker</string> + <object class="IBToOneOutletInfo" key="NS.object.0"> + <string key="name">lineWidthPicker</string> + <string key="candidateClassName">LineWidthPicker</string> + </object> + </object> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/LineInspector.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> + <string key="className">LineWidthPicker</string> + <string key="superclassName">UIView</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBProjectSource</string> + <string key="minorKey">./Classes/LineWidthPicker.h</string> + </object> + </object> + </object> + </object> <int key="IBDocument.localizationMode">0</int> <string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string> + <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults"> + <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string> + <real value="1296" key="NS.object.0"/> + </object> <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies"> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3</string> <integer value="3100" key="NS.object.0"/> @@ -268,12 +339,12 @@ <string>dec_line_width.png</string> <string>inc_line_width.png</string> </object> - <object class="NSMutableArray" key="dict.values"> + <object class="NSArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> <string>{40, 70}</string> <string>{40, 70}</string> </object> </object> - <string key="IBCocoaTouchPluginVersion">933</string> + <string key="IBCocoaTouchPluginVersion">1179</string> </data> </archive> diff --git a/test/ios/RootBrowser/ROOTObjectController.mm b/test/ios/RootBrowser/ROOTObjectController.mm index b8f3e4367d0..3fbcfc76835 100644 --- a/test/ios/RootBrowser/ROOTObjectController.mm +++ b/test/ios/RootBrowser/ROOTObjectController.mm @@ -324,18 +324,12 @@ enum Mode { - (void)willAnimateRotationToInterfaceOrientation : (UIInterfaceOrientation)interfaceOrientation duration : (NSTimeInterval) duration { [self correctFramesForOrientation : interfaceOrientation]; - - //Let's hide shadow during rotation. - if (!editablePadView.isHidden && !editablePadView.selectionView.isHidden) - editablePadView.selectionView.layer.shadowOpacity = 0.f; } //____________________________________________________________________________________________________ - (void) didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { //Now, after rotation is finished we can show the shadow again. - if (!editablePadView.isHidden && !editablePadView.selectionView.isHidden) - editablePadView.selectionView.layer.shadowOpacity = [SelectionView shadowOpacity]; } //____________________________________________________________________________________________________ diff --git a/test/ios/RootBrowser/SelectionView.mm b/test/ios/RootBrowser/SelectionView.mm index 62c8407077b..e371ac9726c 100644 --- a/test/ios/RootBrowser/SelectionView.mm +++ b/test/ios/RootBrowser/SelectionView.mm @@ -21,7 +21,7 @@ const CGRect selectionHintFrame = CGRectMake(0.f, 0.f, 250.f, 300.f); //____________________________________________________________________________________________________ + (CGFloat) shadowOpacity { - return 0.8; + return 0.; } //____________________________________________________________________________________________________ @@ -32,10 +32,6 @@ const CGRect selectionHintFrame = CGRectMake(0.f, 0.f, 250.f, 300.f); if (self) { pad = p; self.opaque = NO; - - self.layer.shadowColor = [UIColor blackColor].CGColor; - self.layer.shadowOpacity = [SelectionView shadowOpacity]; - self.layer.shadowOffset = CGSizeMake(5.f, 5.f); } return self; @@ -56,6 +52,9 @@ const CGRect selectionHintFrame = CGRectMake(0.f, 0.f, 250.f, 300.f); pad->SetViewWH(rect.size.width, rect.size.height); pad->SetContext(ctx); + CGContextTranslateCTM(ctx, 2.5f, 2.5f); + pad->PaintShadowForSelected(); + CGContextTranslateCTM(ctx, -2.5f, -2.5f); pad->PaintSelected(); CGContextRestoreGState(ctx); -- GitLab