Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Unified Diff: webkit/port/platform/graphics/skia/ImageSkia.cpp

Issue 13375: Fix incorrect pattern offsets, and rebaseline associated test results. (Closed)
Patch Set: New fix plus rebaselines Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/port/platform/graphics/skia/ImageSkia.cpp
diff --git a/webkit/port/platform/graphics/skia/ImageSkia.cpp b/webkit/port/platform/graphics/skia/ImageSkia.cpp
index 4d3ee12f2efe5c98df1834286a96733fcc177a26..631469968280b53eda6e2449fb27daaa5146245a 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;

Powered by Google App Engine
This is Rietveld 408576698