Make SampleApp work on iPhone/iOS simulator.
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 27 Sep 2012 16:04:54 +0000 (16:04 +0000)
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Thu, 27 Sep 2012 16:04:54 +0000 (16:04 +0000)
Several parts to this:

1) The DeviceManager subclass for iOS was rewritten because the base class
changed.

2) Two old samples that rely on hardcoded paths to images are deleted. They hit
assertions in SkImageRef. No one has the required images to run these anyway.

3) argv must be non-NULL.

4) The UI delegate must not be loaded from the NIB for viewDidLoad ordering
reasons. So I removed an IBOutlet link from the window to the splitview
controller in the iPad's NIB file. The split view is attached by the AppDelegate
programmatically.

This doesn't make GPU work. That will come in a later change.

Review URL: https://codereview.appspot.com/6561056/

git-svn-id: http://skia.googlecode.com/svn/trunk@5712 2bbb7eff-a529-9590-31e7-b0007b416f81

experimental/iOSSampleApp/SkSampleUIView.mm
experimental/iOSSampleApp/iPad/MainWindow_iPad.xib
gyp/SampleApp.gyp
samplecode/SampleImage.cpp
samplecode/SampleImageDir.cpp

index 54177878c076d3f73d47a8a2ce9732d3419ecc6d..d96e550fbc7371cb0fd85f8f9c213f9be64970d2 100644 (file)
 #include "gl/GrGLInterface.h"
 #include "SkGpuDevice.h"
 #include "SkCGUtils.h"
+#include "SampleApp.h"
+
 class SkiOSDeviceManager : public SampleWindow::DeviceManager {
 public:
     SkiOSDeviceManager() {
-        fGrContext = NULL;
-        fGrRenderTarget = NULL;
-        usingGL = false;
+#if SK_SUPPORT_GPU
+        fCurContext = NULL;
+        fCurIntf = NULL;
+        fCurRenderTarget = NULL;
+        fMSAASampleCount = 0;
+#endif
+        fBackend = SkOSWindow::kNone_BackEndType;
     }
+    
     virtual ~SkiOSDeviceManager() {
-        SkSafeUnref(fGrContext);
-        SkSafeUnref(fGrRenderTarget);
+#if SK_SUPPORT_GPU
+        SkSafeUnref(fCurContext);
+        SkSafeUnref(fCurIntf);
+        SkSafeUnref(fCurRenderTarget);
+#endif
     }
     
-    virtual void init(SampleWindow* win) {
-        win->attach(kNativeGL_BackEndType);
-        if (NULL == fGrContext) {
-#ifdef USE_GL_1
-            fGrContext = GrContext::Create(kOpenGL_Fixed_GrEngine, NULL);
-#else
-            fGrContext = GrContext::Create(kOpenGL_Shaders_GrEngine, NULL);
-#endif
+    virtual void setUpBackend(SampleWindow* win, int msaaSampleCount) SK_OVERRIDE {
+        SkASSERT(SkOSWindow::kNone_BackEndType == fBackend);
+        
+        fBackend = SkOSWindow::kNone_BackEndType;
+        
+#if SK_SUPPORT_GPU
+        switch (win->getDeviceType()) {
+            // these two don't use GL
+            case SampleWindow::kRaster_DeviceType:
+            case SampleWindow::kPicture_DeviceType:
+                break;
+            // these guys use the native backend
+            case SampleWindow::kGPU_DeviceType:
+            case SampleWindow::kNullGPU_DeviceType:
+                fBackend = SkOSWindow::kNativeGL_BackEndType;
+                break;
+            default:
+                SkASSERT(false);
+                break;
         }
         
-        if (NULL == fGrContext) {
-            SkDebugf("Failed to setup 3D");
-            win->detachGL();
+        bool result = win->attach(fBackend, msaaSampleCount);
+        if (!result) {
+            SkDebugf("Failed to initialize GL");
+            return;
         }
-    }        
-    
-    virtual bool supportsDeviceType(SampleWindow::DeviceType dType) {
-        switch (dType) {
+        fMSAASampleCount = msaaSampleCount;
+        
+        SkASSERT(NULL == fCurIntf);
+        switch (win->getDeviceType()) {
+            // these two don't use GL
             case SampleWindow::kRaster_DeviceType:
-            case SampleWindow::kPicture_DeviceType: // fallthru
-                return true;
+            case SampleWindow::kPicture_DeviceType:
+                fCurIntf = NULL;
+                break;
             case SampleWindow::kGPU_DeviceType:
-                return NULL != fGrContext;
+                fCurIntf = GrGLCreateNativeInterface();
+                break;
+            case SampleWindow::kNullGPU_DeviceType:
+                fCurIntf = GrGLCreateNullInterface();
+                break;
             default:
-                return false;
+                SkASSERT(false);
+                break;
         }
+        
+        SkASSERT(NULL == fCurContext);
+        if (SkOSWindow::kNone_BackEndType != fBackend) {
+            fCurContext = GrContext::Create(kOpenGL_Shaders_GrEngine,
+                                            (GrPlatform3DContext) fCurIntf);
+        }
+        
+        if ((NULL == fCurContext || NULL == fCurIntf) &&
+            SkOSWindow::kNone_BackEndType != fBackend) {
+            // We need some context and interface to see results if we're using a GL backend
+            SkSafeUnref(fCurContext);
+            SkSafeUnref(fCurIntf);
+            SkDebugf("Failed to setup 3D");
+            win->detach();
+        }
+#endif // SK_SUPPORT_GPU
+        // call windowSizeChanged to create the render target
+        this->windowSizeChanged(win);
+    }
+    
+    virtual void tearDownBackend(SampleWindow *win) SK_OVERRIDE {
+#if SK_SUPPORT_GPU
+        SkSafeUnref(fCurContext);
+        fCurContext = NULL;
+        
+        SkSafeUnref(fCurIntf);
+        fCurIntf = NULL;
+        
+        SkSafeUnref(fCurRenderTarget);
+        fCurRenderTarget = NULL;
+#endif
+        win->detach();
+        fBackend = SampleWindow::kNone_BackEndType;
     }
+    
     virtual bool prepareCanvas(SampleWindow::DeviceType dType,
                                SkCanvas* canvas,
-                               SampleWindow* win) {
-        if (SampleWindow::kGPU_DeviceType == dType) {
-            canvas->setDevice(new SkGpuDevice(fGrContext, fGrRenderTarget))->unref();
-            usingGL = true;
-        }
-        else {
-            //The clip needs to be applied with a device attached to the canvas
-            canvas->setBitmapDevice(win->getBitmap());
-            usingGL = false;
+                               SampleWindow* win) SK_OVERRIDE {
+        switch (dType) {
+            // use the window's bmp for these two
+            case SampleWindow::kRaster_DeviceType:
+            case SampleWindow::kPicture_DeviceType:
+                canvas->setBitmapDevice(win->getBitmap());
+                break;
+#if SK_SUPPORT_GPU
+            // create a GPU device for these two
+            case SampleWindow::kGPU_DeviceType:
+            case SampleWindow::kNullGPU_DeviceType:
+                if (fCurContext) {
+                    canvas->setDevice(new SkGpuDevice(fCurContext, fCurRenderTarget))->unref();
+                } else {
+                    return false;
+                }
+                break;
+#endif
+            default:
+                SkASSERT(false);
+                return false;
         }
         return true;
     }
+    
     virtual void publishCanvas(SampleWindow::DeviceType dType,
                                SkCanvas* canvas,
-                               SampleWindow* win) {
-        if (SampleWindow::kGPU_DeviceType == dType) {
-            fGrContext->flush();
-        }
-        else {
-            //CGContextRef cg = UIGraphicsGetCurrentContext();
-            //SkCGDrawBitmap(cg, win->getBitmap(), 0, 0);
-        }
-        win->presentGL();
+                               SampleWindow* win) SK_OVERRIDE {
+        win->present();
     }
     
-    virtual void windowSizeChanged(SampleWindow* win) {
-        if (fGrContext) {
-            win->attach(kNativeGL_BackEndType);
+    virtual void windowSizeChanged(SampleWindow* win) SK_OVERRIDE {
+#if SK_SUPPORT_GPU
+        if (fCurContext) {
+            win->attach(fBackend, fMSAASampleCount);
             
-            GrPlatformSurfaceDesc desc;
-            desc.reset();
-            desc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType;
+            GrPlatformRenderTargetDesc desc;
             desc.fWidth = SkScalarRound(win->width());
             desc.fHeight = SkScalarRound(win->height());
             desc.fConfig = kSkia8888_PM_GrPixelConfig;
-            const GrGLInterface* gl = GrGLGetDefaultGLInterface();
-            GrAssert(NULL != gl);
-            GR_GL_GetIntegerv(gl, GR_GL_STENCIL_BITS, &desc.fStencilBits);
-            GR_GL_GetIntegerv(gl, GR_GL_SAMPLES, &desc.fSampleCnt);
+            glGetIntegerv(GL_SAMPLES, &desc.fSampleCnt);
+            glGetIntegerv(GL_STENCIL_BITS, &desc.fStencilBits);
             GrGLint buffer;
-            GR_GL_GetIntegerv(gl, GR_GL_FRAMEBUFFER_BINDING, &buffer);
-            desc.fPlatformRenderTarget = buffer;
+            glGetIntegerv(GL_FRAMEBUFFER_BINDING, &buffer);
+            desc.fRenderTargetHandle = buffer;
             
-            SkSafeUnref(fGrRenderTarget);
-            fGrRenderTarget = static_cast<GrRenderTarget*>(
-                                                           fGrContext->createPlatformSurface(desc));
+            SkSafeUnref(fCurRenderTarget);
+            fCurRenderTarget = fCurContext->createPlatformRenderTarget(desc);
         }
+#endif
     }
     
-    bool isUsingGL() { return usingGL; }
+    virtual GrContext* getGrContext() SK_OVERRIDE {
+#if SK_SUPPORT_GPU
+        return fCurContext;
+#else
+        return NULL;
+#endif
+    }
     
-    virtual GrContext* getGrContext() { return fGrContext; }
-
     virtual GrRenderTarget* getGrRenderTarget() SK_OVERRIDE {
-        return fGrRenderTarget;
+#if SK_SUPPORT_GPU
+        return fCurRenderTarget;
+#else
+        return NULL;
+#endif
     }
+    
+    bool isUsingGL() const { return SkOSWindow::kNone_BackEndType != fBackend; }
+    
 private:
-    bool usingGL;
-    GrContext* fGrContext;
-    GrRenderTarget* fGrRenderTarget;
+    
+#if SK_SUPPORT_GPU
+    GrContext*              fCurContext;
+    const GrGLInterface*    fCurIntf;
+    GrRenderTarget*         fCurRenderTarget;
+    int fMSAASampleCount;
+#endif
+    
+    SkOSWindow::SkBackEndTypes fBackend;
+    
+    typedef SampleWindow::DeviceManager INHERITED;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -254,7 +339,8 @@ static FPSState gFPS;
         [newActions release];
         
         fDevManager = new SkiOSDeviceManager;
-        fWind = new SampleWindow(self, NULL, NULL, fDevManager);
+        static char* kDummyArgv = "dummyExecutableName";
+        fWind = new SampleWindow(self, 1, &kDummyArgv, fDevManager);
         fWind->resize(self.frame.size.width, self.frame.size.height, SKWIND_CONFIG);
     }
     return self;
index 34746e362196d73a65e31ad90b973090cd030086..6b197d063e156df7df58ac9e9695782b1e569b5e 100644 (file)
@@ -1,31 +1,36 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <archive type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="7.10">
        <data>
-               <int key="IBDocument.SystemTarget">1056</int>
-               <string key="IBDocument.SystemVersion">10K540</string>
-               <string key="IBDocument.InterfaceBuilderVersion">851</string>
-               <string key="IBDocument.AppKitVersion">1038.36</string>
-               <string key="IBDocument.HIToolboxVersion">461.00</string>
+               <int key="IBDocument.SystemTarget">1296</int>
+               <string key="IBDocument.SystemVersion">12B19</string>
+               <string key="IBDocument.InterfaceBuilderVersion">2549</string>
+               <string key="IBDocument.AppKitVersion">1187</string>
+               <string key="IBDocument.HIToolboxVersion">624.00</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
                        <string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
-                       <string key="NS.object.0">141</string>
+                       <string key="NS.object.0">1498</string>
                </object>
-               <object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
+               <object class="NSArray" key="IBDocument.IntegratedClassDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
-                       <integer value="143"/>
+                       <string>IBProxyObject</string>
+                       <string>IBUICustomObject</string>
+                       <string>IBUINavigationBar</string>
+                       <string>IBUINavigationController</string>
+                       <string>IBUINavigationItem</string>
+                       <string>IBUISplitViewController</string>
+                       <string>IBUITableView</string>
+                       <string>IBUITableViewController</string>
+                       <string>IBUIView</string>
+                       <string>IBUIViewController</string>
+                       <string>IBUIWindow</string>
                </object>
                <object class="NSArray" key="IBDocument.PluginDependencies">
                        <bool key="EncodedWithXMLCoder">YES</bool>
                        <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                </object>
                <object class="NSMutableDictionary" key="IBDocument.Metadata">
-                       <bool key="EncodedWithXMLCoder">YES</bool>
-                       <object class="NSArray" key="dict.sortedKeys" id="0">
-                               <bool key="EncodedWithXMLCoder">YES</bool>
-                       </object>
-                       <object class="NSMutableArray" key="dict.values">
-                               <bool key="EncodedWithXMLCoder">YES</bool>
-                       </object>
+                       <string key="NS.key.0">PluginDependencyRecalculationVersion</string>
+                       <integer value="1" key="NS.object.0"/>
                </object>
                <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
                        <bool key="EncodedWithXMLCoder">YES</bool>
                                <string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
                                <string key="targetRuntimeIdentifier">IBIPadFramework</string>
                        </object>
+                       <object class="IBUICustomObject" id="250404236">
+                               <string key="targetRuntimeIdentifier">IBIPadFramework</string>
+                       </object>
                        <object class="IBUIWindow" id="62075450">
-                               <nil key="NSNextResponder"/>
+                               <reference key="NSNextResponder"/>
                                <int key="NSvFlags">292</int>
                                <string key="NSFrameSize">{768, 1024}</string>
+                               <reference key="NSSuperview"/>
+                               <reference key="NSWindow"/>
                                <object class="NSColor" key="IBUIBackgroundColor">
                                        <int key="NSColorSpace">1</int>
                                        <bytes key="NSRGB">MSAxIDEAA</bytes>
                                <string key="targetRuntimeIdentifier">IBIPadFramework</string>
                                <bool key="IBUIResizesToFullScreen">YES</bool>
                        </object>
-                       <object class="IBUICustomObject" id="250404236">
-                               <string key="targetRuntimeIdentifier">IBIPadFramework</string>
-                       </object>
                        <object class="IBUISplitViewController" id="143532475">
-                               <reference key="IBUIToolbarItems" ref="0"/>
+                               <object class="NSArray" key="IBUIToolbarItems" id="0">
+                                       <bool key="EncodedWithXMLCoder">YES</bool>
+                               </object>
                                <object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics">
                                        <int key="IBUIStatusBarStyle">2</int>
                                </object>
                                <object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
+                                       <int key="IBUIInterfaceOrientation">1</int>
                                        <int key="interfaceOrientation">1</int>
                                </object>
                                <string key="targetRuntimeIdentifier">IBIPadFramework</string>
@@ -72,6 +82,7 @@
                                                <int key="IBUIStatusBarStyle">2</int>
                                        </object>
                                        <object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
+                                               <int key="IBUIInterfaceOrientation">1</int>
                                                <int key="interfaceOrientation">1</int>
                                        </object>
                                        <string key="targetRuntimeIdentifier">IBIPadFramework</string>
                                                <bool key="EncodedWithXMLCoder">YES</bool>
                                                <object class="IBUITableViewController" id="714382558">
                                                        <object class="IBUITableView" key="IBUIView" id="805122470">
-                                                               <reference key="NSNextResponder"/>
+                                                               <nil key="NSNextResponder"/>
                                                                <int key="NSvFlags">274</int>
                                                                <string key="NSFrameSize">{320, 960}</string>
-                                                               <reference key="NSSuperview"/>
                                                                <object class="NSColor" key="IBUIBackgroundColor" id="933040628">
                                                                        <int key="NSColorSpace">3</int>
                                                                        <bytes key="NSWhite">MQA</bytes>
                                                                <float key="IBUISectionFooterHeight">22</float>
                                                        </object>
                                                        <object class="IBUINavigationItem" key="IBUINavigationItem" id="136024681">
-                                                               <reference key="IBUINavigationBar"/>
                                                                <string key="IBUITitle">Samples</string>
                                                                <string key="targetRuntimeIdentifier">IBIPadFramework</string>
                                                        </object>
                                                                <int key="IBUIStatusBarStyle">2</int>
                                                        </object>
                                                        <object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
+                                                               <int key="IBUIInterfaceOrientation">1</int>
                                                                <int key="interfaceOrientation">1</int>
                                                        </object>
                                                        <string key="targetRuntimeIdentifier">IBIPadFramework</string>
                                                <int key="IBUIStatusBarStyle">2</int>
                                        </object>
                                        <object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
+                                               <int key="IBUIInterfaceOrientation">1</int>
                                                <int key="interfaceOrientation">1</int>
                                        </object>
                                        <string key="targetRuntimeIdentifier">IBIPadFramework</string>
                                                <bool key="EncodedWithXMLCoder">YES</bool>
                                                <object class="IBUIViewController" id="659859393">
                                                        <object class="IBUIView" key="IBUIView" id="879616490">
-                                                               <reference key="NSNextResponder"/>
+                                                               <nil key="NSNextResponder"/>
                                                                <int key="NSvFlags">274</int>
                                                                <string key="NSFrameSize">{768, 960}</string>
-                                                               <reference key="NSSuperview"/>
                                                                <reference key="IBUIBackgroundColor" ref="933040628"/>
                                                                <bool key="IBUIMultipleTouchEnabled">YES</bool>
                                                                <string key="targetRuntimeIdentifier">IBIPadFramework</string>
                                                        </object>
                                                        <reference key="IBUIToolbarItems" ref="0"/>
                                                        <object class="IBUINavigationItem" key="IBUINavigationItem" id="245890386">
-                                                               <reference key="IBUINavigationBar"/>
                                                                <string key="IBUITitle">Title</string>
                                                                <string key="targetRuntimeIdentifier">IBIPadFramework</string>
                                                        </object>
                                                        <reference key="IBUIParentViewController" ref="1006871283"/>
                                                        <object class="IBUISimulatedOrientationMetrics" key="IBUISimulatedOrientationMetrics">
+                                                               <int key="IBUIInterfaceOrientation">1</int>
                                                                <int key="interfaceOrientation">1</int>
                                                        </object>
                                                        <string key="targetRuntimeIdentifier">IBIPadFramework</string>
                <object class="IBObjectContainer" key="IBDocument.Objects">
                        <object class="NSMutableArray" key="connectionRecords">
                                <bool key="EncodedWithXMLCoder">YES</bool>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBCocoaTouchOutletConnection" key="connection">
-                                               <string key="label">window</string>
-                                               <reference key="source" ref="250404236"/>
-                                               <reference key="destination" ref="62075450"/>
-                                       </object>
-                                       <int key="connectionID">7</int>
-                               </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBCocoaTouchOutletConnection" key="connection">
                                                <string key="label">delegate</string>
                                        </object>
                                        <int key="connectionID">8</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBCocoaTouchOutletConnection" key="connection">
+                                               <string key="label">window</string>
+                                               <reference key="source" ref="250404236"/>
+                                               <reference key="destination" ref="62075450"/>
+                                       </object>
+                                       <int key="connectionID">7</int>
+                               </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBCocoaTouchOutletConnection" key="connection">
                                                <string key="label">splitViewController</string>
                                </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBCocoaTouchOutletConnection" key="connection">
-                                               <string key="label">rootViewController</string>
-                                               <reference key="source" ref="62075450"/>
-                                               <reference key="destination" ref="143532475"/>
+                                               <string key="label">fDetail</string>
+                                               <reference key="source" ref="143532475"/>
+                                               <reference key="destination" ref="659859393"/>
                                        </object>
-                                       <int key="connectionID">88</int>
+                                       <int key="connectionID">172</int>
                                </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBCocoaTouchOutletConnection" key="connection">
                                        </object>
                                        <int key="connectionID">93</int>
                                </object>
-                               <object class="IBConnectionRecord">
-                                       <object class="IBCocoaTouchOutletConnection" key="connection">
-                                               <string key="label">fDetail</string>
-                                               <reference key="source" ref="143532475"/>
-                                               <reference key="destination" ref="659859393"/>
-                                       </object>
-                                       <int key="connectionID">172</int>
-                               </object>
                        </object>
                        <object class="IBMutableOrderedSet" key="objectRecords">
                                <object class="NSArray" key="orderedObjects">
                                <object class="NSArray" key="dict.sortedKeys">
                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                        <string>-1.CustomClassName</string>
+                                       <string>-1.IBPluginDependency</string>
                                        <string>-2.CustomClassName</string>
-                                       <string>138.IBEditorWindowLastContentRect</string>
+                                       <string>-2.IBPluginDependency</string>
                                        <string>138.IBPluginDependency</string>
                                        <string>140.IBPluginDependency</string>
                                        <string>142.CustomClassName</string>
                                        <string>142.IBPluginDependency</string>
                                        <string>143.CustomClassName</string>
                                        <string>143.IBPluginDependency</string>
-                                       <string>143.IBViewBoundsToFrameTransform</string>
-                                       <string>2.IBEditorWindowLastContentRect</string>
+                                       <string>162.IBPluginDependency</string>
                                        <string>2.IBPluginDependency</string>
                                        <string>52.CustomClassName</string>
-                                       <string>52.IBEditorWindowLastContentRect</string>
                                        <string>52.IBPluginDependency</string>
                                        <string>53.IBPluginDependency</string>
                                        <string>55.CustomClassName</string>
                                        <string>6.IBPluginDependency</string>
                                        <string>89.IBPluginDependency</string>
                                </object>
-                               <object class="NSMutableArray" key="dict.values">
+                               <object class="NSArray" key="dict.values">
                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                        <string>UIApplication</string>
+                                       <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                                        <string>UIResponder</string>
-                                       <string>{{335, 4}, {768, 1024}}</string>
+                                       <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                                        <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                                        <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                                        <string>SkUIDetailViewController</string>
                                        <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                                        <string>SkSampleUIView</string>
                                        <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
-                                       <object class="NSAffineTransform">
-                                               <bytes key="NSTransformStruct">P4AAAL+AAAAAAAAAxDqAAA</bytes>
-                                       </object>
-                                       <string>{{125, 4}, {768, 1024}}</string>
+                                       <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                                        <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                                        <string>SkUISplitViewController</string>
-                                       <string>{{362, 0}, {783, 1006}}</string>
                                        <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                                        <string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
                                        <string>SkUIRootViewController</string>
                        <object class="NSMutableDictionary" key="unlocalizedProperties">
                                <bool key="EncodedWithXMLCoder">YES</bool>
                                <reference key="dict.sortedKeys" ref="0"/>
-                               <object class="NSMutableArray" key="dict.values">
-                                       <bool key="EncodedWithXMLCoder">YES</bool>
-                               </object>
+                               <reference key="dict.values" ref="0"/>
                        </object>
                        <nil key="activeLocalization"/>
                        <object class="NSMutableDictionary" key="localizations">
                                <bool key="EncodedWithXMLCoder">YES</bool>
                                <reference key="dict.sortedKeys" ref="0"/>
-                               <object class="NSMutableArray" key="dict.values">
-                                       <bool key="EncodedWithXMLCoder">YES</bool>
-                               </object>
+                               <reference key="dict.values" ref="0"/>
                        </object>
                        <nil key="sourceID"/>
                        <int key="maxID">197</int>
                                                        <string>splitViewController</string>
                                                        <string>window</string>
                                                </object>
-                                               <object class="NSMutableArray" key="dict.values">
+                                               <object class="NSArray" key="dict.values">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                        <string>SkUISplitViewController</string>
                                                        <string>UIWindow</string>
                                                        <string>splitViewController</string>
                                                        <string>window</string>
                                                </object>
-                                               <object class="NSMutableArray" key="dict.values">
+                                               <object class="NSArray" key="dict.values">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                        <object class="IBToOneOutletInfo">
                                                                <string key="name">splitViewController</string>
                                        </object>
                                        <object class="IBClassDescriptionSource" key="sourceIdentifier">
                                                <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">iPad/AppDelegate_iPad.h</string>
+                                               <string key="minorKey">./Classes/AppDelegate_iPad.h</string>
                                        </object>
                                </object>
                                <object class="IBPartialClassDescription">
                                        <string key="superclassName">SkUIView</string>
                                        <object class="IBClassDescriptionSource" key="sourceIdentifier">
                                                <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">SkSampleUIView.h</string>
+                                               <string key="minorKey">./Classes/SkSampleUIView.h</string>
                                        </object>
                                </object>
                                <object class="IBPartialClassDescription">
                                        <string key="superclassName">UIViewController</string>
                                        <object class="IBClassDescriptionSource" key="sourceIdentifier">
                                                <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">Shared/SkUIDetailViewController.h</string>
+                                               <string key="minorKey">./Classes/SkUIDetailViewController.h</string>
                                        </object>
                                </object>
                                <object class="IBPartialClassDescription">
                                        <string key="superclassName">UITableViewController</string>
                                        <object class="IBClassDescriptionSource" key="sourceIdentifier">
                                                <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">Shared/SkUIRootViewController.h</string>
+                                               <string key="minorKey">./Classes/SkUIRootViewController.h</string>
                                        </object>
                                </object>
                                <object class="IBPartialClassDescription">
                                                        <string>fDetail</string>
                                                        <string>fRoot</string>
                                                </object>
-                                               <object class="NSMutableArray" key="dict.values">
+                                               <object class="NSArray" key="dict.values">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                        <string>SkUIDetailViewController</string>
                                                        <string>SkUIRootViewController</string>
                                                        <string>fDetail</string>
                                                        <string>fRoot</string>
                                                </object>
-                                               <object class="NSMutableArray" key="dict.values">
+                                               <object class="NSArray" key="dict.values">
                                                        <bool key="EncodedWithXMLCoder">YES</bool>
                                                        <object class="IBToOneOutletInfo">
                                                                <string key="name">fDetail</string>
                                        </object>
                                        <object class="IBClassDescriptionSource" key="sourceIdentifier">
                                                <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">iPad/SkUISplitViewController.h</string>
+                                               <string key="minorKey">./Classes/SkUISplitViewController.h</string>
                                        </object>
                                </object>
                                <object class="IBPartialClassDescription">
                                        <string key="className">SkUIView</string>
                                        <string key="superclassName">UIView</string>
-                                       <object class="NSMutableDictionary" key="outlets">
-                                               <string key="NS.key.0">fOptionsDelegate</string>
-                                               <string key="NS.object.0">id</string>
-                                       </object>
-                                       <object class="NSMutableDictionary" key="toOneOutletInfosByName">
-                                               <string key="NS.key.0">fOptionsDelegate</string>
-                                               <object class="IBToOneOutletInfo" key="NS.object.0">
-                                                       <string key="name">fOptionsDelegate</string>
-                                                       <string key="candidateClassName">id</string>
-                                               </object>
-                                       </object>
                                        <object class="IBClassDescriptionSource" key="sourceIdentifier">
                                                <string key="majorKey">IBProjectSource</string>
-                                               <string key="minorKey">Shared/SkUIView.h</string>
-                                       </object>
-                               </object>
-                       </object>
-                       <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
-                               <bool key="EncodedWithXMLCoder">YES</bool>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">Foundation.framework/Headers/NSError.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UIAccessibility.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UINibLoading.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier" id="786211723">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UIResponder.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIApplication</string>
-                                       <string key="superclassName">UIResponder</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UIApplication.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIBarButtonItem</string>
-                                       <string key="superclassName">UIBarItem</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UIBarButtonItem.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIBarItem</string>
-                                       <string key="superclassName">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UIBarItem.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UINavigationBar</string>
-                                       <string key="superclassName">UIView</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier" id="840300946">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UINavigationBar.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UINavigationController</string>
-                                       <string key="superclassName">UIViewController</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier" id="143108953">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UINavigationController.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UINavigationItem</string>
-                                       <string key="superclassName">NSObject</string>
-                                       <reference key="sourceIdentifier" ref="840300946"/>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIResponder</string>
-                                       <string key="superclassName">NSObject</string>
-                                       <reference key="sourceIdentifier" ref="786211723"/>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIScrollView</string>
-                                       <string key="superclassName">UIView</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UIScrollView.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UISearchBar</string>
-                                       <string key="superclassName">UIView</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UISearchBar.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UISearchDisplayController</string>
-                                       <string key="superclassName">NSObject</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UISearchDisplayController.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UISplitViewController</string>
-                                       <string key="superclassName">UIViewController</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier" id="774996372">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UISplitViewController.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UITableView</string>
-                                       <string key="superclassName">UIScrollView</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UITableView.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UITableViewController</string>
-                                       <string key="superclassName">UIViewController</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UITableViewController.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIView</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UIPrintFormatter.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIView</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UITextField.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIView</string>
-                                       <string key="superclassName">UIResponder</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UIView.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIViewController</string>
-                                       <reference key="sourceIdentifier" ref="143108953"/>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIViewController</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UIPopoverController.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIViewController</string>
-                                       <reference key="sourceIdentifier" ref="774996372"/>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIViewController</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UITabBarController.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIViewController</string>
-                                       <string key="superclassName">UIResponder</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UIViewController.h</string>
-                                       </object>
-                               </object>
-                               <object class="IBPartialClassDescription">
-                                       <string key="className">UIWindow</string>
-                                       <string key="superclassName">UIView</string>
-                                       <object class="IBClassDescriptionSource" key="sourceIdentifier">
-                                               <string key="majorKey">IBFrameworkSource</string>
-                                               <string key="minorKey">UIKit.framework/Headers/UIWindow.h</string>
+                                               <string key="minorKey">./Classes/SkUIView.h</string>
                                        </object>
                                </object>
                        </object>
                <string key="IBDocument.TargetRuntimeIdentifier">IBIPadFramework</string>
                <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
                        <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
-                       <integer value="1056" key="NS.object.0"/>
+                       <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"/>
                </object>
                <bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
-               <string key="IBDocument.LastKnownRelativeProjectPath">../iOSSampleApp.xcodeproj</string>
                <int key="IBDocument.defaultPropertyAccessControl">3</int>
-               <string key="IBCocoaTouchPluginVersion">141</string>
+               <string key="IBCocoaTouchPluginVersion">1498</string>
        </data>
 </archive>
index 6de6f70ff7d61a6ef9e73c7553a6906ccc4c6bc4..c8b9ba75e6194180e6b5b6538fb1fc297df6d8b6 100644 (file)
@@ -61,8 +61,6 @@
         '../samplecode/SampleHairCurves.cpp',
         '../samplecode/SampleHairline.cpp',
         '../samplecode/SampleHairModes.cpp',
-        '../samplecode/SampleImage.cpp',
-        '../samplecode/SampleImageDir.cpp',
         '../samplecode/SampleLayerMask.cpp',
         '../samplecode/SampleLayers.cpp',
         '../samplecode/SampleLCD.cpp',
index 8fdf6b99ea0ad7e2acea067010a03373e81e7a17..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,163 +0,0 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "SampleCode.h"
-#include "SkView.h"
-#include "SkCanvas.h"
-#include "SkGradientShader.h"
-#include "SkGraphics.h"
-#include "SkImageDecoder.h"
-#include "SkPath.h"
-#include "SkRegion.h"
-#include "SkShader.h"
-#include "SkUtils.h"
-#include "SkXfermode.h"
-#include "SkColorPriv.h"
-#include "SkColorFilter.h"
-#include "SkTime.h"
-#include "SkTypeface.h"
-
-#include "SkImageRef_GlobalPool.h"
-#include "SkStream.h"
-
-static const char* gNames[] = {
-    "1.bmp", "1.gif", "1.jpg", "1.png",
-    "2.bmp", "2.gif", "2.jpg", "2.png"
-};
-
-static bool SetImageRef(SkBitmap* bitmap, SkStream* stream,
-                        SkBitmap::Config pref, const char name[] = NULL)
-{
-    if (SkImageDecoder::DecodeStream(stream, bitmap, pref,
-                                 SkImageDecoder::kDecodeBounds_Mode, NULL)) {
-        SkASSERT(bitmap->config() != SkBitmap::kNo_Config);
-
-        SkImageRef* ref = new SkImageRef_GlobalPool(stream, bitmap->config());
-        ref->setURI(name);
-        bitmap->setPixelRef(ref)->unref();
-        return true;
-    } else {
-        return false;
-    }
-}
-
-class ImageView : public SkView {
-public:
-    SkBitmap*   fBitmaps;
-    SkShader*   fShader;
-
-    ImageView() {
-        SkImageRef_GlobalPool::SetRAMBudget(32 * 1024);
-
-        int i, N = SK_ARRAY_COUNT(gNames);
-        fBitmaps = new SkBitmap[N];
-
-        for (i = 0; i < N; i++) {
-            SkString str("/skimages/");
-            str.append(gNames[i]);
-            SkFILEStream* stream = new SkFILEStream(str.c_str());
-
-            SetImageRef(&fBitmaps[i], stream, SkBitmap::kNo_Config, gNames[i]);
-            if (i & 1)
-                fBitmaps[i].buildMipMap();
-            stream->unref();
-        }
-
-        fShader = SkShader::CreateBitmapShader(fBitmaps[5],
-                                               SkShader::kRepeat_TileMode,
-                                               SkShader::kRepeat_TileMode);
-
-        if (true) {
-            SkMatrix m;
-
-            m.setRotate(SkIntToScalar(30));
-            fShader->setLocalMatrix(m);
-        }
-
-#if 0
-        SkImageRef::DumpPool();
-        for (i = 0; i < N; i++) {
-            SkBitmap& bm = fBitmaps[i];
-
-            SkDebugf("<%s> addr=%p", gNames[i], bm.getPixels());
-            bool success = bm.lockPixels();
-            SkDebugf(" addr=%d", bm.getPixels());
-            if (success)
-                bm.unlockPixels();
-            SkDebugf(" addr=%p", bm.getPixels());
-            success = bm.lockPixels();
-            SkDebugf(" addr=%d", bm.getPixels());
-            if (success)
-                bm.unlockPixels();
-            SkDebugf("\n");
-        }
-        SkImageRef::DumpPool();
-#endif
-    }
-
-    virtual ~ImageView() {
-        delete[] fBitmaps;
-        delete fShader;
-
-        SkImageRef_GlobalPool::DumpPool();
-    }
-
-protected:
-    // overrides from SkEventSink
-    virtual bool onQuery(SkEvent* evt) {
-        if (SampleCode::TitleQ(*evt)) {
-            SampleCode::TitleR(evt, "Image");
-            return true;
-        }
-        return this->INHERITED::onQuery(evt);
-    }
-
-    void drawBG(SkCanvas* canvas) {
-        canvas->drawColor(0xFFDDDDDD);
-//        canvas->drawColor(SK_ColorWHITE);
-    }
-
-    virtual void onDraw(SkCanvas* canvas) {
-        this->drawBG(canvas);
-
-        canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
-
-        SkScalar x = 0, y = 0;
-
-        for (size_t i = 0; i < SK_ARRAY_COUNT(gNames); i++) {
-            canvas->drawBitmap(fBitmaps[i], x, y);
-            x += SkIntToScalar(fBitmaps[i].width() + 10);
-        }
-
-        canvas->translate(0, SkIntToScalar(120));
-
-        SkPaint paint;
-        paint.setShader(fShader);
-        paint.setFilterBitmap(true);
-        SkRect r = { 0, 0, SkIntToScalar(300), SkIntToScalar(100) };
-
-        canvas->drawRect(r, paint);
-    }
-
-    virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
-        this->inval(NULL);
-        return this->INHERITED::onFindClickHandler(x, y);
-    }
-
-    virtual bool onClick(Click* click) {
-        return this->INHERITED::onClick(click);
-    }
-
-private:
-    typedef SkView INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-static SkView* MyFactory() { return new ImageView; }
-static SkViewRegister reg(MyFactory);
-
index 652a2f3f478289d7eef1839d3356e6d623c8d0c0..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,317 +0,0 @@
-
-/*
- * Copyright 2011 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-#include "SampleCode.h"
-#include "SkView.h"
-#include "SkCanvas.h"
-#include "SkGradientShader.h"
-#include "SkGraphics.h"
-#include "SkImageDecoder.h"
-#include "SkPath.h"
-#include "SkRegion.h"
-#include "SkShader.h"
-#include "SkUtils.h"
-#include "SkXfermode.h"
-#include "SkComposeShader.h"
-#include "SkColorPriv.h"
-#include "SkColorFilter.h"
-#include "SkTime.h"
-#include "SkTypeface.h"
-
-#include "SkImageRef_GlobalPool.h"
-#include "SkOSFile.h"
-#include "SkStream.h"
-
-#include "SkBlurDrawLooper.h"
-#include "SkColorMatrixFilter.h"
-
-static void drawmarshmallow(SkCanvas* canvas) {
-    SkBitmap bitmap;
-    SkPaint paint;
-    SkRect r;
-    SkMatrix m;
-
-    SkImageDecoder::DecodeFile("/Users/reed/Downloads/3elfs.jpg", &bitmap);
-    if (!bitmap.pixelRef()) {
-        return;
-    }
-
-    SkShader* s = SkShader::CreateBitmapShader(bitmap,
-                                               SkShader::kRepeat_TileMode,
-                                               SkShader::kRepeat_TileMode);
-    paint.setShader(s)->unref();
-    m.setTranslate(SkIntToScalar(250), SkIntToScalar(134));
-    s->setLocalMatrix(m);
-
-    r.set(SkIntToScalar(250),
-          SkIntToScalar(134),
-          SkIntToScalar(250 + 449),
-          SkIntToScalar(134 + 701));
-    paint.setFlags(2);
-
-    canvas->drawRect(r, paint);
-}
-
-static void DrawRoundRect(SkCanvas& canvas) {
-   bool ret = false;
-   SkPaint  paint;
-   SkBitmap bitmap;
-   SkMatrix matrix;
-   matrix.reset();
-
-   bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1370, 812);
-   bitmap.allocPixels();
-
-   // set up clipper
-   SkRect skclip;
-   skclip.set(SkIntToScalar(284), SkIntToScalar(40), SkIntToScalar(1370), SkIntToScalar(708));
-
-//   ret = canvas.clipRect(skclip);
-//   SkASSERT(ret);
-
-   matrix.set(SkMatrix::kMTransX, SkFloatToScalar(-1153.28f));
-   matrix.set(SkMatrix::kMTransY, SkFloatToScalar(1180.50f));
-
-   matrix.set(SkMatrix::kMScaleX, SkFloatToScalar(0.177171f));
-   matrix.set(SkMatrix::kMScaleY, SkFloatToScalar(0.177043f));
-
-   matrix.set(SkMatrix::kMSkewX, SkFloatToScalar(0.126968f));
-   matrix.set(SkMatrix::kMSkewY, SkFloatToScalar(-0.126876f));
-
-   matrix.set(SkMatrix::kMPersp0, SkFloatToScalar(0.0f));
-   matrix.set(SkMatrix::kMPersp1, SkFloatToScalar(0.0f));
-
-   ret = canvas.concat(matrix);
-
-   paint.setAntiAlias(true);
-   paint.setColor(0xb2202020);
-   paint.setStyle(SkPaint::kStroke_Style);
-   paint.setStrokeWidth(SkFloatToScalar(68.13f));
-
-   SkRect r;
-   r.set(SkFloatToScalar(-313.714417f), SkFloatToScalar(-4.826389f), SkFloatToScalar(18014.447266f), SkFloatToScalar(1858.154541f));
-   canvas.drawRoundRect(r, SkFloatToScalar(91.756363f), SkFloatToScalar(91.756363f), paint);
-}
-
-static bool SetImageRef(SkBitmap* bitmap, SkStream* stream,
-                        SkBitmap::Config pref, const char name[] = NULL) {
-#if 0
-    // test buffer streams
-    SkStream* str = new SkBufferStream(stream, 717);
-    stream->unref();
-    stream = str;
-#endif
-
-    SkImageRef* ref = new SkImageRef_GlobalPool(stream, pref, 1);
-    ref->setURI(name);
-    if (!ref->getInfo(bitmap)) {
-        delete ref;
-        return false;
-    }
-    bitmap->setPixelRef(ref)->unref();
-    return true;
-}
-
-//#define SPECIFIC_IMAGE  "/skimages/72.jpg"
-#define SPECIFIC_IMAGE  "/Users/reed/Downloads/3elfs.jpg"
-
-#define IMAGE_DIR       "/skimages/"
-#define IMAGE_SUFFIX    ".gif"
-
-class ImageDirView : public SkView {
-public:
-    SkBitmap*   fBitmaps;
-    SkString*   fStrings;
-    int         fBitmapCount;
-    int         fCurrIndex;
-    SkScalar    fSaturation;
-    SkScalar    fAngle;
-
-    ImageDirView() {
-        SkImageRef_GlobalPool::SetRAMBudget(320 * 1024);
-
-#ifdef SPECIFIC_IMAGE
-        fBitmaps = new SkBitmap[3];
-        fStrings = new SkString[3];
-        fBitmapCount = 3;
-        const SkBitmap::Config configs[] = {
-            SkBitmap::kARGB_8888_Config,
-            SkBitmap::kRGB_565_Config,
-            SkBitmap::kARGB_4444_Config
-        };
-        for (int i = 0; i < fBitmapCount; i++) {
-#if 1
-            SkStream* stream = new SkFILEStream(SPECIFIC_IMAGE);
-            SetImageRef(&fBitmaps[i], stream, configs[i], SPECIFIC_IMAGE);
-            stream->unref();
-#else
-            SkImageDecoder::DecodeFile(SPECIFIC_IMAGE, &fBitmaps[i]);
-#endif
-        }
-#else
-        int i, N = 0;
-        SkOSFile::Iter  iter(IMAGE_DIR, IMAGE_SUFFIX);
-        SkString    name;
-        while (iter.next(&name)) {
-            N += 1;
-        }
-        fBitmaps = new SkBitmap[N];
-        fStrings = new SkString[N];
-        iter.reset(IMAGE_DIR, IMAGE_SUFFIX);
-        for (i = 0; i < N; i++) {
-            iter.next(&name);
-            SkString path(IMAGE_DIR);
-            path.append(name);
-            SkStream* stream = new SkFILEStream(path.c_str());
-
-            SetImageRef(&fBitmaps[i], stream, SkBitmap::kNo_Config,
-                        name.c_str());
-            stream->unref();
-            fStrings[i] = name;
-        }
-        fBitmapCount = N;
-#endif
-        fCurrIndex = 0;
-        fDX = fDY = 0;
-
-        fSaturation = SK_Scalar1;
-        fAngle = 0;
-
-        fScale = SK_Scalar1;
-    }
-
-    virtual ~ImageDirView() {
-        delete[] fBitmaps;
-        delete[] fStrings;
-
-        SkImageRef_GlobalPool::DumpPool();
-    }
-
-protected:
-    // overrides from SkEventSink
-    virtual bool onQuery(SkEvent* evt) {
-        if (SampleCode::TitleQ(*evt)) {
-            SkString str("ImageDir: ");
-#ifdef SPECIFIC_IMAGE
-            str.append(SPECIFIC_IMAGE);
-#else
-            str.append(IMAGE_DIR);
-#endif
-            SampleCode::TitleR(evt, str.c_str());
-            return true;
-        }
-        return this->INHERITED::onQuery(evt);
-    }
-
-    void drawBG(SkCanvas* canvas) {
-//        canvas->drawColor(0xFFDDDDDD);
-        canvas->drawColor(SK_ColorGRAY);
-        canvas->drawColor(SK_ColorWHITE);
-    }
-
-    SkScalar fScale;
-    virtual void onDraw(SkCanvas* canvas) {
-        this->drawBG(canvas);
-
-        if (true) {
-            canvas->scale(SkIntToScalar(2), SkIntToScalar(2));
-            drawmarshmallow(canvas);
-            return;
-        }
-
-        if (false) {
-            SkPaint p;
-            p.setStyle(SkPaint::kStroke_Style);
-            p.setStrokeWidth(SkIntToScalar(4));
-            canvas->drawCircle(SkIntToScalar(100), SkIntToScalar(100), SkIntToScalar(50), p);
-            p.setAntiAlias(true);
-            canvas->drawCircle(SkIntToScalar(300), SkIntToScalar(100), SkIntToScalar(50), p);
-        }
-        if (false) {
-            SkScalar cx = this->width()/2;
-            SkScalar cy = this->height()/2;
-            canvas->translate(cx, cy);
-            canvas->scale(fScale, fScale);
-            canvas->translate(-cx, -cy);
-            DrawRoundRect(*canvas);
-            return;
-        }
-
-        canvas->translate(SkIntToScalar(10), SkIntToScalar(10));
-
-        SkScalar x = SkIntToScalar(32), y = SkIntToScalar(32);
-        SkPaint paint;
-
-#if 0
-        for (int i = 0; i < fBitmapCount; i++) {
-            SkPaint p;
-
-#if 1
-            const SkScalar cm[] = {
-                SkIntToScalar(2), 0, 0, 0, SkIntToScalar(-255),
-                0, SkIntToScalar(2), 0, 0, SkIntToScalar(-255),
-                0, 0, SkIntToScalar(2), 0, SkIntToScalar(-255),
-                0, 0, 0, SkIntToScalar(1), 0
-            };
-            SkColorFilter* cf = new SkColorMatrixFilter(cm);
-            p.setColorFilter(cf)->unref();
-#endif
-
-            canvas->drawBitmap(fBitmaps[i], x, y, &p);
-            x += SkIntToScalar(fBitmaps[i].width() + 10);
-        }
-        return;
-#endif
-
-        canvas->drawBitmap(fBitmaps[fCurrIndex], x, y, &paint);
-#ifndef SPECIFIC_IMAGE
-        if (true) {
-            fCurrIndex += 1;
-            if (fCurrIndex >= fBitmapCount) {
-                fCurrIndex = 0;
-            }
-            this->inval(NULL);
-        }
-#endif
-    }
-
-    virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
-        if (true) {
-            fCurrIndex += 1;
-            if (fCurrIndex >= fBitmapCount)
-                fCurrIndex = 0;
-            this->inval(NULL);
-        }
-        return new Click(this);
-    }
-
-    virtual bool onClick(Click* click)  {
-        SkScalar center = this->width()/2;
-        fSaturation = SkScalarDiv(click->fCurr.fX - center, center/2);
-        center = this->height()/2;
-        fAngle = SkScalarDiv(click->fCurr.fY - center, center) * 180;
-
-        fDX += click->fCurr.fX - click->fPrev.fX;
-        fDY += click->fCurr.fY - click->fPrev.fY;
-
-        fScale = SkScalarDiv(click->fCurr.fX, this->width());
-
-        this->inval(NULL);
-        return true;
-        return this->INHERITED::onClick(click);
-    }
-
-private:
-    SkScalar fDX, fDY;
-    typedef SkView INHERITED;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-
-static SkView* MyFactory() { return new ImageDirView; }
-static SkViewRegister reg(MyFactory);
-