| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Skia | 2 * Copyright 2011 Skia |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SampleApp_DEFINED | 8 #ifndef SampleApp_DEFINED |
| 9 #define SampleApp_DEFINED | 9 #define SampleApp_DEFINED |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 class DeviceManager : public SkRefCnt { | 69 class DeviceManager : public SkRefCnt { |
| 70 public: | 70 public: |
| 71 SK_DECLARE_INST_COUNT(DeviceManager) | 71 SK_DECLARE_INST_COUNT(DeviceManager) |
| 72 | 72 |
| 73 virtual void setUpBackend(SampleWindow* win, int msaaSampleCount) = 0; | 73 virtual void setUpBackend(SampleWindow* win, int msaaSampleCount) = 0; |
| 74 | 74 |
| 75 virtual void tearDownBackend(SampleWindow* win) = 0; | 75 virtual void tearDownBackend(SampleWindow* win) = 0; |
| 76 | 76 |
| 77 // called before drawing. should install correct device | 77 // called before drawing. should install correct device |
| 78 // type on the canvas. Will skip drawing if returns false. | 78 // type on the canvas. Will skip drawing if returns false. |
| 79 virtual SkCanvas* createCanvas(DeviceType dType, SampleWindow* win) = 0; | 79 virtual SkSurface* createSurface(DeviceType dType, SampleWindow* win) =
0; |
| 80 | 80 |
| 81 // called after drawing, should get the results onto the | 81 // called after drawing, should get the results onto the |
| 82 // screen. | 82 // screen. |
| 83 virtual void publishCanvas(DeviceType dType, | 83 virtual void publishCanvas(DeviceType dType, |
| 84 SkCanvas* canvas, | 84 SkCanvas* canvas, |
| 85 SampleWindow* win) = 0; | 85 SampleWindow* win) = 0; |
| 86 | 86 |
| 87 // called when window changes size, guaranteed to be called | 87 // called when window changes size, guaranteed to be called |
| 88 // at least once before first draw (after init) | 88 // at least once before first draw (after init) |
| 89 virtual void windowSizeChanged(SampleWindow* win) = 0; | 89 virtual void windowSizeChanged(SampleWindow* win) = 0; |
| 90 | 90 |
| 91 // return the GrContext backing gpu devices (NULL if not built with GPU
support) | 91 // return the GrContext backing gpu devices (NULL if not built with GPU
support) |
| 92 virtual GrContext* getGrContext() = 0; | 92 virtual GrContext* getGrContext() = 0; |
| 93 | 93 |
| 94 // return the GrRenderTarget backing gpu devices (NULL if not built with
GPU support) | 94 // return the GrRenderTarget backing gpu devices (NULL if not built with
GPU support) |
| 95 virtual GrRenderTarget* getGrRenderTarget() = 0; | 95 virtual GrRenderTarget* getGrRenderTarget() = 0; |
| 96 private: | 96 private: |
| 97 typedef SkRefCnt INHERITED; | 97 typedef SkRefCnt INHERITED; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 SampleWindow(void* hwnd, int argc, char** argv, DeviceManager*); | 100 SampleWindow(void* hwnd, int argc, char** argv, DeviceManager*); |
| 101 virtual ~SampleWindow(); | 101 virtual ~SampleWindow(); |
| 102 | 102 |
| 103 virtual SkCanvas* createCanvas() SK_OVERRIDE { | 103 virtual SkSurface* createSurface() SK_OVERRIDE { |
| 104 SkCanvas* canvas = NULL; | 104 SkSurface* surface = NULL; |
| 105 if (fDevManager) { | 105 if (fDevManager) { |
| 106 canvas = fDevManager->createCanvas(fDeviceType, this); | 106 surface = fDevManager->createSurface(fDeviceType, this); |
| 107 } | 107 } |
| 108 if (NULL == canvas) { | 108 if (NULL == surface) { |
| 109 canvas = this->INHERITED::createCanvas(); | 109 surface = this->INHERITED::createSurface(); |
| 110 } | 110 } |
| 111 return canvas; | 111 return surface; |
| 112 } | 112 } |
| 113 | 113 |
| 114 virtual void draw(SkCanvas* canvas); | 114 virtual void draw(SkCanvas*) SK_OVERRIDE; |
| 115 | 115 |
| 116 void setDeviceType(DeviceType type); | 116 void setDeviceType(DeviceType type); |
| 117 void toggleRendering(); | 117 void toggleRendering(); |
| 118 void toggleSlideshow(); | 118 void toggleSlideshow(); |
| 119 void toggleFPS(); | 119 void toggleFPS(); |
| 120 void showOverview(); | 120 void showOverview(); |
| 121 | 121 |
| 122 GrContext* getGrContext() const { return fDevManager->getGrContext(); } | 122 GrContext* getGrContext() const { return fDevManager->getGrContext(); } |
| 123 | 123 |
| 124 void setZoomCenter(float x, float y); | 124 void setZoomCenter(float x, float y); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 void postAnimatingEvent(); | 235 void postAnimatingEvent(); |
| 236 void installDrawFilter(SkCanvas*); | 236 void installDrawFilter(SkCanvas*); |
| 237 int findByTitle(const char*); | 237 int findByTitle(const char*); |
| 238 void listTitles(); | 238 void listTitles(); |
| 239 SkSize tileSize() const; | 239 SkSize tileSize() const; |
| 240 | 240 |
| 241 typedef SkOSWindow INHERITED; | 241 typedef SkOSWindow INHERITED; |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 #endif | 244 #endif |
| OLD | NEW |