Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: experimental/PdfViewer/SkTrackDevice.h

Issue 22978012: Split SkDevice into SkBaseDevice and SkBitmapDevice (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Updating to ToT (10994) Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « experimental/PdfViewer/SkPdfRenderer.cpp ('k') | experimental/PdfViewer/pdf_viewer_main.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 SkTrackDevice_DEFINED 8 #ifndef SkTrackDevice_DEFINED
9 #define SkTrackDevice_DEFINED 9 #define SkTrackDevice_DEFINED
10 10
11 #include "SkDevice.h" 11 #include "SkDevice.h"
12 #include "SkTracker.h" 12 #include "SkTracker.h"
13 13
14 class SkTrackDevice : public SkDevice { 14 class SkTrackDevice : public SkBitmapDevice {
15 public: 15 public:
16 SK_DECLARE_INST_COUNT(SkTrackDevice) 16 SK_DECLARE_INST_COUNT(SkTrackDevice)
17 17
18 SkTrackDevice(const SkBitmap& bitmap) : SkDevice(bitmap) 18 SkTrackDevice(const SkBitmap& bitmap) : SkBitmapDevice(bitmap)
19 , fTracker(NULL) {} 19 , fTracker(NULL) {}
20 20
21 SkTrackDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProper ties) 21 SkTrackDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProper ties)
22 : SkDevice(bitmap, deviceProperties) 22 : SkBitmapDevice(bitmap, deviceProperties)
23 , fTracker(NULL) {} 23 , fTracker(NULL) {}
24 24
25 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false) 25 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false)
26 : SkDevice(config, width, height, isOpaque) 26 : SkBitmapDevice(config, width, height, isOpaque)
27 , fTracker(NULL) {} 27 , fTracker(NULL) {}
28 28
29 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque, 29 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
30 const SkDeviceProperties& deviceProperties) 30 const SkDeviceProperties& deviceProperties)
31 : SkDevice(config, width, height, isOpaque, deviceProperties) 31 : SkBitmapDevice(config, width, height, isOpaque, deviceProperties)
32 , fTracker(NULL) {} 32 , fTracker(NULL) {}
33 33
34 virtual ~SkTrackDevice() {} 34 virtual ~SkTrackDevice() {}
35 35
36 void installTracker(SkTracker* tracker) { 36 void installTracker(SkTracker* tracker) {
37 fTracker = tracker; 37 fTracker = tracker;
38 fTracker->newFrame(); 38 fTracker->newFrame();
39 } 39 }
40 40
41 protected: 41 protected:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 virtual void drawVertices(const SkDraw& dummy1, SkCanvas::VertexMode dummy2, int vertexCount, 147 virtual void drawVertices(const SkDraw& dummy1, SkCanvas::VertexMode dummy2, int vertexCount,
148 const SkPoint verts[], const SkPoint texs[], 148 const SkPoint verts[], const SkPoint texs[],
149 const SkColor colors[], SkXfermode* xmode, 149 const SkColor colors[], SkXfermode* xmode,
150 const uint16_t indices[], int indexCount, 150 const uint16_t indices[], int indexCount,
151 const SkPaint& paint) { 151 const SkPaint& paint) {
152 before(); 152 before();
153 INHERITED::drawVertices(dummy1, dummy2, vertexCount,verts, texs,colors, xmode, indices, indexCount, paint); 153 INHERITED::drawVertices(dummy1, dummy2, vertexCount,verts, texs,colors, xmode, indices, indexCount, paint);
154 after(); 154 after();
155 } 155 }
156 156
157 virtual void drawDevice(const SkDraw& dummy1, SkDevice* dummy2, int x, int y , 157 virtual void drawDevice(const SkDraw& dummy1, SkBaseDevice* dummy2, int x, i nt y,
158 const SkPaint& dummy3) { 158 const SkPaint& dummy3) {
159 before(); 159 before();
160 INHERITED::drawDevice(dummy1, dummy2, x, y, dummy3); 160 INHERITED::drawDevice(dummy1, dummy2, x, y, dummy3);
161 after(); 161 after();
162 } 162 }
163 163
164 private: 164 private:
165 void before() { 165 void before() {
166 if (fTracker) { 166 if (fTracker) {
167 fTracker->before(accessBitmap(false)); 167 fTracker->before(accessBitmap(false));
168 } 168 }
169 } 169 }
170 170
171 // any/all of the expected touched has to be changed, and all expected untou ched must be intact 171 // any/all of the expected touched has to be changed, and all expected untou ched must be intact
172 void after() { 172 void after() {
173 if (fTracker) { 173 if (fTracker) {
174 fTracker->after(accessBitmap(false)); 174 fTracker->after(accessBitmap(false));
175 } 175 }
176 } 176 }
177 177
178 private: 178 private:
179 SkTracker* fTracker; 179 SkTracker* fTracker;
180 180
181 typedef SkDevice INHERITED; 181 typedef SkBitmapDevice INHERITED;
182 }; 182 };
183 183
184 #endif // SkTrackDevice_DEFINED 184 #endif // SkTrackDevice_DEFINED
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkPdfRenderer.cpp ('k') | experimental/PdfViewer/pdf_viewer_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698