OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkPaint.h" | 8 #include "SkPaint.h" |
9 #include "SkAnnotation.h" | 9 #include "SkAnnotation.h" |
10 #include "SkAutoKern.h" | 10 #include "SkAutoKern.h" |
(...skipping 1760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1771 case SkMask::kLCD16_Format: | 1771 case SkMask::kLCD16_Format: |
1772 case SkMask::kLCD32_Format: { | 1772 case SkMask::kLCD32_Format: { |
1773 // filter down the luminance color to a finite number of bits | 1773 // filter down the luminance color to a finite number of bits |
1774 SkColor color = rec->getLuminanceColor(); | 1774 SkColor color = rec->getLuminanceColor(); |
1775 rec->setLuminanceColor(SkMaskGamma::CanonicalColor(color)); | 1775 rec->setLuminanceColor(SkMaskGamma::CanonicalColor(color)); |
1776 break; | 1776 break; |
1777 } | 1777 } |
1778 case SkMask::kA8_Format: { | 1778 case SkMask::kA8_Format: { |
1779 // filter down the luminance to a single component, since A8 can't | 1779 // filter down the luminance to a single component, since A8 can't |
1780 // use per-component information | 1780 // use per-component information |
1781 | |
1782 SkColor color = rec->getLuminanceColor(); | 1781 SkColor color = rec->getLuminanceColor(); |
| 1782 #ifdef SK_IGNORE_FASTER_TEXT_FIX |
1783 U8CPU lum = SkColorSpaceLuminance::computeLuminance(rec->getPaintGam
ma(), color); | 1783 U8CPU lum = SkColorSpaceLuminance::computeLuminance(rec->getPaintGam
ma(), color); |
1784 //If we are asked to look like LCD, look like LCD. | 1784 //If we are asked to look like LCD, look like LCD. |
1785 if (!(rec->fFlags & SkScalerContext::kGenA8FromLCD_Flag)) { | 1785 if (!(rec->fFlags & SkScalerContext::kGenA8FromLCD_Flag)) { |
1786 // HACK: Prevents green from being pre-blended as white. | 1786 // HACK: Prevents green from being pre-blended as white. |
1787 lum -= ((255 - lum) * lum) / 255; | 1787 lum -= ((255 - lum) * lum) / 255; |
1788 } | 1788 } |
1789 | 1789 #else |
| 1790 U8CPU lum = SkComputeLuminance(SkColorGetR(color), |
| 1791 SkColorGetG(color), |
| 1792 SkColorGetB(color)); |
| 1793 #endif |
1790 // reduce to our finite number of bits | 1794 // reduce to our finite number of bits |
1791 color = SkColorSetRGB(lum, lum, lum); | 1795 color = SkColorSetRGB(lum, lum, lum); |
1792 rec->setLuminanceColor(SkMaskGamma::CanonicalColor(color)); | 1796 rec->setLuminanceColor(SkMaskGamma::CanonicalColor(color)); |
1793 break; | 1797 break; |
1794 } | 1798 } |
1795 case SkMask::kBW_Format: | 1799 case SkMask::kBW_Format: |
1796 // No need to differentiate gamma if we're BW | 1800 // No need to differentiate gamma if we're BW |
1797 rec->ignorePreBlend(); | 1801 rec->ignorePreBlend(); |
1798 break; | 1802 break; |
1799 } | 1803 } |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2748 } | 2752 } |
2749 #ifdef SK_BUILD_FOR_ANDROID | 2753 #ifdef SK_BUILD_FOR_ANDROID |
2750 if (dirty & kPaintOptionsAndroid_DirtyBit) { | 2754 if (dirty & kPaintOptionsAndroid_DirtyBit) { |
2751 SkPaintOptionsAndroid options; | 2755 SkPaintOptionsAndroid options; |
2752 options.unflatten(buffer); | 2756 options.unflatten(buffer); |
2753 paint->setPaintOptionsAndroid(options); | 2757 paint->setPaintOptionsAndroid(options); |
2754 } | 2758 } |
2755 #endif | 2759 #endif |
2756 SkASSERT(dirty == paint->fDirtyBits); | 2760 SkASSERT(dirty == paint->fDirtyBits); |
2757 } | 2761 } |
OLD | NEW |