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

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

Issue 265693005: Add a fix for a spurious assert in SkMatrixConvolutionImageFilter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
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& rect,
155 const SkIRect& bounds) const { 155 const SkIRect& bounds) const {
156 if (rect.isEmpty()) {
157 return;
158 }
156 for (int y = rect.fTop; y < rect.fBottom; ++y) { 159 for (int y = rect.fTop; y < rect.fBottom; ++y) {
157 SkPMColor* dptr = result->getAddr32(rect.fLeft - bounds.fLeft, y - bound s.fTop); 160 SkPMColor* dptr = result->getAddr32(rect.fLeft - bounds.fLeft, y - bound s.fTop);
158 for (int x = rect.fLeft; x < rect.fRight; ++x) { 161 for (int x = rect.fLeft; x < rect.fRight; ++x) {
159 SkScalar sumA = 0, sumR = 0, sumG = 0, sumB = 0; 162 SkScalar sumA = 0, sumR = 0, sumG = 0, sumB = 0;
160 for (int cy = 0; cy < fKernelSize.fHeight; cy++) { 163 for (int cy = 0; cy < fKernelSize.fHeight; cy++) {
161 for (int cx = 0; cx < fKernelSize.fWidth; cx++) { 164 for (int cx = 0; cx < fKernelSize.fWidth; cx++) {
162 SkPMColor s = PixelFetcher::fetch(src, 165 SkPMColor s = PixelFetcher::fetch(src,
163 x + cx - fKernelOffset.fX, 166 x + cx - fKernelOffset.fX,
164 y + cy - fKernelOffset.fY, 167 y + cy - fKernelOffset.fY,
165 bounds); 168 bounds);
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 fBias, 678 fBias,
676 fKernelOffset, 679 fKernelOffset,
677 fTileMode, 680 fTileMode,
678 fConvolveAlpha); 681 fConvolveAlpha);
679 return true; 682 return true;
680 } 683 }
681 684
682 /////////////////////////////////////////////////////////////////////////////// 685 ///////////////////////////////////////////////////////////////////////////////
683 686
684 #endif 687 #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