diff options
author | Steve Block <steveblock@google.com> | 2011-11-24 07:21:29 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-11-24 07:21:29 -0800 |
commit | d3e14d5783061619077851b76bf03cd273defd08 (patch) | |
tree | 6594eea3e3044ac3ec38ae0b0a8f6f9757803c13 /Source/WebCore | |
parent | 30a9d6dfa5ddf75aef0fcf23f7bfbffa41a704ff (diff) | |
parent | 7839f0a8c60340239148921eb35c3e2afc750701 (diff) | |
download | external_webkit-d3e14d5783061619077851b76bf03cd273defd08.zip external_webkit-d3e14d5783061619077851b76bf03cd273defd08.tar.gz external_webkit-d3e14d5783061619077851b76bf03cd273defd08.tar.bz2 |
am 7839f0a8: Fix SVG text rendering
* commit '7839f0a8c60340239148921eb35c3e2afc750701':
Fix SVG text rendering
Diffstat (limited to 'Source/WebCore')
-rw-r--r-- | Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp | 9 | ||||
-rw-r--r-- | Source/WebCore/rendering/svg/SVGInlineTextBox.cpp | 20 |
2 files changed, 25 insertions, 4 deletions
diff --git a/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp index f647673..a490d5f 100644 --- a/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp @@ -1207,10 +1207,11 @@ AffineTransform GraphicsContext::getCTM() const void GraphicsContext::setCTM(const AffineTransform& transform) { - if (paintingDisabled()) - return; - - GC2CANVAS(this)->setMatrix(transform); + // The SkPicture mode of Skia does not support SkCanvas::setMatrix(), so we + // can not simply use that method here. We could calculate the transform + // required to achieve the desired matrix and use SkCanvas::concat(), but + // there's currently no need for this. + ASSERT_NOT_REACHED(); } /////////////////////////////////////////////////////////////////////////////// diff --git a/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp b/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp index bc550a6..bb34652 100644 --- a/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp +++ b/Source/WebCore/rendering/svg/SVGInlineTextBox.cpp @@ -573,11 +573,18 @@ void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, ETextD width *= scalingFactor; decorationOrigin.scale(scalingFactor, scalingFactor); +#if PLATFORM(ANDROID) + // Android does not support GraphicsContext::setCTM(). + AffineTransform scaleTransform; + scaleTransform.scale(1 / scalingFactor); + context->concatCTM(scaleTransform); +#else AffineTransform newTransform = context->getCTM(); newTransform.scale(1 / scalingFactor); normalizeTransform(newTransform); context->setCTM(newTransform); +#endif } decorationOrigin.move(0, -scaledFontMetrics.floatAscent() + positionOffsetForDecoration(decoration, scaledFontMetrics, thickness)); @@ -622,6 +629,13 @@ void SVGInlineTextBox::paintTextWithShadows(GraphicsContext* context, RenderStyl AffineTransform originalTransform; if (scalingFactor != 1) { +#if PLATFORM(ANDROID) + // Android does not support GraphicsContext::setCTM(). + context->save(); + AffineTransform scaleTransform; + scaleTransform.scale(1 / scalingFactor); + context->concatCTM(scaleTransform); +#else originalTransform = context->getCTM(); AffineTransform newTransform = originalTransform; @@ -629,12 +643,18 @@ void SVGInlineTextBox::paintTextWithShadows(GraphicsContext* context, RenderStyl normalizeTransform(newTransform); context->setCTM(newTransform); +#endif } scaledFont.drawText(context, textRun, textOrigin + extraOffset, startPosition, endPosition); if (scalingFactor != 1) +#if PLATFORM(ANDROID) + // Android does not support GraphicsContext::setCTM(). + context->restore(); +#else context->setCTM(originalTransform); +#endif restoreGraphicsContextAfterTextPainting(context, textRun); |