[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
simon.fraser at apple.com
simon.fraser at apple.com
Wed Dec 22 17:58:30 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 41015fa07a9631868a0dd56ab8b46d99520706ad
Author: simon.fraser at apple.com <simon.fraser at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Dec 3 20:08:04 2010 +0000
2010-12-03 Simon Fraser <simon.fraser at apple.com>
Reviewed by Nikolas Zimmermann.
Clean up some text-related code on GraphicsContext
https://bugs.webkit.org/show_bug.cgi?id=50464
Use defined types for textDrawingMode and it's associated flags.
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawTextInternal):
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::textDrawingMode):
(WebCore::GraphicsContext::setTextDrawingMode):
(WebCore::GraphicsContext::setPlatformTextDrawingMode):
* platform/graphics/GraphicsContext.h:
* platform/graphics/GraphicsContextPrivate.h:
(WebCore::GraphicsContextState::GraphicsContextState):
* platform/graphics/cairo/FontCairo.cpp:
(WebCore::drawGlyphsShadow):
(WebCore::Font::drawGlyphs):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::setPlatformTextDrawingMode):
* platform/graphics/chromium/FontLinux.cpp:
(WebCore::Font::drawGlyphs):
(WebCore::Font::drawComplexText):
* platform/graphics/gtk/FontGtk.cpp:
(WebCore::drawGlyphsShadow):
(WebCore::Font::drawComplexText):
* platform/graphics/mac/FontMac.mm:
(WebCore::Font::drawGlyphs):
* platform/graphics/openvg/PainterOpenVG.cpp:
(WebCore::PlatformPainterState::PlatformPainterState):
(WebCore::PainterOpenVG::textDrawingMode):
(WebCore::PainterOpenVG::setTextDrawingMode):
(WebCore::PainterOpenVG::drawText):
* platform/graphics/qt/FontQt.cpp:
(WebCore::drawTextCommon):
* platform/graphics/skia/PlatformContextSkia.cpp:
(WebCore::PlatformContextSkia::State::State):
(WebCore::PlatformContextSkia::getTextDrawingMode):
(WebCore::PlatformContextSkia::setTextDrawingMode):
* platform/graphics/skia/SkiaFontWin.cpp:
(WebCore::windowsCanHandleTextDrawing):
(WebCore::paintSkiaText):
* platform/graphics/texmap/TextureMapper.h:
(WebCore::TextureMapper::setTextDrawingMode):
(WebCore::TextureMapper::textDrawingMode):
(WebCore::TextureMapper::TextureMapper):
* platform/graphics/win/FontCGWin.cpp:
(WebCore::drawGDIGlyphs):
(WebCore::Font::drawGlyphs):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::drawText):
* rendering/InlineTextBox.cpp:
(WebCore::updateGraphicsContext):
* rendering/RenderSVGResourceGradient.cpp:
(WebCore::RenderSVGResourceGradient::applyResource):
* rendering/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::applyResource):
* rendering/RenderSVGResourceSolidColor.cpp:
(WebCore::RenderSVGResourceSolidColor::applyResource):
* svg/SVGFont.cpp:
(WebCore::Font::drawTextUsingSVGFont):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73284 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e7b3aa7..346f506 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,68 @@
+2010-12-03 Simon Fraser <simon.fraser at apple.com>
+
+ Reviewed by Nikolas Zimmermann.
+
+ Clean up some text-related code on GraphicsContext
+ https://bugs.webkit.org/show_bug.cgi?id=50464
+
+ Use defined types for textDrawingMode and it's associated flags.
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::drawTextInternal):
+ * platform/graphics/GraphicsContext.cpp:
+ (WebCore::GraphicsContext::textDrawingMode):
+ (WebCore::GraphicsContext::setTextDrawingMode):
+ (WebCore::GraphicsContext::setPlatformTextDrawingMode):
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/GraphicsContextPrivate.h:
+ (WebCore::GraphicsContextState::GraphicsContextState):
+ * platform/graphics/cairo/FontCairo.cpp:
+ (WebCore::drawGlyphsShadow):
+ (WebCore::Font::drawGlyphs):
+ * platform/graphics/cg/GraphicsContextCG.cpp:
+ (WebCore::GraphicsContext::setPlatformTextDrawingMode):
+ * platform/graphics/chromium/FontLinux.cpp:
+ (WebCore::Font::drawGlyphs):
+ (WebCore::Font::drawComplexText):
+ * platform/graphics/gtk/FontGtk.cpp:
+ (WebCore::drawGlyphsShadow):
+ (WebCore::Font::drawComplexText):
+ * platform/graphics/mac/FontMac.mm:
+ (WebCore::Font::drawGlyphs):
+ * platform/graphics/openvg/PainterOpenVG.cpp:
+ (WebCore::PlatformPainterState::PlatformPainterState):
+ (WebCore::PainterOpenVG::textDrawingMode):
+ (WebCore::PainterOpenVG::setTextDrawingMode):
+ (WebCore::PainterOpenVG::drawText):
+ * platform/graphics/qt/FontQt.cpp:
+ (WebCore::drawTextCommon):
+ * platform/graphics/skia/PlatformContextSkia.cpp:
+ (WebCore::PlatformContextSkia::State::State):
+ (WebCore::PlatformContextSkia::getTextDrawingMode):
+ (WebCore::PlatformContextSkia::setTextDrawingMode):
+ * platform/graphics/skia/SkiaFontWin.cpp:
+ (WebCore::windowsCanHandleTextDrawing):
+ (WebCore::paintSkiaText):
+ * platform/graphics/texmap/TextureMapper.h:
+ (WebCore::TextureMapper::setTextDrawingMode):
+ (WebCore::TextureMapper::textDrawingMode):
+ (WebCore::TextureMapper::TextureMapper):
+ * platform/graphics/win/FontCGWin.cpp:
+ (WebCore::drawGDIGlyphs):
+ (WebCore::Font::drawGlyphs):
+ * platform/graphics/wince/GraphicsContextWinCE.cpp:
+ (WebCore::GraphicsContext::drawText):
+ * rendering/InlineTextBox.cpp:
+ (WebCore::updateGraphicsContext):
+ * rendering/RenderSVGResourceGradient.cpp:
+ (WebCore::RenderSVGResourceGradient::applyResource):
+ * rendering/RenderSVGResourcePattern.cpp:
+ (WebCore::RenderSVGResourcePattern::applyResource):
+ * rendering/RenderSVGResourceSolidColor.cpp:
+ (WebCore::RenderSVGResourceSolidColor::applyResource):
+ * svg/SVGFont.cpp:
+ (WebCore::Font::drawTextUsingSVGFont):
+
2010-12-03 Chris Rogers <crogers at google.com>
Reviewed by Kenneth Russell.
diff --git a/WebCore/html/canvas/CanvasRenderingContext2D.cpp b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
index eb552c6..45b9c55 100644
--- a/WebCore/html/canvas/CanvasRenderingContext2D.cpp
+++ b/WebCore/html/canvas/CanvasRenderingContext2D.cpp
@@ -1830,7 +1830,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
maskImageContext->setStrokeThickness(c->strokeThickness());
}
- maskImageContext->setTextDrawingMode(fill ? cTextFill : cTextStroke);
+ maskImageContext->setTextDrawingMode(fill ? TextModeFill : TextModeStroke);
maskImageContext->translate(-maskRect.x(), -maskRect.y());
maskImageContext->drawBidiText(font, textRun, location);
@@ -1845,7 +1845,7 @@ void CanvasRenderingContext2D::drawTextInternal(const String& text, float x, flo
}
#endif
- c->setTextDrawingMode(fill ? cTextFill : cTextStroke);
+ c->setTextDrawingMode(fill ? TextModeFill : TextModeStroke);
#if PLATFORM(QT)
// We always use complex text shaping since it can't be turned off for QPainterPath::addText().
diff --git a/WebCore/platform/graphics/GraphicsContext.cpp b/WebCore/platform/graphics/GraphicsContext.cpp
index f5e9b14..2edcc6d 100644
--- a/WebCore/platform/graphics/GraphicsContext.cpp
+++ b/WebCore/platform/graphics/GraphicsContext.cpp
@@ -526,12 +526,12 @@ void GraphicsContext::clipToImageBuffer(ImageBuffer* buffer, const FloatRect& re
buffer->clip(this, rect);
}
-int GraphicsContext::textDrawingMode()
+TextDrawingModeFlags GraphicsContext::textDrawingMode() const
{
return m_common->state.textDrawingMode;
}
-void GraphicsContext::setTextDrawingMode(int mode)
+void GraphicsContext::setTextDrawingMode(TextDrawingModeFlags mode)
{
m_common->state.textDrawingMode = mode;
if (paintingDisabled())
@@ -567,7 +567,7 @@ void GraphicsContext::setPlatformStrokePattern(Pattern*)
#if !PLATFORM(CG) && !PLATFORM(SKIA)
// Implement this if you want to go ahead and push the drawing mode into your native context
// immediately.
-void GraphicsContext::setPlatformTextDrawingMode(int mode)
+void GraphicsContext::setPlatformTextDrawingMode(TextDrawingModeFlags mode)
{
}
#endif
diff --git a/WebCore/platform/graphics/GraphicsContext.h b/WebCore/platform/graphics/GraphicsContext.h
index 551adc3..57b43b8 100644
--- a/WebCore/platform/graphics/GraphicsContext.h
+++ b/WebCore/platform/graphics/GraphicsContext.h
@@ -131,11 +131,13 @@ namespace WebCore {
class SharedGraphicsContext3D;
class TextRun;
- // These bits can be ORed together for a total of 8 possible text drawing modes.
- const int cTextInvisible = 0;
- const int cTextFill = 1;
- const int cTextStroke = 2;
- const int cTextClip = 4;
+ enum TextDrawingMode {
+ TextModeInvisible = 0,
+ TextModeFill = 1 << 0,
+ TextModeStroke = 1 << 1,
+ TextModeClip = 1 << 2
+ };
+ typedef unsigned TextDrawingModeFlags;
enum StrokeStyle {
NoStroke,
@@ -256,8 +258,8 @@ namespace WebCore {
void clipConvexPolygon(size_t numPoints, const FloatPoint*, bool antialias = true);
void clipToImageBuffer(ImageBuffer*, const FloatRect&);
- int textDrawingMode();
- void setTextDrawingMode(int);
+ TextDrawingModeFlags textDrawingMode() const;
+ void setTextDrawingMode(TextDrawingModeFlags);
void drawText(const Font&, const TextRun&, const IntPoint&, int from = 0, int to = -1);
void drawBidiText(const Font&, const TextRun&, const FloatPoint&);
@@ -421,7 +423,7 @@ namespace WebCore {
void savePlatformState();
void restorePlatformState();
- void setPlatformTextDrawingMode(int);
+ void setPlatformTextDrawingMode(TextDrawingModeFlags);
void setPlatformFont(const Font& font);
void setPlatformStrokeColor(const Color&, ColorSpace);
diff --git a/WebCore/platform/graphics/GraphicsContextPrivate.h b/WebCore/platform/graphics/GraphicsContextPrivate.h
index 696932e..273bffe 100644
--- a/WebCore/platform/graphics/GraphicsContextPrivate.h
+++ b/WebCore/platform/graphics/GraphicsContextPrivate.h
@@ -34,7 +34,7 @@ namespace WebCore {
struct GraphicsContextState {
GraphicsContextState()
- : textDrawingMode(cTextFill)
+ : textDrawingMode(TextModeFill)
, strokeStyle(SolidStroke)
, strokeThickness(0)
, strokeColor(Color::black)
@@ -52,7 +52,7 @@ namespace WebCore {
{
}
- int textDrawingMode;
+ TextDrawingModeFlags textDrawingMode;
StrokeStyle strokeStyle;
float strokeThickness;
diff --git a/WebCore/platform/graphics/cairo/FontCairo.cpp b/WebCore/platform/graphics/cairo/FontCairo.cpp
index 3d55c70..4b11756 100644
--- a/WebCore/platform/graphics/cairo/FontCairo.cpp
+++ b/WebCore/platform/graphics/cairo/FontCairo.cpp
@@ -69,7 +69,7 @@ static void drawGlyphsShadow(GraphicsContext* graphicsContext, cairo_t* context,
ContextShadow* shadow = graphicsContext->contextShadow();
ASSERT(shadow);
- if (!(graphicsContext->textDrawingMode() & cTextFill) || shadow->m_type == ContextShadow::NoShadow)
+ if (!(graphicsContext->textDrawingMode() & TextModeFill) || shadow->m_type == ContextShadow::NoShadow)
return;
if (shadow->m_type == ContextShadow::SolidShadow) {
@@ -111,7 +111,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons
cairo_save(cr);
prepareContextForGlyphDrawing(cr, font, point);
- if (context->textDrawingMode() & cTextFill) {
+ if (context->textDrawingMode() & TextModeFill) {
if (context->fillGradient()) {
cairo_set_source(cr, context->fillGradient()->platformGradient());
if (context->getAlpha() < 1.0f) {
@@ -141,7 +141,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons
// twice the size of the width of the text we will not ask cairo to stroke
// the text as even one single stroke would cover the full wdth of the text.
// See https://bugs.webkit.org/show_bug.cgi?id=33759.
- if (context->textDrawingMode() & cTextStroke && context->strokeThickness() < 2 * offset) {
+ if (context->textDrawingMode() & TextModeStroke && context->strokeThickness() < 2 * offset) {
if (context->strokeGradient()) {
cairo_set_source(cr, context->strokeGradient()->platformGradient());
if (context->getAlpha() < 1.0f) {
diff --git a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
index 2eb929e..cbcb104 100644
--- a/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
+++ b/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
@@ -1116,7 +1116,7 @@ InterpolationQuality GraphicsContext::imageInterpolationQuality() const
return InterpolationDefault;
}
-void GraphicsContext::setPlatformTextDrawingMode(int mode)
+void GraphicsContext::setPlatformTextDrawingMode(TextDrawingModeFlags mode)
{
if (paintingDisabled())
return;
@@ -1124,28 +1124,28 @@ void GraphicsContext::setPlatformTextDrawingMode(int mode)
// Wow, wish CG had used bits here.
CGContextRef context = platformContext();
switch (mode) {
- case cTextInvisible: // Invisible
+ case TextModeInvisible:
CGContextSetTextDrawingMode(context, kCGTextInvisible);
break;
- case cTextFill: // Fill
+ case TextModeFill:
CGContextSetTextDrawingMode(context, kCGTextFill);
break;
- case cTextStroke: // Stroke
+ case TextModeStroke:
CGContextSetTextDrawingMode(context, kCGTextStroke);
break;
- case 3: // Fill | Stroke
+ case TextModeFill | TextModeStroke:
CGContextSetTextDrawingMode(context, kCGTextFillStroke);
break;
- case cTextClip: // Clip
+ case TextModeClip:
CGContextSetTextDrawingMode(context, kCGTextClip);
break;
- case 5: // Fill | Clip
+ case TextModeFill | TextModeClip:
CGContextSetTextDrawingMode(context, kCGTextFillClip);
break;
- case 6: // Stroke | Clip
+ case TextModeStroke | TextModeClip:
CGContextSetTextDrawingMode(context, kCGTextStrokeClip);
break;
- case 7: // Fill | Stroke | Clip
+ case TextModeFill | TextModeStroke | TextModeClip:
CGContextSetTextDrawingMode(context, kCGTextFillStrokeClip);
break;
default:
diff --git a/WebCore/platform/graphics/chromium/FontLinux.cpp b/WebCore/platform/graphics/chromium/FontLinux.cpp
index 82b9df7..d1cfac6 100644
--- a/WebCore/platform/graphics/chromium/FontLinux.cpp
+++ b/WebCore/platform/graphics/chromium/FontLinux.cpp
@@ -103,10 +103,10 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
gc->platformContext()->prepareForSoftwareDraw();
SkCanvas* canvas = gc->platformContext()->canvas();
- int textMode = gc->platformContext()->getTextDrawingMode();
+ TextDrawingModeFlags textMode = gc->platformContext()->getTextDrawingMode();
// We draw text up to two times (once for fill, once for stroke).
- if (textMode & cTextFill) {
+ if (textMode & TextModeFill) {
SkPaint paint;
gc->platformContext()->setupPaintForFilling(&paint);
font->platformData().setupPaint(&paint);
@@ -116,7 +116,7 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
canvas->drawPosText(glyphs, numGlyphs << 1, pos, paint);
}
- if ((textMode & cTextStroke)
+ if ((textMode & TextModeStroke)
&& gc->platformContext()->getStrokeStyle() != NoStroke
&& gc->platformContext()->getStrokeThickness() > 0) {
@@ -127,7 +127,7 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font,
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
paint.setColor(gc->strokeColor().rgb());
- if (textMode & cTextFill) {
+ if (textMode & TextModeFill) {
// If we also filled, we don't want to draw shadows twice.
// See comment in FontChromiumWin.cpp::paintSkiaText() for more details.
SkSafeUnref(paint.setLooper(0));
@@ -651,9 +651,9 @@ void Font::drawComplexText(GraphicsContext* gc, const TextRun& run,
return;
SkCanvas* canvas = gc->platformContext()->canvas();
- int textMode = gc->platformContext()->getTextDrawingMode();
- bool fill = textMode & cTextFill;
- bool stroke = (textMode & cTextStroke)
+ TextDrawingModeFlags textMode = gc->platformContext()->getTextDrawingMode();
+ bool fill = textMode & TextModeFill;
+ bool stroke = (textMode & TextModeStroke)
&& gc->platformContext()->getStrokeStyle() != NoStroke
&& gc->platformContext()->getStrokeThickness() > 0;
diff --git a/WebCore/platform/graphics/gtk/FontGtk.cpp b/WebCore/platform/graphics/gtk/FontGtk.cpp
index 54e18c9..f6c5f2a 100644
--- a/WebCore/platform/graphics/gtk/FontGtk.cpp
+++ b/WebCore/platform/graphics/gtk/FontGtk.cpp
@@ -218,7 +218,7 @@ static void drawGlyphsShadow(GraphicsContext* graphicsContext, cairo_t* context,
ContextShadow* shadow = graphicsContext->contextShadow();
ASSERT(shadow);
- if (!(graphicsContext->textDrawingMode() & cTextFill) || shadow->m_type == ContextShadow::NoShadow)
+ if (!(graphicsContext->textDrawingMode() & TextModeFill) || shadow->m_type == ContextShadow::NoShadow)
return;
FloatPoint totalOffset(point + shadow->m_offset);
@@ -300,7 +300,7 @@ void Font::drawComplexText(GraphicsContext* context, const TextRun& run, const F
pango_cairo_show_layout_line(cr, layoutLine);
- if (context->textDrawingMode() & cTextStroke) {
+ if (context->textDrawingMode() & TextModeStroke) {
Color strokeColor = context->strokeColor();
strokeColor.getRGBA(red, green, blue, alpha);
cairo_set_source_rgba(cr, red, green, blue, alpha);
diff --git a/WebCore/platform/graphics/mac/FontMac.mm b/WebCore/platform/graphics/mac/FontMac.mm
index 8dc741b..8f15cb3 100644
--- a/WebCore/platform/graphics/mac/FontMac.mm
+++ b/WebCore/platform/graphics/mac/FontMac.mm
@@ -160,7 +160,7 @@ void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, cons
ColorSpace fillColorSpace = context->fillColorSpace();
context->getShadow(shadowOffset, shadowBlur, shadowColor);
- bool hasSimpleShadow = context->textDrawingMode() == cTextFill && shadowColor.isValid() && !shadowBlur && !platformData.isColorBitmapFont();
+ bool hasSimpleShadow = context->textDrawingMode() == TextModeFill && shadowColor.isValid() && !shadowBlur && !platformData.isColorBitmapFont();
if (hasSimpleShadow) {
// Paint simple shadows ourselves instead of relying on CG shadows, to avoid losing subpixel antialiasing.
context->clearShadow();
diff --git a/WebCore/platform/graphics/openvg/PainterOpenVG.cpp b/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
index 7409a97..54937a4 100644
--- a/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
+++ b/WebCore/platform/graphics/openvg/PainterOpenVG.cpp
@@ -123,7 +123,7 @@ struct PlatformPainterState {
DashArray strokeDashArray;
float strokeDashOffset;
- int textDrawingMode;
+ TextDrawingModeFlags textDrawingMode;
bool antialiasingEnabled;
PlatformPainterState()
@@ -141,7 +141,7 @@ struct PlatformPainterState {
, strokeLineJoin(MiterJoin)
, strokeMiterLimit(4.0)
, strokeDashOffset(0.0)
- , textDrawingMode(cTextFill)
+ , textDrawingMode(TextModeFill)
, antialiasingEnabled(true)
{
}
@@ -653,13 +653,13 @@ void PainterOpenVG::setFillColor(const Color& color)
setVGSolidColor(VG_FILL_PATH, color);
}
-int PainterOpenVG::textDrawingMode() const
+TextDrawingModeFlags PainterOpenVG::textDrawingMode() const
{
ASSERT(m_state);
return m_state->textDrawingMode;
}
-void PainterOpenVG::setTextDrawingMode(int mode)
+void PainterOpenVG::setTextDrawingMode(TextDrawingModeFlags mode)
{
ASSERT(m_state);
m_state->textDrawingMode = mode;
@@ -1114,11 +1114,11 @@ void PainterOpenVG::drawText(VGFont vgFont, Vector<VGuint>& characters, VGfloat*
VGbitfield paintModes = 0;
- if (m_state->textDrawingMode & cTextClip)
+ if (m_state->textDrawingMode & TextModeClip)
return; // unsupported for every port except CG at the time of writing
- if (m_state->textDrawingMode & cTextFill && !m_state->fillDisabled())
+ if (m_state->textDrawingMode & TextModeFill && !m_state->fillDisabled())
paintModes |= VG_FILL_PATH;
- if (m_state->textDrawingMode & cTextStroke && !m_state->strokeDisabled())
+ if (m_state->textDrawingMode & TextModeStroke && !m_state->strokeDisabled())
paintModes |= VG_STROKE_PATH;
m_surface->makeCurrent();
diff --git a/WebCore/platform/graphics/qt/FontQt.cpp b/WebCore/platform/graphics/qt/FontQt.cpp
index 89dfd00..1ee2b29 100644
--- a/WebCore/platform/graphics/qt/FontQt.cpp
+++ b/WebCore/platform/graphics/qt/FontQt.cpp
@@ -79,7 +79,7 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
QPainter *p = ctx->platformContext();
QPen textFillPen;
- if (ctx->textDrawingMode() & cTextFill) {
+ if (ctx->textDrawingMode() & TextModeFill) {
if (ctx->fillGradient()) {
QBrush brush(*ctx->fillGradient()->platformGradient());
brush.setTransform(ctx->fillGradient()->gradientSpaceTransform());
@@ -92,7 +92,7 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
}
QPen textStrokePen;
- if (ctx->textDrawingMode() & cTextStroke) {
+ if (ctx->textDrawingMode() & TextModeStroke) {
if (ctx->strokeGradient()) {
QBrush brush(*ctx->strokeGradient()->platformGradient());
brush.setTransform(ctx->strokeGradient()->gradientSpaceTransform());
@@ -179,17 +179,17 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
int flags = run.rtl() ? Qt::TextForceRightToLeft : Qt::TextForceLeftToRight;
#if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)
// See QWebPagePrivate::QWebPagePrivate() where the default path is set to Complex for Qt 4.6 and earlier.
- if (!isComplexText && !(ctx->textDrawingMode() & cTextStroke))
+ if (!isComplexText && !(ctx->textDrawingMode() & TextModeStroke))
flags |= Qt::TextBypassShaping;
#endif
QPainterPath textStrokePath;
- if (ctx->textDrawingMode() & cTextStroke)
+ if (ctx->textDrawingMode() & TextModeStroke)
textStrokePath.addText(pt, font, string);
ContextShadow* ctxShadow = ctx->contextShadow();
if (ctxShadow->m_type != ContextShadow::NoShadow) {
- if (ctx->textDrawingMode() & cTextFill) {
+ if (ctx->textDrawingMode() & TextModeFill) {
if (ctxShadow->m_type != ContextShadow::BlurShadow) {
p->save();
p->setPen(ctxShadow->m_color);
@@ -212,7 +212,7 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
ctxShadow->endShadowLayer(p);
}
}
- } else if (ctx->textDrawingMode() & cTextStroke) {
+ } else if (ctx->textDrawingMode() & TextModeStroke) {
if (ctxShadow->m_type != ContextShadow::BlurShadow) {
p->translate(ctxShadow->offset());
p->strokePath(textStrokePath, QPen(ctxShadow->m_color));
@@ -235,10 +235,10 @@ static void drawTextCommon(GraphicsContext* ctx, const TextRun& run, const Float
}
}
- if (ctx->textDrawingMode() & cTextStroke)
+ if (ctx->textDrawingMode() & TextModeStroke)
p->strokePath(textStrokePath, textStrokePen);
- if (ctx->textDrawingMode() & cTextFill) {
+ if (ctx->textDrawingMode() & TextModeFill) {
QPen previousPen = p->pen();
p->setPen(textFillPen);
p->drawText(pt, string, flags, run.padding());
diff --git a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
index d610c2a..c8f9b86 100644
--- a/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
+++ b/WebCore/platform/graphics/skia/PlatformContextSkia.cpp
@@ -94,8 +94,8 @@ struct PlatformContextSkia::State {
SkPaint::Join m_lineJoin;
SkDashPathEffect* m_dash;
- // Text. (See cTextFill & friends in GraphicsContext.h.)
- int m_textDrawingMode;
+ // Text. (See TextModeFill & friends in GraphicsContext.h.)
+ TextDrawingModeFlags m_textDrawingMode;
// Helper function for applying the state's alpha value to the given input
// color to produce a new output color.
@@ -137,7 +137,7 @@ PlatformContextSkia::State::State()
, m_lineCap(SkPaint::kDefault_Cap)
, m_lineJoin(SkPaint::kDefault_Join)
, m_dash(0)
- , m_textDrawingMode(cTextFill)
+ , m_textDrawingMode(TextModeFill)
, m_interpolationQuality(InterpolationHigh)
, m_canvasClipApplied(false)
{
@@ -501,7 +501,7 @@ void PlatformContextSkia::setStrokeShader(SkShader* strokeShader)
}
}
-int PlatformContextSkia::getTextDrawingMode() const
+TextDrawingModeFlags PlatformContextSkia::getTextDrawingMode() const
{
return m_state->m_textDrawingMode;
}
@@ -521,11 +521,11 @@ int PlatformContextSkia::getNormalizedAlpha() const
return alpha;
}
-void PlatformContextSkia::setTextDrawingMode(int mode)
+void PlatformContextSkia::setTextDrawingMode(TextDrawingModeFlags mode)
{
- // cTextClip is never used, so we assert that it isn't set:
+ // TextModeClip is never used, so we assert that it isn't set:
// https://bugs.webkit.org/show_bug.cgi?id=21898
- ASSERT(!(mode & cTextClip));
+ ASSERT(!(mode & TextModeClip));
m_state->m_textDrawingMode = mode;
}
diff --git a/WebCore/platform/graphics/skia/SkiaFontWin.cpp b/WebCore/platform/graphics/skia/SkiaFontWin.cpp
index 6acfd35..62a4d96 100644
--- a/WebCore/platform/graphics/skia/SkiaFontWin.cpp
+++ b/WebCore/platform/graphics/skia/SkiaFontWin.cpp
@@ -242,7 +242,7 @@ bool windowsCanHandleTextDrawing(GraphicsContext* context)
return false;
// Check for stroke effects.
- if (context->platformContext()->getTextDrawingMode() != cTextFill)
+ if (context->platformContext()->getTextDrawingMode() != TextModeFill)
return false;
// Check for gradients.
@@ -307,7 +307,7 @@ bool paintSkiaText(GraphicsContext* context,
HGDIOBJ oldFont = SelectObject(dc, hfont);
PlatformContextSkia* platformContext = context->platformContext();
- int textMode = platformContext->getTextDrawingMode();
+ TextDrawingModeFlags textMode = platformContext->getTextDrawingMode();
// Filling (if necessary). This is the common case.
SkPaint paint;
@@ -315,7 +315,7 @@ bool paintSkiaText(GraphicsContext* context,
paint.setFlags(SkPaint::kAntiAlias_Flag);
bool didFill = false;
- if ((textMode & cTextFill) && SkColorGetA(paint.getColor())) {
+ if ((textMode & TextModeFill) && SkColorGetA(paint.getColor())) {
if (!skiaDrawText(hfont, dc, platformContext->canvas(), *origin, &paint,
&glyphs[0], &advances[0], &offsets[0], numGlyphs))
return false;
@@ -323,7 +323,7 @@ bool paintSkiaText(GraphicsContext* context,
}
// Stroking on top (if necessary).
- if ((textMode & cTextStroke)
+ if ((textMode & TextModeStroke)
&& platformContext->getStrokeStyle() != NoStroke
&& platformContext->getStrokeThickness() > 0) {
diff --git a/WebCore/platform/graphics/texmap/TextureMapper.h b/WebCore/platform/graphics/texmap/TextureMapper.h
index 250125b..589fda1 100644
--- a/WebCore/platform/graphics/texmap/TextureMapper.h
+++ b/WebCore/platform/graphics/texmap/TextureMapper.h
@@ -110,22 +110,22 @@ public:
virtual PassRefPtr<BitmapTexture> createTexture() = 0;
void setImageInterpolationQuality(InterpolationQuality quality) { m_interpolationQuality = quality; }
- void setTextDrawingMode(int mode) { m_textDrawingMode = mode; }
+ void setTextDrawingMode(TextDrawingModeFlags mode) { m_textDrawingMode = mode; }
InterpolationQuality imageInterpolationQuality() const { return m_interpolationQuality; }
- int textDrawingMode() const { return m_textDrawingMode; }
+ TextDrawingModeFlags textDrawingMode() const { return m_textDrawingMode; }
void setViewportSize(const IntSize&);
protected:
TextureMapper()
: m_interpolationQuality(InterpolationDefault)
- , m_textDrawingMode(cTextFill)
+ , m_textDrawingMode(TextModeFill)
{}
private:
InterpolationQuality m_interpolationQuality;
- int m_textDrawingMode;
+ TextDrawingModeFlags m_textDrawingMode;
};
};
diff --git a/WebCore/platform/graphics/win/FontCGWin.cpp b/WebCore/platform/graphics/win/FontCGWin.cpp
index 2f1fb41..a27872b 100644
--- a/WebCore/platform/graphics/win/FontCGWin.cpp
+++ b/WebCore/platform/graphics/win/FontCGWin.cpp
@@ -133,8 +133,8 @@ static void drawGDIGlyphs(GraphicsContext* graphicsContext, const SimpleFontData
Color fillColor = graphicsContext->fillColor();
bool drawIntoBitmap = false;
- int drawingMode = graphicsContext->textDrawingMode();
- if (drawingMode == cTextFill) {
+ TextDrawingModeFlags drawingMode = graphicsContext->textDrawingMode();
+ if (drawingMode == TextModeFill) {
if (!fillColor.alpha())
return;
@@ -205,7 +205,7 @@ static void drawGDIGlyphs(GraphicsContext* graphicsContext, const SimpleFontData
ModifyWorldTransform(hdc, &xform, MWT_LEFTMULTIPLY);
}
- if (drawingMode == cTextFill) {
+ if (drawingMode == TextModeFill) {
XFORM xform;
xform.eM11 = 1.0;
xform.eM12 = 0;
@@ -247,7 +247,7 @@ static void drawGDIGlyphs(GraphicsContext* graphicsContext, const SimpleFontData
CGContextSaveGState(cgContext);
CGContextConcatCTM(cgContext, initialGlyphTransform);
- if (drawingMode & cTextFill) {
+ if (drawingMode & TextModeFill) {
CGContextAddPath(cgContext, glyphPath.get());
CGContextFillPath(cgContext);
if (font->syntheticBoldOffset()) {
@@ -257,7 +257,7 @@ static void drawGDIGlyphs(GraphicsContext* graphicsContext, const SimpleFontData
CGContextTranslateCTM(cgContext, -font->syntheticBoldOffset(), 0);
}
}
- if (drawingMode & cTextStroke) {
+ if (drawingMode & TextModeStroke) {
CGContextAddPath(cgContext, glyphPath.get());
CGContextStrokePath(cgContext);
if (font->syntheticBoldOffset()) {
@@ -354,7 +354,7 @@ void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* fo
Color shadowColor;
graphicsContext->getShadow(shadowOffset, shadowBlur, shadowColor);
- bool hasSimpleShadow = graphicsContext->textDrawingMode() == cTextFill && shadowColor.isValid() && !shadowBlur;
+ bool hasSimpleShadow = graphicsContext->textDrawingMode() == TextModeFill && shadowColor.isValid() && !shadowBlur;
if (hasSimpleShadow) {
// Paint simple shadows ourselves instead of relying on CG shadows, to avoid losing subpixel antialiasing.
graphicsContext->clearShadow();
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
index 917d585..a52658f 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp
@@ -1626,7 +1626,7 @@ void GraphicsContext::drawText(const SimpleFontData* fontData, const GlyphBuffer
FloatSize shadowOffset;
float shadowBlur = 0;
Color shadowColor;
- bool hasShadow = textDrawingMode() == cTextFill
+ bool hasShadow = textDrawingMode() == TextModeFill
&& getShadow(shadowOffset, shadowBlur, shadowColor)
&& shadowColor.alpha();
COLORREF shadowRGBColor;
diff --git a/WebCore/rendering/InlineTextBox.cpp b/WebCore/rendering/InlineTextBox.cpp
index d055185..109597f 100644
--- a/WebCore/rendering/InlineTextBox.cpp
+++ b/WebCore/rendering/InlineTextBox.cpp
@@ -284,19 +284,19 @@ Color correctedTextColor(Color textColor, Color backgroundColor)
void updateGraphicsContext(GraphicsContext* context, const Color& fillColor, const Color& strokeColor, float strokeThickness, ColorSpace colorSpace)
{
- int mode = context->textDrawingMode();
+ TextDrawingModeFlags mode = context->textDrawingMode();
if (strokeThickness > 0) {
- int newMode = mode | cTextStroke;
+ TextDrawingModeFlags newMode = mode | TextModeStroke;
if (mode != newMode) {
context->setTextDrawingMode(newMode);
mode = newMode;
}
}
- if (mode & cTextFill && (fillColor != context->fillColor() || colorSpace != context->fillColorSpace()))
+ if (mode & TextModeFill && (fillColor != context->fillColor() || colorSpace != context->fillColorSpace()))
context->setFillColor(fillColor, colorSpace);
- if (mode & cTextStroke) {
+ if (mode & TextModeStroke) {
if (strokeColor != context->strokeColor())
context->setStrokeColor(strokeColor, colorSpace);
if (strokeThickness != context->strokeThickness())
diff --git a/WebCore/rendering/RenderSVGResourceGradient.cpp b/WebCore/rendering/RenderSVGResourceGradient.cpp
index b76e7f8..7c383d0 100644
--- a/WebCore/rendering/RenderSVGResourceGradient.cpp
+++ b/WebCore/rendering/RenderSVGResourceGradient.cpp
@@ -209,7 +209,7 @@ bool RenderSVGResourceGradient::applyResource(RenderObject* object, RenderStyle*
}
#endif
- context->setTextDrawingMode(resourceMode & ApplyToFillMode ? cTextFill : cTextStroke);
+ context->setTextDrawingMode(resourceMode & ApplyToFillMode ? TextModeFill : TextModeStroke);
}
const SVGRenderStyle* svgStyle = style->svgStyle();
diff --git a/WebCore/rendering/RenderSVGResourcePattern.cpp b/WebCore/rendering/RenderSVGResourcePattern.cpp
index 83754ad..cd64183 100644
--- a/WebCore/rendering/RenderSVGResourcePattern.cpp
+++ b/WebCore/rendering/RenderSVGResourcePattern.cpp
@@ -165,13 +165,13 @@ bool RenderSVGResourcePattern::applyResource(RenderObject* object, RenderStyle*
if (resourceMode & ApplyToTextMode) {
if (resourceMode & ApplyToFillMode) {
- context->setTextDrawingMode(cTextFill);
+ context->setTextDrawingMode(TextModeFill);
#if PLATFORM(CG)
context->applyFillPattern();
#endif
} else if (resourceMode & ApplyToStrokeMode) {
- context->setTextDrawingMode(cTextStroke);
+ context->setTextDrawingMode(TextModeStroke);
#if PLATFORM(CG)
context->applyStrokePattern();
diff --git a/WebCore/rendering/RenderSVGResourceSolidColor.cpp b/WebCore/rendering/RenderSVGResourceSolidColor.cpp
index 1eb9da5..c2c7297 100644
--- a/WebCore/rendering/RenderSVGResourceSolidColor.cpp
+++ b/WebCore/rendering/RenderSVGResourceSolidColor.cpp
@@ -60,7 +60,7 @@ bool RenderSVGResourceSolidColor::applyResource(RenderObject* object, RenderStyl
context->setFillRule(svgStyle ? svgStyle->fillRule() : RULE_NONZERO);
if (resourceMode & ApplyToTextMode)
- context->setTextDrawingMode(cTextFill);
+ context->setTextDrawingMode(TextModeFill);
} else if (resourceMode & ApplyToStrokeMode) {
context->setAlpha(svgStyle ? svgStyle->strokeOpacity() : 1.0f);
context->setStrokeColor(m_color, colorSpace);
@@ -69,7 +69,7 @@ bool RenderSVGResourceSolidColor::applyResource(RenderObject* object, RenderStyl
SVGRenderSupport::applyStrokeStyleToContext(context, style, object);
if (resourceMode & ApplyToTextMode)
- context->setTextDrawingMode(cTextStroke);
+ context->setTextDrawingMode(TextModeStroke);
}
return true;
diff --git a/WebCore/svg/SVGFont.cpp b/WebCore/svg/SVGFont.cpp
index 4bda2d8..b0151cb 100644
--- a/WebCore/svg/SVGFont.cpp
+++ b/WebCore/svg/SVGFont.cpp
@@ -512,7 +512,7 @@ void Font::drawTextUsingSVGFont(GraphicsContext* context, const TextRun& run,
SVGTextRunWalker<SVGTextRunWalkerDrawTextData> runWalker(fontData, fontElement, data, drawTextUsingSVGFontCallback, drawTextMissingGlyphCallback);
runWalker.walk(run, isVerticalText, language, from, to);
- RenderSVGResourceMode resourceMode = context->textDrawingMode() == cTextStroke ? ApplyToStrokeMode : ApplyToFillMode;
+ RenderSVGResourceMode resourceMode = context->textDrawingMode() == TextModeStroke ? ApplyToStrokeMode : ApplyToFillMode;
unsigned numGlyphs = data.glyphIdentifiers.size();
unsigned fallbackCharacterIndex = 0;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list