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

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

Issue 267863004: Fix for SkMatrixConvolutionImageFilter with large borders. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Simplify further Created 6 years, 7 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 | « no previous file | tests/ImageFilterTest.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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 return 0; 144 return 0;
145 } else { 145 } else {
146 return *src.getAddr32(x, y); 146 return *src.getAddr32(x, y);
147 } 147 }
148 } 148 }
149 }; 149 };
150 150
151 template<class PixelFetcher, bool convolveAlpha> 151 template<class PixelFetcher, bool convolveAlpha>
152 void SkMatrixConvolutionImageFilter::filterPixels(const SkBitmap& src, 152 void SkMatrixConvolutionImageFilter::filterPixels(const SkBitmap& src,
153 SkBitmap* result, 153 SkBitmap* result,
154 const SkIRect& rect, 154 const SkIRect& r,
155 const SkIRect& bounds) const { 155 const SkIRect& bounds) const {
156 if (rect.isEmpty()) { 156 SkIRect rect(r);
157 if (!rect.intersect(bounds)) {
157 return; 158 return;
158 } 159 }
159 for (int y = rect.fTop; y < rect.fBottom; ++y) { 160 for (int y = rect.fTop; y < rect.fBottom; ++y) {
160 SkPMColor* dptr = result->getAddr32(rect.fLeft - bounds.fLeft, y - bound s.fTop); 161 SkPMColor* dptr = result->getAddr32(rect.fLeft - bounds.fLeft, y - bound s.fTop);
161 for (int x = rect.fLeft; x < rect.fRight; ++x) { 162 for (int x = rect.fLeft; x < rect.fRight; ++x) {
162 SkScalar sumA = 0, sumR = 0, sumG = 0, sumB = 0; 163 SkScalar sumA = 0, sumR = 0, sumG = 0, sumB = 0;
163 for (int cy = 0; cy < fKernelSize.fHeight; cy++) { 164 for (int cy = 0; cy < fKernelSize.fHeight; cy++) {
164 for (int cx = 0; cx < fKernelSize.fWidth; cx++) { 165 for (int cx = 0; cx < fKernelSize.fWidth; cx++) {
165 SkPMColor s = PixelFetcher::fetch(src, 166 SkPMColor s = PixelFetcher::fetch(src,
166 x + cx - fKernelOffset.fX, 167 x + cx - fKernelOffset.fX,
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 fBias, 679 fBias,
679 fKernelOffset, 680 fKernelOffset,
680 fTileMode, 681 fTileMode,
681 fConvolveAlpha); 682 fConvolveAlpha);
682 return true; 683 return true;
683 } 684 }
684 685
685 /////////////////////////////////////////////////////////////////////////////// 686 ///////////////////////////////////////////////////////////////////////////////
686 687
687 #endif 688 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698