diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-17 23:38:28 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-12-17 23:38:28 +0000 |
commit | 4e8f1e56b17c3663d1892f44a4c1893b568ce67f (patch) | |
tree | c1106d4b2f91f018b8a7e7383796959e18828286 /gm/xfermodes.cpp | |
parent | b09bfcb7b1c755c996ed76bba377201048e454af (diff) |
[PDF] Fix clipping in xfermode improvement.
In some cases, the wrong clip (src clip instead of initial clip) was used.
Switch almost exclusively to initial clip because it is safe and generates a smaller result.
BUG=chromium:328009
R=reed@google.com, bungeman@google.com
Author: vandebo@chromium.org
Review URL: https://codereview.chromium.org/116423004
git-svn-id: http://skia.googlecode.com/svn/trunk@12729 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/xfermodes.cpp')
-rw-r--r-- | gm/xfermodes.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/gm/xfermodes.cpp b/gm/xfermodes.cpp index 6e1de3eb67..7ee1e80086 100644 --- a/gm/xfermodes.cpp +++ b/gm/xfermodes.cpp @@ -66,8 +66,10 @@ class XfermodesGM : public GM { kQuarterClearInLayer_SrcType = 0x20, //! A W/2xH/2 transparent image. kSmallTransparentImage_SrcType = 0x40, + //! kRectangleImage_SrcType drawn directly with a mask. + kRectangleWithMask_SrcType = 0x80, - kAll_SrcType = 0x7F, //!< All the source types. + kAll_SrcType = 0xFF, //!< All the source types. kBasic_SrcType = 0x03, //!< Just basic source types. }; @@ -112,6 +114,15 @@ class XfermodesGM : public GM { canvas->drawRect(r, p); break; } + case kRectangleWithMask_SrcType: { + canvas->save(SkCanvas::kClip_SaveFlag); + restoreNeeded = true; + SkScalar w = SkIntToScalar(W); + SkScalar h = SkIntToScalar(H); + SkRect r = SkRect::MakeXYWH(x, y + h / 4, w, h * 23 / 60); + canvas->clipRect(r); + // Fall through. + } case kRectangle_SrcType: { SkScalar w = SkIntToScalar(W); SkScalar h = SkIntToScalar(H); |