diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-09-18 12:59:44 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-09-18 12:59:44 +0000 |
commit | f1ab723033a186dc53434104a636c2dfac5fc863 (patch) | |
tree | b3e9f1224fdaa890072b22a953df589fdb80fd58 /debugger | |
parent | 54339a826e460c2371f946224cca4db8482d8f5b (diff) |
Change drawBitmapRect to take a float-src-rect instead of integer-src-rect. This
allows the client more control over the scaling. Because of virtual overrides
and wanting to keep the old call-sites up and running, this CL renames the
virtual entry-point to drawBitmapRectToRect, and downgrades drawBitmapRect to
a non-virtual helper function.
The implementation is to use the float-rect for computing the matrix, but still
cons-up an integer rect for the purposes of subsetting the original bitmap. We
do this by calling float_src->roundOut(&int_src) so that we include all
(partially) covered src pixels.
No change needed on SkDevice, since that signature is explicitly passed the
computed matrix.
Review URL: https://codereview.appspot.com/6501140
git-svn-id: http://skia.googlecode.com/svn/trunk@5578 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'debugger')
-rw-r--r-- | debugger/SkDebugCanvas.cpp | 4 | ||||
-rw-r--r-- | debugger/SkDebugCanvas.h | 4 | ||||
-rw-r--r-- | debugger/SkDrawCommand.cpp | 4 | ||||
-rw-r--r-- | debugger/SkDrawCommand.h | 4 |
4 files changed, 8 insertions, 8 deletions
diff --git a/debugger/SkDebugCanvas.cpp b/debugger/SkDebugCanvas.cpp index 6fda8b0f24..db9154e15b 100644 --- a/debugger/SkDebugCanvas.cpp +++ b/debugger/SkDebugCanvas.cpp @@ -183,8 +183,8 @@ void SkDebugCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar left, addDrawCommand(new DrawBitmap(bitmap, left, top, paint)); } -void SkDebugCanvas::drawBitmapRect(const SkBitmap& bitmap, - const SkIRect* src, const SkRect& dst, const SkPaint* paint) { +void SkDebugCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, + const SkRect* src, const SkRect& dst, const SkPaint* paint) { addDrawCommand(new DrawBitmapRect(bitmap, src, dst, paint)); } diff --git a/debugger/SkDebugCanvas.h b/debugger/SkDebugCanvas.h index 28340109fa..5172bc23f5 100644 --- a/debugger/SkDebugCanvas.h +++ b/debugger/SkDebugCanvas.h @@ -135,8 +135,8 @@ public: virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) SK_OVERRIDE; - virtual void drawBitmapRect(const SkBitmap&, const SkIRect* src, - const SkRect& dst, const SkPaint*) SK_OVERRIDE; + virtual void drawBitmapRectToRect(const SkBitmap&, const SkRect* src, + const SkRect& dst, const SkPaint*) SK_OVERRIDE; virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&, const SkPaint*) SK_OVERRIDE; diff --git a/debugger/SkDrawCommand.cpp b/debugger/SkDrawCommand.cpp index 00ea535a58..7d9eaea6e4 100644 --- a/debugger/SkDrawCommand.cpp +++ b/debugger/SkDrawCommand.cpp @@ -180,7 +180,7 @@ void DrawBitmapNine::execute(SkCanvas* canvas) { canvas->drawBitmapNine(*this->fBitmap, *this->fCenter, *this->fDst, this->fPaint); } -DrawBitmapRect::DrawBitmapRect(const SkBitmap& bitmap, const SkIRect* src, +DrawBitmapRect::DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, const SkPaint* paint) { this->fBitmap = &bitmap; this->fSrc = src; @@ -189,7 +189,7 @@ DrawBitmapRect::DrawBitmapRect(const SkBitmap& bitmap, const SkIRect* src, this->fDrawType = DRAW_BITMAP_RECT; this->fInfo.push(SkObjectParser::BitmapToString(bitmap)); - if (src) this->fInfo.push(SkObjectParser::IRectToString(*src)); + if (src) this->fInfo.push(SkObjectParser::RectToString(*src)); this->fInfo.push(SkObjectParser::RectToString(dst)); if (paint) this->fInfo.push(SkObjectParser::PaintToString(*paint)); } diff --git a/debugger/SkDrawCommand.h b/debugger/SkDrawCommand.h index 33b735e51e..3334209bd0 100644 --- a/debugger/SkDrawCommand.h +++ b/debugger/SkDrawCommand.h @@ -134,11 +134,11 @@ private: class DrawBitmapRect : public SkDrawCommand { public: - DrawBitmapRect(const SkBitmap& bitmap, const SkIRect* src, + DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, const SkPaint* paint); virtual void execute(SkCanvas* canvas) SK_OVERRIDE; private: - const SkIRect* fSrc; + const SkRect* fSrc; const SkPaint* fPaint; const SkBitmap* fBitmap; const SkRect* fDst; |