| 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 1762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 1781 |
| 1782 SkColor color = rec->getLuminanceColor(); | 1782 SkColor color = rec->getLuminanceColor(); |
| 1783 U8CPU lum = SkColorSpaceLuminance::computeLuminance(rec->getPaintGam
ma(), color); | 1783 U8CPU lum = SkComputeLuminance(SkColorGetR(color), |
| 1784 //If we are asked to look like LCD, look like LCD. | 1784 SkColorGetG(color), |
| 1785 if (!(rec->fFlags & SkScalerContext::kGenA8FromLCD_Flag)) { | 1785 SkColorGetB(color)); |
| 1786 // HACK: Prevents green from being pre-blended as white. | 1786 |
| 1787 lum -= ((255 - lum) * lum) / 255; | |
| 1788 } | |
| 1789 | |
| 1790 // reduce to our finite number of bits | 1787 // reduce to our finite number of bits |
| 1791 color = SkColorSetRGB(lum, lum, lum); | 1788 color = SkColorSetRGB(lum, lum, lum); |
| 1792 rec->setLuminanceColor(SkMaskGamma::CanonicalColor(color)); | 1789 rec->setLuminanceColor(SkMaskGamma::CanonicalColor(color)); |
| 1793 break; | 1790 break; |
| 1794 } | 1791 } |
| 1795 case SkMask::kBW_Format: | 1792 case SkMask::kBW_Format: |
| 1796 // No need to differentiate gamma if we're BW | 1793 // No need to differentiate gamma if we're BW |
| 1797 rec->ignorePreBlend(); | 1794 rec->ignorePreBlend(); |
| 1798 break; | 1795 break; |
| 1799 } | 1796 } |
| (...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2748 } | 2745 } |
| 2749 #ifdef SK_BUILD_FOR_ANDROID | 2746 #ifdef SK_BUILD_FOR_ANDROID |
| 2750 if (dirty & kPaintOptionsAndroid_DirtyBit) { | 2747 if (dirty & kPaintOptionsAndroid_DirtyBit) { |
| 2751 SkPaintOptionsAndroid options; | 2748 SkPaintOptionsAndroid options; |
| 2752 options.unflatten(buffer); | 2749 options.unflatten(buffer); |
| 2753 paint->setPaintOptionsAndroid(options); | 2750 paint->setPaintOptionsAndroid(options); |
| 2754 } | 2751 } |
| 2755 #endif | 2752 #endif |
| 2756 SkASSERT(dirty == paint->fDirtyBits); | 2753 SkASSERT(dirty == paint->fDirtyBits); |
| 2757 } | 2754 } |
| OLD | NEW |