diff options
author | Mike Reed <reed@google.com> | 2009-10-16 10:29:45 -0400 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2009-10-16 10:29:45 -0400 |
commit | 6623a2fa4116b5764908c6a168e4460b527edad1 (patch) | |
tree | 15f0c0b617b1bcfc9ff089505e8653cbe6f84e31 /WebCore | |
parent | 734b5134dfb8de1717b5772d41dd8fdcc093980e (diff) | |
download | external_webkit-6623a2fa4116b5764908c6a168e4460b527edad1.zip external_webkit-6623a2fa4116b5764908c6a168e4460b527edad1.tar.gz external_webkit-6623a2fa4116b5764908c6a168e4460b527edad1.tar.bz2 |
don't pre-round rects, since we will zoom (arbitrarily) after we record the geometry.
This fixes the funny case of <canvas> elements being scaled twice: once by our scaleFactor() and
then again by this roundToDevicePixels method.
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/platform/graphics/android/GraphicsContextAndroid.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp index 46ac9da..a78c155 100644 --- a/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp +++ b/WebCore/platform/graphics/android/GraphicsContextAndroid.cpp @@ -1049,16 +1049,21 @@ void GraphicsContext::concatCTM(const TransformationMatrix& xform) GC2Canvas(this)->concat((SkMatrix) xform); } +/* This is intended to round the rect to device pixels (through the CTM) + and then invert the result back into source space, with the hope that when + it is drawn (through the matrix), it will land in the "right" place (i.e. + on pixel boundaries). + + For android, we record this geometry once and then draw it though various + scale factors as the user zooms, without re-recording. Thus this routine + should just leave the original geometry alone. + + If we instead draw into bitmap tiles, we should then perform this + transform -> round -> inverse step. + */ FloatRect GraphicsContext::roundToDevicePixels(const FloatRect& rect) { - if (paintingDisabled()) - return FloatRect(); - - const SkMatrix& matrix = GC2Canvas(this)->getTotalMatrix(); - SkRect r(rect); - matrix.mapRect(&r); - FloatRect result(SkScalarToFloat(r.fLeft), SkScalarToFloat(r.fTop), SkScalarToFloat(r.width()), SkScalarToFloat(r.height())); - return result; + return rect; } ////////////////////////////////////////////////////////////////////////////////////////////////// |