OLD | NEW |
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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SkIPoint offset = SkIPoint::Make(0, 0); | 412 SkIPoint offset = SkIPoint::Make(0, 0); |
413 SkMatrix matrix = *draw.fMatrix; | 413 SkMatrix matrix = *draw.fMatrix; |
414 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); | 414 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
415 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); | 415 const SkIRect clipBounds = draw.fRC->getBounds().makeOffset(-x, -y); |
416 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); | 416 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); |
417 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); | 417 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); |
418 | 418 |
419 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(bitmap, &this->
surfaceProps())); | 419 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(bitmap, &this->
surfaceProps())); |
420 if (!srcImg) { | 420 if (!srcImg) { |
421 return; // something disastrous happened | 421 return; // something disastrous happened |
422 } | 422 } |
423 | 423 |
424 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offs
et)); | 424 sk_sp<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(), ctx, &offs
et)); |
425 if (resultImg) { | 425 if (resultImg) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 | 501 |
502 // Also log filter quality independent scale factor. | 502 // Also log filter quality independent scale factor. |
503 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor, | 503 SK_HISTOGRAM_ENUMERATION("DrawScaleFactor.AnyFilterQuality", scaleFactor, |
504 kLast_ScaleFactor + 1); | 504 kLast_ScaleFactor + 1); |
505 | 505 |
506 // Also log an overall histogram of filter quality. | 506 // Also log an overall histogram of filter quality. |
507 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali
ty + 1); | 507 SK_HISTOGRAM_ENUMERATION("FilterQuality", filterQuality, kLast_SkFilterQuali
ty + 1); |
508 #endif | 508 #endif |
509 } | 509 } |
510 | 510 |
OLD | NEW |