[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Thu Apr 8 00:39:23 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit dabc7d254bc8b367a728391eb8c83aa2b6483e32
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 17 00:41:04 2009 +0000

    2009-12-16  Eric Seidel  <eric at webkit.org>
    
            No review, rolling out r52206.
            http://trac.webkit.org/changeset/52206
            https://bugs.webkit.org/show_bug.cgi?id=31187
    
            This broke pixel tests on Mac.  Presumably the code in
            ImageCG is wrong here.
    
            * platform/graphics/BitmapImage.h:
            * platform/graphics/GeneratedImage.cpp:
            (WebCore::GeneratedImage::drawPattern):
            * platform/graphics/GeneratedImage.h:
            * platform/graphics/Image.cpp:
            (WebCore::Image::drawTiled):
            * platform/graphics/Image.h:
            * platform/graphics/cairo/ImageCairo.cpp:
            (WebCore::Image::drawPattern):
            * platform/graphics/cg/ImageCG.cpp:
            (WebCore::Image::drawPattern):
            * platform/graphics/haiku/ImageHaiku.cpp:
            (WebCore::Image::drawPattern):
            * platform/graphics/qt/ImageQt.cpp:
            (WebCore::Image::drawPattern):
            * platform/graphics/skia/ImageSkia.cpp:
            (WebCore::Image::drawPattern):
            * platform/graphics/wince/GraphicsContextWince.cpp:
            (WebCore::GraphicsContext::drawBitmapPattern):
            * platform/graphics/wince/ImageBufferWince.cpp:
            (WebCore::):
            (WebCore::BufferedImage::drawPattern):
            * platform/graphics/wx/ImageWx.cpp:
            (WebCore::BitmapImage::drawPattern):
            (WebCore::Image::drawPattern):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52229 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e1f3bdd..71e6a4a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,38 @@
+2009-12-16  Eric Seidel  <eric at webkit.org>
+
+        No review, rolling out r52206.
+        http://trac.webkit.org/changeset/52206
+        https://bugs.webkit.org/show_bug.cgi?id=31187
+
+        This broke pixel tests on Mac.  Presumably the code in
+        ImageCG is wrong here.
+
+        * platform/graphics/BitmapImage.h:
+        * platform/graphics/GeneratedImage.cpp:
+        (WebCore::GeneratedImage::drawPattern):
+        * platform/graphics/GeneratedImage.h:
+        * platform/graphics/Image.cpp:
+        (WebCore::Image::drawTiled):
+        * platform/graphics/Image.h:
+        * platform/graphics/cairo/ImageCairo.cpp:
+        (WebCore::Image::drawPattern):
+        * platform/graphics/cg/ImageCG.cpp:
+        (WebCore::Image::drawPattern):
+        * platform/graphics/haiku/ImageHaiku.cpp:
+        (WebCore::Image::drawPattern):
+        * platform/graphics/qt/ImageQt.cpp:
+        (WebCore::Image::drawPattern):
+        * platform/graphics/skia/ImageSkia.cpp:
+        (WebCore::Image::drawPattern):
+        * platform/graphics/wince/GraphicsContextWince.cpp:
+        (WebCore::GraphicsContext::drawBitmapPattern):
+        * platform/graphics/wince/ImageBufferWince.cpp:
+        (WebCore::):
+        (WebCore::BufferedImage::drawPattern):
+        * platform/graphics/wx/ImageWx.cpp:
+        (WebCore::BitmapImage::drawPattern):
+        (WebCore::Image::drawPattern):
+
 2009-12-16  Dimitri Glazkov  <dglazkov at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebCore/platform/graphics/BitmapImage.h b/WebCore/platform/graphics/BitmapImage.h
index 3283549..614ebaf 100644
--- a/WebCore/platform/graphics/BitmapImage.h
+++ b/WebCore/platform/graphics/BitmapImage.h
@@ -171,7 +171,7 @@ protected:
 
 #if PLATFORM(WX) || (PLATFORM(WINCE) && !PLATFORM(QT))
     virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
-                             ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
+                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
 #endif
 
 #if PLATFORM(HAIKU)
diff --git a/WebCore/platform/graphics/GeneratedImage.cpp b/WebCore/platform/graphics/GeneratedImage.cpp
index b701c62..eec7ffb 100644
--- a/WebCore/platform/graphics/GeneratedImage.cpp
+++ b/WebCore/platform/graphics/GeneratedImage.cpp
@@ -48,7 +48,7 @@ void GeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, co
 }
 
 void GeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
-                                 ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect)
+                                 const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect)
 {
     // Create a BitmapImage and call drawPattern on it.
     OwnPtr<ImageBuffer> imageBuffer = ImageBuffer::create(m_size);
@@ -62,7 +62,7 @@ void GeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcR
     Image* bitmap = imageBuffer->image();
     
     // Now just call drawTiled on that image.
-    bitmap->drawPattern(context, srcRect, patternTransform, styleColorSpace, compositeOp, destRect);
+    bitmap->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect);
 }
 
 }
diff --git a/WebCore/platform/graphics/GeneratedImage.h b/WebCore/platform/graphics/GeneratedImage.h
index 9d31448..a4583e3 100644
--- a/WebCore/platform/graphics/GeneratedImage.h
+++ b/WebCore/platform/graphics/GeneratedImage.h
@@ -59,7 +59,7 @@ public:
 protected:
     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
     virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
-                             ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
+                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
     
     GeneratedImage(PassRefPtr<Generator> generator, const IntSize& size)
         : m_generator(generator)
diff --git a/WebCore/platform/graphics/Image.cpp b/WebCore/platform/graphics/Image.cpp
index 61093d0..611216a 100644
--- a/WebCore/platform/graphics/Image.cpp
+++ b/WebCore/platform/graphics/Image.cpp
@@ -136,12 +136,9 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl
         return;
     }
 
-    TransformationMatrix patternTransform = TransformationMatrix();
-    patternTransform.translate(oneTileRect.x(), oneTileRect.y());
-    patternTransform.scaleNonUniform(scale.width(), scale.height());
-
+    TransformationMatrix patternTransform = TransformationMatrix().scaleNonUniform(scale.width(), scale.height());
     FloatRect tileRect(FloatPoint(), intrinsicTileSize);    
-    drawPattern(ctxt, tileRect, patternTransform, styleColorSpace, op, destRect);
+    drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), styleColorSpace, op, destRect);
     
     startAnimation();
 }
@@ -161,6 +158,7 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const Flo
         vRule = RepeatTile;
 
     FloatSize scale = calculatePatternScale(dstRect, srcRect, hRule, vRule);
+    TransformationMatrix patternTransform = TransformationMatrix().scaleNonUniform(scale.width(), scale.height());
 
     // We want to construct the phase such that the pattern is centered (when stretch is not
     // set for a particular rule).
@@ -170,11 +168,9 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const Flo
         hPhase -= fmodf(dstRect.width(), scale.width() * srcRect.width()) / 2.0f;
     if (vRule == Image::RepeatTile)
         vPhase -= fmodf(dstRect.height(), scale.height() * srcRect.height()) / 2.0f;
-    TransformationMatrix patternTransform = TransformationMatrix();
-    patternTransform.translate(dstRect.x() - hPhase, dstRect.y() - vPhase);
-    patternTransform.scaleNonUniform(scale.width(), scale.height());
+    FloatPoint patternPhase(dstRect.x() - hPhase, dstRect.y() - vPhase);
     
-    drawPattern(ctxt, srcRect, patternTransform, styleColorSpace, op, dstRect);
+    drawPattern(ctxt, srcRect, patternTransform, patternPhase, styleColorSpace, op, dstRect);
 
     startAnimation();
 }
diff --git a/WebCore/platform/graphics/Image.h b/WebCore/platform/graphics/Image.h
index 23992b1..90ebe4d 100644
--- a/WebCore/platform/graphics/Image.h
+++ b/WebCore/platform/graphics/Image.h
@@ -170,7 +170,7 @@ protected:
     virtual Color solidColor() const { return Color(); }
     
     virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
-                             ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
+                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
 
 private:
     RefPtr<SharedBuffer> m_data; // The encoded raw data for the image. 
diff --git a/WebCore/platform/graphics/cairo/ImageCairo.cpp b/WebCore/platform/graphics/cairo/ImageCairo.cpp
index 4caa466..92e36fc 100644
--- a/WebCore/platform/graphics/cairo/ImageCairo.cpp
+++ b/WebCore/platform/graphics/cairo/ImageCairo.cpp
@@ -171,12 +171,16 @@ void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const Flo
 }
 
 void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform,
-                        ColorSpace, CompositeOperator op, const FloatRect& destRect)
+                        const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect)
 {
     cairo_surface_t* image = nativeImageForCurrentFrame();
     if (!image) // If it's too early we won't have an image yet.
         return;
 
+    // Avoid NaN
+    if (!isfinite(phase.x()) || !isfinite(phase.y()))
+       return;
+
     cairo_t* cr = context->platformContext();
     context->save();
 
@@ -196,16 +200,12 @@ void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, con
     cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image);
     cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
 
-    cairo_matrix_t patternMatrix = cairo_matrix_t(patternTransform);
-    cairo_matrix_t phaseMatrix = {1, 0, 0, 1, tileRect.x() * patternTransform.a(), tileRect.y() * patternTransform.d()};
-    cairo_matrix_t combinedMatrix;
-    cairo_matrix_multiply(&combinedMatrix, &patternMatrix, &phaseMatrix);
-    cairo_matrix_invert(&combinedMatrix);
-    cairo_pattern_set_matrix(pattern, &combinedMatrix);
-    if (cairo_pattern_status(pattern)) {
-        cairo_pattern_destroy(pattern);
-        return;
-    }
+    cairo_matrix_t pattern_matrix = cairo_matrix_t(patternTransform);
+    cairo_matrix_t phase_matrix = {1, 0, 0, 1, phase.x() + tileRect.x() * patternTransform.a(), phase.y() + tileRect.y() * patternTransform.d()};
+    cairo_matrix_t combined;
+    cairo_matrix_multiply(&combined, &pattern_matrix, &phase_matrix);
+    cairo_matrix_invert(&combined);
+    cairo_pattern_set_matrix(pattern, &combined);
 
     context->setCompositeOperation(op);
     cairo_set_source(cr, pattern);
diff --git a/WebCore/platform/graphics/cg/ImageCG.cpp b/WebCore/platform/graphics/cg/ImageCG.cpp
index f98f247..2e372e2 100644
--- a/WebCore/platform/graphics/cg/ImageCG.cpp
+++ b/WebCore/platform/graphics/cg/ImageCG.cpp
@@ -245,7 +245,7 @@ static void drawPatternCallback(void* info, CGContextRef context)
 }
 
 void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const TransformationMatrix& patternTransform,
-                        ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
+                        const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
 {
     if (!nativeImageForCurrentFrame())
         return;
@@ -267,8 +267,8 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
     
     // We have to adjust the phase to deal with the fact we're in Cartesian space now (with the bottom left corner of destRect being
     // the origin).
-    float adjustedX = - destRect.x() + tileRect.x() * narrowPrecisionToFloat(patternTransform.a()); // We translated the context so that destRect.x() is the origin, so subtract it out.
-    float adjustedY = destRect.height() + destRect.y() - tileRect.y() * narrowPrecisionToFloat(patternTransform.d()) - scaledTileHeight;
+    float adjustedX = phase.x() - destRect.x() + tileRect.x() * narrowPrecisionToFloat(patternTransform.a()); // We translated the context so that destRect.x() is the origin, so subtract it out.
+    float adjustedY = destRect.height() - (phase.y() - destRect.y() + tileRect.y() * narrowPrecisionToFloat(patternTransform.d()) + scaledTileHeight);
 
     CGImageRef tileImage = nativeImageForCurrentFrame();
     float h = CGImageGetHeight(tileImage);
diff --git a/WebCore/platform/graphics/haiku/ImageHaiku.cpp b/WebCore/platform/graphics/haiku/ImageHaiku.cpp
index 9889013..df08822 100644
--- a/WebCore/platform/graphics/haiku/ImageHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/ImageHaiku.cpp
@@ -109,8 +109,9 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatR
     ctxt->restore();
 }
 
-void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform, ColorSpace, CompositeOperator op, const FloatRect& dstRect)
+void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform, const FloatPoint& srcPoint, ColorSpace, CompositeOperator op, const FloatRect& dstRect)
 {
+    // FIXME: finish this to support also phased position (srcPoint)
     startAnimation();
 
     BBitmap* image = nativeImageForCurrentFrame();
diff --git a/WebCore/platform/graphics/qt/ImageQt.cpp b/WebCore/platform/graphics/qt/ImageQt.cpp
index 7b7a65e..9a82911 100644
--- a/WebCore/platform/graphics/qt/ImageQt.cpp
+++ b/WebCore/platform/graphics/qt/ImageQt.cpp
@@ -94,7 +94,7 @@ PassRefPtr<Image> Image::loadPlatformResource(const char* name)
 }
 
 void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const TransformationMatrix& patternTransform,
-                        ColorSpace, CompositeOperator op, const FloatRect& destRect)
+                        const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect)
 {
     QPixmap* framePixmap = nativeImageForCurrentFrame();
     if (!framePixmap) // If it's too early we won't have an image yet.
@@ -112,6 +112,7 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
     QPainter* p = ctxt->platformContext();
     if (!pixmap.hasAlpha() && p->compositionMode() == QPainter::CompositionMode_SourceOver)
         p->setCompositionMode(QPainter::CompositionMode_Source);
+    p->setBrushOrigin(phase);
     p->fillRect(destRect, b);
     ctxt->restore();
 
diff --git a/WebCore/platform/graphics/skia/ImageSkia.cpp b/WebCore/platform/graphics/skia/ImageSkia.cpp
index e39bf5f..6d8ed22 100644
--- a/WebCore/platform/graphics/skia/ImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageSkia.cpp
@@ -301,6 +301,7 @@ PassRefPtr<Image> Image::loadPlatformResource(const char *name)
 void Image::drawPattern(GraphicsContext* context,
                         const FloatRect& floatSrcRect,
                         const TransformationMatrix& patternTransform,
+                        const FloatPoint& phase,
                         ColorSpace styleColorSpace,
                         CompositeOperator compositeOp,
                         const FloatRect& destRect)
@@ -364,9 +365,9 @@ 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.
-    float adjustedX = normSrcRect.x() *
+    float adjustedX = phase.x() + normSrcRect.x() *
                       narrowPrecisionToFloat(patternTransform.a());
-    float adjustedY = normSrcRect.y() *
+    float adjustedY = phase.y() + normSrcRect.y() *
                       narrowPrecisionToFloat(patternTransform.d());
     matrix.postTranslate(SkFloatToScalar(adjustedX),
                          SkFloatToScalar(adjustedY));
diff --git a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
index b3d2e86..f22e6c9 100644
--- a/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
+++ b/WebCore/platform/graphics/wince/GraphicsContextWince.cpp
@@ -1871,7 +1871,7 @@ void GraphicsContext::drawBitmap(SharedBitmap* bmp, const IntRect& dstRectIn, co
 }
 
 void GraphicsContext::drawBitmapPattern(SharedBitmap* bmp, const FloatRect& tileRectIn, const TransformationMatrix& patternTransform,
-                CompositeOperator op, const FloatRect& destRectIn, const IntSize& origSourceSize)
+                const FloatPoint& phase, CompositeOperator op, const FloatRect& destRectIn, const IntSize& origSourceSize)
 {
     if (!m_data->m_opacity)
         return;
@@ -1892,7 +1892,7 @@ void GraphicsContext::drawBitmapPattern(SharedBitmap* bmp, const FloatRect& tile
     TransformationMatrix transform = m_data->m_transform;
     transform.translate(moved.width(), moved.height());
 
-    bmp->drawPattern(dc, transform, tileRectIn, patternTransform, op, destRectIn, origSourceSize);
+    bmp->drawPattern(dc, transform, tileRectIn, patternTransform, phase, op, destRectIn, origSourceSize);
 
     if (!bmp->hasAlpha())
         transparentDC.fillAlphaChannel();
diff --git a/WebCore/platform/graphics/wince/ImageBufferWince.cpp b/WebCore/platform/graphics/wince/ImageBufferWince.cpp
index 5f78fd8..3417f5f 100644
--- a/WebCore/platform/graphics/wince/ImageBufferWince.cpp
+++ b/WebCore/platform/graphics/wince/ImageBufferWince.cpp
@@ -43,7 +43,7 @@ public:
     virtual unsigned decodedSize() const { return 0; }
     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
     virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
-                             CompositeOperator, const FloatRect& destRect);
+                             const FloatPoint& phase, CompositeOperator, const FloatRect& destRect);
 
     const ImageBufferData* m_data;
 };
@@ -56,9 +56,9 @@ void BufferedImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect, const
 }
 
 void BufferedImage::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRectIn, const TransformationMatrix& patternTransform,
-                             CompositeOperator op, const FloatRect& destRect)
+                             const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect)
 {
-    m_data->m_bitmap->drawPattern(ctxt, tileRectIn, patternTransform, op, destRect, size());
+    m_data->m_bitmap->drawPattern(ctxt, tileRectIn, patternTransform, phase, op, destRect, size());
 }
 
 ImageBufferData::ImageBufferData(const IntSize& size)
diff --git a/WebCore/platform/graphics/wx/ImageWx.cpp b/WebCore/platform/graphics/wx/ImageWx.cpp
index 4cd71e0..ff60d6f 100644
--- a/WebCore/platform/graphics/wx/ImageWx.cpp
+++ b/WebCore/platform/graphics/wx/ImageWx.cpp
@@ -176,7 +176,7 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatR
         observer->didDraw(this);
 }
 
-void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, const TransformationMatrix& patternTransform, ColorSpace, CompositeOperator, const FloatRect& dstRect)
+void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, ColorSpace, CompositeOperator, const FloatRect& dstRect)
 {
     if (!m_source.initialized())
         return;
@@ -201,8 +201,10 @@ void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, c
 #if USE(WXGC)
     wxGraphicsContext* gc = context->GetGraphicsContext();
 
-    float adjustedX = srcRect.x() * narrowPrecisionToFloat(patternTransform.a());
-    float adjustedY = srcRect.y() * narrowPrecisionToFloat(patternTransform.d());
+    float adjustedX = phase.x() + srcRect.x() *
+                      narrowPrecisionToFloat(patternTransform.a());
+    float adjustedY = phase.y() + srcRect.y() *
+                      narrowPrecisionToFloat(patternTransform.d());
                       
     gc->ConcatTransform(patternTransform);
 #else
@@ -259,7 +261,7 @@ void BitmapImage::invalidatePlatformData()
 
 }
 
-void Image::drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform, ColorSpace, CompositeOperator, const FloatRect& destRect)
+void Image::drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, ColorSpace, CompositeOperator, const FloatRect& destRect)
 {
     notImplemented();
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list