diff options
author | 2013-08-16 10:24:37 +0000 | |
---|---|---|
committer | 2013-08-16 10:24:37 +0000 | |
commit | eed779d866e1e239bfb9ebc6a225b7345a41adf9 (patch) | |
tree | 5661727de9fcb9d0398ae74cdda92165a75b4297 /src/core | |
parent | c9917c054567ab03419614f01392ecf13f29da5c (diff) |
This CL plumbs in the drawBitmapRectToRect "bleed" flag and makes it live on the simplest GPU path.
R=bsalomon@google.com, reed@google.com, edisonn@google.com, scroggo@google.com, jvanverth@google.com, mtklein@google.com
Author: robertphillips@google.com
Review URL: https://chromiumcodereview.appspot.com/20806003
git-svn-id: http://skia.googlecode.com/svn/trunk@10765 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBBoxRecord.cpp | 5 | ||||
-rw-r--r-- | src/core/SkBBoxRecord.h | 3 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 13 | ||||
-rw-r--r-- | src/core/SkDevice.cpp | 3 | ||||
-rw-r--r-- | src/core/SkPicture.cpp | 6 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 15 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 8 | ||||
-rw-r--r-- | src/core/SkPictureRecord.h | 3 |
8 files changed, 41 insertions, 15 deletions
diff --git a/src/core/SkBBoxRecord.cpp b/src/core/SkBBoxRecord.cpp index 52d599f57e..366808703f 100644 --- a/src/core/SkBBoxRecord.cpp +++ b/src/core/SkBBoxRecord.cpp @@ -134,9 +134,10 @@ void SkBBoxRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar to } void SkBBoxRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, - const SkRect& dst, const SkPaint* paint) { + const SkRect& dst, const SkPaint* paint, + DrawBitmapRectFlags flags) { if (this->transformBounds(dst, paint)) { - INHERITED::drawBitmapRectToRect(bitmap, src, dst, paint); + INHERITED::drawBitmapRectToRect(bitmap, src, dst, paint, flags); } } diff --git a/src/core/SkBBoxRecord.h b/src/core/SkBBoxRecord.h index 9f796717e4..7859df1b02 100644 --- a/src/core/SkBBoxRecord.h +++ b/src/core/SkBBoxRecord.h @@ -42,7 +42,8 @@ public: virtual void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, const SkPaint* paint = NULL) SK_OVERRIDE; virtual void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, - const SkRect& dst, const SkPaint* paint) SK_OVERRIDE; + const SkRect& dst, const SkPaint* paint, + DrawBitmapRectFlags flags) SK_OVERRIDE; virtual void drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& mat, const SkPaint* paint) SK_OVERRIDE; virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 961b9d7e67..d143b85a53 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1751,7 +1751,8 @@ void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, // this one is non-virtual, so it can be called safely by other canvas apis void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, - const SkRect& dst, const SkPaint* paint) { + const SkRect& dst, const SkPaint* paint, + DrawBitmapRectFlags flags) { if (bitmap.width() == 0 || bitmap.height() == 0 || dst.isEmpty()) { return; } @@ -1777,16 +1778,17 @@ void SkCanvas::internalDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type) while (iter.next()) { - iter.fDevice->drawBitmapRect(iter, bitmap, src, dst, looper.paint()); + iter.fDevice->drawBitmapRect(iter, bitmap, src, dst, looper.paint(), flags); } LOOPER_END } void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, - const SkRect& dst, const SkPaint* paint) { + const SkRect& dst, const SkPaint* paint, + DrawBitmapRectFlags flags) { SkDEBUGCODE(bitmap.validate();) - this->internalDrawBitmapRect(bitmap, src, dst, paint); + this->internalDrawBitmapRect(bitmap, src, dst, paint, flags); } void SkCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix, @@ -1856,7 +1858,8 @@ void SkCanvas::internalDrawBitmapNine(const SkBitmap& bitmap, s.fRight = srcX[x+1]; d.fLeft = dstX[x]; d.fRight = dstX[x+1]; - this->internalDrawBitmapRect(bitmap, &s, d, paint); + this->internalDrawBitmapRect(bitmap, &s, d, paint, + kNone_DrawBitmapRectflag); } } } diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp index 408cda23f3..8b7131a940 100644 --- a/src/core/SkDevice.cpp +++ b/src/core/SkDevice.cpp @@ -377,7 +377,8 @@ void SkDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, void SkDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, - const SkPaint& paint) { + const SkPaint& paint, + SkCanvas::DrawBitmapRectFlags flags) { SkMatrix matrix; SkRect bitmapBounds, tmpSrc, tmpDst; SkBitmap tmpBitmap; diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp index d8ad80dd67..06b54f610c 100644 --- a/src/core/SkPicture.cpp +++ b/src/core/SkPicture.cpp @@ -273,7 +273,11 @@ bool SkPicture::StreamIsSKP(SkStream* stream, SkPictInfo* pInfo) { if (!stream->read(&info, sizeof(SkPictInfo))) { return false; } - if (PICTURE_VERSION != info.fVersion) { + if (PICTURE_VERSION != info.fVersion +#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V13_AND_ALL_OTHER_INSTANCES_TOO + && PRIOR_PICTURE_VERSION != info.fVersion // TODO: remove when .skps regenerated +#endif + ) { return false; } diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index fe1a037cfc..77c2afd494 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -834,7 +834,20 @@ void SkPicturePlayback::draw(SkCanvas& canvas, SkDrawPictureCallback* callback) const SkBitmap& bitmap = getBitmap(reader); const SkRect* src = this->getRectPtr(reader); // may be null const SkRect& dst = reader.skipT<SkRect>(); // required - canvas.drawBitmapRectToRect(bitmap, src, dst, paint); + SkCanvas::DrawBitmapRectFlags flags; +#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V13_AND_ALL_OTHER_INSTANCES_TOO + flags = SkCanvas::kNone_DrawBitmapRectflag; + // TODO: remove this backwards compatibility code once the .skps are + // regenerated + SkASSERT(32 == size || 48 == size || // old sizes + 36 == size || 52 == size); // new sizes + if (36 == size || 52 == size) { +#endif + flags = (SkCanvas::DrawBitmapRectFlags) reader.readInt(); +#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V13_AND_ALL_OTHER_INSTANCES_TOO + } +#endif + canvas.drawBitmapRectToRect(bitmap, src, dst, paint, flags); } break; case DRAW_BITMAP_MATRIX: { const SkPaint* paint = getPaint(reader); diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 2c2d334caf..7a853816ae 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -913,9 +913,10 @@ void SkPictureRecord::drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar } void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, - const SkRect& dst, const SkPaint* paint) { - // id + paint index + bitmap index + bool for 'src' - uint32_t size = 4 * kUInt32Size; + const SkRect& dst, const SkPaint* paint, + DrawBitmapRectFlags flags) { + // id + paint index + bitmap index + bool for 'src' + flags + uint32_t size = 5 * kUInt32Size; if (NULL != src) { size += sizeof(*src); // + rect } @@ -927,6 +928,7 @@ void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* addBitmap(bitmap); addRectPtr(src); // may be null addRect(dst); + addInt(flags); validate(initialOffset, size); } diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index 0ea857d4e5..4e30302e39 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -59,7 +59,8 @@ public: virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE; virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, - const SkRect& dst, const SkPaint*) SK_OVERRIDE; + const SkRect& dst, const SkPaint* paint, + DrawBitmapRectFlags flags) SK_OVERRIDE; virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&, const SkPaint*) SK_OVERRIDE; virtual void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, |