Changeset 92150 in webkit
- Timestamp:
- Aug 1, 2011, 4:12:49 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r92149 r92150 1 2011-08-01 Zhenyao Mo <zmo@google.com> 2 3 Unreviewed, rolling out r92022. 4 http://trac.webkit.org/changeset/92022 5 https://bugs.webkit.org/show_bug.cgi?id=65203 6 7 try to see if this is causing a bunch of browser tests failues 8 on win bots - will recommit if not 9 10 * platform/chromium/test_expectations.txt: 11 1 12 2011-08-01 Ryosuke Niwa <rniwa@webkit.org> 2 13 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r92126 r92150 1834 1834 1835 1835 BUGWK38705 : http/tests/security/sandbox-inherit-to-initial-document-2.html = TEXT 1836 1837 // Switching windows over from GDI to Skia for all text rendering.1838 // When that lands, we will rebaseline these images.1839 BUGWK65203 WIN : fast/borders/border-antialiasing.html = IMAGE1840 BUGWK65203 WIN : fast/reflections/reflection-overflow-hidden.html = IMAGE1841 BUGWK65203 WIN : fast/repaint/reflection-redraw.html = IMAGE1842 BUGWK65203 WIN : fast/text/atsui-spacing-features.html = IMAGE1843 BUGWK65203 WIN : fast/text/cg-vs-atsui.html = IMAGE1844 BUGWK65203 WIN : fast/text/complex-text-opacity.html = IMAGE1845 BUGWK65203 WIN : fast/text/international/complex-character-based-fallback.html = IMAGE1846 BUGWK65203 WIN : fast/text/international/danda-space.html = IMAGE1847 BUGWK65203 WIN : fast/text/international/thai-baht-space.html = IMAGE1848 BUGWK65203 WIN : fast/text/international/thai-line-breaks.html = IMAGE1849 BUGWK65203 WIN : media/audio-repaint.html = IMAGE1850 BUGWK65203 WIN : platform/win/fast/text/uniscribe-missing-glyph.html = IMAGE1851 BUGWK65203 WIN : svg/W3C-SVG-1.1-SE/text-intro-05-t.svg = IMAGE1852 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-37-t.svg = IMAGE1853 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-39-t.svg = IMAGE1854 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-40-t.svg = IMAGE1855 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-41-t.svg = IMAGE1856 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-46-t.svg = IMAGE1857 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-60-t.svg = IMAGE1858 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-61-t.svg = IMAGE1859 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-62-t.svg = IMAGE1860 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-63-t.svg = IMAGE1861 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-64-t.svg = IMAGE1862 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-65-t.svg = IMAGE1863 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-66-t.svg = IMAGE1864 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-67-t.svg = IMAGE1865 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-68-t.svg = IMAGE1866 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-69-t.svg = IMAGE1867 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-70-t.svg = IMAGE1868 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-81-t.svg = IMAGE1869 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-82-t.svg = IMAGE1870 BUGWK65203 WIN : svg/W3C-SVG-1.1/animate-elem-83-t.svg = IMAGE1871 BUGWK65203 WIN : svg/W3C-SVG-1.1/pservers-grad-07-b.svg = IMAGE1872 BUGWK65203 WIN : svg/W3C-SVG-1.1/struct-frag-02-t.svg = IMAGE1873 BUGWK65203 WIN : svg/W3C-SVG-1.1/text-align-04-b.svg = IMAGE1874 BUGWK65203 WIN : svg/W3C-SVG-1.1/text-align-05-b.svg = IMAGE1875 BUGWK65203 WIN : svg/W3C-SVG-1.1/text-align-06-b.svg = IMAGE1876 BUGWK65203 WIN : svg/W3C-SVG-1.1/text-path-01-b.svg = IMAGE1877 BUGWK65203 WIN : svg/W3C-SVG-1.1/text-text-05-t.svg = IMAGE1878 BUGWK65203 WIN : svg/as-background-image/animated-svg-as-background.html = IMAGE1879 BUGWK65203 WIN : svg/as-image/animated-svg-as-image.html = IMAGE1880 BUGWK65203 WIN : svg/batik/filters/feTile.svg = IMAGE1881 BUGWK65203 WIN : svg/batik/filters/filterRegions.svg = IMAGE1882 BUGWK65203 WIN : svg/batik/text/longTextOnPath.svg = IMAGE1883 BUGWK65203 WIN : svg/batik/text/textAnchor.svg = IMAGE1884 BUGWK65203 WIN : svg/batik/text/textFeatures.svg = IMAGE1885 BUGWK65203 WIN : svg/batik/text/textLayout.svg = IMAGE1886 BUGWK65203 WIN : svg/batik/text/textPCDATA.svg = IMAGE1887 BUGWK65203 WIN : svg/batik/text/textProperties.svg = IMAGE1888 BUGWK65203 WIN : svg/batik/text/textProperties2.svg = IMAGE1889 BUGWK65203 WIN : svg/batik/text/textStyles.svg = IMAGE1890 BUGWK65203 WIN : svg/carto.net/textbox.svg = IMAGE1891 BUGWK65203 WIN : svg/carto.net/window.svg = IMAGE1892 BUGWK65203 WIN : svg/custom/js-late-clipPath-and-object-creation.svg = IMAGE1893 BUGWK65203 WIN : svg/custom/js-late-clipPath-creation.svg = IMAGE1894 BUGWK65203 WIN : svg/custom/linking-a-03-b-viewBox.svg = IMAGE1895 BUGWK65203 WIN : svg/custom/linking-uri-01-b.svg = IMAGE1896 BUGWK65203 WIN : svg/custom/svg-fonts-fallback.xhtml = IMAGE1897 BUGWK65203 WIN : svg/dynamic-updates/SVGTextElement-dom-lengthAdjust-attr.html = IMAGE1898 BUGWK65203 WIN : svg/dynamic-updates/SVGTextElement-svgdom-lengthAdjust-prop.html = IMAGE1899 BUGWK65203 WIN : svg/hixie/mixed/009.xml = IMAGE1900 BUGWK65203 WIN : svg/text/foreignObject-text-clipping-bug.xml = IMAGE1901 BUGWK65203 WIN : svg/text/scaling-font-with-geometric-precision.html = IMAGE1902 BUGWK65203 WIN : svg/text/text-align-01-b.svg = IMAGE1903 BUGWK65203 WIN : svg/text/text-align-05-b.svg = IMAGE1904 BUGWK65203 WIN : svg/text/text-align-06-b.svg = IMAGE1905 BUGWK65203 WIN : svg/text/text-intro-05-t.svg = IMAGE1906 BUGWK65203 WIN : svg/text/text-path-01-b.svg = IMAGE1907 BUGWK65203 WIN : svg/text/textPathBoundsBug.svg = IMAGE1908 BUGWK65203 WIN : svg/zoom/page/zoom-coords-viewattr-01-b.svg = IMAGE1909 BUGWK65203 WIN : svg/zoom/page/zoom-hixie-mixed-008.xml = IMAGE1910 BUGWK65203 WIN : svg/zoom/page/zoom-hixie-mixed-009.xml = IMAGE1911 BUGWK65203 WIN : svg/zoom/text/zoom-coords-viewattr-01-b.svg = IMAGE1912 BUGWK65203 WIN : svg/zoom/text/zoom-hixie-mixed-009.xml = IMAGE1913 1836 1914 1837 // WebKit roll 58791:58807 -
trunk/Source/WebCore/ChangeLog
r92143 r92150 1 2011-08-01 Zhenyao Mo <zmo@google.com> 2 3 Unreviewed, rolling out r92022. 4 http://trac.webkit.org/changeset/92022 5 https://bugs.webkit.org/show_bug.cgi?id=65203 6 7 try to see if this is causing a bunch of browser tests failues 8 on win bots - will recommit if not 9 10 * platform/graphics/chromium/FontChromiumWin.cpp: 11 (WebCore::TransparencyAwareFontPainter::TransparencyAwareFontPainter::TransparencyAwareFontPainter): 12 (WebCore::TransparencyAwareFontPainter::TransparencyAwareFontPainter::init): 13 (WebCore::TransparencyAwareFontPainter::TransparencyAwareFontPainter::initializeForGDI): 14 (WebCore::TransparencyAwareFontPainter::TransparencyAwareFontPainter::~TransparencyAwareFontPainter): 15 (WebCore::TransparencyAwareFontPainter::TransparencyAwareGlyphPainter::TransparencyAwareGlyphPainter): 16 (WebCore::TransparencyAwareFontPainter::TransparencyAwareGlyphPainter::~TransparencyAwareGlyphPainter): 17 (WebCore::TransparencyAwareFontPainter::TransparencyAwareGlyphPainter::drawGlyphs): 18 (WebCore::TransparencyAwareFontPainter::TransparencyAwareUniscribePainter::hdc): 19 (WebCore::TransparencyAwareFontPainter::TransparencyAwareUniscribePainter::TransparencyAwareUniscribePainter): 20 (WebCore::TransparencyAwareFontPainter::TransparencyAwareUniscribePainter::~TransparencyAwareUniscribePainter): 21 (WebCore::drawGlyphsWin): 22 (WebCore::Font::drawComplexText): 23 * platform/graphics/chromium/UniscribeHelper.cpp: 24 (WebCore::UniscribeHelper::draw): 25 * platform/graphics/skia/PlatformContextSkia.cpp: 26 (WebCore::PlatformContextSkia::isNativeFontRenderingAllowed): 27 * platform/graphics/skia/PlatformContextSkia.h: 28 * platform/graphics/skia/SkiaFontWin.cpp: 29 (WebCore::windowsCanHandleDrawTextShadow): 30 (WebCore::windowsCanHandleTextDrawing): 31 (WebCore::windowsCanHandleTextDrawingWithoutShadow): 32 * platform/graphics/skia/SkiaFontWin.h: 33 1 34 2011-08-01 Scott Graham <scottmg@chromium.org> 2 35 -
trunk/Source/WebCore/platform/graphics/chromium/FontChromiumWin.cpp
r92022 r92150 63 63 public: 64 64 TransparencyAwareFontPainter(GraphicsContext*, const FloatPoint&); 65 ~TransparencyAwareFontPainter(); 65 66 66 67 protected: 68 // Called by our subclass' constructor to initialize GDI if necessary. This 69 // is a separate function so it can be called after the subclass finishes 70 // construction (it calls virtual functions). 71 void init(); 72 67 73 virtual IntRect estimateTextBounds() = 0; 68 74 … … 73 79 74 80 FloatPoint m_point; 81 82 // Set when Windows can handle the type of drawing we're doing. 83 bool m_useGDI; 84 85 // These members are valid only when m_useGDI is set. 86 HDC m_hdc; 87 TransparencyWin m_transparency; 88 89 private: 90 // Call when we're using GDI mode to initialize the TransparencyWin to help 91 // us draw GDI text. 92 void initializeForGDI(); 93 94 bool m_createdTransparencyLayer; // We created a layer to give the font some alpha. 75 95 }; 76 96 … … 80 100 , m_platformContext(context->platformContext()) 81 101 , m_point(point) 82 { 102 , m_useGDI(windowsCanHandleTextDrawing(context)) 103 , m_hdc(0) 104 , m_createdTransparencyLayer(false) 105 { 106 } 107 108 void TransparencyAwareFontPainter::init() 109 { 110 if (m_useGDI) 111 initializeForGDI(); 112 } 113 114 void TransparencyAwareFontPainter::initializeForGDI() 115 { 116 m_graphicsContext->save(); 117 SkColor color = m_platformContext->effectiveFillColor(); 118 // Used only when m_createdTransparencyLayer is true. 119 float layerAlpha = 0.0f; 120 if (SkColorGetA(color) != 0xFF) { 121 // When the font has some transparency, apply it by creating a new 122 // transparency layer with that opacity applied. We'll actually create 123 // a new transparency layer after we calculate the bounding box. 124 m_createdTransparencyLayer = true; 125 layerAlpha = SkColorGetA(color) / 255.0f; 126 // The color should be opaque now. 127 color = SkColorSetRGB(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color)); 128 } 129 130 TransparencyWin::LayerMode layerMode; 131 IntRect layerRect; 132 if (m_platformContext->isDrawingToImageBuffer()) { 133 // Assume if we're drawing to an image buffer that the background 134 // is not opaque and we have to undo ClearType. We may want to 135 // enhance this to actually check, since it will often be opaque 136 // and we could do ClearType in that case. 137 layerMode = TransparencyWin::TextComposite; 138 layerRect = estimateTextBounds(); 139 m_graphicsContext->clip(layerRect); 140 if (m_createdTransparencyLayer) 141 m_graphicsContext->beginTransparencyLayer(layerAlpha); 142 143 // The transparency helper requires that we draw text in black in 144 // this mode and it will apply the color. 145 m_transparency.setTextCompositeColor(color); 146 color = SkColorSetRGB(0, 0, 0); 147 } else if (m_createdTransparencyLayer || canvasHasMultipleLayers(m_platformContext->canvas())) { 148 // When we're drawing a web page, we know the background is opaque, 149 // but if we're drawing to a layer, we still need extra work. 150 layerMode = TransparencyWin::OpaqueCompositeLayer; 151 layerRect = estimateTextBounds(); 152 m_graphicsContext->clip(layerRect); 153 if (m_createdTransparencyLayer) 154 m_graphicsContext->beginTransparencyLayer(layerAlpha); 155 } else { 156 // Common case of drawing onto the bottom layer of a web page: we 157 // know everything is opaque so don't need to do anything special. 158 layerMode = TransparencyWin::NoLayer; 159 } 160 161 // Bug 26088 - init() might fail if layerRect is invalid. Given this, we 162 // need to be careful to check for null pointers everywhere after this call 163 m_transparency.init(m_graphicsContext, layerMode, 164 TransparencyWin::KeepTransform, layerRect); 165 166 // Set up the DC, using the one from the transparency helper. 167 if (m_transparency.platformContext()) { 168 m_hdc = skia::BeginPlatformPaint(m_transparency.platformContext()->canvas()); 169 SetTextColor(m_hdc, skia::SkColorToCOLORREF(color)); 170 SetBkMode(m_hdc, TRANSPARENT); 171 } 172 } 173 174 TransparencyAwareFontPainter::~TransparencyAwareFontPainter() 175 { 176 if (!m_useGDI || !m_graphicsContext || !m_platformContext) 177 return; // Nothing to do. 178 m_transparency.composite(); 179 if (m_createdTransparencyLayer) 180 m_graphicsContext->endTransparencyLayer(); 181 m_graphicsContext->restore(); 182 if (m_transparency.platformContext()) 183 skia::EndPlatformPaint(m_transparency.platformContext()->canvas()); 83 184 } 84 185 … … 91 192 int from, int numGlyphs, 92 193 const FloatPoint&); 194 ~TransparencyAwareGlyphPainter(); 93 195 94 196 // Draws the partial string of glyphs, starting at |startAdvance| to the 95 // left of m_point. 96 void drawGlyphs(int numGlyphs, const WORD* glyphs, const int* advances, float startAdvance) const; 197 // left of m_point. We express it this way so that if we're using the Skia 198 // drawing path we can use floating-point positioning, even though we have 199 // to use integer positioning in the GDI path. 200 bool drawGlyphs(int numGlyphs, const WORD* glyphs, const int* advances, float startAdvance) const; 97 201 98 202 private: … … 103 207 int m_from; 104 208 int m_numGlyphs; 209 210 // When m_useGdi is set, this stores the previous HFONT selected into the 211 // m_hdc so we can restore it. 212 HGDIOBJ m_oldFont; // For restoring the DC to its original state. 105 213 }; 106 214 … … 116 224 , m_from(from) 117 225 , m_numGlyphs(numGlyphs) 118 { 119 } 226 , m_oldFont(0) 227 { 228 init(); 229 230 if (m_hdc) 231 m_oldFont = ::SelectObject(m_hdc, m_font->platformData().hfont()); 232 } 233 234 TransparencyAwareGlyphPainter::~TransparencyAwareGlyphPainter() 235 { 236 if (m_useGDI && m_hdc) 237 ::SelectObject(m_hdc, m_oldFont); 238 } 239 120 240 121 241 // Estimates the bounding box of the given text. This is copied from … … 135 255 } 136 256 137 voidTransparencyAwareGlyphPainter::drawGlyphs(int numGlyphs,257 bool TransparencyAwareGlyphPainter::drawGlyphs(int numGlyphs, 138 258 const WORD* glyphs, 139 259 const int* advances, 140 260 float startAdvance) const 141 261 { 142 SkPoint origin = m_point; 143 origin.fX += SkFloatToScalar(startAdvance); 144 paintSkiaText(m_graphicsContext, m_font->platformData().hfont(), 145 numGlyphs, glyphs, advances, 0, &origin); 262 if (!m_useGDI) { 263 SkPoint origin = m_point; 264 origin.fX += SkFloatToScalar(startAdvance); 265 paintSkiaText(m_graphicsContext, m_font->platformData().hfont(), 266 numGlyphs, glyphs, advances, 0, &origin); 267 return true; 268 } 269 270 if (!m_graphicsContext || !m_hdc) 271 return true; 272 273 // Windows' origin is the top-left of the bounding box, so we have 274 // to subtract off the font ascent to get it. 275 int x = lroundf(m_point.x() + startAdvance); 276 int y = lroundf(m_point.y() - m_font->fontMetrics().ascent()); 277 278 // If there is a non-blur shadow and both the fill color and shadow color 279 // are opaque, handle without skia. 280 FloatSize shadowOffset; 281 float shadowBlur; 282 Color shadowColor; 283 ColorSpace shadowColorSpace; 284 if (m_graphicsContext->getShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace)) { 285 // If there is a shadow and this code is reached, windowsCanHandleDrawTextShadow() 286 // will have already returned true during the ctor initiatization of m_useGDI 287 ASSERT(shadowColor.alpha() == 255); 288 ASSERT(m_graphicsContext->fillColor().alpha() == 255); 289 ASSERT(shadowBlur == 0); 290 COLORREF textColor = skia::SkColorToCOLORREF(SkColorSetARGB(255, shadowColor.red(), shadowColor.green(), shadowColor.blue())); 291 COLORREF savedTextColor = GetTextColor(m_hdc); 292 SetTextColor(m_hdc, textColor); 293 ExtTextOut(m_hdc, x + shadowOffset.width(), y + shadowOffset.height(), ETO_GLYPH_INDEX, 0, reinterpret_cast<const wchar_t*>(&glyphs[0]), numGlyphs, &advances[0]); 294 SetTextColor(m_hdc, savedTextColor); 295 } 296 297 return !!ExtTextOut(m_hdc, x, y, ETO_GLYPH_INDEX, 0, reinterpret_cast<const wchar_t*>(&glyphs[0]), numGlyphs, &advances[0]); 146 298 } 147 299 … … 153 305 int from, int to, 154 306 const FloatPoint&); 307 ~TransparencyAwareUniscribePainter(); 308 309 // Uniscibe will draw directly into our buffer, so we need to expose our DC. 310 HDC hdc() const { return m_hdc; } 155 311 156 312 private: … … 174 330 , m_from(from) 175 331 , m_to(to) 332 { 333 init(); 334 } 335 336 TransparencyAwareUniscribePainter::~TransparencyAwareUniscribePainter() 176 337 { 177 338 } … … 265 426 } 266 427 267 painter.drawGlyphs(curLen, &glyphs[0], &advances[0], horizontalOffset - point.x() - currentWidth); 428 // Actually draw the glyphs (with retry on failure). 429 bool success = false; 430 for (int executions = 0; executions < 2; ++executions) { 431 success = painter.drawGlyphs(curLen, &glyphs[0], &advances[0], horizontalOffset - point.x() - currentWidth); 432 if (!success && executions == 0) { 433 // Ask the browser to load the font for us and retry. 434 PlatformBridge::ensureFontLoaded(font->platformData().hfont()); 435 continue; 436 } 437 break; 438 } 439 440 if (!success) 441 LOG_ERROR("Unable to draw the glyphs after second attempt"); 268 442 } 269 443 } … … 319 493 return; 320 494 495 TransparencyAwareUniscribePainter painter(graphicsContext, this, run, from, to, point); 496 497 HDC hdc = painter.hdc(); 498 if (windowsCanHandleTextDrawing(graphicsContext) && !hdc) 499 return; 500 501 // TODO(maruel): http://b/700464 SetTextColor doesn't support transparency. 502 // Enforce non-transparent color. 503 color = SkColorSetRGB(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color)); 504 if (hdc) { 505 SetTextColor(hdc, skia::SkColorToCOLORREF(color)); 506 SetBkMode(hdc, TRANSPARENT); 507 } 508 509 // If there is a non-blur shadow and both the fill color and shadow color 510 // are opaque, handle without skia. 511 FloatSize shadowOffset; 512 float shadowBlur; 513 Color shadowColor; 514 ColorSpace shadowColorSpace; 515 if (graphicsContext->getShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace) && windowsCanHandleDrawTextShadow(graphicsContext)) { 516 COLORREF textColor = skia::SkColorToCOLORREF(SkColorSetARGB(255, shadowColor.red(), shadowColor.green(), shadowColor.blue())); 517 COLORREF savedTextColor = GetTextColor(hdc); 518 SetTextColor(hdc, textColor); 519 state.draw(graphicsContext, hdc, static_cast<int>(point.x()) + shadowOffset.width(), 520 static_cast<int>(point.y() - fontMetrics().ascent()) + shadowOffset.height(), from, to); 521 SetTextColor(hdc, savedTextColor); 522 } 523 321 524 // Uniscribe counts the coordinates from the upper left, while WebKit uses 322 525 // the baseline, so we have to subtract off the ascent. 323 HDC hdc = 0;324 526 state.draw(graphicsContext, hdc, lroundf(point.x()), lroundf(point.y() - fontMetrics().ascent()), from, to); 325 527 } -
trunk/Source/WebCore/platform/graphics/chromium/UniscribeHelper.cpp
r92022 r92150 270 270 int curX = x; 271 271 bool firstRun = true; 272 bool useWindowsDrawing = windowsCanHandleTextDrawing(graphicsContext); 272 273 273 274 for (size_t screenIndex = 0; screenIndex < m_runs.size(); screenIndex++) { … … 348 349 const int* justify = shaping.m_justify.size() == 0 ? 0 : &shaping.m_justify[fromGlyph]; 349 350 351 if (useWindowsDrawing) { 352 if (firstRun) { 353 oldFont = SelectObject(dc, shaping.m_hfont); 354 firstRun = false; 355 } else 356 SelectObject(dc, shaping.m_hfont); 357 } 358 350 359 // Fonts with different ascents can be used to render different 351 360 // runs. 'Across-runs' y-coordinate correction needs to be … … 353 362 bool textOutOk = false; 354 363 for (int executions = 0; executions < 2; ++executions) { 355 SkPoint origin; 356 origin.fX = curX + + innerOffset; 357 origin.fY = y + m_ascent; 358 paintSkiaText(graphicsContext, 359 shaping.m_hfont, 360 glyphCount, 361 &shaping.m_glyphs[fromGlyph], 362 &shaping.m_advance[fromGlyph], 363 &shaping.m_offsets[fromGlyph], 364 &origin); 365 textOutOk = true; 364 if (useWindowsDrawing) { 365 HRESULT hr = ScriptTextOut(dc, shaping.m_scriptCache, 366 curX + innerOffset, 367 y - shaping.m_ascentOffset, 368 0, 0, &item.a, 0, 0, 369 &shaping.m_glyphs[fromGlyph], 370 glyphCount, 371 &shaping.m_advance[fromGlyph], 372 justify, 373 &shaping.m_offsets[fromGlyph]); 374 textOutOk = (hr == S_OK); 375 } else { 376 SkPoint origin; 377 origin.fX = curX + + innerOffset; 378 origin.fY = y + m_ascent; 379 paintSkiaText(graphicsContext, 380 shaping.m_hfont, 381 glyphCount, 382 &shaping.m_glyphs[fromGlyph], 383 &shaping.m_advance[fromGlyph], 384 &shaping.m_offsets[fromGlyph], 385 &origin); 386 textOutOk = true; 387 } 366 388 367 389 if (!textOutOk && 0 == executions) { -
trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
r92022 r92150 570 570 } 571 571 572 bool PlatformContextSkia::isNativeFontRenderingAllowed() 573 { 574 #if ENABLE(SKIA_TEXT) 575 return false; 576 #else 577 if (useSkiaGPU()) 578 return false; 579 return skia::SupportsPlatformPaint(m_canvas); 580 #endif 581 } 582 572 583 void PlatformContextSkia::getImageResamplingHint(IntSize* srcSize, FloatSize* dstSize) const 573 584 { -
trunk/Source/WebCore/platform/graphics/skia/PlatformContextSkia.h
r92022 r92150 168 168 void setPrinting(bool p) { m_printing = p; } 169 169 170 // Returns if the context allows rendering of fonts using native platform 171 // APIs. If false is returned font rendering is performed using the skia 172 // text drawing APIs. 173 bool isNativeFontRenderingAllowed(); 174 170 175 void getImageResamplingHint(IntSize* srcSize, FloatSize* dstSize) const; 171 176 void setImageResamplingHint(const IntSize& srcSize, const FloatSize& dstSize); -
trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.cpp
r92022 r92150 44 44 namespace WebCore { 45 45 46 bool windowsCanHandleDrawTextShadow(GraphicsContext *context) 47 { 48 FloatSize shadowOffset; 49 float shadowBlur; 50 Color shadowColor; 51 ColorSpace shadowColorSpace; 52 53 bool hasShadow = context->getShadow(shadowOffset, shadowBlur, shadowColor, shadowColorSpace); 54 return !hasShadow || (!shadowBlur && (shadowColor.alpha() == 255) && (context->fillColor().alpha() == 255)); 55 } 56 57 bool windowsCanHandleTextDrawing(GraphicsContext* context) 58 { 59 if (!windowsCanHandleTextDrawingWithoutShadow(context)) 60 return false; 61 62 // Check for shadow effects. 63 if (!windowsCanHandleDrawTextShadow(context)) 64 return false; 65 66 return true; 67 } 68 69 bool windowsCanHandleTextDrawingWithoutShadow(GraphicsContext* context) 70 { 71 // Check for non-translation transforms. Sometimes zooms will look better in 72 // Skia, and sometimes better in Windows. The main problem is that zooming 73 // in using Skia will show you the hinted outlines for the smaller size, 74 // which look weird. All else being equal, it's better to use Windows' text 75 // drawing, so we don't check for zooms. 76 const AffineTransform& matrix = context->getCTM(); 77 if (matrix.b() != 0 || matrix.c() != 0) // Check for skew. 78 return false; 79 80 // Check for stroke effects. 81 if (context->platformContext()->getTextDrawingMode() != TextModeFill) 82 return false; 83 84 // Check for gradients. 85 if (context->fillGradient() || context->strokeGradient()) 86 return false; 87 88 // Check for patterns. 89 if (context->fillPattern() || context->strokePattern()) 90 return false; 91 92 if (!context->platformContext()->isNativeFontRenderingAllowed()) 93 return false; 94 95 return true; 96 } 97 46 98 static void skiaDrawText(SkCanvas* canvas, 47 99 const SkPoint& point, -
trunk/Source/WebCore/platform/graphics/skia/SkiaFontWin.h
r92022 r92150 40 40 41 41 class GraphicsContext; 42 class PlatformContextSkia; 43 44 // The functions below are used for more complex font drawing (effects such as 45 // stroking and more complex transforms) than Windows supports directly. Since 46 // Windows drawing is faster you should use windowsCanHandleTextDrawing first to 47 // check if using Skia is required at all. 48 // Note that the text will look different (no ClearType) so this should only be 49 // used when necessary. 50 // 51 // When you call a Skia* text drawing function, various glyph outlines will be 52 // cached. As a result, you should call SkiaWinOutlineCache::removePathsForFont 53 // when the font is destroyed so that the cache does not outlive the font (since 54 // the HFONTs are recycled). 55 // 56 // Remember that Skia's text drawing origin is the baseline, like WebKit, not 57 // the top, like Windows. 58 59 // Returns true if the fillColor and shadowColor are opaque and the text-shadow 60 // is not blurred. 61 bool windowsCanHandleDrawTextShadow(GraphicsContext*); 62 63 // Returns true if advanced font rendering is recommended. 64 bool windowsCanHandleTextDrawing(GraphicsContext*); 65 66 // Returns true if advanced font rendering is recommended if shadows are 67 // disregarded. 68 bool windowsCanHandleTextDrawingWithoutShadow(GraphicsContext*); 42 69 43 70 // Note that the offsets parameter is optional. If not NULL it represents a
Note:
See TracChangeset
for help on using the changeset viewer.