| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 * SampleApp ports can subclass this manager class if they want to: | 67 * SampleApp ports can subclass this manager class if they want to: |
| 68 * * filter the types of devices supported | 68 * * filter the types of devices supported |
| 69 * * customize plugging of SkBaseDevice objects into an SkCanvas | 69 * * customize plugging of SkBaseDevice objects into an SkCanvas |
| 70 * * customize publishing the results of draw to the OS window | 70 * * customize publishing the results of draw to the OS window |
| 71 * * manage GrContext / GrRenderTarget lifetimes | 71 * * manage GrContext / GrRenderTarget lifetimes |
| 72 */ | 72 */ |
| 73 class DeviceManager : public SkRefCnt { | 73 class DeviceManager : public SkRefCnt { |
| 74 public: | 74 public: |
| 75 | 75 |
| 76 | 76 |
| 77 virtual void setUpBackend(SampleWindow* win, int msaaSampleCount) = 0; | 77 virtual void setUpBackend(SampleWindow* win, int msaaSampleCount, bool d
eepColor) = 0; |
| 78 | 78 |
| 79 virtual void tearDownBackend(SampleWindow* win) = 0; | 79 virtual void tearDownBackend(SampleWindow* win) = 0; |
| 80 | 80 |
| 81 // called before drawing. should install correct device | 81 // called before drawing. should install correct device |
| 82 // type on the canvas. Will skip drawing if returns false. | 82 // type on the canvas. Will skip drawing if returns false. |
| 83 virtual SkSurface* createSurface(DeviceType dType, SampleWindow* win) =
0; | 83 virtual SkSurface* createSurface(DeviceType dType, SampleWindow* win) =
0; |
| 84 | 84 |
| 85 // called after drawing, should get the results onto the | 85 // called after drawing, should get the results onto the |
| 86 // screen. | 86 // screen. |
| 87 virtual void publishCanvas(DeviceType dType, | 87 virtual void publishCanvas(DeviceType dType, |
| 88 SkCanvas* canvas, | 88 SkCanvas* canvas, |
| 89 SampleWindow* win) = 0; | 89 SampleWindow* win) = 0; |
| 90 | 90 |
| 91 // called when window changes size, guaranteed to be called | 91 // called when window changes size, guaranteed to be called |
| 92 // at least once before first draw (after init) | 92 // at least once before first draw (after init) |
| 93 virtual void windowSizeChanged(SampleWindow* win) = 0; | 93 virtual void windowSizeChanged(SampleWindow* win) = 0; |
| 94 | 94 |
| 95 // return the GrContext backing gpu devices (nullptr if not built with G
PU support) | 95 // return the GrContext backing gpu devices (nullptr if not built with G
PU support) |
| 96 virtual GrContext* getGrContext() = 0; | 96 virtual GrContext* getGrContext() = 0; |
| 97 | 97 |
| 98 // return the GrRenderTarget backing gpu devices (nullptr if not built w
ith GPU support) | 98 // return the GrRenderTarget backing gpu devices (nullptr if not built w
ith GPU support) |
| 99 virtual GrRenderTarget* getGrRenderTarget() = 0; | 99 virtual GrRenderTarget* getGrRenderTarget() = 0; |
| 100 |
| 101 // return the color depth of the output device |
| 102 virtual int getColorBits() = 0; |
| 103 |
| 100 private: | 104 private: |
| 101 typedef SkRefCnt INHERITED; | 105 typedef SkRefCnt INHERITED; |
| 102 }; | 106 }; |
| 103 | 107 |
| 104 SampleWindow(void* hwnd, int argc, char** argv, DeviceManager*); | 108 SampleWindow(void* hwnd, int argc, char** argv, DeviceManager*); |
| 105 virtual ~SampleWindow(); | 109 virtual ~SampleWindow(); |
| 106 | 110 |
| 107 SkSurface* createSurface() override { | 111 SkSurface* createSurface() override { |
| 108 SkSurface* surface = nullptr; | 112 SkSurface* surface = nullptr; |
| 109 if (fDevManager) { | 113 if (fDevManager) { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 209 |
| 206 SkOSMenu::TriState fLCDState; | 210 SkOSMenu::TriState fLCDState; |
| 207 SkOSMenu::TriState fAAState; | 211 SkOSMenu::TriState fAAState; |
| 208 SkOSMenu::TriState fSubpixelState; | 212 SkOSMenu::TriState fSubpixelState; |
| 209 int fHintingState; | 213 int fHintingState; |
| 210 int fPixelGeometryIndex; | 214 int fPixelGeometryIndex; |
| 211 int fFilterQualityIndex; | 215 int fFilterQualityIndex; |
| 212 unsigned fFlipAxis; | 216 unsigned fFlipAxis; |
| 213 | 217 |
| 214 int fMSAASampleCount; | 218 int fMSAASampleCount; |
| 219 bool fDeepColor; |
| 215 | 220 |
| 216 SkScalar fZoomCenterX, fZoomCenterY; | 221 SkScalar fZoomCenterX, fZoomCenterY; |
| 217 | 222 |
| 218 //Stores global settings | 223 //Stores global settings |
| 219 SkOSMenu* fAppMenu; // We pass ownership to SkWindow, when we call addMenu | 224 SkOSMenu* fAppMenu; // We pass ownership to SkWindow, when we call addMenu |
| 220 //Stores slide specific settings | 225 //Stores slide specific settings |
| 221 SkOSMenu* fSlideMenu; // We pass ownership to SkWindow, when we call addMenu | 226 SkOSMenu* fSlideMenu; // We pass ownership to SkWindow, when we call addMenu |
| 222 | 227 |
| 223 void loadView(SkView*); | 228 void loadView(SkView*); |
| 224 void updateTitle(); | 229 void updateTitle(); |
| 225 bool getRawTitle(SkString*); | 230 bool getRawTitle(SkString*); |
| 226 | 231 |
| 227 bool zoomIn(); | 232 bool zoomIn(); |
| 228 bool zoomOut(); | 233 bool zoomOut(); |
| 229 void updatePointer(int x, int y); | 234 void updatePointer(int x, int y); |
| 230 void magnify(SkCanvas* canvas); | 235 void magnify(SkCanvas* canvas); |
| 231 void showZoomer(SkCanvas* canvas); | 236 void showZoomer(SkCanvas* canvas); |
| 232 void updateMatrix(); | 237 void updateMatrix(); |
| 233 void postAnimatingEvent(); | 238 void postAnimatingEvent(); |
| 234 int findByTitle(const char*); | 239 int findByTitle(const char*); |
| 235 void listTitles(); | 240 void listTitles(); |
| 236 SkSize tileSize() const; | 241 SkSize tileSize() const; |
| 237 bool sendAnimatePulse(); | 242 bool sendAnimatePulse(); |
| 238 | 243 |
| 239 typedef SkOSWindow INHERITED; | 244 typedef SkOSWindow INHERITED; |
| 240 }; | 245 }; |
| 241 | 246 |
| 242 #endif | 247 #endif |
| OLD | NEW |