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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 SkBitmap dst; | 411 SkBitmap dst; |
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 #ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS | 415 #ifdef SK_SUPPORT_SRC_BOUNDS_BLOAT_FOR_IMAGEFILTERS |
416 const SkIRect clipBounds = bitmap.bounds(); | 416 const SkIRect clipBounds = bitmap.bounds(); |
417 #else | 417 #else |
418 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); | 418 const SkIRect clipBounds = draw.fClip->getBounds().makeOffset(-x, -y); |
419 #endif | 419 #endif |
420 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); | 420 SkAutoTUnref<SkImageFilter::Cache> cache(this->getImageFilterCache()); |
421 SkImageFilter::Context ctx(matrix, clipBounds, cache.get(), | 421 SkImageFilter::Context ctx(matrix, clipBounds, cache.get()); |
422 SkImageFilter::kApprox_SizeConstraint); | |
423 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { | 422 if (filter->filterImage(&proxy, bitmap, ctx, &dst, &offset)) { |
424 SkPaint tmpUnfiltered(paint); | 423 SkPaint tmpUnfiltered(paint); |
425 tmpUnfiltered.setImageFilter(nullptr); | 424 tmpUnfiltered.setImageFilter(nullptr); |
426 this->drawSprite(draw, dst, x + offset.x(), y + offset.y(), tmpUnfil
tered); | 425 this->drawSprite(draw, dst, x + offset.x(), y + offset.y(), tmpUnfil
tered); |
427 } | 426 } |
428 } else { | 427 } else { |
429 this->drawSprite(draw, bitmap, x, y, paint); | 428 this->drawSprite(draw, bitmap, x, y, paint); |
430 } | 429 } |
431 } | 430 } |
432 | 431 |
433 uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const { | 432 uint32_t SkBaseDevice::filterTextFlags(const SkPaint& paint) const { |
434 uint32_t flags = paint.getFlags(); | 433 uint32_t flags = paint.getFlags(); |
435 | 434 |
436 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { | 435 if (!paint.isLCDRenderText() || !paint.isAntiAlias()) { |
437 return flags; | 436 return flags; |
438 } | 437 } |
439 | 438 |
440 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() | 439 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() |
441 || this->onShouldDisableLCD(paint)) { | 440 || this->onShouldDisableLCD(paint)) { |
442 | 441 |
443 flags &= ~SkPaint::kLCDRenderText_Flag; | 442 flags &= ~SkPaint::kLCDRenderText_Flag; |
444 flags |= SkPaint::kGenA8FromLCD_Flag; | 443 flags |= SkPaint::kGenA8FromLCD_Flag; |
445 } | 444 } |
446 | 445 |
447 return flags; | 446 return flags; |
448 } | 447 } |
449 | 448 |
OLD | NEW |