OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007 Apple Computer, Inc. | 2 * Copyright (C) 2006, 2007 Apple Computer, Inc. |
3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. | 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 paint->setTextSkewX(m_syntheticItalic ? -SK_Scalar1 / 4 : 0); | 49 paint->setTextSkewX(m_syntheticItalic ? -SK_Scalar1 / 4 : 0); |
50 | 50 |
51 uint32_t textFlags = paintTextFlags(); | 51 uint32_t textFlags = paintTextFlags(); |
52 uint32_t flags = paint->getFlags(); | 52 uint32_t flags = paint->getFlags(); |
53 static const uint32_t textFlagsMask = SkPaint::kAntiAlias_Flag | | 53 static const uint32_t textFlagsMask = SkPaint::kAntiAlias_Flag | |
54 SkPaint::kLCDRenderText_Flag | | 54 SkPaint::kLCDRenderText_Flag | |
55 SkPaint::kGenA8FromLCD_Flag; | 55 SkPaint::kGenA8FromLCD_Flag; |
56 flags &= ~textFlagsMask; | 56 flags &= ~textFlagsMask; |
57 | 57 |
58 if (ts >= m_minSizeForAntiAlias) { | 58 if (ts >= m_minSizeForAntiAlias) { |
59 paint->setSubpixelText(m_useSubpixelPositioning); | 59 if (m_useSubpixelPositioning) |
| 60 flags |= SkPaint::kSubpixelText_Flag; |
60 | 61 |
61 // Only set painting flags when we're actually painting. | 62 // Only set painting flags when we're actually painting. |
62 if (context && !context->couldUseLCDRenderedText()) { | 63 if (context && !context->couldUseLCDRenderedText()) { |
63 textFlags &= ~SkPaint::kLCDRenderText_Flag; | 64 textFlags &= ~SkPaint::kLCDRenderText_Flag; |
64 // If we *just* clear our request for LCD, then GDI seems to | 65 // If we *just* clear our request for LCD, then GDI seems to |
65 // sometimes give us AA text, and sometimes give us BW text. Since t
he | 66 // sometimes give us AA text, and sometimes give us BW text. Since t
he |
66 // original intent was LCD, we want to force AA (rather than BW), so
we | 67 // original intent was LCD, we want to force AA (rather than BW), so
we |
67 // add a special bit to tell Skia to do its best to avoid the BW: by | 68 // add a special bit to tell Skia to do its best to avoid the BW: by |
68 // drawing LCD offscreen and downsampling that to AA. | 69 // drawing LCD offscreen and downsampling that to AA. |
69 textFlags |= SkPaint::kGenA8FromLCD_Flag; | 70 textFlags |= SkPaint::kGenA8FromLCD_Flag; |
70 } | 71 } |
71 SkASSERT(!(textFlags & ~textFlagsMask)); | 72 SkASSERT(!(textFlags & ~textFlagsMask)); |
72 flags |= textFlags; | 73 flags |= textFlags; |
73 | |
74 } else { | |
75 paint->setSubpixelText(false); | |
76 } | 74 } |
77 | 75 |
78 paint->setFlags(flags); | 76 paint->setFlags(flags); |
79 } | 77 } |
80 | 78 |
81 // Lookup the current system settings for font smoothing. | 79 // Lookup the current system settings for font smoothing. |
82 // We cache these values for performance, but if the browser has a way to be | 80 // We cache these values for performance, but if the browser has a way to be |
83 // notified when these change, we could re-query them at that time. | 81 // notified when these change, we could re-query them at that time. |
84 static uint32_t getSystemTextFlags() | 82 static uint32_t getSystemTextFlags() |
85 { | 83 { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 { | 130 { |
133 m_paintTextFlags = computePaintTextFlags(fontFamilyName()); | 131 m_paintTextFlags = computePaintTextFlags(fontFamilyName()); |
134 } | 132 } |
135 | 133 |
136 bool FontPlatformData::defaultUseSubpixelPositioning() | 134 bool FontPlatformData::defaultUseSubpixelPositioning() |
137 { | 135 { |
138 return FontCache::fontCache()->useSubpixelPositioning(); | 136 return FontCache::fontCache()->useSubpixelPositioning(); |
139 } | 137 } |
140 | 138 |
141 } // namespace WebCore | 139 } // namespace WebCore |
OLD | NEW |