| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 * | 7 * |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 #ifndef SkExample_DEFINED | 10 #ifndef HelloWorld_DEFINED |
| 11 #define SkExample_DEFINED | 11 #define HelloWorld_DEFINED |
| 12 | 12 |
| 13 #include "SkSurface.h" | 13 #include "SkSurface.h" |
| 14 #include "SkWindow.h" | 14 #include "SkWindow.h" |
| 15 #include "SkTRegistry.h" | |
| 16 | 15 |
| 17 class GrContext; | 16 class GrContext; |
| 18 struct GrGLInterface; | 17 struct GrGLInterface; |
| 19 class GrRenderTarget; | 18 class GrRenderTarget; |
| 20 class SkCanvas; | 19 class SkCanvas; |
| 21 class SkExampleWindow; | |
| 22 | 20 |
| 23 class SkExample : SkNoncopyable { | 21 class HelloWorldWindow : public SkOSWindow { |
| 24 public: | |
| 25 SkExample(SkExampleWindow* window) : fWindow(window) {} | |
| 26 | |
| 27 virtual ~SkExample() {} | |
| 28 | |
| 29 // Your class should override this method to do its thing. | |
| 30 virtual void draw(SkCanvas* canvas) = 0; | |
| 31 | |
| 32 SkString getName() { return fName; }; | |
| 33 // Use this public registry to tell the world about your sample. | |
| 34 typedef SkTRegistry<SkExample*(*)(SkExampleWindow*)> Registry; | |
| 35 | |
| 36 protected: | |
| 37 SkExampleWindow* fWindow; | |
| 38 SkString fName; | |
| 39 }; | |
| 40 | |
| 41 class SkExampleWindow : public SkOSWindow { | |
| 42 public: | 22 public: |
| 43 enum DeviceType { | 23 enum DeviceType { |
| 44 kRaster_DeviceType, | 24 kRaster_DeviceType, |
| 45 kGPU_DeviceType, | 25 kGPU_DeviceType, |
| 46 }; | 26 }; |
| 47 SkExampleWindow(void* hwnd); | 27 HelloWorldWindow(void* hwnd); |
| 48 virtual ~SkExampleWindow() SK_OVERRIDE; | 28 virtual ~HelloWorldWindow() SK_OVERRIDE; |
| 49 | 29 |
| 50 // Changes the device type of the object. | 30 // Changes the device type of the object. |
| 51 bool setUpBackend(); | 31 bool setUpBackend(); |
| 52 | 32 |
| 53 DeviceType getDeviceType() const { return fType; } | 33 DeviceType getDeviceType() const { return fType; } |
| 54 | 34 |
| 55 protected: | 35 protected: |
| 56 SkSurface* createSurface() SK_OVERRIDE { | 36 SkSurface* createSurface() SK_OVERRIDE { |
| 57 if (kGPU_DeviceType == fType) { | 37 if (kGPU_DeviceType == fType) { |
| 58 SkSurfaceProps props(INHERITED::getSurfaceProps()); | 38 SkSurfaceProps props(INHERITED::getSurfaceProps()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 83 SkSurface* fSurface; | 63 SkSurface* fSurface; |
| 84 GrContext* fContext; | 64 GrContext* fContext; |
| 85 GrRenderTarget* fRenderTarget; | 65 GrRenderTarget* fRenderTarget; |
| 86 AttachmentInfo fAttachmentInfo; | 66 AttachmentInfo fAttachmentInfo; |
| 87 const GrGLInterface* fInterface; | 67 const GrGLInterface* fInterface; |
| 88 | 68 |
| 89 typedef SkOSWindow INHERITED; | 69 typedef SkOSWindow INHERITED; |
| 90 }; | 70 }; |
| 91 | 71 |
| 92 #endif | 72 #endif |
| OLD | NEW |