Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: src/core/SkPaint.cpp

Issue 337603008: Remove A8_LCD luminance hack. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add SK_IGNORE_FASTER_TEXT_FIX Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698