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

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

Issue 1500923004: Matrix convolution bounds fix; affectsTransparentBlack fixes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Alternate, more future-proof fix Created 5 years 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
« no previous file with comments | « src/effects/SkColorFilterImageFilter.cpp ('k') | src/effects/SkRectShaderImageFilter.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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 bounds.fRight += fKernelSize.width() - 1; 328 bounds.fRight += fKernelSize.width() - 1;
329 bounds.fBottom += fKernelSize.height() - 1; 329 bounds.fBottom += fKernelSize.height() - 1;
330 bounds.offset(-fKernelOffset); 330 bounds.offset(-fKernelOffset);
331 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) { 331 if (getInput(0) && !getInput(0)->filterBounds(bounds, ctm, &bounds)) {
332 return false; 332 return false;
333 } 333 }
334 *dst = bounds; 334 *dst = bounds;
335 return true; 335 return true;
336 } 336 }
337 337
338 bool SkMatrixConvolutionImageFilter::canComputeFastBounds() const {
339 // Because the kernel is applied in device-space, we have no idea what
340 // pixels it will affect in object-space.
341 return false;
342 }
343
338 #if SK_SUPPORT_GPU 344 #if SK_SUPPORT_GPU
339 345
340 static GrTextureDomain::Mode convert_tilemodes( 346 static GrTextureDomain::Mode convert_tilemodes(
341 SkMatrixConvolutionImageFilter::TileMode tileMode) { 347 SkMatrixConvolutionImageFilter::TileMode tileMode) {
342 switch (tileMode) { 348 switch (tileMode) {
343 case SkMatrixConvolutionImageFilter::kClamp_TileMode: 349 case SkMatrixConvolutionImageFilter::kClamp_TileMode:
344 return GrTextureDomain::kClamp_Mode; 350 return GrTextureDomain::kClamp_Mode;
345 case SkMatrixConvolutionImageFilter::kRepeat_TileMode: 351 case SkMatrixConvolutionImageFilter::kRepeat_TileMode:
346 return GrTextureDomain::kRepeat_Mode; 352 return GrTextureDomain::kRepeat_Mode;
347 case SkMatrixConvolutionImageFilter::kClampToBlack_TileMode: 353 case SkMatrixConvolutionImageFilter::kClampToBlack_TileMode:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); 388 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]);
383 } 389 }
384 } 390 }
385 str->appendf(")"); 391 str->appendf(")");
386 str->appendf("gain: %f bias: %f ", fGain, fBias); 392 str->appendf("gain: %f bias: %f ", fGain, fBias);
387 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); 393 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY);
388 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); 394 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false");
389 str->append(")"); 395 str->append(")");
390 } 396 }
391 #endif 397 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorFilterImageFilter.cpp ('k') | src/effects/SkRectShaderImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698