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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 SkImageFilter* filter = paint.getImageFilter(); | 409 SkImageFilter* filter = paint.getImageFilter(); |
410 if (filter && !this->canHandleImageFilter(filter)) { | 410 if (filter && !this->canHandleImageFilter(filter)) { |
411 SkImageFilter::DeviceProxy proxy(this); | 411 SkImageFilter::DeviceProxy proxy(this); |
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.fClip->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 SkAutoTUnref<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&pro
xy, bitmap)); | 419 sk_sp<SkSpecialImage> srcImg(SkSpecialImage::internal_fromBM(&proxy, bit
map)); |
420 if (!srcImg) { | 420 if (!srcImg) { |
421 return; // something disastrous happened | 421 return; // something disastrous happened |
422 } | 422 } |
423 | 423 |
424 SkAutoTUnref<SkSpecialImage> resultImg(filter->filterImage(srcImg, ctx,
&offset)); | 424 SkAutoTUnref<SkSpecialImage> resultImg(filter->filterImage(srcImg.get(),
ctx, &offset)); |
425 if (resultImg) { | 425 if (resultImg) { |
426 SkPaint tmpUnfiltered(paint); | 426 SkPaint tmpUnfiltered(paint); |
427 tmpUnfiltered.setImageFilter(nullptr); | 427 tmpUnfiltered.setImageFilter(nullptr); |
428 SkBitmap resultBM; | 428 SkBitmap resultBM; |
429 if (resultImg->internal_getBM(&resultBM)) { | 429 if (resultImg->internal_getBM(&resultBM)) { |
430 // TODO: add drawSprite(SkSpecialImage) to SkDevice? (see skbug.
com/5073) | 430 // TODO: add drawSprite(SkSpecialImage) to SkDevice? (see skbug.
com/5073) |
431 this->drawSprite(draw, resultBM, x + offset.x(), y + offset.y(),
tmpUnfiltered); | 431 this->drawSprite(draw, resultBM, x + offset.x(), y + offset.y(),
tmpUnfiltered); |
432 } | 432 } |
433 } | 433 } |
434 } else { | 434 } else { |
(...skipping 11 matching lines...) Expand all Loading... |
446 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() | 446 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() |
447 || this->onShouldDisableLCD(paint)) { | 447 || this->onShouldDisableLCD(paint)) { |
448 | 448 |
449 flags &= ~SkPaint::kLCDRenderText_Flag; | 449 flags &= ~SkPaint::kLCDRenderText_Flag; |
450 flags |= SkPaint::kGenA8FromLCD_Flag; | 450 flags |= SkPaint::kGenA8FromLCD_Flag; |
451 } | 451 } |
452 | 452 |
453 return flags; | 453 return flags; |
454 } | 454 } |
455 | 455 |
OLD | NEW |