Changeset 41279 in webkit
- Timestamp:
- Feb 27, 2009 12:20:15 AM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r41274 r41279 1 2009-02-26 Dirk Schulze <krit@webkit.org> 2 3 Reviewed by Oliver Hunt. 4 5 Added support for Gradients and Patterns on filled or stroked Fonts 6 in Cairo. I also added support for globalAlpha on FontCairo. 7 8 [CAIRO] SVG/Canvas fonts miss gradients/pattern support 9 https://bugs.webkit.org/show_bug.cgi?id=18617 10 11 * html/CanvasRenderingContext2D.cpp: 12 (WebCore::CanvasRenderingContext2D::drawTextInternal): 13 * platform/graphics/cairo/FontCairo.cpp: 14 (WebCore::Font::drawGlyphs): 15 1 16 2009-02-26 Stephen White <senorblanco@chromium.org> 2 17 -
trunk/WebCore/html/CanvasRenderingContext2D.cpp
r40761 r41279 1419 1419 1420 1420 CanvasStyle* drawStyle = fill ? state().m_fillStyle.get() : state().m_strokeStyle.get(); 1421 #if PLATFORM(CG) 1421 1422 if (drawStyle->canvasGradient() || drawStyle->canvasPattern()) { 1422 1423 // FIXME: The rect is not big enough for miters on stroked text. … … 1447 1448 return; 1448 1449 } 1450 #endif 1449 1451 1450 1452 c->setTextDrawingMode(fill ? cTextFill : cTextStroke); -
trunk/WebCore/platform/graphics/cairo/FontCairo.cpp
r36070 r41279 3 3 * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com 4 4 * Copyright (C) 2007, 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 6 * 6 7 * Redistribution and use in source and binary forms, with or without … … 30 31 31 32 #include "GlyphBuffer.h" 33 #include "Gradient.h" 32 34 #include "GraphicsContext.h" 35 #include "Pattern.h" 33 36 #include "SimpleFontData.h" 37 #include "TransformationMatrix.h" 34 38 35 39 namespace WebCore { … … 79 83 80 84 if (context->textDrawingMode() & cTextFill) { 81 float red, green, blue, alpha; 82 fillColor.getRGBA(red, green, blue, alpha); 83 cairo_set_source_rgba(cr, red, green, blue, alpha); 84 85 if (context->fillGradient()) { 86 cairo_set_source(cr, context->fillGradient()->platformGradient()); 87 if (context->getAlpha() < 1.0f) { 88 cairo_push_group(cr); 89 cairo_paint_with_alpha(cr, context->getAlpha()); 90 cairo_pop_group_to_source(cr); 91 } 92 } else if (context->fillPattern()) { 93 TransformationMatrix affine; 94 cairo_set_source(cr, context->fillPattern()->createPlatformPattern(affine)); 95 if (context->getAlpha() < 1.0f) { 96 cairo_push_group(cr); 97 cairo_paint_with_alpha(cr, context->getAlpha()); 98 cairo_pop_group_to_source(cr); 99 } 100 } else { 101 float red, green, blue, alpha; 102 fillColor.getRGBA(red, green, blue, alpha); 103 cairo_set_source_rgba(cr, red, green, blue, alpha * context->getAlpha()); 104 } 85 105 cairo_show_glyphs(cr, glyphs, numGlyphs); 86 106 } 87 107 88 108 if (context->textDrawingMode() & cTextStroke) { 89 Color strokeColor = context->strokeColor(); 90 float red, green, blue, alpha; 91 strokeColor.getRGBA(red, green, blue, alpha); 92 cairo_set_source_rgba(cr, red, green, blue, alpha); 109 if (context->strokeGradient()) { 110 cairo_set_source(cr, context->strokeGradient()->platformGradient()); 111 if (context->getAlpha() < 1.0f) { 112 cairo_push_group(cr); 113 cairo_paint_with_alpha(cr, context->getAlpha()); 114 cairo_pop_group_to_source(cr); 115 } 116 } else if (context->strokePattern()) { 117 TransformationMatrix affine; 118 cairo_set_source(cr, context->strokePattern()->createPlatformPattern(affine)); 119 if (context->getAlpha() < 1.0f) { 120 cairo_push_group(cr); 121 cairo_paint_with_alpha(cr, context->getAlpha()); 122 cairo_pop_group_to_source(cr); 123 } 124 } else { 125 Color strokeColor = context->strokeColor(); 126 float red, green, blue, alpha; 127 strokeColor.getRGBA(red, green, blue, alpha); 128 cairo_set_source_rgba(cr, red, green, blue, alpha * context->getAlpha()); 129 } 93 130 cairo_glyph_path(cr, glyphs, numGlyphs); 94 131 cairo_set_line_width(cr, context->strokeThickness());
Note: See TracChangeset
for help on using the changeset viewer.