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 "SkBigPicture.h" | 8 #include "SkBigPicture.h" |
9 #include "SkCanvasPriv.h" | 9 #include "SkCanvasPriv.h" |
10 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 } | 179 } |
180 #else | 180 #else |
181 APPEND(DrawBitmap, this->copy(paint), bitmap, left, top); | 181 APPEND(DrawBitmap, this->copy(paint), bitmap, left, top); |
182 #endif | 182 #endif |
183 } | 183 } |
184 | 184 |
185 void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap, | 185 void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap, |
186 const SkRect* src, | 186 const SkRect* src, |
187 const SkRect& dst, | 187 const SkRect& dst, |
188 const SkPaint* paint, | 188 const SkPaint* paint, |
189 DrawBitmapRectFlags flags) { | 189 SK_VIRTUAL_CONSTRAINT_TYPE legacyConstraint) { |
| 190 SrcRectConstraint constraint = (SrcRectConstraint)legacyConstraint; |
| 191 |
190 #ifdef WRAP_BITMAP_AS_IMAGE | 192 #ifdef WRAP_BITMAP_AS_IMAGE |
191 // TODO: need a way to support the flags for images... | 193 // TODO: need a way to support the flags for images... |
192 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap)); | 194 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap)); |
193 if (image) { | 195 if (image) { |
194 this->onDrawImageRect(image, src, dst, paint); | 196 this->onDrawImageRect(image, src, dst, paint); |
195 } | 197 } |
196 #else | 198 #else |
197 TRY_MINIRECORDER(drawBitmapRectToRect, bitmap, src, dst, paint, flags); | 199 TRY_MINIRECORDER(drawBitmapRect, bitmap, src, dst, paint, constraint); |
198 if (kBleed_DrawBitmapRectFlag == flags) { | 200 if (kFast_SrcRectConstraint == constraint) { |
199 APPEND(DrawBitmapRectToRectBleed, | 201 APPEND(DrawBitmapRectFast, this->copy(paint), bitmap, this->copy(src), d
st); |
200 this->copy(paint), bitmap, this->copy(src), dst); | |
201 return; | 202 return; |
202 } | 203 } |
203 SkASSERT(kNone_DrawBitmapRectFlag == flags); | 204 SkASSERT(kStrict_SrcRectConstraint == constraint); |
204 APPEND(DrawBitmapRectToRect, | 205 APPEND(DrawBitmapRect, this->copy(paint), bitmap, this->copy(src), dst); |
205 this->copy(paint), bitmap, this->copy(src), dst); | |
206 #endif | 206 #endif |
207 } | 207 } |
208 | 208 |
209 void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap, | 209 void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap, |
210 const SkIRect& center, | 210 const SkIRect& center, |
211 const SkRect& dst, | 211 const SkRect& dst, |
212 const SkPaint* paint) { | 212 const SkPaint* paint) { |
213 #ifdef WRAP_BITMAP_AS_IMAGE | 213 #ifdef WRAP_BITMAP_AS_IMAGE |
214 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap)); | 214 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap)); |
215 if (image) { | 215 if (image) { |
216 this->onDrawImageNine(image, center, dst, paint); | 216 this->onDrawImageNine(image, center, dst, paint); |
217 } | 217 } |
218 #else | 218 #else |
219 APPEND(DrawBitmapNine, this->copy(paint), bitmap, center, dst); | 219 APPEND(DrawBitmapNine, this->copy(paint), bitmap, center, dst); |
220 #endif | 220 #endif |
221 } | 221 } |
222 | 222 |
223 void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top, | 223 void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top, |
224 const SkPaint* paint) { | 224 const SkPaint* paint) { |
225 APPEND(DrawImage, this->copy(paint), image, left, top); | 225 APPEND(DrawImage, this->copy(paint), image, left, top); |
226 } | 226 } |
227 | 227 |
228 void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src, | 228 void SkRecorder::onDrawImageRect(const SkImage* image, const SkRect* src, |
229 const SkRect& dst, | 229 const SkRect& dst, |
230 const SkPaint* paint) { | 230 const SkPaint* paint SRC_RECT_CONSTRAINT_PARAM(
constraint)) { |
231 APPEND(DrawImageRect, this->copy(paint), image, this->copy(src), dst); | 231 #ifdef SK_SUPPORT_LEGACY_ONDRAWIMAGERECT |
| 232 SrcRectConstraint constraint = kStrict_SrcRectConstraint; |
| 233 #endif |
| 234 APPEND(DrawImageRect, this->copy(paint), image, this->copy(src), dst, constr
aint); |
232 } | 235 } |
233 | 236 |
234 void SkRecorder::onDrawImageNine(const SkImage* image, const SkIRect& center, | 237 void SkRecorder::onDrawImageNine(const SkImage* image, const SkIRect& center, |
235 const SkRect& dst, const SkPaint* paint) { | 238 const SkRect& dst, const SkPaint* paint) { |
236 APPEND(DrawImageNine, this->copy(paint), image, center, dst); | 239 APPEND(DrawImageNine, this->copy(paint), image, center, dst); |
237 } | 240 } |
238 | 241 |
239 void SkRecorder::onDrawSprite(const SkBitmap& bitmap, int left, int top, const S
kPaint* paint) { | 242 void SkRecorder::onDrawSprite(const SkBitmap& bitmap, int left, int top, const S
kPaint* paint) { |
240 APPEND(DrawSprite, this->copy(paint), bitmap, left, top); | 243 APPEND(DrawSprite, this->copy(paint), bitmap, left, top); |
241 } | 244 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 INHERITED(onClipPath, path, op, edgeStyle); | 379 INHERITED(onClipPath, path, op, edgeStyle); |
377 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); | 380 SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle); |
378 APPEND(ClipPath, this->devBounds(), path, opAA); | 381 APPEND(ClipPath, this->devBounds(), path, opAA); |
379 } | 382 } |
380 | 383 |
381 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { | 384 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { |
382 INHERITED(onClipRegion, deviceRgn, op); | 385 INHERITED(onClipRegion, deviceRgn, op); |
383 APPEND(ClipRegion, this->devBounds(), deviceRgn, op); | 386 APPEND(ClipRegion, this->devBounds(), deviceRgn, op); |
384 } | 387 } |
385 | 388 |
OLD | NEW |