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

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

Issue 19793006: pdfviewer: All NulCanvas (does not draw operations), TrackDevice (trackes what pixels have been cha… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 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/SkNulCanvas.cpp ('k') | experimental/PdfViewer/SkTrackDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #ifndef EXPERIMENTAL_PDFVIEWER_SKTRACKDEVICE_H_
2 #define EXPERIMENTAL_PDFVIEWER_SKTRACKDEVICE_H_
3
4 #include "SkDevice.h"
5 #include "SkTracker.h"
6
7 class SkTrackDevice : public SkDevice {
8 public:
9 SK_DECLARE_INST_COUNT(SkTrackDevice)
10
11 SkTrackDevice(const SkBitmap& bitmap) : SkDevice(bitmap)
12 , fTracker(NULL) {}
13
14 SkTrackDevice(const SkBitmap& bitmap, const SkDeviceProperties& deviceProper ties)
15 : SkDevice(bitmap, deviceProperties)
16 , fTracker(NULL) {}
17
18 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque = false)
19 : SkDevice(config, width, height, isOpaque)
20 , fTracker(NULL) {}
21
22 SkTrackDevice(SkBitmap::Config config, int width, int height, bool isOpaque,
23 const SkDeviceProperties& deviceProperties)
24 : SkDevice(config, width, height, isOpaque, deviceProperties)
25 , fTracker(NULL) {}
26
27 virtual ~SkTrackDevice() {}
28
29 void installTracker(SkTracker* tracker) {
30 fTracker = tracker;
31 fTracker->newFrame();
32 }
33
34 protected:
35 virtual void clear(SkColor color) {
36 before();
37 INHERITED::clear(color);
38 after();
39 }
40
41 virtual void drawPaint(const SkDraw& dummy1, const SkPaint& paint) {
42 before();
43 INHERITED::drawPaint(dummy1, paint);
44 after();
45 }
46
47 virtual void drawPoints(const SkDraw& dummy1, SkCanvas::PointMode mode, size _t count,
48 const SkPoint dummy2[], const SkPaint& paint) {
49 before();
50 INHERITED::drawPoints(dummy1, mode, count, dummy2, paint);
51 after();
52 }
53
54 virtual void drawRect(const SkDraw& dummy1, const SkRect& r,
55 const SkPaint& paint) {
56 before();
57 INHERITED::drawRect(dummy1, r, paint);
58 after();
59 }
60
61
62 virtual void drawOval(const SkDraw& dummy1, const SkRect& oval,
63 const SkPaint& paint) {
64 before();
65 INHERITED::drawOval(dummy1, oval, paint);
66 after();
67 }
68
69 virtual void drawRRect(const SkDraw& dummy1, const SkRRect& rr,
70 const SkPaint& paint) {
71 before();
72 INHERITED::drawRRect(dummy1, rr, paint);
73 after();
74 }
75
76 virtual void drawPath(const SkDraw& dummy1, const SkPath& path,
77 const SkPaint& paint,
78 const SkMatrix* prePathMatrix = NULL,
79 bool pathIsMutable = false) {
80 before();
81 INHERITED::drawPath(dummy1, path, paint, prePathMatrix, pathIsMutable);
82 after();
83 }
84
85 virtual void drawBitmap(const SkDraw& dummy1, const SkBitmap& bitmap,
86 const SkIRect* srcRectOrNull,
87 const SkMatrix& matrix, const SkPaint& paint) {
88 before();
89 INHERITED::drawBitmap(dummy1, bitmap, srcRectOrNull, matrix, paint);
90 after();
91 }
92
93 virtual void drawSprite(const SkDraw& dummy1, const SkBitmap& bitmap,
94 int x, int y, const SkPaint& paint) {
95 before();
96 INHERITED::drawSprite(dummy1, bitmap, x, y, paint);
97 after();
98 }
99
100 virtual void drawBitmapRect(const SkDraw& dummy1, const SkBitmap& dummy2,
101 const SkRect* srcOrNull, const SkRect& dst,
102 const SkPaint& paint) {
103 before();
104 INHERITED::drawBitmapRect(dummy1, dummy2, srcOrNull, dst, paint);
105 after();
106 }
107
108 virtual void drawText(const SkDraw& dummy1, const void* text, size_t len,
109 SkScalar x, SkScalar y, const SkPaint& paint) {
110 before();
111 INHERITED::drawText(dummy1, text, len, x, y, paint);
112 after();
113 }
114
115 virtual void drawPosText(const SkDraw& dummy1, const void* text, size_t len,
116 const SkScalar pos[], SkScalar constY,
117 int scalarsPerPos, const SkPaint& paint) {
118 before();
119 INHERITED::drawPosText(dummy1, text, len, pos, constY, scalarsPerPos, pa int);
120 after();
121 }
122
123 virtual void drawTextOnPath(const SkDraw& dummy1, const void* text, size_t l en,
124 const SkPath& path, const SkMatrix* matrix,
125 const SkPaint& paint) {
126 before();
127 INHERITED::drawTextOnPath(dummy1, text, len, path, matrix, paint);
128 after();
129 }
130
131 #ifdef SK_BUILD_FOR_ANDROID
132 virtual void drawPosTextOnPath(const SkDraw& draw, const void* text, size_t len,
133 const SkPoint pos[], const SkPaint& paint,
134 const SkPath& path, const SkMatrix* matrix) {
135 before();
136 INHERITED::drawPosTextOnPath(draw, text, len, pos, paint, path, matrix);
137 after();
138 }
139 #endif
140 virtual void drawVertices(const SkDraw& dummy1, SkCanvas::VertexMode dummy2, int vertexCount,
141 const SkPoint verts[], const SkPoint texs[],
142 const SkColor colors[], SkXfermode* xmode,
143 const uint16_t indices[], int indexCount,
144 const SkPaint& paint) {
145 before();
146 INHERITED::drawVertices(dummy1, dummy2, vertexCount,verts, texs,colors, xmode, indices, indexCount, paint);
147 after();
148 }
149
150 virtual void drawDevice(const SkDraw& dummy1, SkDevice* dummy2, int x, int y ,
151 const SkPaint& dummy3) {
152 before();
153 INHERITED::drawDevice(dummy1, dummy2, x, y, dummy3);
154 after();
155 }
156
157 private:
158 void before() {
159 if (fTracker) {
160 fTracker->before(accessBitmap(false));
161 }
162 }
163
164 // any/all of the expected touched has to be changed, and all expected untou ched must be intact
165 void after() {
166 if (fTracker) {
167 fTracker->after(accessBitmap(false));
168 }
169 }
170
171 private:
172 SkTracker* fTracker;
173
174 typedef SkDevice INHERITED;
175 };
176
177 #endif // EXPERIMENTAL_PDFVIEWER_SKTRACKDEVICE_H_
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkNulCanvas.cpp ('k') | experimental/PdfViewer/SkTrackDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698