OLD | NEW |
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 "SkData.h" | 8 #include "SkData.h" |
9 #include "SkRecorder.h" | 9 #include "SkRecorder.h" |
10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 145 } |
146 | 146 |
147 void SkRecorder::drawPaint(const SkPaint& paint) { | 147 void SkRecorder::drawPaint(const SkPaint& paint) { |
148 APPEND(DrawPaint, delay_copy(paint)); | 148 APPEND(DrawPaint, delay_copy(paint)); |
149 } | 149 } |
150 | 150 |
151 void SkRecorder::drawPoints(PointMode mode, | 151 void SkRecorder::drawPoints(PointMode mode, |
152 size_t count, | 152 size_t count, |
153 const SkPoint pts[], | 153 const SkPoint pts[], |
154 const SkPaint& paint) { | 154 const SkPaint& paint) { |
155 APPEND(DrawPoints, delay_copy(paint), mode, count, this->copy(pts, count)); | 155 APPEND(DrawPoints, delay_copy(paint), mode, SkToUInt(count), this->copy(pts,
count)); |
156 } | 156 } |
157 | 157 |
158 void SkRecorder::drawRect(const SkRect& rect, const SkPaint& paint) { | 158 void SkRecorder::drawRect(const SkRect& rect, const SkPaint& paint) { |
159 APPEND(DrawRect, delay_copy(paint), rect); | 159 APPEND(DrawRect, delay_copy(paint), rect); |
160 } | 160 } |
161 | 161 |
162 void SkRecorder::drawOval(const SkRect& oval, const SkPaint& paint) { | 162 void SkRecorder::drawOval(const SkRect& oval, const SkPaint& paint) { |
163 APPEND(DrawOval, delay_copy(paint), oval); | 163 APPEND(DrawOval, delay_copy(paint), oval); |
164 } | 164 } |
165 | 165 |
(...skipping 19 matching lines...) Expand all Loading... |
185 SkScalar top, | 185 SkScalar top, |
186 const SkPaint* paint) { | 186 const SkPaint* paint) { |
187 APPEND(DrawBitmap, this->copy(paint), delay_copy(bitmap), left, top); | 187 APPEND(DrawBitmap, this->copy(paint), delay_copy(bitmap), left, top); |
188 } | 188 } |
189 | 189 |
190 void SkRecorder::drawBitmapRectToRect(const SkBitmap& bitmap, | 190 void SkRecorder::drawBitmapRectToRect(const SkBitmap& bitmap, |
191 const SkRect* src, | 191 const SkRect* src, |
192 const SkRect& dst, | 192 const SkRect& dst, |
193 const SkPaint* paint, | 193 const SkPaint* paint, |
194 DrawBitmapRectFlags flags) { | 194 DrawBitmapRectFlags flags) { |
| 195 if (kBleed_DrawBitmapRectFlag == flags) { |
| 196 APPEND(DrawBitmapRectToRectBleed, |
| 197 this->copy(paint), delay_copy(bitmap), this->copy(src), dst); |
| 198 return; |
| 199 } |
| 200 SkASSERT(kNone_DrawBitmapRectFlag == flags); |
195 APPEND(DrawBitmapRectToRect, | 201 APPEND(DrawBitmapRectToRect, |
196 this->copy(paint), delay_copy(bitmap), this->copy(src), dst, flags); | 202 this->copy(paint), delay_copy(bitmap), this->copy(src), dst); |
197 } | 203 } |
198 | 204 |
199 void SkRecorder::drawBitmapMatrix(const SkBitmap& bitmap, | 205 void SkRecorder::drawBitmapMatrix(const SkBitmap& bitmap, |
200 const SkMatrix& matrix, | 206 const SkMatrix& matrix, |
201 const SkPaint* paint) { | 207 const SkPaint* paint) { |
202 APPEND(DrawBitmapMatrix, this->copy(paint), delay_copy(bitmap), matrix); | 208 APPEND(DrawBitmapMatrix, this->copy(paint), delay_copy(bitmap), matrix); |
203 } | 209 } |
204 | 210 |
205 void SkRecorder::drawBitmapNine(const SkBitmap& bitmap, | 211 void SkRecorder::drawBitmapNine(const SkBitmap& bitmap, |
206 const SkIRect& center, | 212 const SkIRect& center, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 byteLength, | 245 byteLength, |
240 this->copy(pos, points)); | 246 this->copy(pos, points)); |
241 } | 247 } |
242 | 248 |
243 void SkRecorder::onDrawPosTextH(const void* text, size_t byteLength, | 249 void SkRecorder::onDrawPosTextH(const void* text, size_t byteLength, |
244 const SkScalar xpos[], SkScalar constY, const Sk
Paint& paint) { | 250 const SkScalar xpos[], SkScalar constY, const Sk
Paint& paint) { |
245 const unsigned points = paint.countText(text, byteLength); | 251 const unsigned points = paint.countText(text, byteLength); |
246 APPEND(DrawPosTextH, | 252 APPEND(DrawPosTextH, |
247 delay_copy(paint), | 253 delay_copy(paint), |
248 this->copy((const char*)text, byteLength), | 254 this->copy((const char*)text, byteLength), |
249 byteLength, | 255 SkToUInt(byteLength), |
250 this->copy(xpos, points), | 256 constY, |
251 constY); | 257 this->copy(xpos, points)); |
252 } | 258 } |
253 | 259 |
254 void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, | 260 void SkRecorder::onDrawTextOnPath(const void* text, size_t byteLength, const SkP
ath& path, |
255 const SkMatrix* matrix, const SkPaint& paint)
{ | 261 const SkMatrix* matrix, const SkPaint& paint)
{ |
256 APPEND(DrawTextOnPath, | 262 APPEND(DrawTextOnPath, |
257 delay_copy(paint), | 263 delay_copy(paint), |
258 this->copy((const char*)text, byteLength), | 264 this->copy((const char*)text, byteLength), |
259 byteLength, | 265 byteLength, |
260 delay_copy(path), | 266 delay_copy(path), |
261 this->copy(matrix)); | 267 this->copy(matrix)); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 APPEND(EndCommentGroup); | 380 APPEND(EndCommentGroup); |
375 } | 381 } |
376 | 382 |
377 bool SkRecorder::isDrawingToLayer() const { | 383 bool SkRecorder::isDrawingToLayer() const { |
378 return fSaveLayerCount > 0; | 384 return fSaveLayerCount > 0; |
379 } | 385 } |
380 | 386 |
381 void SkRecorder::drawData(const void* data, size_t length) { | 387 void SkRecorder::drawData(const void* data, size_t length) { |
382 APPEND(DrawData, copy((const char*)data), length); | 388 APPEND(DrawData, copy((const char*)data), length); |
383 } | 389 } |
OLD | NEW |