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

Unified Diff: src/core/SkPicturePlayback.cpp

Issue 375703002: Turn on threaded DMQuiltTask drawing for old-format SkPictures too. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: borrow Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/DMQuiltTask.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicturePlayback.cpp
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index eccd1ae0c850d757bdd00686aa9f10998f784c3b..a6e3f0776df42e6717b7f0e05466b6fd70a8e806 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -115,6 +115,11 @@ void get_text(SkReader32* reader, TextContainer* text) {
text->fText = (const char*)reader->skip(length);
}
+// FIXME: SkBitmaps are stateful, so we need to copy them to play back in multiple threads.
+static SkBitmap shallow_copy(const SkBitmap& bitmap) {
+ return bitmap;
+}
+
void SkPicturePlayback::draw(SkCanvas* canvas, SkDrawPictureCallback* callback) {
SkAutoResetOpID aroi(this);
SkASSERT(0 == fCurOffset);
@@ -389,13 +394,13 @@ void SkPicturePlayback::draw(SkCanvas* canvas, SkDrawPictureCallback* callback)
}
case DRAW_BITMAP: {
const SkPaint* paint = fPictureData->getPaint(reader);
- const SkBitmap& bitmap = fPictureData->getBitmap(reader);
+ const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader));
const SkPoint& loc = reader.skipT<SkPoint>();
canvas->drawBitmap(bitmap, loc.fX, loc.fY, paint);
} break;
case DRAW_BITMAP_RECT_TO_RECT: {
const SkPaint* paint = fPictureData->getPaint(reader);
- const SkBitmap& bitmap = fPictureData->getBitmap(reader);
+ const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader));
const SkRect* src = get_rect_ptr(reader); // may be null
const SkRect& dst = reader.skipT<SkRect>(); // required
SkCanvas::DrawBitmapRectFlags flags;
@@ -404,14 +409,14 @@ void SkPicturePlayback::draw(SkCanvas* canvas, SkDrawPictureCallback* callback)
} break;
case DRAW_BITMAP_MATRIX: {
const SkPaint* paint = fPictureData->getPaint(reader);
- const SkBitmap& bitmap = fPictureData->getBitmap(reader);
+ const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader));
SkMatrix matrix;
reader.readMatrix(&matrix);
canvas->drawBitmapMatrix(bitmap, matrix, paint);
} break;
case DRAW_BITMAP_NINE: {
const SkPaint* paint = fPictureData->getPaint(reader);
- const SkBitmap& bitmap = fPictureData->getBitmap(reader);
+ const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader));
const SkIRect& src = reader.skipT<SkIRect>();
const SkRect& dst = reader.skipT<SkRect>();
canvas->drawBitmapNine(bitmap, src, dst, paint);
@@ -514,7 +519,7 @@ void SkPicturePlayback::draw(SkCanvas* canvas, SkDrawPictureCallback* callback)
} break;
case DRAW_SPRITE: {
const SkPaint* paint = fPictureData->getPaint(reader);
- const SkBitmap& bitmap = fPictureData->getBitmap(reader);
+ const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader));
int left = reader.readInt();
int top = reader.readInt();
canvas->drawSprite(bitmap, left, top, paint);
« no previous file with comments | « dm/DMQuiltTask.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698