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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 uint32_t textFlags = paintTextFlags(); | 55 uint32_t textFlags = paintTextFlags(); |
56 uint32_t flags = paint->getFlags(); | 56 uint32_t flags = paint->getFlags(); |
57 static const uint32_t textFlagsMask = SkPaint::kAntiAlias_Flag | | 57 static const uint32_t textFlagsMask = SkPaint::kAntiAlias_Flag | |
58 SkPaint::kLCDRenderText_Flag | | 58 SkPaint::kLCDRenderText_Flag | |
59 SkPaint::kGenA8FromLCD_Flag; | 59 SkPaint::kGenA8FromLCD_Flag; |
60 flags &= ~textFlagsMask; | 60 flags &= ~textFlagsMask; |
61 | 61 |
62 if (ts <= kMaxSizeForEmbeddedBitmap) | 62 if (ts <= kMaxSizeForEmbeddedBitmap) |
63 flags |= SkPaint::kEmbeddedBitmapText_Flag; | 63 flags |= SkPaint::kEmbeddedBitmapText_Flag; |
64 | 64 |
65 if (m_useSubpixelPositioning) | 65 if (ts >= m_minSizeForAntiAlias) { |
66 flags |= SkPaint::kSubpixelText_Flag; | 66 if (m_useSubpixelPositioning) |
| 67 flags |= SkPaint::kSubpixelText_Flag; |
67 | 68 |
68 // Only set painting flags when we're actually painting. | 69 // Only set painting flags when we're actually painting. |
69 if (context && !context->couldUseLCDRenderedText()) { | 70 if (context && !context->couldUseLCDRenderedText()) { |
70 textFlags &= ~SkPaint::kLCDRenderText_Flag; | 71 textFlags &= ~SkPaint::kLCDRenderText_Flag; |
71 // If we *just* clear our request for LCD, then GDI seems to | 72 // If we *just* clear our request for LCD, then GDI seems to |
72 // sometimes give us AA text, and sometimes give us BW text. Since the | 73 // sometimes give us AA text, and sometimes give us BW text. Since t
he |
73 // original intent was LCD, we want to force AA (rather than BW), so we | 74 // original intent was LCD, we want to force AA (rather than BW), so
we |
74 // add a special bit to tell Skia to do its best to avoid the BW: by | 75 // add a special bit to tell Skia to do its best to avoid the BW: by |
75 // drawing LCD offscreen and downsampling that to AA. | 76 // drawing LCD offscreen and downsampling that to AA. |
76 textFlags |= SkPaint::kGenA8FromLCD_Flag; | 77 textFlags |= SkPaint::kGenA8FromLCD_Flag; |
| 78 } |
| 79 SkASSERT(!(textFlags & ~textFlagsMask)); |
| 80 flags |= textFlags; |
77 } | 81 } |
78 SkASSERT(!(textFlags & ~textFlagsMask)); | |
79 flags |= textFlags; | |
80 | 82 |
81 paint->setFlags(flags); | 83 paint->setFlags(flags); |
82 } | 84 } |
83 | 85 |
84 // Lookup the current system settings for font smoothing. | 86 // Lookup the current system settings for font smoothing. |
85 // We cache these values for performance, but if the browser has a way to be | 87 // We cache these values for performance, but if the browser has a way to be |
86 // notified when these change, we could re-query them at that time. | 88 // notified when these change, we could re-query them at that time. |
87 static uint32_t getSystemTextFlags() | 89 static uint32_t getSystemTextFlags() |
88 { | 90 { |
89 static bool gInited; | 91 static bool gInited; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 { | 137 { |
136 m_paintTextFlags = computePaintTextFlags(fontFamilyName()); | 138 m_paintTextFlags = computePaintTextFlags(fontFamilyName()); |
137 } | 139 } |
138 | 140 |
139 bool FontPlatformData::defaultUseSubpixelPositioning() | 141 bool FontPlatformData::defaultUseSubpixelPositioning() |
140 { | 142 { |
141 return FontCache::fontCache()->useSubpixelPositioning(); | 143 return FontCache::fontCache()->useSubpixelPositioning(); |
142 } | 144 } |
143 | 145 |
144 } // namespace WebCore | 146 } // namespace WebCore |
OLD | NEW |