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

Side by Side Diff: src/effects/SkXfermodeImageFilter.cpp

Issue 196353021: Revert "Implement support for expanding crop rects in image filters" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/effects/SkRectShaderImageFilter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 The Android Open Source Project 2 * Copyright 2013 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkXfermodeImageFilter.h" 8 #include "SkXfermodeImageFilter.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 !backgroundInput->filterImage(proxy, src, ctx, &background, &backgroundO ffset)) { 55 !backgroundInput->filterImage(proxy, src, ctx, &background, &backgroundO ffset)) {
56 return false; 56 return false;
57 } 57 }
58 SkIPoint foregroundOffset = SkIPoint::Make(0, 0); 58 SkIPoint foregroundOffset = SkIPoint::Make(0, 0);
59 if (foregroundInput && 59 if (foregroundInput &&
60 !foregroundInput->filterImage(proxy, src, ctx, &foreground, &foregroundO ffset)) { 60 !foregroundInput->filterImage(proxy, src, ctx, &foreground, &foregroundO ffset)) {
61 return false; 61 return false;
62 } 62 }
63 63
64 SkIRect bounds, foregroundBounds; 64 SkIRect bounds, foregroundBounds;
65 if (!applyCropRect(ctx, foreground, foregroundOffset, &foregroundBounds)) { 65 background.getBounds(&bounds);
66 bounds.offset(backgroundOffset);
67 foreground.getBounds(&foregroundBounds);
68 foregroundBounds.offset(foregroundOffset);
69 bounds.join(foregroundBounds);
70 if (!applyCropRect(&bounds, ctx.ctm())) {
66 return false; 71 return false;
67 } 72 }
68 if (!applyCropRect(ctx, background, backgroundOffset, &bounds)) {
69 return false;
70 }
71 bounds.join(foregroundBounds);
72 73
73 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds .height())); 74 SkAutoTUnref<SkBaseDevice> device(proxy->createDevice(bounds.width(), bounds .height()));
74 if (NULL == device.get()) { 75 if (NULL == device.get()) {
75 return false; 76 return false;
76 } 77 }
77 SkCanvas canvas(device); 78 SkCanvas canvas(device);
78 canvas.translate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()) ); 79 canvas.translate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()) );
79 SkPaint paint; 80 SkPaint paint;
80 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 81 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
81 canvas.drawBitmap(background, SkIntToScalar(backgroundOffset.fX), 82 canvas.drawBitmap(background, SkIntToScalar(backgroundOffset.fX),
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix); 157 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix);
157 context->drawRect(foregroundPaint, srcRect); 158 context->drawRect(foregroundPaint, srcRect);
158 } 159 }
159 offset->fX = backgroundOffset.fX; 160 offset->fX = backgroundOffset.fX;
160 offset->fY = backgroundOffset.fY; 161 offset->fY = backgroundOffset.fY;
161 WrapTexture(dst, src.width(), src.height(), result); 162 WrapTexture(dst, src.width(), src.height(), result);
162 return true; 163 return true;
163 } 164 }
164 165
165 #endif 166 #endif
OLDNEW
« no previous file with comments | « src/effects/SkRectShaderImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698