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

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: update to ToT, re-add SkBaseDevice::config & default parameter Created 7 years, 4 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
OLDNEW
1 #ifndef EXPERIMENTAL_PDFVIEWER_SKTRACKDEVICE_H_ 1 #ifndef EXPERIMENTAL_PDFVIEWER_SKTRACKDEVICE_H_
2 #define EXPERIMENTAL_PDFVIEWER_SKTRACKDEVICE_H_ 2 #define EXPERIMENTAL_PDFVIEWER_SKTRACKDEVICE_H_
3 3
4 #include "SkDevice.h" 4 #include "SkDevice.h"
5 #include "SkTracker.h" 5 #include "SkTracker.h"
6 6
7 class SkTrackDevice : public SkDevice { 7 class SkTrackDevice : public SkBitmapDevice {
8 public: 8 public:
9 SK_DECLARE_INST_COUNT(SkTrackDevice) 9 SK_DECLARE_INST_COUNT(SkTrackDevice)
10 10
11 SkTrackDevice(const SkBitmap& bitmap) : SkDevice(bitmap) 11 SkTrackDevice(const SkBitmap& bitmap) : SkBitmapDevice(bitmap)
12 , fTracker(NULL) {} 12 , fTracker(NULL) {}
13 13
14 SkTrackDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProper ties) 14 SkTrackDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProper ties)
15 : SkDevice(bitmap, deviceProperties) 15 : SkBitmapDevice(bitmap, deviceProperties)
16 , fTracker(NULL) {} 16 , fTracker(NULL) {}
17 17
18 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false) 18 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false)
19 : SkDevice(config, width, height, isOpaque) 19 : SkBitmapDevice(config, width, height, isOpaque)
20 , fTracker(NULL) {} 20 , fTracker(NULL) {}
21 21
22 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque, 22 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
23 const SkDeviceProperties& deviceProperties) 23 const SkDeviceProperties& deviceProperties)
24 : SkDevice(config, width, height, isOpaque, deviceProperties) 24 : SkBitmapDevice(config, width, height, isOpaque, deviceProperties)
25 , fTracker(NULL) {} 25 , fTracker(NULL) {}
26 26
27 virtual ~SkTrackDevice() {} 27 virtual ~SkTrackDevice() {}
28 28
29 void installTracker(SkTracker* tracker) { 29 void installTracker(SkTracker* tracker) {
30 fTracker = tracker; 30 fTracker = tracker;
31 fTracker->newFrame(); 31 fTracker->newFrame();
32 } 32 }
33 33
34 protected: 34 protected:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 virtual void drawVertices(const SkDraw& dummy1, SkCanvas::VertexMode dummy2, int vertexCount, 140 virtual void drawVertices(const SkDraw& dummy1, SkCanvas::VertexMode dummy2, int vertexCount,
141 const SkPoint verts[], const SkPoint texs[], 141 const SkPoint verts[], const SkPoint texs[],
142 const SkColor colors[], SkXfermode* xmode, 142 const SkColor colors[], SkXfermode* xmode,
143 const uint16_t indices[], int indexCount, 143 const uint16_t indices[], int indexCount,
144 const SkPaint& paint) { 144 const SkPaint& paint) {
145 before(); 145 before();
146 INHERITED::drawVertices(dummy1, dummy2, vertexCount,verts, texs,colors, xmode, indices, indexCount, paint); 146 INHERITED::drawVertices(dummy1, dummy2, vertexCount,verts, texs,colors, xmode, indices, indexCount, paint);
147 after(); 147 after();
148 } 148 }
149 149
150 virtual void drawDevice(const SkDraw& dummy1, SkDevice* dummy2, int x, int y , 150 virtual void drawDevice(const SkDraw& dummy1, SkBaseDevice* dummy2, int x, i nt y,
151 const SkPaint& dummy3) { 151 const SkPaint& dummy3) {
152 before(); 152 before();
153 INHERITED::drawDevice(dummy1, dummy2, x, y, dummy3); 153 INHERITED::drawDevice(dummy1, dummy2, x, y, dummy3);
154 after(); 154 after();
155 } 155 }
156 156
157 private: 157 private:
158 void before() { 158 void before() {
159 if (fTracker) { 159 if (fTracker) {
160 fTracker->before(accessBitmap(false)); 160 fTracker->before(accessBitmap(false));
161 } 161 }
162 } 162 }
163 163
164 // any/all of the expected touched has to be changed, and all expected untou ched must be intact 164 // any/all of the expected touched has to be changed, and all expected untou ched must be intact
165 void after() { 165 void after() {
166 if (fTracker) { 166 if (fTracker) {
167 fTracker->after(accessBitmap(false)); 167 fTracker->after(accessBitmap(false));
168 } 168 }
169 } 169 }
170 170
171 private: 171 private:
172 SkTracker* fTracker; 172 SkTracker* fTracker;
173 173
174 typedef SkDevice INHERITED; 174 typedef SkBitmapDevice INHERITED;
175 }; 175 };
176 176
177 #endif // EXPERIMENTAL_PDFVIEWER_SKTRACKDEVICE_H_ 177 #endif // EXPERIMENTAL_PDFVIEWER_SKTRACKDEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698