summaryrefslogtreecommitdiffstats
path: root/webkit/port
diff options
context:
space:
mode:
authormmoss@google.com <mmoss@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-16 22:53:03 +0000
committermmoss@google.com <mmoss@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-16 22:53:03 +0000
commit816079b199b01fdea8ecd384be708bae5708d1f6 (patch)
treef118477114efbc694c84ebd188f01f99d7286247 /webkit/port
parent6ddd29f1f1a3d68d1f5546296bea956e502715c9 (diff)
downloadchromium_src-816079b199b01fdea8ecd384be708bae5708d1f6.zip
chromium_src-816079b199b01fdea8ecd384be708bae5708d1f6.tar.gz
chromium_src-816079b199b01fdea8ecd384be708bae5708d1f6.tar.bz2
Fix incorrect pattern offsets, and rebaseline associated test results.
This now performs a similar origin translation as ImageCG.cpp, which seems to work, though it also seems to imply a relationship between the src and dest rects which I haven't found explicitly documented or enforced anywhere. Review URL: http://codereview.chromium.org/13375 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7107 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-rw-r--r--webkit/port/platform/graphics/skia/ImageSkia.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/webkit/port/platform/graphics/skia/ImageSkia.cpp b/webkit/port/platform/graphics/skia/ImageSkia.cpp
index 4d3ee12..6314699 100644
--- a/webkit/port/platform/graphics/skia/ImageSkia.cpp
+++ b/webkit/port/platform/graphics/skia/ImageSkia.cpp
@@ -33,6 +33,7 @@
#include "BitmapImage.h"
#include "BitmapImageSingleFrameSkia.h"
#include "ChromiumBridge.h"
+#include "FloatConversion.h"
#include "FloatRect.h"
#include "GraphicsContext.h"
#include "Logging.h"
@@ -371,8 +372,12 @@ void Image::drawPattern(GraphicsContext* context,
// origin of the destination rect, which is what WebKit expects. Skia uses
// the coordinate system origin as the base for the patter. If WebKit wants
// a shifted image, it will shift it from there using the patternTransform.
- matrix.postTranslate(SkFloatToScalar(phase.x()),
- SkFloatToScalar(phase.y()));
+ float adjustedX = phase.x() + floatSrcRect.x() *
+ narrowPrecisionToFloat(patternTransform.a());
+ float adjustedY = phase.y() + floatSrcRect.y() *
+ narrowPrecisionToFloat(patternTransform.d());
+ matrix.postTranslate(SkFloatToScalar(adjustedX),
+ SkFloatToScalar(adjustedY));
shader->setLocalMatrix(matrix);
SkPaint paint;