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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 // return the GrRenderTarget backing gpu devices (NULL if not built with
GPU support) | 95 // return the GrRenderTarget backing gpu devices (NULL if not built with
GPU support) |
96 virtual GrRenderTarget* getGrRenderTarget() = 0; | 96 virtual GrRenderTarget* getGrRenderTarget() = 0; |
97 private: | 97 private: |
98 typedef SkRefCnt INHERITED; | 98 typedef SkRefCnt INHERITED; |
99 }; | 99 }; |
100 | 100 |
101 SampleWindow(void* hwnd, int argc, char** argv, DeviceManager*); | 101 SampleWindow(void* hwnd, int argc, char** argv, DeviceManager*); |
102 virtual ~SampleWindow(); | 102 virtual ~SampleWindow(); |
103 | 103 |
104 virtual SkSurface* createSurface() SK_OVERRIDE { | 104 SkSurface* createSurface() SK_OVERRIDE { |
105 SkSurface* surface = NULL; | 105 SkSurface* surface = NULL; |
106 if (fDevManager) { | 106 if (fDevManager) { |
107 surface = fDevManager->createSurface(fDeviceType, this); | 107 surface = fDevManager->createSurface(fDeviceType, this); |
108 } | 108 } |
109 if (NULL == surface) { | 109 if (NULL == surface) { |
110 surface = this->INHERITED::createSurface(); | 110 surface = this->INHERITED::createSurface(); |
111 } | 111 } |
112 return surface; | 112 return surface; |
113 } | 113 } |
114 | 114 |
115 virtual void draw(SkCanvas*) SK_OVERRIDE; | 115 void draw(SkCanvas*) SK_OVERRIDE; |
116 | 116 |
117 void setDeviceType(DeviceType type); | 117 void setDeviceType(DeviceType type); |
118 void toggleRendering(); | 118 void toggleRendering(); |
119 void toggleSlideshow(); | 119 void toggleSlideshow(); |
120 void toggleFPS(); | 120 void toggleFPS(); |
121 void showOverview(); | 121 void showOverview(); |
122 void toggleDistanceFieldFonts(); | 122 void toggleDistanceFieldFonts(); |
123 | 123 |
124 GrContext* getGrContext() const { return fDevManager->getGrContext(); } | 124 GrContext* getGrContext() const { return fDevManager->getGrContext(); } |
125 | 125 |
126 void setZoomCenter(float x, float y); | 126 void setZoomCenter(float x, float y); |
127 void changeZoomLevel(float delta); | 127 void changeZoomLevel(float delta); |
128 bool nextSample(); | 128 bool nextSample(); |
129 bool previousSample(); | 129 bool previousSample(); |
130 bool goToSample(int i); | 130 bool goToSample(int i); |
131 SkString getSampleTitle(int i); | 131 SkString getSampleTitle(int i); |
132 int sampleCount(); | 132 int sampleCount(); |
133 bool handleTouch(int ownerId, float x, float y, | 133 bool handleTouch(int ownerId, float x, float y, |
134 SkView::Click::State state); | 134 SkView::Click::State state); |
135 void saveToPdf(); | 135 void saveToPdf(); |
136 void postInvalDelay(); | 136 void postInvalDelay(); |
137 | 137 |
138 DeviceType getDeviceType() const { return fDeviceType; } | 138 DeviceType getDeviceType() const { return fDeviceType; } |
139 | 139 |
140 protected: | 140 protected: |
141 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE; | 141 void onDraw(SkCanvas* canvas) SK_OVERRIDE; |
142 virtual bool onHandleKey(SkKey key) SK_OVERRIDE; | 142 bool onHandleKey(SkKey key) SK_OVERRIDE; |
143 virtual bool onHandleChar(SkUnichar) SK_OVERRIDE; | 143 bool onHandleChar(SkUnichar) SK_OVERRIDE; |
144 virtual void onSizeChange() SK_OVERRIDE; | 144 void onSizeChange() SK_OVERRIDE; |
145 | 145 |
146 virtual SkCanvas* beforeChildren(SkCanvas*) SK_OVERRIDE; | 146 SkCanvas* beforeChildren(SkCanvas*) SK_OVERRIDE; |
147 virtual void afterChildren(SkCanvas*) SK_OVERRIDE; | 147 void afterChildren(SkCanvas*) SK_OVERRIDE; |
148 virtual void beforeChild(SkView* child, SkCanvas* canvas) SK_OVERRIDE; | 148 void beforeChild(SkView* child, SkCanvas* canvas) SK_OVERRIDE; |
149 virtual void afterChild(SkView* child, SkCanvas* canvas) SK_OVERRIDE; | 149 void afterChild(SkView* child, SkCanvas* canvas) SK_OVERRIDE; |
150 | 150 |
151 virtual bool onEvent(const SkEvent& evt) SK_OVERRIDE; | 151 bool onEvent(const SkEvent& evt) SK_OVERRIDE; |
152 virtual bool onQuery(SkEvent* evt) SK_OVERRIDE; | 152 bool onQuery(SkEvent* evt) SK_OVERRIDE; |
153 | 153 |
154 virtual bool onDispatchClick(int x, int y, Click::State, void* owner, | 154 virtual bool onDispatchClick(int x, int y, Click::State, void* owner, |
155 unsigned modi) SK_OVERRIDE; | 155 unsigned modi) SK_OVERRIDE; |
156 virtual bool onClick(Click* click) SK_OVERRIDE; | 156 bool onClick(Click* click) SK_OVERRIDE; |
157 virtual Click* onFindClickHandler(SkScalar x, SkScalar y, | 157 virtual Click* onFindClickHandler(SkScalar x, SkScalar y, |
158 unsigned modi) SK_OVERRIDE; | 158 unsigned modi) SK_OVERRIDE; |
159 | 159 |
160 private: | 160 private: |
161 class DefaultDeviceManager; | 161 class DefaultDeviceManager; |
162 | 162 |
163 int fCurrIndex; | 163 int fCurrIndex; |
164 | 164 |
165 SkPictureRecorder fRecorder; | 165 SkPictureRecorder fRecorder; |
166 SkPath fClipPath; | 166 SkPath fClipPath; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 void postAnimatingEvent(); | 236 void postAnimatingEvent(); |
237 void installDrawFilter(SkCanvas*); | 237 void installDrawFilter(SkCanvas*); |
238 int findByTitle(const char*); | 238 int findByTitle(const char*); |
239 void listTitles(); | 239 void listTitles(); |
240 SkSize tileSize() const; | 240 SkSize tileSize() const; |
241 | 241 |
242 typedef SkOSWindow INHERITED; | 242 typedef SkOSWindow INHERITED; |
243 }; | 243 }; |
244 | 244 |
245 #endif | 245 #endif |
OLD | NEW |