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

Side by Side Diff: src/core/SkDevice.cpp

Issue 1896383003: Begin removing deprecated (and now, unused) ImageFilter code paths (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comment Created 4 years, 8 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
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkImageFilter.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 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 "SkColorFilter.h" 8 #include "SkColorFilter.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkDraw.h" 10 #include "SkDraw.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 402 }
403 403
404 //////////////////////////////////////////////////////////////////////////////// ////////// 404 //////////////////////////////////////////////////////////////////////////////// //////////
405 405
406 void SkBaseDevice::drawSpriteWithFilter(const SkDraw& draw, const SkBitmap& bitm ap, 406 void SkBaseDevice::drawSpriteWithFilter(const SkDraw& draw, const SkBitmap& bitm ap,
407 int x, int y, 407 int x, int y,
408 const SkPaint& paint) { 408 const SkPaint& paint) {
409 SkImageFilter* filter = paint.getImageFilter(); 409 SkImageFilter* filter = paint.getImageFilter();
410 SkASSERT(filter); 410 SkASSERT(filter);
411 411
412 SkImageFilter::DeviceProxy proxy(this);
413 SkIPoint offset = SkIPoint::Make(0, 0); 412 SkIPoint offset = SkIPoint::Make(0, 0);
414 SkMatrix matrix = *draw.fMatrix; 413 SkMatrix matrix = *draw.fMatrix;
415 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); 414 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y));
416 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); 415 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y);
417 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); 416 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache());
418 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); 417 SkImageFilter::Context ctx(matrix, clipBounds, cache.get());
419 418
420 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, bitmap, 419 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(bitmap, &this-> surfaceProps()));
421 &this->surfaceP rops()));
422 if (!srcImg) { 420 if (!srcImg) {
423 return; // something disastrous happened 421 return; // something disastrous happened
424 } 422 }
425 423
426 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offs et)); 424 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offs et));
427 if (resultImg) { 425 if (resultImg) {
428 SkPaint tmpUnfiltered(paint); 426 SkPaint tmpUnfiltered(paint);
429 tmpUnfiltered.setImageFilter(nullptr); 427 tmpUnfiltered.setImageFilter(nullptr);
430 SkBitmap resultBM; 428 SkBitmap resultBM;
431 if (resultImg->internal_getBM(&resultBM)) { 429 if (resultImg->internal_getBM(&resultBM)) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 501
504 // Also log filter quality independent scale factor. 502 // Also log filter quality independent scale factor.
505 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor, 503 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor,
506 kLast_ScaleFactor + 1); 504 kLast_ScaleFactor + 1);
507 505
508 // Also log an overall histogram of filter quality. 506 // Also log an overall histogram of filter quality.
509 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali ty + 1); 507 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali ty + 1);
510 #endif 508 #endif
511 } 509 }
512 510
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698