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

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

Issue 1823573003: Change signatures of filter bounds methods to return a rect. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Hide legacy API behind #ifdef; switch callers to new API Created 4 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
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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 SkIRect right = SkIRect::MakeLTRB(interior.right(), interior.top(), 316 SkIRect right = SkIRect::MakeLTRB(interior.right(), interior.top(),
317 bounds.right(), interior.bottom()); 317 bounds.right(), interior.bottom());
318 filterBorderPixels(src, result, top, bounds); 318 filterBorderPixels(src, result, top, bounds);
319 filterBorderPixels(src, result, left, bounds); 319 filterBorderPixels(src, result, left, bounds);
320 filterInteriorPixels(src, result, interior, bounds); 320 filterInteriorPixels(src, result, interior, bounds);
321 filterBorderPixels(src, result, right, bounds); 321 filterBorderPixels(src, result, right, bounds);
322 filterBorderPixels(src, result, bottom, bounds); 322 filterBorderPixels(src, result, bottom, bounds);
323 return true; 323 return true;
324 } 324 }
325 325
326 void SkMatrixConvolutionImageFilter::onFilterNodeBounds(const SkIRect& src, cons t SkMatrix& ctm, 326 SkIRect SkMatrixConvolutionImageFilter::onFilterNodeBounds(const SkIRect& src, c onst SkMatrix& ctm,
327 SkIRect* dst, MapDirection d irection) const { 327 MapDirection directio n) const {
328 *dst = src; 328 SkIRect dst = src;
329 int w = fKernelSize.width() - 1, h = fKernelSize.height() - 1; 329 int w = fKernelSize.width() - 1, h = fKernelSize.height() - 1;
330 dst->fRight += w; 330 dst.fRight += w;
331 dst->fBottom += h; 331 dst.fBottom += h;
332 if (kReverse_MapDirection == direction) { 332 if (kReverse_MapDirection == direction) {
333 dst->offset(-fKernelOffset); 333 dst.offset(-fKernelOffset);
334 } else { 334 } else {
335 dst->offset(fKernelOffset - SkIPoint::Make(w, h)); 335 dst.offset(fKernelOffset - SkIPoint::Make(w, h));
336 } 336 }
337 return dst;
337 } 338 }
338 339
339 bool SkMatrixConvolutionImageFilter::canComputeFastBounds() const { 340 bool SkMatrixConvolutionImageFilter::canComputeFastBounds() const {
340 // Because the kernel is applied in device-space, we have no idea what 341 // Because the kernel is applied in device-space, we have no idea what
341 // pixels it will affect in object-space. 342 // pixels it will affect in object-space.
342 return false; 343 return false;
343 } 344 }
344 345
345 #if SK_SUPPORT_GPU 346 #if SK_SUPPORT_GPU
346 347
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); 390 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]);
390 } 391 }
391 } 392 }
392 str->appendf(")"); 393 str->appendf(")");
393 str->appendf("gain: %f bias: %f ", fGain, fBias); 394 str->appendf("gain: %f bias: %f ", fGain, fBias);
394 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); 395 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY);
395 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); 396 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false");
396 str->append(")"); 397 str->append(")");
397 } 398 }
398 #endif 399 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698