Changeset 51212 in webkit


Ignore:
Timestamp:
Nov 19, 2009 3:36:58 PM (14 years ago)
Author:
Beth Dakin
Message:

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.
Location:
trunk
Files:
9 added
42 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r51210 r51212  
     12009-11-19  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Tests for https://bugs.webkit.org/show_bug.cgi?id=31321 Make
     6        -webkit-color-correction work with untagged images
     7
     8        * fast/css/color-correction-on-background-image.html: Added.
     9        * fast/css/color-correction-untagged-images.html: Added.
     10        * fast/css/resources/purple-noprofile.png: Added.
     11        * platform/mac/fast/css/color-correction-on-background-image-expected.checksum: Added.
     12        * platform/mac/fast/css/color-correction-on-background-image-expected.png: Added.
     13        * platform/mac/fast/css/color-correction-on-background-image-expected.txt: Added.
     14        * platform/mac/fast/css/color-correction-untagged-images-expected.checksum: Added.
     15        * platform/mac/fast/css/color-correction-untagged-images-expected.png: Added.
     16        * platform/mac/fast/css/color-correction-untagged-images-expected.txt: Added.
     17
    1182009-11-19  Michelangelo De Simone  <michelangelo@webkit.org>
    219
  • trunk/WebCore/ChangeLog

    r51207 r51212  
     12009-11-19  Beth Dakin  <bdakin@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Fix for https://bugs.webkit.org/show_bug.cgi?id=31321 Make -webkit-
     6        color-correction work with untagged images
     7
     8        Image's draw(), drawPattern(), and fillWithSolidColor() functions
     9        now take a ColorSpace. A bunch of classes inherit from Image, so
     10        draw() and drawPattern() functions there must also take a
     11        ColorSpace.
     12        * platform/graphics/Image.cpp:
     13        (WebCore::Image::fillWithSolidColor):
     14        (WebCore::Image::drawTiled):
     15        * platform/graphics/Image.h:
     16        * platform/graphics/BitmapImage.h:
     17        * platform/graphics/GeneratedImage.cpp:
     18        (WebCore::GeneratedImage::draw):
     19        (WebCore::GeneratedImage::drawPattern):
     20        * platform/graphics/GeneratedImage.h:
     21        * platform/graphics/cg/PDFDocumentImage.cpp:
     22        (WebCore::PDFDocumentImage::draw):
     23        * platform/graphics/cg/PDFDocumentImage.h:
     24        * svg/graphics/SVGImage.cpp:
     25        (WebCore::SVGImage::draw):
     26        * svg/graphics/SVGImage.h:
     27
     28        All of the drawImage() functions and drawTiled() functions of
     29        GraphicsContext now take a ColorSpace.
     30        * platform/graphics/GraphicsContext.cpp:
     31        (WebCore::GraphicsContext::drawImage):
     32        (WebCore::GraphicsContext::drawTiledImage):
     33        * platform/graphics/GraphicsContext.h:
     34
     35        This is where the actual work is done.
     36        * platform/graphics/cg/ImageCG.cpp:
     37        (WebCore::imageWithColorSpace): New static function that returns a
     38        copy of the given image in the given ColorSpace *IF* we should use
     39        the given ColorSpace. We will ignore the color space if the image
     40        is tagged and return 0.
     41        (WebCore::BitmapImage::draw): Now takes a ColorSpace and uses it to
     42        call imageWithColorSpace().
     43        (WebCore::Image::drawPattern): Same.
     44
     45        Attempt to keep all ports building.
     46        * platform/graphics/cairo/ImageCairo.cpp:
     47        (WebCore::BitmapImage::draw):
     48        (WebCore::Image::drawPattern):
     49        * platform/graphics/haiku/ImageHaiku.cpp:
     50        (WebCore::BitmapImage::draw):
     51        (WebCore::Image::drawPattern):
     52        * platform/graphics/qt/ImageQt.cpp:
     53        (WebCore::Image::drawPattern):
     54        (WebCore::BitmapImage::draw):
     55        * platform/graphics/skia/BitmapImageSingleFrameSkia.h:
     56        * platform/graphics/skia/ImageSkia.cpp:
     57        (WebCore::Image::drawPattern):
     58        (WebCore::BitmapImage::draw):
     59        (WebCore::BitmapImageSingleFrameSkia::draw):
     60        * platform/graphics/wx/ImageWx.cpp:
     61        (WebCore::BitmapImage::draw):
     62        (WebCore::BitmapImage::drawPattern):
     63
     64        Callers of GraphicsContext's drawImage() and drawTiled() functions
     65        now need to send a ColorSpace.
     66        * html/HTMLCanvasElement.cpp:
     67        (WebCore::HTMLCanvasElement::paint):
     68        * html/canvas/CanvasRenderingContext2D.cpp:
     69        (WebCore::CanvasRenderingContext2D::drawImage):
     70        (WebCore::CanvasRenderingContext2D::drawImageFromRect):
     71        * platform/ScrollView.cpp:
     72        (WebCore::ScrollView::wheelEvent):
     73        * platform/graphics/filters/FEColorMatrix.cpp:
     74        (WebCore::FEColorMatrix::apply):
     75        * platform/graphics/filters/FEComposite.cpp:
     76        (WebCore::FEComposite::apply):
     77        * platform/graphics/filters/SourceGraphic.cpp:
     78        (WebCore::SourceGraphic::apply):
     79        * platform/mac/ScrollbarThemeMac.mm:
     80        (WebCore::ScrollbarThemeMac::paint):
     81        * rendering/RenderBoxModelObject.cpp:
     82        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     83        (WebCore::RenderBoxModelObject::paintNinePieceImage):
     84        * rendering/RenderImage.cpp:
     85        (WebCore::RenderImage::paintReplaced):
     86        * rendering/RenderLayer.cpp:
     87        (WebCore::RenderLayer::paintResizer):
     88        * rendering/RenderListMarker.cpp:
     89        (WebCore::RenderListMarker::paint):
     90        * rendering/RenderSVGImage.cpp:
     91        (WebCore::RenderSVGImage::paint):
     92        * rendering/RenderWidget.cpp:
     93        (WebCore::RenderWidget::paint):
     94        * svg/graphics/SVGPaintServerPattern.cpp:
     95        (WebCore::SVGPaintServerPattern::setup):
     96        * svg/graphics/SVGResourceFilter.cpp:
     97        (WebCore::SVGResourceFilter::applyFilter):
     98        * svg/graphics/filters/SVGFEMerge.cpp:
     99        (WebCore::FEMerge::apply):
     100        * svg/graphics/filters/SVGFEOffset.cpp:
     101        (WebCore::FEOffset::apply):
     102        * svg/graphics/filters/SVGFETile.cpp:
     103        (WebCore::FETile::apply):
     104
    11052009-11-19  Avi Drissman  <avi@chromium.org>
    2106
  • trunk/WebCore/html/HTMLCanvasElement.cpp

    r50725 r51212  
    260260        Image* image = m_imageBuffer->image();
    261261        if (image)
    262             context->drawImage(image, r);
     262            context->drawImage(image, DeviceColorSpace, r);
    263263    }
    264264
  • trunk/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r50910 r51212  
    10031003    FloatRect destRect = c->roundToDevicePixels(dstRect);
    10041004    willDraw(destRect);
    1005     c->drawImage(cachedImage->image(), destRect, sourceRect, state().m_globalComposite);
     1005    c->drawImage(cachedImage->image(), DeviceColorSpace, destRect, sourceRect, state().m_globalComposite);
    10061006}
    10071007
     
    10531053        canvas()->setOriginTainted();
    10541054
    1055     c->drawImage(buffer->image(), destRect, sourceRect, state().m_globalComposite);
     1055    c->drawImage(buffer->image(), DeviceColorSpace, destRect, sourceRect, state().m_globalComposite);
    10561056    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.
    10571057                        // FIXME: Arguably willDraw should become didDraw and occur after drawing calls and not before them to avoid problems like this.
     
    11471147    FloatRect destRect = FloatRect(dx, dy, dw, dh);
    11481148    willDraw(destRect);
    1149     c->drawImage(cachedImage->image(), destRect, FloatRect(sx, sy, sw, sh), op);
     1149    c->drawImage(cachedImage->image(), DeviceColorSpace, destRect, FloatRect(sx, sy, sw, sh), op);
    11501150}
    11511151
  • trunk/WebCore/platform/ScrollView.cpp

    r49804 r51212  
    765765{
    766766    DEFINE_STATIC_LOCAL(Image*, panScrollIcon, (Image::loadPlatformResource("panIcon").releaseRef()));
    767     context->drawImage(panScrollIcon, m_panScrollIconPoint);
     767    context->drawImage(panScrollIcon, DeviceColorSpace, m_panScrollIconPoint);
    768768}
    769769
  • trunk/WebCore/platform/graphics/BitmapImage.h

    r50416 r51212  
    166166
    167167#if PLATFORM(WIN)
    168     virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator);
    169 #endif
    170     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
     168    virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator);
     169#endif
     170    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
    171171
    172172#if PLATFORM(WX) || (PLATFORM(WINCE) && !PLATFORM(QT))
    173173    virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
    174                              const FloatPoint& phase, CompositeOperator, const FloatRect& destRect);
     174                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
    175175#endif
    176176
  • trunk/WebCore/platform/graphics/GeneratedImage.cpp

    r46956 r51212  
    3535namespace WebCore {
    3636
    37 void GeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp)
     37void GeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp)
    3838{
    3939    context->save();
     
    4949
    5050void GeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
    51                                  const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& destRect)
     51                                 const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect)
    5252{
    5353    // Create a BitmapImage and call drawPattern on it.
     
    6363   
    6464    // Now just call drawTiled on that image.
    65     bitmap->drawPattern(context, srcRect, patternTransform, phase, compositeOp, destRect);
     65    bitmap->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, compositeOp, destRect);
    6666}
    6767
  • trunk/WebCore/platform/graphics/GeneratedImage.h

    r39635 r51212  
    5858
    5959protected:
    60     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
     60    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
    6161    virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
    62                              const FloatPoint& phase, CompositeOperator, const FloatRect& destRect);
     62                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
    6363   
    6464    GeneratedImage(PassRefPtr<Generator> generator, const IntSize& size)
  • trunk/WebCore/platform/graphics/GraphicsContext.cpp

    r51161 r51212  
    309309}
    310310
    311 void GraphicsContext::drawImage(Image* image, const IntPoint& p, CompositeOperator op)
    312 {
    313     drawImage(image, p, IntRect(0, 0, -1, -1), op);
    314 }
    315 
    316 void GraphicsContext::drawImage(Image* image, const IntRect& r, CompositeOperator op, bool useLowQualityScale)
    317 {
    318     drawImage(image, r, IntRect(0, 0, -1, -1), op, useLowQualityScale);
    319 }
    320 
    321 void GraphicsContext::drawImage(Image* image, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op)
    322 {
    323     drawImage(image, IntRect(dest, srcRect.size()), srcRect, op);
    324 }
    325 
    326 void GraphicsContext::drawImage(Image* image, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, bool useLowQualityScale)
    327 {
    328     drawImage(image, FloatRect(dest), srcRect, op, useLowQualityScale);
     311void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op)
     312{
     313    drawImage(image, styleColorSpace, p, IntRect(0, 0, -1, -1), op);
     314}
     315
     316void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, bool useLowQualityScale)
     317{
     318    drawImage(image, styleColorSpace, r, IntRect(0, 0, -1, -1), op, useLowQualityScale);
     319}
     320
     321void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op)
     322{
     323    drawImage(image, styleColorSpace, IntRect(dest, srcRect.size()), srcRect, op);
     324}
     325
     326void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, bool useLowQualityScale)
     327{
     328    drawImage(image, styleColorSpace, FloatRect(dest), srcRect, op, useLowQualityScale);
    329329}
    330330
     
    432432}
    433433
    434 void GraphicsContext::drawImage(Image* image, const FloatRect& dest, const FloatRect& src, CompositeOperator op, bool useLowQualityScale)
     434void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, bool useLowQualityScale)
    435435{
    436436    if (paintingDisabled() || !image)
     
    456456        setImageInterpolationQuality(InterpolationNone);
    457457    }
    458     image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), op);
     458    image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op);
    459459    if (useLowQualityScale)
    460460        restore();
    461461}
    462462
    463 void GraphicsContext::drawTiledImage(Image* image, const IntRect& rect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op)
     463void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& rect, const IntPoint& srcPoint, const IntSize& tileSize, CompositeOperator op)
    464464{
    465465    if (paintingDisabled() || !image)
    466466        return;
    467467
    468     image->drawTiled(this, rect, srcPoint, tileSize, op);
    469 }
    470 
    471 void GraphicsContext::drawTiledImage(Image* image, const IntRect& dest, const IntRect& srcRect, Image::TileRule hRule, Image::TileRule vRule, CompositeOperator op)
     468    image->drawTiled(this, rect, srcPoint, tileSize, styleColorSpace, op);
     469}
     470
     471void GraphicsContext::drawTiledImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, Image::TileRule hRule, Image::TileRule vRule, CompositeOperator op)
    472472{
    473473    if (paintingDisabled() || !image)
     
    476476    if (hRule == Image::StretchTile && vRule == Image::StretchTile)
    477477        // Just do a scale.
    478         return drawImage(image, dest, srcRect, op);
    479 
    480     image->drawTiled(this, dest, srcRect, hRule, vRule, op);
     478        return drawImage(image, styleColorSpace, dest, srcRect, op);
     479
     480    image->drawTiled(this, dest, srcRect, hRule, vRule, styleColorSpace, op);
    481481}
    482482
  • trunk/WebCore/platform/graphics/GraphicsContext.h

    r51143 r51212  
    214214        void strokeRect(const FloatRect&, float lineWidth);
    215215
    216         void drawImage(Image*, const IntPoint&, CompositeOperator = CompositeSourceOver);
    217         void drawImage(Image*, const IntRect&, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
    218         void drawImage(Image*, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver);
    219         void drawImage(Image*, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
    220         void drawImage(Image*, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1),
     216        void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint&, CompositeOperator = CompositeSourceOver);
     217        void drawImage(Image*, ColorSpace styleColorSpace, const IntRect&, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
     218        void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver);
     219        void drawImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
     220        void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1),
    221221                       CompositeOperator = CompositeSourceOver, bool useLowQualityScale = false);
    222         void drawTiledImage(Image*, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize,
     222        void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntPoint& srcPoint, const IntSize& tileSize,
    223223                       CompositeOperator = CompositeSourceOver);
    224         void drawTiledImage(Image*, const IntRect& destRect, const IntRect& srcRect,
     224        void drawTiledImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect,
    225225                            Image::TileRule hRule = Image::StretchTile, Image::TileRule vRule = Image::StretchTile,
    226226                            CompositeOperator = CompositeSourceOver);
  • trunk/WebCore/platform/graphics/Image.cpp

    r50760 r51212  
    7676}
    7777
    78 void Image::fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect, const Color& color, CompositeOperator op)
     78void Image::fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect, const Color& color, ColorSpace styleColorSpace, CompositeOperator op)
    7979{
    8080    if (color.alpha() <= 0)
     
    8383    ctxt->save();
    8484    ctxt->setCompositeOperation(!color.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
    85     ctxt->fillRect(dstRect, color, DeviceColorSpace);
     85    ctxt->fillRect(dstRect, color, styleColorSpace);
    8686    ctxt->restore();
    8787}
     
    105105
    106106
    107 void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, CompositeOperator op)
     107void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, ColorSpace styleColorSpace, CompositeOperator op)
    108108{   
    109109    if (mayFillWithSolidColor()) {
    110         fillWithSolidColor(ctxt, destRect, solidColor(), op);
     110        fillWithSolidColor(ctxt, destRect, solidColor(), styleColorSpace, op);
    111111        return;
    112112    }
     
    133133        visibleSrcRect.setWidth(destRect.width() / scale.width());
    134134        visibleSrcRect.setHeight(destRect.height() / scale.height());
    135         draw(ctxt, destRect, visibleSrcRect, op);
     135        draw(ctxt, destRect, visibleSrcRect, styleColorSpace, op);
    136136        return;
    137137    }
     
    139139    TransformationMatrix patternTransform = TransformationMatrix().scaleNonUniform(scale.width(), scale.height());
    140140    FloatRect tileRect(FloatPoint(), intrinsicTileSize);   
    141     drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), op, destRect);
     141    drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), styleColorSpace, op, destRect);
    142142   
    143143    startAnimation();
     
    145145
    146146// FIXME: Merge with the other drawTiled eventually, since we need a combination of both for some things.
    147 void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule, TileRule vRule, CompositeOperator op)
     147void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule, TileRule vRule, ColorSpace styleColorSpace, CompositeOperator op)
    148148{   
    149149    if (mayFillWithSolidColor()) {
    150         fillWithSolidColor(ctxt, dstRect, solidColor(), op);
     150        fillWithSolidColor(ctxt, dstRect, solidColor(), styleColorSpace, op);
    151151        return;
    152152    }
     
    171171    FloatPoint patternPhase(dstRect.x() - hPhase, dstRect.y() - vPhase);
    172172   
    173     drawPattern(ctxt, srcRect, patternTransform, patternPhase, op, dstRect);
     173    drawPattern(ctxt, srcRect, patternTransform, patternPhase, styleColorSpace, op, dstRect);
    174174
    175175    startAnimation();
  • trunk/WebCore/platform/graphics/Image.h

    r45780 r51212  
    2929
    3030#include "Color.h"
     31#include "ColorSpace.h"
    3132#include "GraphicsTypes.h"
    3233#include "ImageSource.h"
     
    155156    Image(ImageObserver* = 0);
    156157
    157     static void fillWithSolidColor(GraphicsContext* ctxt, const FloatRect& dstRect, const Color& color, CompositeOperator op);
     158    static void fillWithSolidColor(GraphicsContext*, const FloatRect& dstRect, const Color&, ColorSpace styleColorSpace, CompositeOperator);
    158159
     160    // The ColorSpace parameter will only be used for untagged images.
    159161#if PLATFORM(WIN)
    160     virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator) { }
     162    virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator) { }
    161163#endif
    162     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator) = 0;
    163     void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, CompositeOperator);
    164     void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule, TileRule vRule, CompositeOperator);
     164    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator) = 0;
     165    void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, ColorSpace styleColorSpace, CompositeOperator);
     166    void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, TileRule hRule, TileRule vRule, ColorSpace styleColorSpace, CompositeOperator);
    165167
    166168    // Supporting tiled drawing
     
    169171   
    170172    virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const TransformationMatrix& patternTransform,
    171                              const FloatPoint& phase, CompositeOperator, const FloatRect& destRect);
     173                             const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
    172174
    173175private:
  • trunk/WebCore/platform/graphics/cairo/ImageCairo.cpp

    r50920 r51212  
    9090}
    9191
    92 void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const FloatRect& src, CompositeOperator op)
     92void BitmapImage::draw(GraphicsContext* context, const FloatRect& dst, const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op)
    9393{
    9494    FloatRect srcRect(src);
     
    106106
    107107    if (mayFillWithSolidColor()) {
    108         fillWithSolidColor(context, dstRect, solidColor(), op);
     108        fillWithSolidColor(context, dstRect, solidColor(), styleColorSpace, op);
    109109        return;
    110110    }
     
    172172
    173173void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform,
    174                         const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect)
     174                        const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect)
    175175{
    176176    cairo_surface_t* image = nativeImageForCurrentFrame();
  • trunk/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

    r51161 r51212  
    6262namespace WebCore {
    6363
    64 static CGColorSpaceRef deviceRGBColorSpaceRef()
    65 {
    66     static CGColorSpaceRef deviceSpace = CGColorSpaceCreateDeviceRGB();
    67     return deviceSpace;
    68 }
    69 
    70 static CGColorSpaceRef sRGBColorSpaceRef()
    71 {
    72     // FIXME: Windows should be able to use kCGColorSpaceSRGB, this is tracked by http://webkit.org/b/31363.
    73 #if PLATFORM(WIN) || defined(BUILDING_ON_TIGER)
    74     return deviceRGBColorSpaceRef();
    75 #else
    76     static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
    77     return sRGBSpace;
    78 #endif
    79 }
    80 
    8164static CGColorRef createCGColorWithColorSpace(const Color& color, ColorSpace colorSpace)
    8265{
  • trunk/WebCore/platform/graphics/cg/GraphicsContextPlatformPrivateCG.h

    r47585 r51212  
    2727
    2828namespace WebCore {
     29
     30// FIXME: This would be in GraphicsContextCG.h if that existed.
     31inline CGColorSpaceRef deviceRGBColorSpaceRef()
     32{
     33    static CGColorSpaceRef deviceSpace = CGColorSpaceCreateDeviceRGB();
     34    return deviceSpace;
     35}
     36
     37// FIXME: This would be in GraphicsContextCG.h if that existed.
     38inline CGColorSpaceRef sRGBColorSpaceRef()
     39{
     40    // FIXME: Windows should be able to use kCGColorSpaceSRGB, this is tracked by http://webkit.org/b/31363.
     41#if PLATFORM(WIN) || defined(BUILDING_ON_TIGER)
     42    return deviceRGBColorSpaceRef();
     43#else
     44    static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
     45    return sRGBSpace;
     46#endif
     47}
    2948
    3049class GraphicsContextPlatformPrivate {
  • trunk/WebCore/platform/graphics/cg/ImageCG.cpp

    r47585 r51212  
    3333#include "FloatRect.h"
    3434#include "GraphicsContext.h"
     35#include "GraphicsContextPlatformPrivateCG.h"
    3536#include "ImageObserver.h"
    3637#include "PDFDocumentImage.h"
     
    128129}
    129130
     131static RetainPtr<CGImageRef> imageWithColorSpace(CGImageRef originalImage, ColorSpace colorSpace)
     132{
     133    CGColorSpaceRef originalColorSpace = CGImageGetColorSpace(originalImage);
     134
     135    // If the image already has a (non-device) color space, we don't want to
     136    // override it, so return.
     137    if (!originalColorSpace || !CFEqual(originalColorSpace, deviceRGBColorSpaceRef()))
     138        return originalImage;
     139
     140    switch (colorSpace) {
     141    case DeviceColorSpace:
     142        return originalImage;
     143    case sRGBColorSpace:
     144        return RetainPtr<CGImageRef>(AdoptCF, CGImageCreateCopyWithColorSpace(originalImage,
     145            sRGBColorSpaceRef()));
     146    }
     147
     148    ASSERT_NOT_REACHED();
     149    return originalImage;
     150}
     151
    130152CGImageRef BitmapImage::getCGImageRef()
    131153{
     
    133155}
    134156
    135 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator compositeOp)
     157void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& destRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator compositeOp)
    136158{
    137159    startAnimation();
    138160
    139     CGImageRef image = frameAtIndex(m_currentFrame);
     161    RetainPtr<CGImageRef> image = frameAtIndex(m_currentFrame);
    140162    if (!image) // If it's too early we won't have an image yet.
    141163        return;
    142164   
    143165    if (mayFillWithSolidColor()) {
    144         fillWithSolidColor(ctxt, destRect, solidColor(), compositeOp);
    145         return;
    146     }
    147 
    148     float currHeight = CGImageGetHeight(image);
     166        fillWithSolidColor(ctxt, destRect, solidColor(), styleColorSpace, compositeOp);
     167        return;
     168    }
     169
     170    float currHeight = CGImageGetHeight(image.get());
    149171    if (currHeight <= srcRect.y())
    150172        return;
     
    182204            adjustedDestRect.setHeight(subimageRect.height() / yScale);
    183205
    184             image = CGImageCreateWithImageInRect(image, subimageRect);
     206            image = CGImageCreateWithImageInRect(image.get(), subimageRect);
    185207            if (currHeight < srcRect.bottom()) {
    186                 ASSERT(CGImageGetHeight(image) == currHeight - CGRectIntegral(srcRect).origin.y);
    187                 adjustedDestRect.setHeight(CGImageGetHeight(image) / yScale);
     208                ASSERT(CGImageGetHeight(image.get()) == currHeight - CGRectIntegral(srcRect).origin.y);
     209                adjustedDestRect.setHeight(CGImageGetHeight(image.get()) / yScale);
    188210            }
    189211        } else {
     
    205227    adjustedDestRect.setY(-adjustedDestRect.bottom());
    206228
     229    // Adjust the color space.
     230    image = imageWithColorSpace(image.get(), styleColorSpace);
     231
    207232    // Draw the image.
    208     CGContextDrawImage(context, adjustedDestRect, image);
    209 
    210     if (shouldUseSubimage)
    211         CGImageRelease(image);
     233    CGContextDrawImage(context, adjustedDestRect, image.get());
    212234
    213235    ctxt->restore();
     
    224246
    225247void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const TransformationMatrix& patternTransform,
    226                         const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect)
     248                        const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
    227249{
    228250    if (!nativeImageForCurrentFrame())
     
    261283        subImage.adoptCF(CGImageCreateWithImageInRect(tileImage, tileRect));
    262284    }
     285
     286    // Adjust the color space.
     287    subImage = imageWithColorSpace(subImage.get(), styleColorSpace);
    263288   
    264289#ifndef BUILDING_ON_TIGER
  • trunk/WebCore/platform/graphics/cg/PDFDocumentImage.cpp

    r51207 r51212  
    146146}
    147147
    148 void PDFDocumentImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator op)
     148void PDFDocumentImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator op)
    149149{
    150150    if (!m_document || m_currentPage == -1)
  • trunk/WebCore/platform/graphics/cg/PDFDocumentImage.h

    r39601 r51212  
    5959
    6060        PDFDocumentImage();
    61         virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
     61        virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
    6262       
    6363        void setCurrentPage(int);
  • trunk/WebCore/platform/graphics/filters/FEColorMatrix.cpp

    r50118 r51212  
    165165        return;
    166166
    167     filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()));
     167    filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()), DeviceColorSpace);
    168168
    169169    IntRect imageRect(IntPoint(), resultImage()->size());
  • trunk/WebCore/platform/graphics/filters/FEComposite.cpp

    r49303 r51212  
    134134    switch (m_type) {
    135135    case FECOMPOSITE_OPERATOR_OVER:
    136         filterContext->drawImage(m_in2->resultImage()->image(), calculateDrawingRect(m_in2->subRegion()));
    137         filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()));
     136        filterContext->drawImage(m_in2->resultImage()->image(), calculateDrawingRect(m_in2->subRegion()), DeviceColorSpace);
     137        filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()), DeviceColorSpace);
    138138        break;
    139139    case FECOMPOSITE_OPERATOR_IN:
    140140        filterContext->save();
    141141        filterContext->clipToImageBuffer(calculateDrawingRect(m_in2->subRegion()), m_in2->resultImage());
    142         filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()));
     142        filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()), DeviceColorSpace);
    143143        filterContext->restore();
    144144        break;
    145145    case FECOMPOSITE_OPERATOR_OUT:
    146         filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()));
    147         filterContext->drawImage(m_in2->resultImage()->image(), calculateDrawingRect(m_in2->subRegion()), srcRect, CompositeDestinationOut);
     146        filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()), DeviceColorSpace);
     147        filterContext->drawImage(m_in2->resultImage()->image(), calculateDrawingRect(m_in2->subRegion()), srcRect, CompositeDestinationOut, DeviceColorSpace);
    148148        break;
    149149    case FECOMPOSITE_OPERATOR_ATOP:
    150         filterContext->drawImage(m_in2->resultImage()->image(), calculateDrawingRect(m_in2->subRegion()));
    151         filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()), srcRect, CompositeSourceAtop);
     150        filterContext->drawImage(m_in2->resultImage()->image(), calculateDrawingRect(m_in2->subRegion()), DeviceColorSpace);
     151        filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()), srcRect, CompositeSourceAtop, DeviceColorSpace);
    152152        break;
    153153    case FECOMPOSITE_OPERATOR_XOR:
    154         filterContext->drawImage(m_in2->resultImage()->image(), calculateDrawingRect(m_in2->subRegion()));
    155         filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()), srcRect, CompositeXOR);
     154        filterContext->drawImage(m_in2->resultImage()->image(), calculateDrawingRect(m_in2->subRegion()), DeviceColorSpace);
     155        filterContext->drawImage(m_in->resultImage()->image(), calculateDrawingRect(m_in->subRegion()), srcRect, CompositeXOR, DeviceColorSpace);
    156156        break;
    157157    case FECOMPOSITE_OPERATOR_ARITHMETIC: {
  • trunk/WebCore/platform/graphics/filters/SourceGraphic.cpp

    r44810 r51212  
    5959        return;
    6060
    61     filterContext->drawImage(filter->sourceImage()->image(), IntPoint());
     61    filterContext->drawImage(filter->sourceImage()->image(), IntPoint(), DeviceColorSpace);
    6262}
    6363
  • trunk/WebCore/platform/graphics/haiku/ImageHaiku.cpp

    r47463 r51212  
    8484
    8585// Drawing Routines
    86 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatRect& src, CompositeOperator op)
     86void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op)
    8787{
    8888    startAnimation();
     
    9393
    9494    if (mayFillWithSolidColor()) {
    95         fillWithSolidColor(ctxt, dst, solidColor(), op);
     95        fillWithSolidColor(ctxt, dst, solidColor(), styleColorSpace, op);
    9696        return;
    9797    }
     
    110110}
    111111
    112 void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform, const FloatPoint& srcPoint, CompositeOperator op, const FloatRect& dstRect)
     112void Image::drawPattern(GraphicsContext* context, const FloatRect& tileRect, const TransformationMatrix& patternTransform, const FloatPoint& srcPoint, ColorSpace, CompositeOperator op, const FloatRect& dstRect)
    113113{
    114114    // FIXME: finish this to support also phased position (srcPoint)
  • trunk/WebCore/platform/graphics/qt/ImageQt.cpp

    r51174 r51212  
    9595
    9696void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const TransformationMatrix& patternTransform,
    97                         const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect)
     97                        const FloatPoint& phase, ColorSpace, CompositeOperator op, const FloatRect& destRect)
    9898{
    9999    QPixmap* framePixmap = nativeImageForCurrentFrame();
     
    163163// Drawing Routines
    164164void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
    165                        const FloatRect& src, CompositeOperator op)
     165                       const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op)
    166166{
    167167    startAnimation();
     
    172172
    173173    if (mayFillWithSolidColor()) {
    174         fillWithSolidColor(ctxt, dst, solidColor(), op);
     174        fillWithSolidColor(ctxt, dst, solidColor(), styleColorSpace, op);
    175175        return;
    176176    }
  • trunk/WebCore/platform/graphics/skia/BitmapImageSingleFrameSkia.h

    r39713 r51212  
    7373
    7474protected:
    75     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator);
     75    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
    7676
    7777private:
  • trunk/WebCore/platform/graphics/skia/ImageSkia.cpp

    r48684 r51212  
    303303                        const TransformationMatrix& patternTransform,
    304304                        const FloatPoint& phase,
     305                        ColorSpace styleColorSpace,
    305306                        CompositeOperator compositeOp,
    306307                        const FloatRect& destRect)
     
    406407
    407408void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dstRect,
    408                        const FloatRect& srcRect, CompositeOperator compositeOp)
     409                       const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp)
    409410{
    410411    if (!m_source.initialized())
     
    438439                                      const FloatRect& dstRect,
    439440                                      const FloatRect& srcRect,
     441                                      ColorSpace styleColorSpace,
    440442                                      CompositeOperator compositeOp)
    441443{
  • trunk/WebCore/platform/graphics/win/ImageCGWin.cpp

    r49060 r51212  
    7878    IntSize imageSize = BitmapImage::size();
    7979    if (size)
    80         drawFrameMatchingSourceSize(&gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), IntSize(*size), CompositeCopy);
     80        drawFrameMatchingSourceSize(&gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), IntSize(*size), DeviceColorSpace, CompositeCopy);
    8181    else
    8282        draw(&gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), CompositeCopy);
     
    8989}
    9090
    91 void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext* ctxt, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator compositeOp)
     91void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext* ctxt, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator compositeOp)
    9292{
    9393    size_t frames = frameCount();
  • trunk/WebCore/platform/graphics/win/ImageCairoWin.cpp

    r49260 r51212  
    8383    IntSize imageSize = BitmapImage::size();
    8484    if (size)
    85         drawFrameMatchingSourceSize(&gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), IntSize(*size), CompositeCopy);
     85        drawFrameMatchingSourceSize(&gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), IntSize(*size), DeviceColorSpace, CompositeCopy);
    8686    else
    8787        draw(&gc, FloatRect(0.0f, 0.0f, bmpInfo.bmWidth, bmpInfo.bmHeight), FloatRect(0.0f, 0.0f, imageSize.width(), imageSize.height()), CompositeCopy);
     
    9393}
    9494
    95 void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext* ctxt, const FloatRect& dstRect, const IntSize& srcSize, CompositeOperator compositeOp)
     95void BitmapImage::drawFrameMatchingSourceSize(GraphicsContext* ctxt, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator compositeOp)
    9696{
    9797    size_t frames = frameCount();
  • trunk/WebCore/platform/graphics/wx/ImageWx.cpp

    r48213 r51212  
    8787// Drawing Routines
    8888
    89 void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatRect& src, CompositeOperator op)
     89void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op)
    9090{
    9191    if (!m_source.initialized())
     
    9393
    9494    if (mayFillWithSolidColor()) {
    95         fillWithSolidColor(ctxt, dst, solidColor(), op);
     95        fillWithSolidColor(ctxt, dst, solidColor(), styleColorSpace, op);
    9696        return;
    9797    }
     
    177177}
    178178
    179 void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, CompositeOperator, const FloatRect& dstRect)
     179void BitmapImage::drawPattern(GraphicsContext* ctxt, const FloatRect& srcRect, const TransformationMatrix& patternTransform, const FloatPoint& phase, ColorSpace, CompositeOperator, const FloatRect& dstRect)
    180180{
    181181    if (!m_source.initialized())
  • trunk/WebCore/platform/mac/ScrollbarThemeMac.mm

    r46956 r51212  
    397397       
    398398        HIThemeDrawTrack(&trackInfo, 0, imageBuffer->context()->platformContext(), kHIThemeOrientationNormal);
    399         context->drawImage(imageBuffer->image(), scrollbar->frameRect().location());
     399        context->drawImage(imageBuffer->image(), DeviceColorSpace, scrollbar->frameRect().location());
    400400    }
    401401
  • trunk/WebCore/rendering/RenderBoxModelObject.cpp

    r50852 r51212  
    478478                }
    479479            }
    480             context->drawTiledImage(bg->image(clientForBackgroundImage, tileSize), destRect, phase, tileSize, compositeOp);
     480            context->drawTiledImage(bg->image(clientForBackgroundImage, tileSize), style()->colorSpace(), destRect, phase, tileSize, compositeOp);
    481481        }
    482482    }
     
    707707
    708708    Image* image = styleImage->image(this, imageSize);
     709    ColorSpace colorSpace = style->colorSpace();
    709710
    710711    if (drawLeft) {
     
    714715        // The rect to use from within the image is obtained from our slice, and is (0, 0, leftSlice, topSlice)
    715716        if (drawTop)
    716             graphicsContext->drawImage(image, IntRect(tx, ty, leftWidth, topWidth),
     717            graphicsContext->drawImage(image, colorSpace, IntRect(tx, ty, leftWidth, topWidth),
    717718                                       IntRect(0, 0, leftSlice, topSlice), op);
    718719
     
    720721        // The rect to use from within the image is (0, imageHeight - bottomSlice, leftSlice, botomSlice)
    721722        if (drawBottom)
    722             graphicsContext->drawImage(image, IntRect(tx, ty + h - bottomWidth, leftWidth, bottomWidth),
     723            graphicsContext->drawImage(image, colorSpace, IntRect(tx, ty + h - bottomWidth, leftWidth, bottomWidth),
    723724                                       IntRect(0, imageHeight - bottomSlice, leftSlice, bottomSlice), op);
    724725
    725726        // Paint the left edge.
    726727        // Have to scale and tile into the border rect.
    727         graphicsContext->drawTiledImage(image, IntRect(tx, ty + topWidth, leftWidth,
     728        graphicsContext->drawTiledImage(image, colorSpace, IntRect(tx, ty + topWidth, leftWidth,
    728729                                        h - topWidth - bottomWidth),
    729730                                        IntRect(0, topSlice, leftSlice, imageHeight - topSlice - bottomSlice),
     
    736737        // The rect to use from within the image is obtained from our slice, and is (imageWidth - rightSlice, 0, rightSlice, topSlice)
    737738        if (drawTop)
    738             graphicsContext->drawImage(image, IntRect(tx + w - rightWidth, ty, rightWidth, topWidth),
     739            graphicsContext->drawImage(image, colorSpace, IntRect(tx + w - rightWidth, ty, rightWidth, topWidth),
    739740                                       IntRect(imageWidth - rightSlice, 0, rightSlice, topSlice), op);
    740741
     
    742743        // The rect to use from within the image is (imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice)
    743744        if (drawBottom)
    744             graphicsContext->drawImage(image, IntRect(tx + w - rightWidth, ty + h - bottomWidth, rightWidth, bottomWidth),
     745            graphicsContext->drawImage(image, colorSpace, IntRect(tx + w - rightWidth, ty + h - bottomWidth, rightWidth, bottomWidth),
    745746                                       IntRect(imageWidth - rightSlice, imageHeight - bottomSlice, rightSlice, bottomSlice), op);
    746747
    747748        // Paint the right edge.
    748         graphicsContext->drawTiledImage(image, IntRect(tx + w - rightWidth, ty + topWidth, rightWidth,
     749        graphicsContext->drawTiledImage(image, colorSpace, IntRect(tx + w - rightWidth, ty + topWidth, rightWidth,
    749750                                        h - topWidth - bottomWidth),
    750751                                        IntRect(imageWidth - rightSlice, topSlice, rightSlice, imageHeight - topSlice - bottomSlice),
     
    754755    // Paint the top edge.
    755756    if (drawTop)
    756         graphicsContext->drawTiledImage(image, IntRect(tx + leftWidth, ty, w - leftWidth - rightWidth, topWidth),
     757        graphicsContext->drawTiledImage(image, colorSpace, IntRect(tx + leftWidth, ty, w - leftWidth - rightWidth, topWidth),
    757758                                        IntRect(leftSlice, 0, imageWidth - rightSlice - leftSlice, topSlice),
    758759                                        (Image::TileRule)hRule, Image::StretchTile, op);
     
    760761    // Paint the bottom edge.
    761762    if (drawBottom)
    762         graphicsContext->drawTiledImage(image, IntRect(tx + leftWidth, ty + h - bottomWidth,
     763        graphicsContext->drawTiledImage(image, colorSpace, IntRect(tx + leftWidth, ty + h - bottomWidth,
    763764                                        w - leftWidth - rightWidth, bottomWidth),
    764765                                        IntRect(leftSlice, imageHeight - bottomSlice, imageWidth - rightSlice - leftSlice, bottomSlice),
     
    767768    // Paint the middle.
    768769    if (drawMiddle)
    769         graphicsContext->drawTiledImage(image, IntRect(tx + leftWidth, ty + topWidth, w - leftWidth - rightWidth,
     770        graphicsContext->drawTiledImage(image, colorSpace, IntRect(tx + leftWidth, ty + topWidth, w - leftWidth - rightWidth,
    770771                                        h - topWidth - bottomWidth),
    771772                                        IntRect(leftSlice, topSlice, imageWidth - rightSlice - leftSlice, imageHeight - topSlice - bottomSlice),
  • trunk/WebCore/rendering/RenderImage.cpp

    r50760 r51212  
    387387                imageX = leftBorder + leftPad + centerX + 1;
    388388                imageY = topBorder + topPad + centerY + 1;
    389                 context->drawImage(image(), IntPoint(tx + imageX, ty + imageY));
     389                context->drawImage(image(), style()->colorSpace(), IntPoint(tx + imageX, ty + imageY));
    390390                errorPictureDrawn = true;
    391391            }
     
    425425        HTMLImageElement* imageElt = (node() && node()->hasTagName(imgTag)) ? static_cast<HTMLImageElement*>(node()) : 0;
    426426        CompositeOperator compositeOperator = imageElt ? imageElt->compositeOperator() : CompositeSourceOver;
    427         context->drawImage(image(cWidth, cHeight), rect, compositeOperator, useLowQualityScaling);
     427        context->drawImage(image(cWidth, cHeight), style()->colorSpace(), rect, compositeOperator, useLowQualityScaling);
    428428    }
    429429}
  • trunk/WebCore/rendering/RenderLayer.cpp

    r51175 r51212  
    19651965    DEFINE_STATIC_LOCAL(RefPtr<Image>, resizeCornerImage, (Image::loadPlatformResource("textAreaResizeCorner")));
    19661966    IntPoint imagePoint(absRect.right() - resizeCornerImage->width(), absRect.bottom() - resizeCornerImage->height());
    1967     context->drawImage(resizeCornerImage.get(), imagePoint);
     1967    context->drawImage(resizeCornerImage.get(), box->style()->colorSpace(), imagePoint);
    19681968
    19691969    // Draw a frame around the resizer (1px grey line) if there are any scrollbars present.
  • trunk/WebCore/rendering/RenderListMarker.cpp

    r51201 r51212  
    546546            paintCustomHighlight(tx, ty, style()->highlight(), true);
    547547#endif
    548         context->drawImage(m_image->image(this, marker.size()), marker.location());
     548        context->drawImage(m_image->image(this, marker.size()), style()->colorSpace(), marker.location());
    549549        if (selectionState() != SelectionNone) {
    550550            // FIXME: selectionRect() is in absolute, not painting coordinates.
  • trunk/WebCore/rendering/RenderSVGImage.cpp

    r46815 r51212  
    167167            adjustRectsForAspectRatio(destRect, srcRect, imageElt->preserveAspectRatio());
    168168
    169         paintInfo.context->drawImage(image(), destRect, srcRect);
     169        paintInfo.context->drawImage(image(), DeviceColorSpace, destRect, srcRect);
    170170        finishRenderSVGContent(this, paintInfo, filter, savedInfo.context);
    171171    }
  • trunk/WebCore/rendering/RenderWidget.cpp

    r50760 r51212  
    261261        // to paint itself.  That way it will composite properly with z-indexed layers.
    262262        if (m_substituteImage)
    263             paintInfo.context->drawImage(m_substituteImage.get(), m_widget->frameRect());
     263            paintInfo.context->drawImage(m_substituteImage.get(), style()->colorSpace(), m_widget->frameRect());
    264264        else
    265265            m_widget->paint(paintInfo.context, paintInfo.rect);
  • trunk/WebCore/svg/graphics/SVGImage.cpp

    r49685 r51212  
    174174}
    175175
    176 void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp)
     176void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp)
    177177{
    178178    if (!m_page)
  • trunk/WebCore/svg/graphics/SVGImage.h

    r44379 r51212  
    6565       
    6666        SVGImage(ImageObserver*);
    67         virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRect& toRect, CompositeOperator);
     67        virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRect& toRect, ColorSpace styleColorSpace, CompositeOperator);
    6868       
    6969        virtual NativeImagePtr nativeImageForCurrentFrame();
  • trunk/WebCore/svg/graphics/SVGPaintServerPattern.cpp

    r46956 r51212  
    132132            for (int j = numX; j > 0; j--) {
    133133                tileImageContext->translate(patternBoundaries().width(), 0);
    134                 tileImageContext->drawImage(tile()->image(), tileRect, tileRect);
     134                tileImageContext->drawImage(tile()->image(), object->style()->colorSpace(), tileRect, tileRect);
    135135            }
    136136            tileImageContext->translate(-patternBoundaries().width() * numX, 0);
  • trunk/WebCore/svg/graphics/SVGResourceFilter.cpp

    r49582 r51212  
    9292}
    9393
    94 void SVGResourceFilter::applyFilter(GraphicsContext*& context, const RenderObject*)
     94void SVGResourceFilter::applyFilter(GraphicsContext*& context, const RenderObject* object)
    9595{
    9696    if (!m_savedContext)
     
    114114            resultImage->transformColorSpace(LinearRGB, DeviceRGB);
    115115#endif
    116             context->drawImage(resultImage->image(), lastEffect->subRegion());
     116            ColorSpace colorSpace = DeviceColorSpace;
     117            if (object)
     118                colorSpace = object->style()->colorSpace();
     119            context->drawImage(resultImage->image(), lastEffect->subRegion(), colorSpace);
    117120        }
    118121    }
  • trunk/WebCore/svg/graphics/filters/SVGFEMerge.cpp

    r44839 r51212  
    8080    for (unsigned i = 0; i < m_mergeInputs.size(); i++) {
    8181        FloatRect destRect = calculateDrawingRect(m_mergeInputs[i]->subRegion());
    82         filterContext->drawImage(m_mergeInputs[i]->resultImage()->image(), destRect);
     82        filterContext->drawImage(m_mergeInputs[i]->resultImage()->image(), destRect, DeviceColorSpace);
    8383    }
    8484}
  • trunk/WebCore/svg/graphics/filters/SVGFEOffset.cpp

    r44841 r51212  
    8585                                  m_in->subRegion().height());
    8686
    87     filterContext->drawImage(m_in->resultImage()->image(), dstRect);
     87    filterContext->drawImage(m_in->resultImage()->image(), dstRect, DeviceColorSpace);
    8888}
    8989
  • trunk/WebCore/svg/graphics/filters/SVGFETile.cpp

    r46956 r51212  
    6868    OwnPtr<ImageBuffer> tileImage = ImageBuffer::create(tileRect.size());
    6969    GraphicsContext* tileImageContext = tileImage->context();
    70     tileImageContext->drawImage(m_in->resultImage()->image(), IntPoint());
     70    tileImageContext->drawImage(m_in->resultImage()->image(), IntPoint(), DeviceColorSpace);
    7171    RefPtr<Pattern> pattern = Pattern::create(tileImage->image(), true, true);
    7272
Note: See TracChangeset for help on using the changeset viewer.