Chromium Code Reviews| Index: src/core/SkRecorder.cpp |
| diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp |
| index 775a7e0c55c45328c46687d23a0d35a1d1dfbc01..a7853666d426996767bd54f636211ec4ae997581 100644 |
| --- a/src/core/SkRecorder.cpp |
| +++ b/src/core/SkRecorder.cpp |
| @@ -12,6 +12,8 @@ |
| #include "SkPictureUtils.h" |
| #include "SkRecorder.h" |
| +//#define WRAP_BITMAP_AS_IMAGE |
| + |
| SkDrawableList::~SkDrawableList() { |
| fArray.unrefAll(); |
| } |
| @@ -170,7 +172,14 @@ void SkRecorder::onDrawBitmap(const SkBitmap& bitmap, |
| SkScalar left, |
| SkScalar top, |
| const SkPaint* paint) { |
| +#ifdef WRAP_BITMAP_AS_IMAGE |
| + SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap)); |
| + if (image) { |
| + this->onDrawImage(image, left, top, paint); |
| + } |
| +#else |
| APPEND(DrawBitmap, this->copy(paint), bitmap, left, top); |
| +#endif |
| } |
| void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap, |
| @@ -178,22 +187,28 @@ void SkRecorder::onDrawBitmapRect(const SkBitmap& bitmap, |
| const SkRect& dst, |
| const SkPaint* paint, |
| DrawBitmapRectFlags flags) { |
| - TRY_MINIRECORDER(drawBitmapRectToRect, bitmap, src, dst, paint, flags); |
|
robertphillips
2015/07/06 20:43:47
What happened to this code?
reed2
2015/07/07 01:18:03
Twas lost in a manual merge. Restored.
|
| - if (kBleed_DrawBitmapRectFlag == flags) { |
| - APPEND(DrawBitmapRectToRectBleed, |
| - this->copy(paint), bitmap, this->copy(src), dst); |
| - return; |
| +#ifdef WRAP_BITMAP_AS_IMAGE |
| + SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap)); |
| + if (image) { |
| + this->onDrawImageRect(image, src, dst, paint); |
| } |
| - SkASSERT(kNone_DrawBitmapRectFlag == flags); |
| - APPEND(DrawBitmapRectToRect, |
| - this->copy(paint), bitmap, this->copy(src), dst); |
| +#else |
| + TRY_MINIRECORDER(drawBitmapRectToRect, bitmap, src, dst, paint, flags); |
|
mtklein
2015/07/06 21:02:27
I support this approach both as a hack and a long
reed2
2015/07/07 01:18:03
Gotcha. Yes, this is just a testing-experiment for
|
| +#endif |
| } |
| void SkRecorder::onDrawBitmapNine(const SkBitmap& bitmap, |
| const SkIRect& center, |
| const SkRect& dst, |
| const SkPaint* paint) { |
| +#ifdef WRAP_BITMAP_AS_IMAGE |
| + SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bitmap)); |
| + if (image) { |
| + this->onDrawImageNine(image, center, dst, paint); |
| + } |
| +#else |
| APPEND(DrawBitmapNine, this->copy(paint), bitmap, center, dst); |
| +#endif |
| } |
| void SkRecorder::onDrawImage(const SkImage* image, SkScalar left, SkScalar top, |