Commit 62711a60 authored by bdakin@apple.com's avatar bdakin@apple.com
Browse files

WebCore: Fix for https://bugs.webkit.org/show_bug.cgi?id=31321 Make -webkit-

color-correction work with untagged images

Reviewed by Darin Adler.

Image's draw(), drawPattern(), and fillWithSolidColor() functions 
now take a ColorSpace. A bunch of classes inherit from Image, so 
draw() and drawPattern() functions there must also take a 
ColorSpace.
* platform/graphics/Image.cpp:
(WebCore::Image::fillWithSolidColor):
(WebCore::Image::drawTiled):
* platform/graphics/Image.h:
* platform/graphics/BitmapImage.h:
* platform/graphics/GeneratedImage.cpp:
(WebCore::GeneratedImage::draw):
(WebCore::GeneratedImage::drawPattern):
* platform/graphics/GeneratedImage.h:
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::draw):
* platform/graphics/cg/PDFDocumentImage.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::draw):
* svg/graphics/SVGImage.h:

All of the drawImage() functions and drawTiled() functions of 
GraphicsContext now take a ColorSpace.
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImage):
(WebCore::GraphicsContext::drawTiledImage):
* platform/graphics/GraphicsContext.h:

This is where the actual work is done.
* platform/graphics/cg/ImageCG.cpp:
(WebCore::imageWithColorSpace): New static function that returns a 
copy of the given image in the given ColorSpace *IF* we should use 
the given ColorSpace. We will ignore the color space if the image 
is tagged and return 0. 
(WebCore::BitmapImage::draw): Now takes a ColorSpace and uses it to 
call imageWithColorSpace(). 
(WebCore::Image::drawPattern): Same.

Attempt to keep all ports building. 
* platform/graphics/cairo/ImageCairo.cpp:
(WebCore::BitmapImage::draw):
(WebCore::Image::drawPattern):
* platform/graphics/haiku/ImageHaiku.cpp:
(WebCore::BitmapImage::draw):
(WebCore::Image::drawPattern):
* platform/graphics/qt/ImageQt.cpp:
(WebCore::Image::drawPattern):
(WebCore::BitmapImage::draw):
* platform/graphics/skia/BitmapImageSingleFrameSkia.h:
* platform/graphics/skia/ImageSkia.cpp:
(WebCore::Image::drawPattern):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImageSingleFrameSkia::draw):
* platform/graphics/wx/ImageWx.cpp:
(WebCore::BitmapImage::draw):
(WebCore::BitmapImage::drawPattern):

Callers of GraphicsContext's drawImage() and drawTiled() functions 
now need to send a ColorSpace.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::paint):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawImage):
(WebCore::CanvasRenderingContext2D::drawImageFromRect):
* platform/ScrollView.cpp:
(WebCore::ScrollView::wheelEvent):
* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::apply):
* platform/graphics/filters/FEComposite.cpp:
(WebCore::FEComposite::apply):
* platform/graphics/filters/SourceGraphic.cpp:
(WebCore::SourceGraphic::apply):
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::ScrollbarThemeMac::paint):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::paintNinePieceImage):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintReplaced):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintResizer):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):
* rendering/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::paint):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paint):
* svg/graphics/SVGPaintServerPattern.cpp:
(WebCore::SVGPaintServerPattern::setup):
* svg/graphics/SVGResourceFilter.cpp:
(WebCore::SVGResourceFilter::applyFilter):
* svg/graphics/filters/SVGFEMerge.cpp:
(WebCore::FEMerge::apply):
* svg/graphics/filters/SVGFEOffset.cpp:
(WebCore::FEOffset::apply):
* svg/graphics/filters/SVGFETile.cpp:
(WebCore::FETile::apply):

LayoutTests: Tests for https://bugs.webkit.org/show_bug.cgi?id=31321 Make 
-webkit-color-correction work with untagged images

Reviewed by Darin Adler.

* fast/css/color-correction-on-background-image.html: Added.
* fast/css/color-correction-untagged-images.html: Added.
* fast/css/resources/purple-noprofile.png: Added.
* platform/mac/fast/css/color-correction-on-background-image-expected.checksum: Added.
* platform/mac/fast/css/color-correction-on-background-image-expected.png: Added.
* platform/mac/fast/css/color-correction-on-background-image-expected.txt: Added.
* platform/mac/fast/css/color-correction-untagged-images-expected.checksum: Added.
* platform/mac/fast/css/color-correction-untagged-images-expected.png: Added.
* platform/mac/fast/css/color-correction-untagged-images-expected.txt: Added.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51212 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8f9f528d
2009-11-19 Beth Dakin <bdakin@apple.com>
Reviewed by Darin Adler.
Tests for https://bugs.webkit.org/show_bug.cgi?id=31321 Make
-webkit-color-correction work with untagged images
* fast/css/color-correction-on-background-image.html: Added.
* fast/css/color-correction-untagged-images.html: Added.
* fast/css/resources/purple-noprofile.png: Added.
* platform/mac/fast/css/color-correction-on-background-image-expected.checksum: Added.
* platform/mac/fast/css/color-correction-on-background-image-expected.png: Added.
* platform/mac/fast/css/color-correction-on-background-image-expected.txt: Added.
* platform/mac/fast/css/color-correction-untagged-images-expected.checksum: Added.
* platform/mac/fast/css/color-correction-untagged-images-expected.png: Added.
* platform/mac/fast/css/color-correction-untagged-images-expected.txt: Added.
2009-11-19 Michelangelo De Simone <michelangelo@webkit.org>
 
Fix for <https://bugs.webkit.org/show_bug.cgi?id=27959>
<html>
<style>
.purple {
background-image: url('resources/purple-noprofile.png');
width: 400px;
height: 400px;
float: left;
}
</style>
<body>
<p>The two squares below should not match each other. On the left an uncorrected image is tiled as a background, and on the right the same image is tiled as a background, but it is corrected from sRGB.</p>
<div class="purple"></div>
<div class="purple" style="-webkit-color-correction: sRGB;"></div>
</body>
</html>
<html>
<style>
.purple {
border: solid 20px #560063;
float: left;
}
</style>
<body>
<p>The two squares below should not match each other. On the left is an uncorrected image and border, and on the right is the same image and same border color corrected from sRGB.</p>
<img src="resources/purple-noprofile.png" class="purple" />
<img src="resources/purple-noprofile.png" class="purple" style="-webkit-color-correction:sRGB;" />
</body>
</html>
c536cc6a4d72ae772e353844ef9a1b74
\ No newline at end of file
layer at (0,0) size 785x860
RenderView at (0,0) size 785x600
layer at (0,0) size 785x860
RenderBlock {HTML} at (0,0) size 785x600
RenderBody {BODY} at (8,8) size 769x576
RenderBlock {P} at (0,0) size 769x36
RenderText {#text} at (0,0) size 768x36
text run at (0,0) width 768: "The two squares below should not match each other. On the left an uncorrected image is tiled as a background, and on the"
text run at (0,18) width 480: "right the same image is tiled as a background, but it is corrected from sRGB."
RenderBlock (floating) {DIV} at (0,52) size 400x400
RenderBlock (floating) {DIV} at (0,452) size 400x400
9042e9c1cd986cceb6f346e36eebae70
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x576
RenderBlock {P} at (0,0) size 784x36
RenderText {#text} at (0,0) size 772x36
text run at (0,0) width 772: "The two squares below should not match each other. On the left is an uncorrected image and border, and on the right is the"
text run at (0,18) width 362: "same image and same border color corrected from sRGB."
RenderImage {IMG} at (0,52) size 140x140 [border: (20px solid #560063)]
RenderImage {IMG} at (140,52) size 140x140 [border: (20px solid #560063)]
2009-11-19 Beth Dakin <bdakin@apple.com>
Reviewed by Darin Adler.
Fix for https://bugs.webkit.org/show_bug.cgi?id=31321 Make -webkit-
color-correction work with untagged images
Image's draw(), drawPattern(), and fillWithSolidColor() functions
now take a ColorSpace. A bunch of classes inherit from Image, so
draw() and drawPattern() functions there must also take a
ColorSpace.
* platform/graphics/Image.cpp:
(WebCore::Image::fillWithSolidColor):
(WebCore::Image::drawTiled):
* platform/graphics/Image.h:
* platform/graphics/BitmapImage.h:
* platform/graphics/GeneratedImage.cpp:
(WebCore::GeneratedImage::draw):
(WebCore::GeneratedImage::drawPattern):
* platform/graphics/GeneratedImage.h:
* platform/graphics/cg/PDFDocumentImage.cpp:
(WebCore::PDFDocumentImage::draw):
* platform/graphics/cg/PDFDocumentImage.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::draw):
* svg/graphics/SVGImage.h:
All of the drawImage() functions and drawTiled() functions of
GraphicsContext now take a ColorSpace.
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImage):
(WebCore::GraphicsContext::drawTiledImage):
* platform/graphics/GraphicsContext.h:
This is where the actual work is done.
* platform/graphics/cg/ImageCG.cpp:
(WebCore::imageWithColorSpace): New static function that returns a
copy of the given image in the given ColorSpace *IF* we should use
the given ColorSpace. We will ignore the color space if the image
is tagged and return 0.
(WebCore::BitmapImage::draw): Now takes a ColorSpace and uses it to
call imageWithColorSpace().
(WebCore::Image::drawPattern): Same.
Attempt to keep all ports building.
* platform/graphics/cairo/ImageCairo.cpp:
(WebCore::BitmapImage::draw):
(WebCore::Image::drawPattern):
* platform/graphics/haiku/ImageHaiku.cpp:
(WebCore::BitmapImage::draw):
(WebCore::Image::drawPattern):
* platform/graphics/qt/ImageQt.cpp:
(WebCore::Image::drawPattern):
(WebCore::BitmapImage::draw):
* platform/graphics/skia/BitmapImageSingleFrameSkia.h:
* platform/graphics/skia/ImageSkia.cpp:
(WebCore::Image::drawPattern):
(WebCore::BitmapImage::draw):
(WebCore::BitmapImageSingleFrameSkia::draw):
* platform/graphics/wx/ImageWx.cpp:
(WebCore::BitmapImage::draw):
(WebCore::BitmapImage::drawPattern):
Callers of GraphicsContext's drawImage() and drawTiled() functions
now need to send a ColorSpace.
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::paint):
* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::drawImage):
(WebCore::CanvasRenderingContext2D::drawImageFromRect):
* platform/ScrollView.cpp:
(WebCore::ScrollView::wheelEvent):
* platform/graphics/filters/FEColorMatrix.cpp:
(WebCore::FEColorMatrix::apply):
* platform/graphics/filters/FEComposite.cpp:
(WebCore::FEComposite::apply):
* platform/graphics/filters/SourceGraphic.cpp:
(WebCore::SourceGraphic::apply):
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::ScrollbarThemeMac::paint):
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended):
(WebCore::RenderBoxModelObject::paintNinePieceImage):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::paintReplaced):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintResizer):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):
* rendering/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::paint):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paint):
* svg/graphics/SVGPaintServerPattern.cpp:
(WebCore::SVGPaintServerPattern::setup):
* svg/graphics/SVGResourceFilter.cpp:
(WebCore::SVGResourceFilter::applyFilter):
* svg/graphics/filters/SVGFEMerge.cpp:
(WebCore::FEMerge::apply):
* svg/graphics/filters/SVGFEOffset.cpp:
(WebCore::FEOffset::apply):
* svg/graphics/filters/SVGFETile.cpp:
(WebCore::FETile::apply):
2009-11-19 Avi Drissman <avi@chromium.org>
 
Reviewed by Darin Adler.
......@@ -259,7 +259,7 @@ void HTMLCanvasElement::paint(GraphicsContext* context, const IntRect& r)
if (m_imageBuffer) {
Image* image = m_imageBuffer->image();
if (image)
context->drawImage(image, r);
context->drawImage(image, DeviceColorSpace, r);
}
#if ENABLE(3D_CANVAS)
......
......@@ -1002,7 +1002,7 @@ void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec
FloatRect sourceRect = c->roundToDevicePixels(srcRect);
FloatRect destRect = c->roundToDevicePixels(dstRect);
willDraw(destRect);
c->drawImage(cachedImage->image(), destRect, sourceRect, state().m_globalComposite);
c->drawImage(cachedImage->image(), DeviceColorSpace, destRect, sourceRect, state().m_globalComposite);
}
void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, float x, float y)
......@@ -1052,7 +1052,7 @@ void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const
if (!sourceCanvas->originClean())
canvas()->setOriginTainted();
c->drawImage(buffer->image(), destRect, sourceRect, state().m_globalComposite);
c->drawImage(buffer->image(), DeviceColorSpace, destRect, sourceRect, state().m_globalComposite);
willDraw(destRect); // This call comes after drawImage, since the buffer we draw into may be our own, and we need to make sure it is dirty.
// FIXME: Arguably willDraw should become didDraw and occur after drawing calls and not before them to avoid problems like this.
}
......@@ -1146,7 +1146,7 @@ void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image,
FloatRect destRect = FloatRect(dx, dy, dw, dh);
willDraw(destRect);
c->drawImage(cachedImage->image(), destRect, FloatRect(sx, sy, sw, sh), op);
c->drawImage(cachedImage->image(), DeviceColorSpace, destRect, FloatRect(sx, sy, sw, sh), op);
}
void CanvasRenderingContext2D::setAlpha(float alpha)
......
......@@ -764,7 +764,7 @@ void ScrollView::paintScrollbars(GraphicsContext* context, const IntRect& rect)
void ScrollView::paintPanScrollIcon(GraphicsContext* context)
{
DEFINE_STATIC_LOCAL(Image*, panScrollIcon, (Image::loadPlatformResource("panIcon").releaseRef()));
context->drawImage(panScrollIcon, m_panScrollIconPoint);
context->drawImage(panScrollIcon, DeviceColorSpace, m_panScrollIconPoint);
}
void ScrollView::paint(GraphicsContext* context, const IntRect& rect)
......
......@@ -165,13 +165,13 @@ protected:
BitmapImage(ImageObserver* = 0);
#if PLATFORM(WIN)
virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator);
virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator);
#endif
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
#if PLATFORM(WX) || (PLATFORM(WINCE) && !PLATFORM(QT))
virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
const FloatPoint& phase, CompositeOperator, const FloatRect& destRect);
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
#endif
#if PLATFORM(HAIKU)
......
......@@ -34,7 +34,7 @@ using namespace std;
namespace WebCore {
void GeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp)
void GeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp)
{
context->save();
context->setCompositeOperation(compositeOp);
......@@ -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, 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, phase, compositeOp, destRect);
bitmap->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect);
}
}
......@@ -57,9 +57,9 @@ public:
virtual unsigned decodedSize() const { return 0; }
protected:
virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
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, CompositeOperator, const FloatRect& destRect);
const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
GeneratedImage(PassRefPtr<Generator> generator, const IntSize& size)
: m_generator(generator)
......
......@@ -308,24 +308,24 @@ bool GraphicsContext::paintingDisabled() const
return m_common->state.paintingDisabled;
}
void GraphicsContext::drawImage(Image* image, const IntPoint& p, CompositeOperator op)
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op)
{
drawImage(image, p, IntRect(0, 0, -1, -1), op);
drawImage(image, styleColorSpace, p, IntRect(0, 0, -1, -1), op);
}
void GraphicsContext::drawImage(Image* image, const IntRect& r, CompositeOperator op, bool useLowQualityScale)
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, bool useLowQualityScale)
{
drawImage(image, r, IntRect(0, 0, -1, -1), op, useLowQualityScale);
drawImage(image, styleColorSpace, r, IntRect(0, 0, -1, -1), op, useLowQualityScale);
}
void GraphicsContext::drawImage(Image* image, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op)
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op)
{
drawImage(image, IntRect(dest, srcRect.size()), srcRect, op);
drawImage(image, styleColorSpace, IntRect(dest, srcRect.size()), srcRect, op);
}
void GraphicsContext::drawImage(Image* image, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, bool useLowQualityScale)
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, bool useLowQualityScale)
{
drawImage(image, FloatRect(dest), srcRect, op, useLowQualityScale);
drawImage(image, styleColorSpace, FloatRect(dest), srcRect, op, useLowQualityScale);
}
#if !PLATFORM(WINCE) || PLATFORM(QT)
......@@ -431,7 +431,7 @@ const Vector<IntRect>& GraphicsContext::focusRingRects() const
return m_common->m_focusRingRects;
}
void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const FloatRect& src, CompositeOperator op, bool useLowQualityScale)
void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, bool useLowQualityScale)
{
if (paintingDisabled() || !image)
return;
......@@ -455,29 +455,29 @@ void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const Float
save();
setImageInterpolationQuality(InterpolationNone);
}
image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), op);
image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op);
if (useLowQualityScale)
restore();
}
void GraphicsContext::drawTiledImage(Image* image, const IntRect& rect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op)
void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& rect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op)
{
if (paintingDisabled() || !image)
return;
image->drawTiled(this, rect, srcPoint, tileSize, op);
image->drawTiled(this, rect, srcPoint, tileSize, styleColorSpace, op);
}
void GraphicsContext::drawTiledImage(Image* image, const IntRect& dest, const IntRect& srcRect, Image::TileRule hRule, Image::TileRule vRule, CompositeOperator op)
void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, Image::TileRule hRule, Image::TileRule vRule, CompositeOperator op)
{
if (paintingDisabled() || !image)
return;
if (hRule == Image::StretchTile && vRule == Image::StretchTile)
// Just do a scale.
return drawImage(image, dest, srcRect, op);
return drawImage(image, styleColorSpace, dest, srcRect, op);
image->drawTiled(this, dest, srcRect, hRule, vRule, op);
image->drawTiled(this, dest, srcRect, hRule, vRule, styleColorSpace, op);
}
void GraphicsContext::addRoundedRectClip(const IntRect& rect, const IntSize& topLeft, const IntSize& topRight,
......
......@@ -213,15 +213,15 @@ namespace WebCore {
void strokeRect(const FloatRect&);
void strokeRect(const FloatRect&, float lineWidth);
void drawImage(Image*, const IntPoint&, CompositeOperator = CompositeSourceOver);
void drawImage(Image*, const IntRect&, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
void drawImage(Image*, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver);
void drawImage(Image*, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1),
void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint&, CompositeOperator = CompositeSourceOver);
void drawImage(Image*, ColorSpace styleColorSpace, const IntRect&, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver);
void drawImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1),
CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize,
void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize,
CompositeOperator = CompositeSourceOver);
void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect,
void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect,
Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile,
CompositeOperator = CompositeSourceOver);
......
......@@ -75,14 +75,14 @@ bool Image::setData(PassRefPtr<SharedBuffer> data, bool allDataReceived)
return dataChanged(allDataReceived);
}
void Image::fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect, const Color& color, CompositeOperator op)
void Image::fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect, const Color& color, ColorSpace styleColorSpace, CompositeOperator op)
{
if (color.alpha() <= 0)
return;
ctxt->save();
ctxt->setCompositeOperation(!color.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
ctxt->fillRect(dstRect, color, DeviceColorSpace);
ctxt->fillRect(dstRect, color, styleColorSpace);
ctxt->restore();
}
......@@ -104,10 +104,10 @@ static inline FloatSize calculatePatternScale(const FloatRect& dstRect, const Fl
}
void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, CompositeOperator op)
void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, ColorSpace styleColorSpace, CompositeOperator op)
{
if (mayFillWithSolidColor()) {
fillWithSolidColor(ctxt, destRect, solidColor(), op);
fillWithSolidColor(ctxt, destRect, solidColor(), styleColorSpace, op);
return;
}
......@@ -132,22 +132,22 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const Fl
visibleSrcRect.setY((destRect.y() - oneTileRect.y()) / scale.height());
visibleSrcRect.setWidth(destRect.width() / scale.width());
visibleSrcRect.setHeight(destRect.height() / scale.height());
draw(ctxt, destRect, visibleSrcRect, op);
draw(ctxt, destRect, visibleSrcRect, styleColorSpace, op);
return;
}
TransformationMatrix patternTransform = TransformationMatrix().scaleNonUniform(scale.width(), scale.height());
FloatRect tileRect(FloatPoint(), intrinsicTileSize);
drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), op, destRect);
drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), styleColorSpace, op, destRect);
startAnimation();
}
// FIXME: Merge with the other drawTiled eventually, since we need a combination of both for some things.
void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule, TileRule vRule, CompositeOperator op)
void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule, TileRule vRule, ColorSpace styleColorSpace, CompositeOperator op)
{
if (mayFillWithSolidColor()) {
fillWithSolidColor(ctxt, dstRect, solidColor(), op);
fillWithSolidColor(ctxt, dstRect, solidColor(), styleColorSpace, op);
return;
}
......@@ -170,7 +170,7 @@ void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const Flo
vPhase -= fmodf(dstRect.height(), scale.height() * srcRect.height()) / 2.0f;
FloatPoint patternPhase(dstRect.x() - hPhase, dstRect.y() - vPhase);
drawPattern(ctxt, srcRect, patternTransform, patternPhase, op, dstRect);
drawPattern(ctxt, srcRect, patternTransform, patternPhase, styleColorSpace, op, dstRect);
startAnimation();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment