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

Side by Side Diff: src/record/SkRecorder.cpp

Issue 272673002: Move paints to the front of draw structs. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 7 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
« no previous file with comments | « src/record/SkRecordOpts.cpp ('k') | src/record/SkRecords.h » ('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 2014 Google Inc. 2 * Copyright 2014 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 #include "SkRecorder.h" 8 #include "SkRecorder.h"
9 #include "SkPicture.h" 9 #include "SkPicture.h"
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 86 }
87 87
88 void SkRecorder::drawPaint(const SkPaint& paint) { 88 void SkRecorder::drawPaint(const SkPaint& paint) {
89 APPEND(DrawPaint, delay_copy(paint)); 89 APPEND(DrawPaint, delay_copy(paint));
90 } 90 }
91 91
92 void SkRecorder::drawPoints(PointMode mode, 92 void SkRecorder::drawPoints(PointMode mode,
93 size_t count, 93 size_t count,
94 const SkPoint pts[], 94 const SkPoint pts[],
95 const SkPaint& paint) { 95 const SkPaint& paint) {
96 APPEND(DrawPoints, mode, count, this->copy(pts, count), delay_copy(paint)); 96 APPEND(DrawPoints, delay_copy(paint), mode, count, this->copy(pts, count));
97 } 97 }
98 98
99 void SkRecorder::drawRect(const SkRect& rect, const SkPaint& paint) { 99 void SkRecorder::drawRect(const SkRect& rect, const SkPaint& paint) {
100 APPEND(DrawRect, rect, delay_copy(paint)); 100 APPEND(DrawRect, delay_copy(paint), rect);
101 } 101 }
102 102
103 void SkRecorder::drawOval(const SkRect& oval, const SkPaint& paint) { 103 void SkRecorder::drawOval(const SkRect& oval, const SkPaint& paint) {
104 APPEND(DrawOval, oval, delay_copy(paint)); 104 APPEND(DrawOval, delay_copy(paint), oval);
105 } 105 }
106 106
107 void SkRecorder::drawRRect(const SkRRect& rrect, const SkPaint& paint) { 107 void SkRecorder::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
108 APPEND(DrawRRect, rrect, delay_copy(paint)); 108 APPEND(DrawRRect, delay_copy(paint), rrect);
109 } 109 }
110 110
111 void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) { 111 void SkRecorder::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint) {
112 APPEND(DrawDRRect, outer, inner, delay_copy(paint)); 112 APPEND(DrawDRRect, delay_copy(paint), outer, inner);
113 } 113 }
114 114
115 void SkRecorder::drawPath(const SkPath& path, const SkPaint& paint) { 115 void SkRecorder::drawPath(const SkPath& path, const SkPaint& paint) {
116 APPEND(DrawPath, delay_copy(path), delay_copy(paint)); 116 APPEND(DrawPath, delay_copy(paint), delay_copy(path));
117 } 117 }
118 118
119 void SkRecorder::drawBitmap(const SkBitmap& bitmap, 119 void SkRecorder::drawBitmap(const SkBitmap& bitmap,
120 SkScalar left, 120 SkScalar left,
121 SkScalar top, 121 SkScalar top,
122 const SkPaint* paint) { 122 const SkPaint* paint) {
123 APPEND(DrawBitmap, delay_copy(bitmap), left, top, this->copy(paint)); 123 APPEND(DrawBitmap, this->copy(paint), delay_copy(bitmap), left, top);
124 } 124 }
125 125
126 void SkRecorder::drawBitmapRectToRect(const SkBitmap& bitmap, 126 void SkRecorder::drawBitmapRectToRect(const SkBitmap& bitmap,
127 const SkRect* src, 127 const SkRect* src,
128 const SkRect& dst, 128 const SkRect& dst,
129 const SkPaint* paint, 129 const SkPaint* paint,
130 DrawBitmapRectFlags flags) { 130 DrawBitmapRectFlags flags) {
131 APPEND(DrawBitmapRectToRect, 131 APPEND(DrawBitmapRectToRect,
132 delay_copy(bitmap), this->copy(src), dst, this->copy(paint), flags); 132 this->copy(paint), delay_copy(bitmap), this->copy(src), dst, flags);
133 } 133 }
134 134
135 void SkRecorder::drawBitmapMatrix(const SkBitmap& bitmap, 135 void SkRecorder::drawBitmapMatrix(const SkBitmap& bitmap,
136 const SkMatrix& matrix, 136 const SkMatrix& matrix,
137 const SkPaint* paint) { 137 const SkPaint* paint) {
138 APPEND(DrawBitmapMatrix, delay_copy(bitmap), matrix, this->copy(paint)); 138 APPEND(DrawBitmapMatrix, this->copy(paint), delay_copy(bitmap), matrix);
139 } 139 }
140 140
141 void SkRecorder::drawBitmapNine(const SkBitmap& bitmap, 141 void SkRecorder::drawBitmapNine(const SkBitmap& bitmap,
142 const SkIRect& center, 142 const SkIRect& center,
143 const SkRect& dst, 143 const SkRect& dst,
144 const SkPaint* paint) { 144 const SkPaint* paint) {
145 APPEND(DrawBitmapNine, delay_copy(bitmap), center, dst, this->copy(paint)); 145 APPEND(DrawBitmapNine, this->copy(paint), delay_copy(bitmap), center, dst);
146 } 146 }
147 147
148 void SkRecorder::drawSprite(const SkBitmap& bitmap, int left, int top, const SkP aint* paint) { 148 void SkRecorder::drawSprite(const SkBitmap& bitmap, int left, int top, const SkP aint* paint) {
149 APPEND(DrawSprite, delay_copy(bitmap), left, top, this->copy(paint)); 149 APPEND(DrawSprite, this->copy(paint), delay_copy(bitmap), left, top);
150 } 150 }
151 151
152 void SkRecorder::onDrawText(const void* text, size_t byteLength, 152 void SkRecorder::onDrawText(const void* text, size_t byteLength,
153 SkScalar x, SkScalar y, const SkPaint& paint) { 153 SkScalar x, SkScalar y, const SkPaint& paint) {
154 APPEND(DrawText, 154 APPEND(DrawText,
155 this->copy((const char*)text, byteLength), byteLength, x, y, delay_co py(paint)); 155 delay_copy(paint), this->copy((const char*)text, byteLength), byteLen gth, x, y);
156 } 156 }
157 157
158 void SkRecorder::onDrawPosText(const void* text, size_t byteLength, 158 void SkRecorder::onDrawPosText(const void* text, size_t byteLength,
159 const SkPoint pos[], const SkPaint& paint) { 159 const SkPoint pos[], const SkPaint& paint) {
160 const unsigned points = paint.countText(text, byteLength); 160 const unsigned points = paint.countText(text, byteLength);
161 APPEND(DrawPosText, 161 APPEND(DrawPosText,
162 this->copy((const char*)text, byteLength), byteLength, 162 delay_copy(paint),
163 this->copy(pos, points), delay_copy(paint)); 163 this->copy((const char*)text, byteLength),
164 byteLength,
165 this->copy(pos, points));
164 } 166 }
165 167
166 void SkRecorder::onDrawPosTextH(const void* text, size_t byteLength, 168 void SkRecorder::onDrawPosTextH(const void* text, size_t byteLength,
167 const SkScalar xpos[], SkScalar constY, const Sk Paint& paint) { 169 const SkScalar xpos[], SkScalar constY, const Sk Paint& paint) {
168 const unsigned points = paint.countText(text, byteLength); 170 const unsigned points = paint.countText(text, byteLength);
169 APPEND(DrawPosTextH, 171 APPEND(DrawPosTextH,
170 this->copy((const char*)text, byteLength), byteLength, 172 delay_copy(paint),
171 this->copy(xpos, points), constY, delay_copy(paint)); 173 this->copy((const char*)text, byteLength),
174 byteLength,
175 this->copy(xpos, points),
176 constY);
172 } 177 }
173 178
174 void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkP ath& path, 179 void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkP ath& path,
175 const SkMatrix* matrix, const SkPaint& paint) { 180 const SkMatrix* matrix, const SkPaint& paint) {
176 APPEND(DrawTextOnPath, 181 APPEND(DrawTextOnPath,
177 this->copy((const char*)text, byteLength), byteLength, 182 delay_copy(paint),
178 delay_copy(path), this->copy(matrix), delay_copy(paint)); 183 this->copy((const char*)text, byteLength),
184 byteLength,
185 delay_copy(path),
186 this->copy(matrix));
179 } 187 }
180 188
181 void SkRecorder::drawPicture(SkPicture& picture) { 189 void SkRecorder::drawPicture(SkPicture& picture) {
182 picture.draw(this); 190 picture.draw(this);
183 } 191 }
184 192
185 void SkRecorder::drawVertices(VertexMode vmode, 193 void SkRecorder::drawVertices(VertexMode vmode,
186 int vertexCount, const SkPoint vertices[], 194 int vertexCount, const SkPoint vertices[],
187 const SkPoint texs[], const SkColor colors[], 195 const SkPoint texs[], const SkColor colors[],
188 SkXfermode* xmode, 196 SkXfermode* xmode,
189 const uint16_t indices[], int indexCount, const Sk Paint& paint) { 197 const uint16_t indices[], int indexCount, const Sk Paint& paint) {
190 APPEND(DrawVertices, vmode, 198 APPEND(DrawVertices, delay_copy(paint),
199 vmode,
191 vertexCount, 200 vertexCount,
192 this->copy(vertices, vertexCount), 201 this->copy(vertices, vertexCount),
193 texs ? this->copy(texs, vertexCount) : NULL, 202 texs ? this->copy(texs, vertexCount) : NULL,
194 colors ? this->copy(colors, vertexCount) : NULL, 203 colors ? this->copy(colors, vertexCount) : NULL,
195 xmode, 204 xmode,
196 this->copy(indices, indexCount), 205 this->copy(indices, indexCount),
197 indexCount, 206 indexCount);
198 delay_copy(paint));
199 } 207 }
200 208
201 void SkRecorder::willSave(SkCanvas::SaveFlags flags) { 209 void SkRecorder::willSave(SkCanvas::SaveFlags flags) {
202 APPEND(Save, flags); 210 APPEND(Save, flags);
203 INHERITED(willSave, flags); 211 INHERITED(willSave, flags);
204 } 212 }
205 213
206 SkCanvas::SaveLayerStrategy SkRecorder::willSaveLayer(const SkRect* bounds, 214 SkCanvas::SaveLayerStrategy SkRecorder::willSaveLayer(const SkRect* bounds,
207 const SkPaint* paint, 215 const SkPaint* paint,
208 SkCanvas::SaveFlags flags) { 216 SkCanvas::SaveFlags flags) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 254
247 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle) { 255 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e dgeStyle) {
248 APPEND(ClipPath, delay_copy(path), op, edgeStyle == kSoft_ClipEdgeStyle); 256 APPEND(ClipPath, delay_copy(path), op, edgeStyle == kSoft_ClipEdgeStyle);
249 INHERITED(updateClipConservativelyUsingBounds, path.getBounds(), op, path.is InverseFillType()); 257 INHERITED(updateClipConservativelyUsingBounds, path.getBounds(), op, path.is InverseFillType());
250 } 258 }
251 259
252 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { 260 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
253 APPEND(ClipRegion, delay_copy(deviceRgn), op); 261 APPEND(ClipRegion, delay_copy(deviceRgn), op);
254 INHERITED(onClipRegion, deviceRgn, op); 262 INHERITED(onClipRegion, deviceRgn, op);
255 } 263 }
OLDNEW
« no previous file with comments | « src/record/SkRecordOpts.cpp ('k') | src/record/SkRecords.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698