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

Unified Diff: gm/xfermodeimagefilter.cpp

Issue 108623002: Reverting 12528 & 12533 due to N4 GM diffs (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years 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 | « gm/tileimagefilter.cpp ('k') | gyp/gmslides.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/xfermodeimagefilter.cpp
===================================================================
--- gm/xfermodeimagefilter.cpp (revision 12533)
+++ gm/xfermodeimagefilter.cpp (working copy)
@@ -72,22 +72,12 @@
void drawClippedBitmap(SkCanvas* canvas, const SkBitmap& bitmap, const SkPaint& paint,
SkScalar x, SkScalar y) {
canvas->save();
- canvas->translate(x, y);
- canvas->clipRect(SkRect::MakeXYWH(0, 0,
+ canvas->clipRect(SkRect::MakeXYWH(x, y,
SkIntToScalar(bitmap.width()), SkIntToScalar(bitmap.height())));
- canvas->drawBitmap(bitmap, 0, 0, &paint);
+ canvas->drawBitmap(bitmap, x, y, &paint);
canvas->restore();
}
- void drawClippedPaint(SkCanvas* canvas, const SkRect& rect, const SkPaint& paint,
- SkScalar x, SkScalar y) {
- canvas->save();
- canvas->translate(x, y);
- canvas->clipRect(rect);
- canvas->drawPaint(paint);
- canvas->restore();
- }
-
virtual void onDraw(SkCanvas* canvas) {
if (!fInitialized) {
make_bitmap();
@@ -166,8 +156,6 @@
x = 0;
y += fBitmap.height() + MARGIN;
}
- SkRect clipRect = SkRect::MakeWH(SkIntToScalar(fBitmap.width() + 4),
- SkIntToScalar(fBitmap.height() + 4));
// Test offsets on SrcMode (uses fixed-function blend)
SkAutoTUnref<SkImageFilter> foreground(SkNEW_ARGS(SkBitmapSource, (fBitmap)));
SkAutoTUnref<SkImageFilter> offsetForeground(SkNEW_ARGS(SkOffsetImageFilter,
@@ -178,8 +166,13 @@
filter.reset(SkNEW_ARGS(SkXfermodeImageFilter,
(mode, offsetBackground, offsetForeground)));
paint.setImageFilter(filter);
- drawClippedPaint(canvas, clipRect, paint,
- SkIntToScalar(x), SkIntToScalar(y));
+ canvas->save();
+ canvas->clipRect(SkRect::MakeXYWH(SkIntToScalar(x),
+ SkIntToScalar(y),
+ SkIntToScalar(fBitmap.width() + 4),
+ SkIntToScalar(fBitmap.height() + 4)));
+ canvas->drawPaint(paint);
+ canvas->restore();
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {
x = 0;
@@ -189,8 +182,13 @@
mode.reset(SkXfermode::Create(SkXfermode::kDarken_Mode));
filter.reset(SkNEW_ARGS(SkXfermodeImageFilter, (mode, offsetBackground, offsetForeground)));
paint.setImageFilter(filter);
- drawClippedPaint(canvas, clipRect, paint,
- SkIntToScalar(x), SkIntToScalar(y));
+ canvas->save();
+ canvas->clipRect(SkRect::MakeXYWH(SkIntToScalar(x),
+ SkIntToScalar(y),
+ SkIntToScalar(fBitmap.width() + 4),
+ SkIntToScalar(fBitmap.height() + 4)));
+ canvas->drawPaint(paint);
+ canvas->restore();
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {
x = 0;
@@ -205,8 +203,8 @@
{ 10, 10, 10, 10},
{-10, -10, -6, -6}};
for (size_t i = 0; i < nbSamples; ++i) {
- SkIRect cropRect = SkIRect::MakeXYWH(offsets[i][0],
- offsets[i][1],
+ SkIRect cropRect = SkIRect::MakeXYWH(x + offsets[i][0],
+ y + offsets[i][1],
fBitmap.width() + offsets[i][2],
fBitmap.height() + offsets[i][3]);
SkImageFilter::CropRect rect(SkRect::Make(cropRect));
@@ -214,8 +212,13 @@
filter.reset(SkNEW_ARGS(SkXfermodeImageFilter,
(mode, offsetBackground, offsetForeground, &rect)));
paint.setImageFilter(filter);
- drawClippedPaint(canvas, clipRect, paint,
- SkIntToScalar(x), SkIntToScalar(y));
+ canvas->save();
+ canvas->clipRect(SkRect::MakeXYWH(SkIntToScalar(x),
+ SkIntToScalar(y),
+ SkIntToScalar(fBitmap.width() + 4),
+ SkIntToScalar(fBitmap.height() + 4)));
+ canvas->drawPaint(paint);
+ canvas->restore();
x += fBitmap.width() + MARGIN;
if (x + fBitmap.width() > WIDTH) {
x = 0;
« no previous file with comments | « gm/tileimagefilter.cpp ('k') | gyp/gmslides.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698