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

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

Issue 189913021: Implement support for a Context parameter in image filters (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Revert all but the Context changes. 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/SkMagnifierImageFilter.cpp ('k') | src/effects/SkMergeImageFilter.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 2012 The Android Open Source Project 2 * Copyright 2012 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 "SkMatrixConvolutionImageFilter.h" 8 #include "SkMatrixConvolutionImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 uint32_t* dstRow = result.getAddr32(0, y); 244 uint32_t* dstRow = result.getAddr32(0, y);
245 for (int x = 0; x < src.width(); ++x) { 245 for (int x = 0; x < src.width(); ++x) {
246 dstRow[x] = SkUnPreMultiply::PMColorToColor(srcRow[x]); 246 dstRow[x] = SkUnPreMultiply::PMColorToColor(srcRow[x]);
247 } 247 }
248 } 248 }
249 return result; 249 return result;
250 } 250 }
251 251
252 bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy, 252 bool SkMatrixConvolutionImageFilter::onFilterImage(Proxy* proxy,
253 const SkBitmap& source, 253 const SkBitmap& source,
254 const SkMatrix& matrix, 254 const Context& ctx,
255 SkBitmap* result, 255 SkBitmap* result,
256 SkIPoint* offset) const { 256 SkIPoint* offset) const {
257 SkBitmap src = source; 257 SkBitmap src = source;
258 SkIPoint srcOffset = SkIPoint::Make(0, 0); 258 SkIPoint srcOffset = SkIPoint::Make(0, 0);
259 if (getInput(0) && !getInput(0)->filterImage(proxy, source, matrix, &src, &s rcOffset)) { 259 if (getInput(0) && !getInput(0)->filterImage(proxy, source, ctx, &src, &srcO ffset)) {
260 return false; 260 return false;
261 } 261 }
262 262
263 if (src.colorType() != kPMColor_SkColorType) { 263 if (src.colorType() != kPMColor_SkColorType) {
264 return false; 264 return false;
265 } 265 }
266 266
267 SkIRect bounds; 267 SkIRect bounds;
268 src.getBounds(&bounds); 268 src.getBounds(&bounds);
269 bounds.offset(srcOffset); 269 bounds.offset(srcOffset);
270 if (!this->applyCropRect(&bounds, matrix)) { 270 if (!this->applyCropRect(&bounds, ctx.ctm())) {
271 return false; 271 return false;
272 } 272 }
273 273
274 if (!fConvolveAlpha && !src.isOpaque()) { 274 if (!fConvolveAlpha && !src.isOpaque()) {
275 src = unpremultiplyBitmap(src); 275 src = unpremultiplyBitmap(src);
276 } 276 }
277 277
278 SkAutoLockPixels alp(src); 278 SkAutoLockPixels alp(src);
279 if (!src.getPixels()) { 279 if (!src.getPixels()) {
280 return false; 280 return false;
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 fBias, 664 fBias,
665 fKernelOffset, 665 fKernelOffset,
666 fTileMode, 666 fTileMode,
667 fConvolveAlpha); 667 fConvolveAlpha);
668 return true; 668 return true;
669 } 669 }
670 670
671 /////////////////////////////////////////////////////////////////////////////// 671 ///////////////////////////////////////////////////////////////////////////////
672 672
673 #endif 673 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/effects/SkMergeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698