Reviewed by Eric Seidel.
https://bugs.webkit.org/show_bug.cgi?id=23934
Skia platform doesn't render text decoration shadows.
Makes Skia render text decoration shadows correctly. We weren't
preparing the SkPaint correctly and didn't have a couple of checks
CG has. Additionally makes the fillColor/strokeColor methods
consistent.
This behavior is covered by existing layout tests (see bug for list).
* platform/graphics/chromium/FontChromiumWin.cpp:
(WebCore::Font::drawGlyphs):
(WebCore::Font::drawComplexText):
* platform/graphics/skia/GraphicsContextSkia.cpp:
(WebCore::GraphicsContext::drawLineForText):
* platform/graphics/skia/PlatformContextSkia.cpp:
(PlatformContextSkia::effectiveFillColor):
(PlatformContextSkia::effectiveStrokeColor):
* platform/graphics/skia/PlatformContextSkia.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@40982
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2009-02-13 Scott Violet <sky@google.com>
+
+ Reviewed by Eric Seidel.
+
+ https://bugs.webkit.org/show_bug.cgi?id=23934
+ Skia platform doesn't render text decoration shadows.
+
+ Makes Skia render text decoration shadows correctly. We weren't
+ preparing the SkPaint correctly and didn't have a couple of checks
+ CG has. Additionally makes the fillColor/strokeColor methods
+ consistent.
+
+ This behavior is covered by existing layout tests (see bug for list).
+
+ * platform/graphics/chromium/FontChromiumWin.cpp:
+ (WebCore::Font::drawGlyphs):
+ (WebCore::Font::drawComplexText):
+ * platform/graphics/skia/GraphicsContextSkia.cpp:
+ (WebCore::GraphicsContext::drawLineForText):
+ * platform/graphics/skia/PlatformContextSkia.cpp:
+ (PlatformContextSkia::effectiveFillColor):
+ (PlatformContextSkia::effectiveStrokeColor):
+ * platform/graphics/skia/PlatformContextSkia.h:
+
2009-02-12 Darin Fisher <darin@chromium.org>
Reviewed by Eric Seidel.
// Default size for the buffer. It should be enough for most of cases.
const int kDefaultBufferLength = 256;
- SkColor color = context->fillColor();
+ SkColor color = context->effectiveFillColor();
unsigned char alpha = SkColorGetA(color);
// Skip 100% transparent text; no need to draw anything.
if (!alpha && context->getStrokeStyle() == NoStroke)
PlatformGraphicsContext* context = graphicsContext->platformContext();
UniscribeHelperTextRun state(run, *this);
- SkColor color = context->fillColor();
+ SkColor color = context->effectiveFillColor();
unsigned char alpha = SkColorGetA(color);
// Skip 100% transparent text; no need to draw anything.
if (!alpha)
if (paintingDisabled())
return;
+ if (width <= 0)
+ return;
+
int thickness = SkMax32(static_cast<int>(strokeThickness()), 1);
SkRect r;
r.fLeft = SkIntToScalar(pt.x());
r.fBottom = r.fTop + SkIntToScalar(thickness);
SkPaint paint;
- paint.setColor(strokeColor().rgb());
+ platformContext()->setupPaintForFilling(&paint);
+ // Text lines are drawn using the stroke color.
+ paint.setColor(platformContext()->effectiveStrokeColor());
platformContext()->canvas()->drawRect(r, paint);
}
m_state->m_useAntialiasing = enable;
}
-SkColor PlatformContextSkia::fillColor() const
+SkColor PlatformContextSkia::effectiveFillColor() const
{
- return m_state->m_fillColor;
+ return m_state->applyAlpha(m_state->m_fillColor);
+}
+
+SkColor PlatformContextSkia::effectiveStrokeColor() const
+{
+ return m_state->applyAlpha(m_state->m_strokeColor);
}
void PlatformContextSkia::beginPath()
void addPath(const SkPath&);
const SkPath* currentPath() const { return &m_path; }
- SkColor fillColor() const;
+ // Returns the fill color. The returned color has it's alpha adjusted
+ // by the current alpha.
+ SkColor effectiveFillColor() const;
+
+ // Returns the stroke color. The returned color has it's alpha adjusted
+ // by the current alpha.
+ SkColor effectiveStrokeColor() const;
skia::PlatformCanvas* canvas() { return m_canvas; }