Changeset 190910 in webkit


Ignore:
Timestamp:
Oct 12, 2015, 5:52:13 PM (10 years ago)
Author:
Simon Fraser
Message:

Remove Image::spaceSize() and ImageBuffer::spaceSize()
https://bugs.webkit.org/show_bug.cgi?id=150064

Reviewed by Tim Horton.

Image spacing when tiled should not be a property of the image; but a description
of how it's drawn, like tile size. So remove spacing from Image and ImageBuffer,
and pass it in as an argument.

  • platform/graphics/BitmapImage.cpp:

(WebCore::BitmapImage::drawPattern):

  • platform/graphics/BitmapImage.h:
  • platform/graphics/CrossfadeGeneratedImage.cpp:

(WebCore::CrossfadeGeneratedImage::drawPattern):

  • platform/graphics/CrossfadeGeneratedImage.h:
  • platform/graphics/GeneratedImage.h:
  • platform/graphics/GradientImage.cpp:

(WebCore::GradientImage::drawPattern):

  • platform/graphics/GradientImage.h:
  • platform/graphics/GraphicsContext.cpp:

(WebCore::GraphicsContext::drawTiledImage):

  • platform/graphics/GraphicsContext.h:
  • platform/graphics/Image.cpp:

(WebCore::Image::drawTiled):

  • platform/graphics/Image.h:

(WebCore::Image::spaceSize): Deleted.
(WebCore::Image::setSpaceSize): Deleted.

  • platform/graphics/ImageBuffer.h:

(WebCore::ImageBuffer::spaceSize): Deleted.
(WebCore::ImageBuffer::setSpaceSize): Deleted.

  • platform/graphics/NamedImageGeneratedImage.cpp:

(WebCore::NamedImageGeneratedImage::drawPattern):

  • platform/graphics/NamedImageGeneratedImage.h:
  • platform/graphics/cg/ImageBufferCG.cpp:

(WebCore::ImageBuffer::copyImage):
(WebCore::ImageBuffer::drawPattern):

  • platform/graphics/cg/ImageCG.cpp:

(WebCore::Image::drawPattern):

  • rendering/RenderBoxModelObject.cpp:

(WebCore::RenderBoxModelObject::paintFillLayerExtended):

  • svg/graphics/SVGImage.cpp:

(WebCore::SVGImage::drawPatternForContainer):

  • svg/graphics/SVGImage.h:
  • svg/graphics/SVGImageForContainer.cpp:

(WebCore::SVGImageForContainer::drawPattern):

  • svg/graphics/SVGImageForContainer.h:
Location:
trunk/Source/WebCore
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r190906 r190910  
     12015-10-12  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Remove Image::spaceSize() and ImageBuffer::spaceSize()
     4        https://bugs.webkit.org/show_bug.cgi?id=150064
     5
     6        Reviewed by Tim Horton.
     7
     8        Image spacing when tiled should not be a property of the image; but a description
     9        of how it's drawn, like tile size. So remove spacing from Image and ImageBuffer,
     10        and pass it in as an argument.
     11
     12        * platform/graphics/BitmapImage.cpp:
     13        (WebCore::BitmapImage::drawPattern):
     14        * platform/graphics/BitmapImage.h:
     15        * platform/graphics/CrossfadeGeneratedImage.cpp:
     16        (WebCore::CrossfadeGeneratedImage::drawPattern):
     17        * platform/graphics/CrossfadeGeneratedImage.h:
     18        * platform/graphics/GeneratedImage.h:
     19        * platform/graphics/GradientImage.cpp:
     20        (WebCore::GradientImage::drawPattern):
     21        * platform/graphics/GradientImage.h:
     22        * platform/graphics/GraphicsContext.cpp:
     23        (WebCore::GraphicsContext::drawTiledImage):
     24        * platform/graphics/GraphicsContext.h:
     25        * platform/graphics/Image.cpp:
     26        (WebCore::Image::drawTiled):
     27        * platform/graphics/Image.h:
     28        (WebCore::Image::spaceSize): Deleted.
     29        (WebCore::Image::setSpaceSize): Deleted.
     30        * platform/graphics/ImageBuffer.h:
     31        (WebCore::ImageBuffer::spaceSize): Deleted.
     32        (WebCore::ImageBuffer::setSpaceSize): Deleted.
     33        * platform/graphics/NamedImageGeneratedImage.cpp:
     34        (WebCore::NamedImageGeneratedImage::drawPattern):
     35        * platform/graphics/NamedImageGeneratedImage.h:
     36        * platform/graphics/cg/ImageBufferCG.cpp:
     37        (WebCore::ImageBuffer::copyImage):
     38        (WebCore::ImageBuffer::drawPattern):
     39        * platform/graphics/cg/ImageCG.cpp:
     40        (WebCore::Image::drawPattern):
     41        * rendering/RenderBoxModelObject.cpp:
     42        (WebCore::RenderBoxModelObject::paintFillLayerExtended):
     43        * svg/graphics/SVGImage.cpp:
     44        (WebCore::SVGImage::drawPatternForContainer):
     45        * svg/graphics/SVGImage.h:
     46        * svg/graphics/SVGImageForContainer.cpp:
     47        (WebCore::SVGImageForContainer::drawPattern):
     48        * svg/graphics/SVGImageForContainer.h:
     49
    1502015-10-12  Andreas Kling  <akling@apple.com>
    251
  • trunk/Source/WebCore/platform/graphics/BitmapImage.cpp

    r190124 r190910  
    607607
    608608void BitmapImage::drawPattern(GraphicsContext& ctxt, const FloatRect& tileRect, const AffineTransform& transform,
    609     const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode)
     609    const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode)
    610610{
    611611    if (tileRect.isEmpty())
     
    613613
    614614    if (!ctxt.drawLuminanceMask()) {
    615         Image::drawPattern(ctxt, tileRect, transform, phase, styleColorSpace, op, destRect, blendMode);
     615        Image::drawPattern(ctxt, tileRect, transform, phase, spacing, styleColorSpace, op, destRect, blendMode);
    616616        return;
    617617    }
     
    635635        if (!m_cachedImage)
    636636            return;
    637 
    638         m_cachedImage->setSpaceSize(spaceSize());
    639637    }
    640638
    641639    ctxt.setDrawLuminanceMask(false);
    642     m_cachedImage->drawPattern(ctxt, tileRect, transform, phase, styleColorSpace, op, destRect, blendMode);
     640    m_cachedImage->drawPattern(ctxt, tileRect, transform, phase, spacing, styleColorSpace, op, destRect, blendMode);
    643641}
    644642
  • trunk/Source/WebCore/platform/graphics/BitmapImage.h

    r189144 r190910  
    144144
    145145    virtual void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform,
    146         const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal) override;
     146        const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal) override;
    147147
    148148    // Accessors for native image formats.
     
    208208#if USE(WINGDI)
    209209    virtual void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform,
    210         const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
     210        const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect);
    211211#endif
    212212
  • trunk/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.cpp

    r190124 r190910  
    9696}
    9797
    98 void CrossfadeGeneratedImage::drawPattern(GraphicsContext& context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
     98void CrossfadeGeneratedImage::drawPattern(GraphicsContext& context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
    9999{
    100100    std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(size(), context.renderingMode());
     
    107107
    108108    // Tile the image buffer into the context.
    109     imageBuffer->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, compositeOp, dstRect, blendMode);
     109    imageBuffer->drawPattern(context, srcRect, patternTransform, phase, spacing, styleColorSpace, compositeOp, dstRect, blendMode);
    110110}
    111111
  • trunk/Source/WebCore/platform/graphics/CrossfadeGeneratedImage.h

    r189144 r190910  
    5151protected:
    5252    virtual void draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode, ImageOrientationDescription) override;
    53     virtual void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& dstRect, BlendMode) override;
     53    virtual void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& dstRect, BlendMode) override;
    5454
    5555    CrossfadeGeneratedImage(Image* fromImage, Image* toImage, float percentage, const FloatSize& crossfadeSize, const FloatSize&);
  • trunk/Source/WebCore/platform/graphics/GeneratedImage.h

    r189144 r190910  
    5252    virtual void draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode, ImageOrientationDescription) override = 0;
    5353    virtual void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform,
    54         const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode) override = 0;
     54        const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode) override = 0;
    5555
    5656    // FIXME: Implement this to be less conservative.
  • trunk/Source/WebCore/platform/graphics/GradientImage.cpp

    r189144 r190910  
    5757
    5858void GradientImage::drawPattern(GraphicsContext& destContext, const FloatRect& srcRect, const AffineTransform& patternTransform,
    59     const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode blendMode)
     59    const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& destRect, BlendMode blendMode)
    6060{
    6161    // Allow the generator to provide visually-equivalent tiling parameters for better performance.
     
    8989    }
    9090
    91     m_cachedImageBuffer->setSpaceSize(spaceSize());
    9291    destContext.setDrawLuminanceMask(false);
    9392
    9493    // Tile the image buffer into the context.
    95     m_cachedImageBuffer->drawPattern(destContext, adjustedSrcRect, adjustedPatternCTM, phase, styleColorSpace, compositeOp, destRect, blendMode);
     94    m_cachedImageBuffer->drawPattern(destContext, adjustedSrcRect, adjustedPatternCTM, phase, spacing, styleColorSpace, compositeOp, destRect, blendMode);
    9695}
    9796
  • trunk/Source/WebCore/platform/graphics/GradientImage.h

    r189144 r190910  
    4949    virtual void draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode, ImageOrientationDescription) override;
    5050    virtual void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform,
    51         const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode) override;
     51        const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode) override;
    5252
    5353    GradientImage(PassRefPtr<Gradient>, const FloatSize&);
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r189144 r190910  
    400400}
    401401
    402 void GraphicsContext::drawTiledImage(Image* image, ColorSpace colorSpace, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize,
    403     const ImagePaintingOptions& imagePaintingOptions)
     402void GraphicsContext::drawTiledImage(Image* image, ColorSpace colorSpace, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& imagePaintingOptions)
    404403{
    405404    if (paintingDisabled() || !image)
     
    407406
    408407    InterpolationQualityMaintainer interpolationQualityForThisScope(*this, imagePaintingOptions.m_useLowQualityScale ? InterpolationLow : imageInterpolationQuality());
    409     image->drawTiled(*this, destination, source, tileSize, colorSpace, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode);
     408    image->drawTiled(*this, destination, source, tileSize, spacing, colorSpace, imagePaintingOptions.m_compositeOperator, imagePaintingOptions.m_blendMode);
    410409}
    411410
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r190249 r190910  
    313313        void drawImage(Image*, ColorSpace, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = ImagePaintingOptions());
    314314
    315         void drawTiledImage(Image*, ColorSpace, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize,
    316             const ImagePaintingOptions& = ImagePaintingOptions());
     315        void drawTiledImage(Image*, ColorSpace, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& = ImagePaintingOptions());
    317316        void drawTiledImage(Image*, ColorSpace, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor,
    318317            Image::TileRule, Image::TileRule, const ImagePaintingOptions& = ImagePaintingOptions());
  • trunk/Source/WebCore/platform/graphics/Image.cpp

    r189144 r190910  
    9595}
    9696
    97 void Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, ColorSpace styleColorSpace, CompositeOperator op, BlendMode blendMode)
     97void Image::drawTiled(GraphicsContext& ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator op, BlendMode blendMode)
    9898{   
    9999    if (mayFillWithSolidColor()) {
     
    118118
    119119    FloatRect oneTileRect;
    120     FloatSize actualTileSize(scaledTileSize.width() + spaceSize().width(), scaledTileSize.height() + spaceSize().height());
     120    FloatSize actualTileSize(scaledTileSize.width() + spacing.width(), scaledTileSize.height() + spacing.height());
    121121    oneTileRect.setX(destRect.x() + fmodf(fmodf(-srcPoint.x(), actualTileSize.width()) - actualTileSize.width(), actualTileSize.width()));
    122122    oneTileRect.setY(destRect.y() + fmodf(fmodf(-srcPoint.y(), actualTileSize.height()) - actualTileSize.height(), actualTileSize.height()));
     
    196196    AffineTransform patternTransform = AffineTransform().scaleNonUniform(scale.width(), scale.height());
    197197    FloatRect tileRect(FloatPoint(), intrinsicTileSize);
    198     drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), styleColorSpace, op, destRect, blendMode);
     198    drawPattern(ctxt, tileRect, patternTransform, oneTileRect.location(), spacing, styleColorSpace, op, destRect, blendMode);
    199199
    200200#if PLATFORM(IOS)
     
    234234    FloatPoint patternPhase(dstRect.x() - hPhase, dstRect.y() - vPhase);
    235235   
    236     drawPattern(ctxt, srcRect, patternTransform, patternPhase, styleColorSpace, op, dstRect);
     236    drawPattern(ctxt, srcRect, patternTransform, patternPhase, FloatSize(), styleColorSpace, op, dstRect);
    237237
    238238#if PLATFORM(IOS)
  • trunk/Source/WebCore/platform/graphics/Image.h

    r189144 r190910  
    168168
    169169    virtual void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform,
    170         const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal);
     170        const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal);
    171171
    172172#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
     
    178178#endif
    179179
    180     FloatSize spaceSize() const { return m_space; }
    181     void setSpaceSize(const FloatSize& space)
    182     {
    183         m_space = space;
    184     }
    185180protected:
    186181    Image(ImageObserver* = nullptr);
     
    193188#endif
    194189    virtual void draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode, ImageOrientationDescription);
    195     void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, ColorSpace styleColorSpace,
     190    void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, const FloatSize& spacing, ColorSpace styleColorSpace,
    196191        CompositeOperator , BlendMode);
    197192    void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, ColorSpace styleColorSpace, CompositeOperator);
     
    204199    RefPtr<SharedBuffer> m_encodedImageData;
    205200    ImageObserver* m_imageObserver;
    206     FloatSize m_space;
    207201};
    208202
  • trunk/Source/WebCore/platform/graphics/ImageBuffer.h

    r190124 r190910  
    119119    bool copyToPlatformTexture(GraphicsContext3D&, GC3Denum, Platform3DObject, GC3Denum, bool, bool);
    120120
    121     FloatSize spaceSize() const { return m_space; }
    122     void setSpaceSize(const FloatSize& space) { m_space = space; }
    123 
    124121    // These functions are used when clamping the ImageBuffer which is created for filter, masker or clipper.
    125122    static bool sizeNeedsClamping(const FloatSize&);
     
    139136
    140137    void draw(GraphicsContext&, ColorSpace, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false);
    141     void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal);
     138    void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& destRect, BlendMode = BlendModeNormal);
    142139
    143140    inline void genericConvertToLuminanceMask();
     
    154151    IntSize m_logicalSize;
    155152    float m_resolutionScale;
    156     FloatSize m_space;
    157153
    158154    // This constructor will place its success into the given out-variable
  • trunk/Source/WebCore/platform/graphics/NamedImageGeneratedImage.cpp

    r190124 r190910  
    6161}
    6262
    63 void NamedImageGeneratedImage::drawPattern(GraphicsContext& context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
     63void NamedImageGeneratedImage::drawPattern(GraphicsContext& context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
    6464{
    6565#if USE(NEW_THEME)
     
    7272
    7373    // Tile the image buffer into the context.
    74     imageBuffer->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, compositeOp, dstRect, blendMode);
     74    imageBuffer->drawPattern(context, srcRect, patternTransform, phase, spacing, styleColorSpace, compositeOp, dstRect, blendMode);
    7575#else
    7676    UNUSED_PARAM(context);
  • trunk/Source/WebCore/platform/graphics/NamedImageGeneratedImage.h

    r189144 r190910  
    4343protected:
    4444    virtual void draw(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode, ImageOrientationDescription) override;
    45     virtual void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& dstRect, BlendMode) override;
     45    virtual void drawPattern(GraphicsContext&, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator, const FloatRect& dstRect, BlendMode) override;
    4646
    4747    NamedImageGeneratedImage(String name, const FloatSize&);
  • trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp

    r190124 r190910  
    197197        return nullptr;
    198198
    199     auto bitmapImage = BitmapImage::create(image.get());
    200     bitmapImage->setSpaceSize(spaceSize());
    201 
    202     return WTF::move(bitmapImage);
     199    return BitmapImage::create(image.get());
    203200}
    204201
     
    248245}
    249246
    250 void ImageBuffer::drawPattern(GraphicsContext& destContext, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode)
     247void ImageBuffer::drawPattern(GraphicsContext& destContext, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode)
    251248{
    252249    FloatRect adjustedSrcRect = srcRect;
     
    256253        if (&destContext == &context() || destContext.isAcceleratedContext()) {
    257254            if (RefPtr<Image> copy = copyImage(CopyBackingStore)) // Drawing into our own buffer, need to deep copy.
    258                 copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
     255                copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, spacing, styleColorSpace, op, destRect, blendMode);
    259256        } else {
    260257            if (RefPtr<Image> imageForRendering = copyImage(DontCopyBackingStore))
    261                 imageForRendering->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
     258                imageForRendering->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, spacing, styleColorSpace, op, destRect, blendMode);
    262259        }
    263260    } else {
    264261        if (RefPtr<Image> copy = copyImage(CopyBackingStore))
    265             copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, styleColorSpace, op, destRect, blendMode);
     262            copy->drawPattern(destContext, adjustedSrcRect, patternTransform, phase, spacing, styleColorSpace, op, destRect, blendMode);
    266263    }
    267264}
  • trunk/Source/WebCore/platform/graphics/cg/ImageCG.cpp

    r189144 r190910  
    8888
    8989void Image::drawPattern(GraphicsContext& ctxt, const FloatRect& tileRect, const AffineTransform& patternTransform,
    90     const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode)
     90    const FloatPoint& phase, const FloatSize& spacing, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect, BlendMode blendMode)
    9191{
    9292    if (!nativeImageForCurrentFrame())
     
    132132    subImage = Image::imageWithColorSpace(subImage.get(), styleColorSpace);
    133133
    134     // If we need to paint gaps between tiles because we have a partially loaded image or non-zero spaceSize(),
     134    // If we need to paint gaps between tiles because we have a partially loaded image or non-zero spacing,
    135135    // fall back to the less efficient CGPattern-based mechanism.
    136136    float scaledTileWidth = tileRect.width() * narrowPrecisionToFloat(patternTransform.a());
    137137    float w = CGImageGetWidth(tileImage);
    138     if (w == size().width() && h == size().height() && !spaceSize().width() && !spaceSize().height())
     138    if (w == size().width() && h == size().height() && !spacing.width() && !spacing.height())
    139139        CGContextDrawTiledImage(context, FloatRect(adjustedX, adjustedY, scaledTileWidth, scaledTileHeight), subImage.get());
    140140    else {
     
    150150        CGImageRef platformImage = CGImageRetain(subImage.get());
    151151        RetainPtr<CGPatternRef> pattern = adoptCF(CGPatternCreate(platformImage, CGRectMake(0, 0, tileRect.width(), tileRect.height()), matrix,
    152             tileRect.width() + spaceSize().width() * (1 / narrowPrecisionToFloat(patternTransform.a())),
    153             tileRect.height() + spaceSize().height() * (1 / narrowPrecisionToFloat(patternTransform.d())),
     152            tileRect.width() + spacing.width() * (1 / narrowPrecisionToFloat(patternTransform.a())),
     153            tileRect.height() + spacing.height() * (1 / narrowPrecisionToFloat(patternTransform.d())),
    154154            kCGPatternTilingConstantSpacing, true, &patternCallbacks));
    155155       
  • trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp

    r190883 r190910  
    837837            context.setDrawLuminanceMask(bgLayer->maskSourceType() == MaskLuminance);
    838838            bool useLowQualityScaling = shouldPaintAtLowQuality(context, image.get(), bgLayer, geometry.tileSize());
    839             if (image.get())
    840                 image->setSpaceSize(geometry.spaceSize());
    841             context.drawTiledImage(image.get(), style().colorSpace(), geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), ImagePaintingOptions(compositeOp, bgLayer->blendMode(), ImageOrientationDescription(), useLowQualityScaling));
     839            context.drawTiledImage(image.get(), style().colorSpace(), geometry.destRect(), toLayoutPoint(geometry.relativePhase()), geometry.tileSize(), geometry.spaceSize(), ImagePaintingOptions(compositeOp, bgLayer->blendMode(), ImageOrientationDescription(), useLowQualityScaling));
    842840        }
    843841    }
  • trunk/Source/WebCore/svg/graphics/SVGImage.cpp

    r190124 r190910  
    186186#endif
    187187
    188 void SVGImage::drawPatternForContainer(GraphicsContext& context, const FloatSize containerSize, float zoom, const FloatRect& srcRect,
    189     const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
     188void SVGImage::drawPatternForContainer(GraphicsContext& context, const FloatSize& containerSize, float zoom, const FloatRect& srcRect,
     189    const AffineTransform& patternTransform, const FloatPoint& phase, const FloatSize& spacing, ColorSpace colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
    190190{
    191191    FloatRect zoomedContainerRect = FloatRect(FloatPoint(), containerSize);
     
    211211    if (!image)
    212212        return;
    213     image->setSpaceSize(spaceSize());
    214213
    215214    // Adjust the source rect and transform due to the image buffer's scaling.
     
    220219
    221220    context.setDrawLuminanceMask(false);
    222     image->drawPattern(context, scaledSrcRect, unscaledPatternTransform, phase, colorSpace, compositeOp, dstRect, blendMode);
     221    image->drawPattern(context, scaledSrcRect, unscaledPatternTransform, phase, spacing, colorSpace, compositeOp, dstRect, blendMode);
    223222}
    224223
  • trunk/Source/WebCore/svg/graphics/SVGImage.h

    r189144 r190910  
    9494    virtual void draw(GraphicsContext&, const FloatRect& fromRect, const FloatRect& toRect, ColorSpace styleColorSpace, CompositeOperator, BlendMode, ImageOrientationDescription) override;
    9595    void drawForContainer(GraphicsContext&, const FloatSize, float, const FloatRect&, const FloatRect&, ColorSpace, CompositeOperator, BlendMode);
    96     void drawPatternForContainer(GraphicsContext&, const FloatSize, float, const FloatRect&, const AffineTransform&, const FloatPoint&, ColorSpace,
     96    void drawPatternForContainer(GraphicsContext&, const FloatSize& containerSize, float zoom, const FloatRect& srcRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, ColorSpace,
    9797        CompositeOperator, const FloatRect&, BlendMode);
    9898
  • trunk/Source/WebCore/svg/graphics/SVGImageForContainer.cpp

    r189144 r190910  
    4242
    4343void SVGImageForContainer::drawPattern(GraphicsContext& context, const FloatRect& srcRect, const AffineTransform& patternTransform,
    44     const FloatPoint& phase, ColorSpace colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
     44    const FloatPoint& phase, const FloatSize& spacing, ColorSpace colorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode)
    4545{
    46     m_image->setSpaceSize(spaceSize());
    47     m_image->drawPatternForContainer(context, m_containerSize, m_zoom, srcRect, patternTransform, phase, colorSpace, compositeOp, dstRect, blendMode);
     46    m_image->drawPatternForContainer(context, m_containerSize, m_zoom, srcRect, patternTransform, phase, spacing, colorSpace, compositeOp, dstRect, blendMode);
    4847}
    4948
  • trunk/Source/WebCore/svg/graphics/SVGImageForContainer.h

    r189144 r190910  
    5959    virtual void draw(GraphicsContext&, const FloatRect&, const FloatRect&, ColorSpace, CompositeOperator, BlendMode, ImageOrientationDescription) override;
    6060
    61     virtual void drawPattern(GraphicsContext&, const FloatRect&, const AffineTransform&, const FloatPoint&, ColorSpace, CompositeOperator, const FloatRect&, BlendMode) override;
     61    virtual void drawPattern(GraphicsContext&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, ColorSpace, CompositeOperator, const FloatRect&, BlendMode) override;
    6262
    6363    // FIXME: Implement this to be less conservative.
Note: See TracChangeset for help on using the changeset viewer.