Changeset 148953 in webkit


Ignore:
Timestamp:
Apr 23, 2013 2:02:03 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[Texmap] Don't paint to an intermediate surface when the result is going to be clipped out completely.
https://bugs.webkit.org/show_bug.cgi?id=115015

Patch by Noam Rosenthal <Noam Rosenthal> on 2013-04-23
Reviewed by Allan Sandfeld Jensen.

Maintain a clipBounds rectangle in TextureMapper, and test it against the bounds of an intermediate
surface before it is painted.
This allows us to opt out completely of painting into the surface if the result is going to be optimized
out by the GPU clipping.

Covered by tests in compositing/overlap-blending.

  • platform/graphics/texmap/TextureMapper.h:

(TextureMapper):

  • platform/graphics/texmap/TextureMapperGL.cpp:

(WebCore::TextureMapperGL::clipBounds):
(WebCore):

  • platform/graphics/texmap/TextureMapperGL.h:
  • platform/graphics/texmap/TextureMapperImageBuffer.h:
  • platform/graphics/texmap/TextureMapperLayer.cpp:

(WebCore::TextureMapperLayer::paintUsingOverlapRegions):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148952 r148953  
     12013-04-23  Noam Rosenthal  <noam@webkit.org>
     2
     3        [Texmap] Don't paint to an intermediate surface when the result is going to be clipped out completely.
     4        https://bugs.webkit.org/show_bug.cgi?id=115015
     5
     6        Reviewed by Allan Sandfeld Jensen.
     7
     8        Maintain a clipBounds rectangle in TextureMapper, and test it against the bounds of an intermediate
     9        surface before it is painted.
     10        This allows us to opt out completely of painting into the surface if the result is going to be optimized
     11        out by the GPU clipping.
     12
     13        Covered by tests in compositing/overlap-blending.
     14
     15        * platform/graphics/texmap/TextureMapper.h:
     16        (TextureMapper):
     17        * platform/graphics/texmap/TextureMapperGL.cpp:
     18        (WebCore::TextureMapperGL::clipBounds):
     19        (WebCore):
     20        * platform/graphics/texmap/TextureMapperGL.h:
     21        * platform/graphics/texmap/TextureMapperImageBuffer.h:
     22        * platform/graphics/texmap/TextureMapperLayer.cpp:
     23        (WebCore::TextureMapperLayer::paintUsingOverlapRegions):
     24
    1252013-04-23  Noam Rosenthal  <noam@webkit.org>
    226
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapper.h

    r148748 r148953  
    148148    virtual void beginClip(const TransformationMatrix&, const FloatRect&) = 0;
    149149    virtual void endClip() = 0;
     150    virtual IntRect clipBounds() = 0;
    150151    virtual PassRefPtr<BitmapTexture> createTexture() = 0;
    151152
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp

    r148748 r148953  
    11991199}
    12001200
     1201IntRect TextureMapperGL::clipBounds()
     1202{
     1203    return clipStack().current().scissorBox;
     1204}
     1205
    12011206PassRefPtr<BitmapTexture> TextureMapperGL::createTexture()
    12021207{
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.h

    r148090 r148953  
    6565    virtual void endPainting() OVERRIDE;
    6666    virtual void endClip() OVERRIDE;
     67    virtual IntRect clipBounds() OVERRIDE;
    6768    virtual IntSize maxTextureSize() const OVERRIDE { return IntSize(2000, 2000); }
    6869    virtual PassRefPtr<BitmapTexture> createTexture() OVERRIDE;
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperImageBuffer.h

    r144190 r148953  
    6161    virtual void bindSurface(BitmapTexture* surface) OVERRIDE { m_currentSurface = surface;}
    6262    virtual void endClip() OVERRIDE { graphicsContext()->restore(); }
     63    virtual IntRect clipBounds() OVERRIDE { return currentContext()->clipBounds(); }
    6364    virtual IntSize maxTextureSize() const;
    6465    virtual PassRefPtr<BitmapTexture> createTexture() OVERRIDE { return BitmapTextureImageBuffer::create(); }
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

    r148945 r148953  
    360360    }
    361361
    362     Vector<IntRect> rects;
    363 
    364362    nonOverlapRegion.translate(options.offset);
    365     rects = nonOverlapRegion.rects();
     363    Vector<IntRect> rects = nonOverlapRegion.rects();
    366364    for (size_t i = 0; i < rects.size(); ++i) {
     365        IntRect rect = rects[i];
     366        if (!rect.intersects(options.textureMapper->clipBounds()))
     367            continue;
     368
    367369        options.textureMapper->beginClip(TransformationMatrix(), rects[i]);
    368370        paintSelfAndChildrenWithReplica(options);
     
    372374    rects = overlapRegion.rects();
    373375    IntSize maxTextureSize = options.textureMapper->maxTextureSize();
    374     IntRect rect;
     376    IntRect adjustedClipBounds(options.textureMapper->clipBounds());
     377    adjustedClipBounds.move(-options.offset);
    375378    for (size_t i = 0; i < rects.size(); ++i) {
    376         rect = rects[i];
     379        IntRect rect = rects[i];
    377380        for (int x = rect.x(); x < rect.maxX(); x += maxTextureSize.width()) {
    378381            for (int y = rect.y(); y < rect.maxY(); y += maxTextureSize.height()) {
    379382                IntRect tileRect(IntPoint(x, y), maxTextureSize);
    380383                tileRect.intersect(rect);
     384                if (!tileRect.intersects(adjustedClipBounds))
     385                    continue;
     386
    381387                paintWithIntermediateSurface(options, tileRect);
    382388            }
Note: See TracChangeset for help on using the changeset viewer.