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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 | 404 |
405 void SkBaseDevice::drawBitmapAsSprite(const SkDraw& draw, const SkBitmap& bitmap
, int x, int y, | 405 void SkBaseDevice::drawBitmapAsSprite(const SkDraw& draw, const SkBitmap& bitmap
, int x, int y, |
406 const SkPaint& paint) { | 406 const SkPaint& paint) { |
407 SkImageFilter* filter = paint.getImageFilter(); | 407 SkImageFilter* filter = paint.getImageFilter(); |
408 if (filter && !this->canHandleImageFilter(filter)) { | 408 if (filter && !this->canHandleImageFilter(filter)) { |
409 SkImageFilter::DeviceProxy proxy(this); | 409 SkImageFilter::DeviceProxy proxy(this); |
410 SkBitmap dst; | 410 SkBitmap dst; |
411 SkIPoint offset = SkIPoint::Make(0, 0); | 411 SkIPoint offset = SkIPoint::Make(0, 0); |
412 SkMatrix matrix = *draw.fMatrix; | 412 SkMatrix matrix = *draw.fMatrix; |
413 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); | 413 matrix.postTranslate(SkIntToScalar(-x), SkIntToScalar(-y)); |
414 const SkIRect clipBounds = bitmap.bounds(); | 414 SkIRect clipBounds = draw.fClip->getBounds(); |
| 415 clipBounds.offset(-x, -y); |
415 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); | 416 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); |
416 SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), | 417 SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), |
417 SkImageFilter::kApprox_SizeConstraint); | 418 SkImageFilter::kApprox_SizeConstraint); |
418 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { | 419 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { |
419 SkPaint tmpUnfiltered(paint); | 420 SkPaint tmpUnfiltered(paint); |
420 tmpUnfiltered.setImageFilter(nullptr); | 421 tmpUnfiltered.setImageFilter(nullptr); |
421 this->drawSprite(draw, dst, x + offset.x(), y + offset.y(), tmpUnfil
tered); | 422 this->drawSprite(draw, dst, x + offset.x(), y + offset.y(), tmpUnfil
tered); |
422 } | 423 } |
423 } else { | 424 } else { |
424 this->drawSprite(draw, bitmap, x, y, paint); | 425 this->drawSprite(draw, bitmap, x, y, paint); |
(...skipping 10 matching lines...) Expand all Loading... |
435 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() | 436 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() |
436 || this->onShouldDisableLCD(paint)) { | 437 || this->onShouldDisableLCD(paint)) { |
437 | 438 |
438 flags &= ~SkPaint::kLCDRenderText_Flag; | 439 flags &= ~SkPaint::kLCDRenderText_Flag; |
439 flags |= SkPaint::kGenA8FromLCD_Flag; | 440 flags |= SkPaint::kGenA8FromLCD_Flag; |
440 } | 441 } |
441 | 442 |
442 return flags; | 443 return flags; |
443 } | 444 } |
444 | 445 |
OLD | NEW |