Changeset 142123 in webkit


Ignore:
Timestamp:
Feb 7, 2013 7:53:50 AM (11 years ago)
Author:
schenney@chromium.org
Message:

GraphicsContext::drawImageBuffer is inefficient
https://bugs.webkit.org/show_bug.cgi?id=104367

Reviewed by Dirk Schulze.

This patch converts all of the drawImage and drawImageBuffer
convenience methods (those that take parameters of various types) to
invoke the implementing method (that takes FloatRect src and dest)
directly, rather than through the next-most-convenient method as was
done previously. This will knock some layers off the stack compared
to the existing code, and may remove one or two constructor invocations.
This may be slightly more efficient, and also makes debugging simpler.

Also removes the unused drawImage method that takes and IntRect source
area and IntRect destination. It is not invoked anywhere in a standard
WebKit checkout.

No new tests. No change in functionality, just refactoring.

  • platform/graphics/GraphicsContext.cpp:

(WebCore::GraphicsContext::drawImage): Modify all the convenience versions to call
the implementing version directly.
(WebCore::GraphicsContext::drawImageBuffer): Modify all the convenience versions
to call the implementing version directly.

  • platform/graphics/GraphicsContext.h:

(GraphicsContext): Remove IntRect, IntRect version of drawImage.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r142122 r142123  
     12013-02-07  Stephen Chenney  <schenney@chromium.org>
     2
     3        GraphicsContext::drawImageBuffer is inefficient
     4        https://bugs.webkit.org/show_bug.cgi?id=104367
     5
     6        Reviewed by Dirk Schulze.
     7
     8        This patch converts all of the drawImage and drawImageBuffer
     9        convenience methods (those that take parameters of various types) to
     10        invoke the implementing method (that takes FloatRect src and dest)
     11        directly, rather than through the next-most-convenient method as was
     12        done previously. This will knock some layers off the stack compared
     13        to the existing code, and may remove one or two constructor invocations.
     14        This may be slightly more efficient, and also makes debugging simpler.
     15
     16        Also removes the unused drawImage method that takes and IntRect source
     17        area and IntRect destination. It is not invoked anywhere in a standard
     18        WebKit checkout.
     19
     20        No new tests. No change in functionality, just refactoring.
     21
     22        * platform/graphics/GraphicsContext.cpp:
     23        (WebCore::GraphicsContext::drawImage): Modify all the convenience versions to call
     24        the implementing version directly.
     25        (WebCore::GraphicsContext::drawImageBuffer): Modify all the convenience versions
     26        to call the implementing version directly.
     27        * platform/graphics/GraphicsContext.h:
     28        (GraphicsContext): Remove IntRect, IntRect version of drawImage.
     29
    1302013-02-07  Kent Tamura  <tkent@chromium.org>
    231
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp

    r140279 r142123  
    451451    if (!image)
    452452        return;
    453     drawImage(image, styleColorSpace, p, IntRect(IntPoint(), image->size()), op, shouldRespectImageOrientation);
     453    drawImage(image, styleColorSpace, FloatRect(IntRect(p, image->size())), FloatRect(FloatPoint(), FloatSize(image->size())), op, shouldRespectImageOrientation);
    454454}
    455455
     
    458458    if (!image)
    459459        return;
    460     drawImage(image, styleColorSpace, r, IntRect(IntPoint(), image->size()), op, shouldRespectImageOrientation, useLowQualityScale);
     460    drawImage(image, styleColorSpace, FloatRect(r), FloatRect(FloatPoint(), FloatSize(image->size())), op, shouldRespectImageOrientation, useLowQualityScale);
    461461}
    462462
    463463void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation)
    464464{
    465     drawImage(image, styleColorSpace, IntRect(dest, srcRect.size()), srcRect, op, shouldRespectImageOrientation);
    466 }
    467 
    468 void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
    469 {
    470     drawImage(image, styleColorSpace, FloatRect(dest), srcRect, op, shouldRespectImageOrientation, useLowQualityScale);
     465    drawImage(image, styleColorSpace, FloatRect(IntRect(dest, srcRect.size())), FloatRect(srcRect), op, shouldRespectImageOrientation);
    471466}
    472467
    473468void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
    474469{
    475     drawImage(image, styleColorSpace, FloatRect(dest), src, op, BlendModeNormal, shouldRespectImageOrientation, useLowQualityScale);
     470    drawImage(image, styleColorSpace, dest, src, op, BlendModeNormal, shouldRespectImageOrientation, useLowQualityScale);
    476471}
    477472
     
    544539    if (!image)
    545540        return;
    546     drawImageBuffer(image, styleColorSpace, p, IntRect(IntPoint(), image->logicalSize()), op, blendMode);
     541    drawImageBuffer(image, styleColorSpace, FloatRect(IntRect(p, image->logicalSize())), FloatRect(FloatPoint(), FloatSize(image->logicalSize())), op, blendMode);
    547542}
    548543
     
    551546    if (!image)
    552547        return;
    553     drawImageBuffer(image, styleColorSpace, r, IntRect(IntPoint(), image->logicalSize()), op, blendMode, useLowQualityScale);
     548    drawImageBuffer(image, styleColorSpace, FloatRect(r), FloatRect(FloatPoint(), FloatSize(image->logicalSize())), op, blendMode, useLowQualityScale);
    554549}
    555550
    556551void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op, BlendMode blendMode)
    557552{
    558     drawImageBuffer(image, styleColorSpace, IntRect(dest, srcRect.size()), srcRect, op, blendMode);
     553    drawImageBuffer(image, styleColorSpace, FloatRect(IntRect(dest, srcRect.size())), FloatRect(srcRect), op, blendMode);
    559554}
    560555
    561556void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
    562557{
    563     drawImageBuffer(image, styleColorSpace, FloatRect(dest), srcRect, op, blendMode, useLowQualityScale);
     558    drawImageBuffer(image, styleColorSpace, FloatRect(dest), FloatRect(srcRect), op, blendMode, useLowQualityScale);
    564559}
    565560
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r139967 r142123  
    322322        void drawImage(Image*, ColorSpace styleColorSpace, const IntRect&, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
    323323        void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation);
    324         void drawImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
    325324        void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect);
    326325        void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
Note: See TracChangeset for help on using the changeset viewer.