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

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

Issue 112803004: Make SkImageFilter crop rects relative to the primitive origin, instead of relative to their parent (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Updated to ToT Created 6 years, 11 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/SkTileImageFilter.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 81 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
82 canvas.drawBitmap(background, SkIntToScalar(backgroundOffset.fX), 82 canvas.drawBitmap(background, SkIntToScalar(backgroundOffset.fX),
83 SkIntToScalar(backgroundOffset.fY), &paint); 83 SkIntToScalar(backgroundOffset.fY), &paint);
84 paint.setXfermode(fMode); 84 paint.setXfermode(fMode);
85 canvas.drawBitmap(foreground, SkIntToScalar(foregroundOffset.fX), 85 canvas.drawBitmap(foreground, SkIntToScalar(foregroundOffset.fX),
86 SkIntToScalar(foregroundOffset.fY), &paint); 86 SkIntToScalar(foregroundOffset.fY), &paint);
87 canvas.clipRect(SkRect::Make(foregroundBounds), SkRegion::kDifference_Op); 87 canvas.clipRect(SkRect::Make(foregroundBounds), SkRegion::kDifference_Op);
88 paint.setColor(SK_ColorTRANSPARENT); 88 paint.setColor(SK_ColorTRANSPARENT);
89 canvas.drawPaint(paint); 89 canvas.drawPaint(paint);
90 *dst = device->accessBitmap(false); 90 *dst = device->accessBitmap(false);
91 offset->fX += bounds.left(); 91 offset->fX = bounds.left();
92 offset->fY += bounds.top(); 92 offset->fY = bounds.top();
93 return true; 93 return true;
94 } 94 }
95 95
96 #if SK_SUPPORT_GPU 96 #if SK_SUPPORT_GPU
97 97
98 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy, 98 bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
99 const SkBitmap& src, 99 const SkBitmap& src,
100 const SkMatrix& ctm, 100 const SkMatrix& ctm,
101 SkBitmap* result, 101 SkBitmap* result,
102 SkIPoint* offset) { 102 SkIPoint* offset) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 GrPaint backgroundPaint; 150 GrPaint backgroundPaint;
151 SkMatrix backgroundMatrix = GrEffect::MakeDivByTextureWHMatrix(backgroun dTex); 151 SkMatrix backgroundMatrix = GrEffect::MakeDivByTextureWHMatrix(backgroun dTex);
152 backgroundPaint.addColorTextureEffect(backgroundTex, backgroundMatrix); 152 backgroundPaint.addColorTextureEffect(backgroundTex, backgroundMatrix);
153 context->drawRect(backgroundPaint, srcRect); 153 context->drawRect(backgroundPaint, srcRect);
154 154
155 GrPaint foregroundPaint; 155 GrPaint foregroundPaint;
156 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen d(dm)); 156 foregroundPaint.setBlendFunc(sk_blend_to_grblend(sm), sk_blend_to_grblen d(dm));
157 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix); 157 foregroundPaint.addColorTextureEffect(foregroundTex, foregroundMatrix);
158 context->drawRect(foregroundPaint, srcRect); 158 context->drawRect(foregroundPaint, srcRect);
159 } 159 }
160 offset->fX += backgroundOffset.fX; 160 offset->fX = backgroundOffset.fX;
161 offset->fY += backgroundOffset.fY; 161 offset->fY = backgroundOffset.fY;
162 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul t); 162 return SkImageFilterUtils::WrapTexture(dst, src.width(), src.height(), resul t);
163 } 163 }
164 164
165 #endif 165 #endif
OLDNEW
« no previous file with comments | « src/effects/SkTileImageFilter.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698