[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
eric at webkit.org
eric at webkit.org
Tue Jan 5 23:51:09 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 8110bd070da76afde572371229a5966eb33d4ee1
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 16 19:00:25 2009 +0000
2009-12-16 Benjamin Otte <otte at gnome.org>
Reviewed by Darin Adler.
Get rid of the phase argument to Image::drawPattern.
https://bugs.webkit.org/show_bug.cgi?id=31187
The argument can be expressed equally well as part of the
patternTransform. All backends but the Qt one did exactly that
manually anyway.
* 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@52206 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8d898fd..3875a87 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,40 @@
+2009-12-16 Benjamin Otte <otte at gnome.org>
+
+ Reviewed by Darin Adler.
+
+ Get rid of the phase argument to Image::drawPattern.
+ https://bugs.webkit.org/show_bug.cgi?id=31187
+
+ The argument can be expressed equally well as part of the
+ patternTransform. All backends but the Qt one did exactly that
+ manually anyway.
+
+ * 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 Kenneth Russell <kbr at google.com>
Reviewed by Darin Fisher.
diff --git a/WebCore/platform/graphics/BitmapImage.h b/WebCore/platform/graphics/BitmapImage.h
index 614ebaf..3283549 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,
- const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
+ 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 eec7ffb..b701c62 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,
- const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect)
+ 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, phase, styleColorSpace, compositeOp, destRect);
+ bitmap->drawPattern(context, srcRect, patternTransform, styleColorSpace, compositeOp, destRect);
}
}
diff --git a/WebCore/platform/graphics/GeneratedImage.h b/WebCore/platform/graphics/GeneratedImage.h
index a4583e3..9d31448 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,
- const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
+ 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 611216a..61093d0 100644
--- a/WebCore/platform/graphics/Image.cpp
+++ b/WebCore/platform/graphics/Image.cpp
@@ -136,9 +136,12 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl
return;
}
- TransformationMatrix patternTransform = TransformationMatrix().scaleNonUniform(scale.width(), scale.height());
+ TransformationMatrix patternTransform = TransformationMatrix();
+ patternTransform.translate(oneTileRect.x(), oneTileRect.y());
+ patternTransform.scaleNonUniform(scale.width(), scale.height());
+
FloatRect tileRect(FloatPoint(), intrinsicTileSize);
- drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), styleColorSpace, op, destRect);
+ drawPattern(ctxt, tileRect, patternTransform, styleColorSpace, op, destRect);
startAnimation();
}
@@ -158,7 +161,6 @@ 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).
@@ -168,9 +170,11 @@ 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;
- FloatPoint patternPhase(dstRect.x() - hPhase, dstRect.y() - vPhase);
+ TransformationMatrix patternTransform = TransformationMatrix();
+ patternTransform.translate(dstRect.x() - hPhase, dstRect.y() - vPhase);
+ patternTransform.scaleNonUniform(scale.width(), scale.height());
- drawPattern(ctxt, srcRect, patternTransform, patternPhase, styleColorSpace, op, dstRect);
+ drawPattern(ctxt, srcRect, patternTransform, styleColorSpace, op, dstRect);
startAnimation();
}
diff --git a/WebCore/platform/graphics/Image.h b/WebCore/platform/graphics/Image.h
index 90ebe4d..23992b1 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,
- const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
+ 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 92e36fc..4caa466 100644
--- a/WebCore/platform/graphics/cairo/ImageCairo.cpp
+++ b/WebCore/platform/graphics/cairo/ImageCairo.cpp
@@ -171,16 +171,12 @@ void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const Flo
}
void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform,
- const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect)
+ 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();
@@ -200,12 +196,16 @@ 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 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);
+ 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;
+ }
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 2e372e2..f98f247 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,
- const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
+ 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 = 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);
+ 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;
CGImageRef tileImage = nativeImageForCurrentFrame();
float h = CGImageGetHeight(tileImage);
diff --git a/WebCore/platform/graphics/haiku/ImageHaiku.cpp b/WebCore/platform/graphics/haiku/ImageHaiku.cpp
index df08822..9889013 100644
--- a/WebCore/platform/graphics/haiku/ImageHaiku.cpp
+++ b/WebCore/platform/graphics/haiku/ImageHaiku.cpp
@@ -109,9 +109,8 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatR
ctxt->restore();
}
-void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform, const FloatPoint& srcPoint, ColorSpace, CompositeOperator op, const FloatRect& dstRect)
+void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform, 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 9a82911..7b7a65e 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,
- const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect)
+ ColorSpace, CompositeOperator op, const FloatRect& destRect)
{
QPixmap* framePixmap = nativeImageForCurrentFrame();
if (!framePixmap) // If it's too early we won't have an image yet.
@@ -112,7 +112,6 @@ 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 6d8ed22..e39bf5f 100644
--- a/WebCore/platform/graphics/skia/ImageSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageSkia.cpp
@@ -301,7 +301,6 @@ 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)
@@ -365,9 +364,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 = phase.x() + normSrcRect.x() *
+ float adjustedX = normSrcRect.x() *
narrowPrecisionToFloat(patternTransform.a());
- float adjustedY = phase.y() + normSrcRect.y() *
+ float adjustedY = 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 f22e6c9..b3d2e86 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,
- const FloatPoint& phase, CompositeOperator op, const FloatRect& destRectIn, const IntSize& origSourceSize)
+ 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, phase, op, destRectIn, origSourceSize);
+ bmp->drawPattern(dc, transform, tileRectIn, patternTransform, 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 3417f5f..5f78fd8 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,
- const FloatPoint& phase, CompositeOperator, const FloatRect& destRect);
+ 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,
- const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect)
+ CompositeOperator op, const FloatRect& destRect)
{
- m_data->m_bitmap->drawPattern(ctxt, tileRectIn, patternTransform, phase, op, destRect, size());
+ m_data->m_bitmap->drawPattern(ctxt, tileRectIn, patternTransform, 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 ff60d6f..4cd71e0 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, const FloatPoint& phase, ColorSpace, CompositeOperator, const FloatRect& dstRect)
+void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, const TransformationMatrix& patternTransform, ColorSpace, CompositeOperator, const FloatRect& dstRect)
{
if (!m_source.initialized())
return;
@@ -201,10 +201,8 @@ void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, c
#if USE(WXGC)
wxGraphicsContext* gc = context->GetGraphicsContext();
- float adjustedX = phase.x() + srcRect.x() *
- narrowPrecisionToFloat(patternTransform.a());
- float adjustedY = phase.y() + srcRect.y() *
- narrowPrecisionToFloat(patternTransform.d());
+ float adjustedX = srcRect.x() * narrowPrecisionToFloat(patternTransform.a());
+ float adjustedY = srcRect.y() * narrowPrecisionToFloat(patternTransform.d());
gc->ConcatTransform(patternTransform);
#else
@@ -261,7 +259,7 @@ void BitmapImage::invalidatePlatformData()
}
-void Image::drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, ColorSpace, CompositeOperator, const FloatRect& destRect)
+void Image::drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform, ColorSpace, CompositeOperator, const FloatRect& destRect)
{
notImplemented();
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list