Changeset 90492 in webkit


Ignore:
Timestamp:
Jul 6, 2011 1:56:28 PM (13 years ago)
Author:
jamesr@google.com
Message:

2011-07-01 James Robinson <jamesr@chromium.org>

Reviewed by Stephen White.

[chromium] Externalize layer visibility calculation
https://bugs.webkit.org/show_bug.cgi?id=63847

This moves the layer visibility calculation from the layer itself out to LayerRendererChromium, like the other
calculated properties. Previously, we were doing this calculating at paint time and again at draw time and
relying on the fact that this produced the same value. This avoids the redundant calculation.

Covered by existing compositing/ layout tests.

  • platform/graphics/chromium/ContentLayerChromium.cpp: (WebCore::ContentLayerChromium::ContentLayerChromium): (WebCore::ContentLayerChromium::paintContentsIfDirty): (WebCore::ContentLayerChromium::tilingTransform): (WebCore::ContentLayerChromium::contentBounds): (WebCore::ContentLayerChromium::updateLayerSize): (WebCore::ContentLayerChromium::draw): (WebCore::ContentLayerChromium::setTilingOption): (WebCore::ContentLayerChromium::setIsMask):
  • platform/graphics/chromium/ContentLayerChromium.h:
  • platform/graphics/chromium/ImageLayerChromium.cpp: (WebCore::ImageLayerChromium::paintContentsIfDirty): (WebCore::ImageLayerChromium::contentBounds):
  • platform/graphics/chromium/ImageLayerChromium.h:
  • platform/graphics/chromium/LayerChromium.cpp: (WebCore::LayerChromium::pushPropertiesTo):
  • platform/graphics/chromium/LayerChromium.h: (WebCore::LayerChromium::contentBounds): (WebCore::LayerChromium::visibleLayerRect): (WebCore::LayerChromium::setVisibleLayerRect): (WebCore::LayerChromium::draw):
  • platform/graphics/chromium/LayerRendererChromium.cpp: (WebCore::calculateVisibleLayerRect): (WebCore::LayerRendererChromium::paintLayerContents): (WebCore::LayerRendererChromium::drawLayer):
  • platform/graphics/chromium/RenderSurfaceChromium.cpp: (WebCore::RenderSurfaceChromium::draw):
  • platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp: (WebCore::CCCanvasLayerImpl::draw):
  • platform/graphics/chromium/cc/CCCanvasLayerImpl.h:
  • platform/graphics/chromium/cc/CCLayerImpl.cpp: (WebCore::CCLayerImpl::draw):
  • platform/graphics/chromium/cc/CCLayerImpl.h: (WebCore::CCLayerImpl::contentBounds): (WebCore::CCLayerImpl::setContentBounds): (WebCore::CCLayerImpl::visibleLayerRect): (WebCore::CCLayerImpl::setVisibleLayerRect): (WebCore::CCLayerImpl::doubleSided): (WebCore::CCLayerImpl::setDoubleSided):
  • platform/graphics/chromium/cc/CCPluginLayerImpl.cpp: (WebCore::CCPluginLayerImpl::draw):
  • platform/graphics/chromium/cc/CCPluginLayerImpl.h:
  • platform/graphics/chromium/cc/CCVideoLayerImpl.cpp: (WebCore::CCVideoLayerImpl::draw):
  • platform/graphics/chromium/cc/CCVideoLayerImpl.h:
Location:
trunk/Source/WebCore
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90486 r90492  
     12011-07-01  James Robinson  <jamesr@chromium.org>
     2
     3        Reviewed by Stephen White.
     4
     5        [chromium] Externalize layer visibility calculation
     6        https://bugs.webkit.org/show_bug.cgi?id=63847
     7
     8        This moves the layer visibility calculation from the layer itself out to LayerRendererChromium, like the other
     9        calculated properties.  Previously, we were doing this calculating at paint time and again at draw time and
     10        relying on the fact that this produced the same value.  This avoids the redundant calculation.
     11
     12        Covered by existing compositing/ layout tests.
     13
     14        * platform/graphics/chromium/ContentLayerChromium.cpp:
     15        (WebCore::ContentLayerChromium::ContentLayerChromium):
     16        (WebCore::ContentLayerChromium::paintContentsIfDirty):
     17        (WebCore::ContentLayerChromium::tilingTransform):
     18        (WebCore::ContentLayerChromium::contentBounds):
     19        (WebCore::ContentLayerChromium::updateLayerSize):
     20        (WebCore::ContentLayerChromium::draw):
     21        (WebCore::ContentLayerChromium::setTilingOption):
     22        (WebCore::ContentLayerChromium::setIsMask):
     23        * platform/graphics/chromium/ContentLayerChromium.h:
     24        * platform/graphics/chromium/ImageLayerChromium.cpp:
     25        (WebCore::ImageLayerChromium::paintContentsIfDirty):
     26        (WebCore::ImageLayerChromium::contentBounds):
     27        * platform/graphics/chromium/ImageLayerChromium.h:
     28        * platform/graphics/chromium/LayerChromium.cpp:
     29        (WebCore::LayerChromium::pushPropertiesTo):
     30        * platform/graphics/chromium/LayerChromium.h:
     31        (WebCore::LayerChromium::contentBounds):
     32        (WebCore::LayerChromium::visibleLayerRect):
     33        (WebCore::LayerChromium::setVisibleLayerRect):
     34        (WebCore::LayerChromium::draw):
     35        * platform/graphics/chromium/LayerRendererChromium.cpp:
     36        (WebCore::calculateVisibleLayerRect):
     37        (WebCore::LayerRendererChromium::paintLayerContents):
     38        (WebCore::LayerRendererChromium::drawLayer):
     39        * platform/graphics/chromium/RenderSurfaceChromium.cpp:
     40        (WebCore::RenderSurfaceChromium::draw):
     41        * platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp:
     42        (WebCore::CCCanvasLayerImpl::draw):
     43        * platform/graphics/chromium/cc/CCCanvasLayerImpl.h:
     44        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
     45        (WebCore::CCLayerImpl::draw):
     46        * platform/graphics/chromium/cc/CCLayerImpl.h:
     47        (WebCore::CCLayerImpl::contentBounds):
     48        (WebCore::CCLayerImpl::setContentBounds):
     49        (WebCore::CCLayerImpl::visibleLayerRect):
     50        (WebCore::CCLayerImpl::setVisibleLayerRect):
     51        (WebCore::CCLayerImpl::doubleSided):
     52        (WebCore::CCLayerImpl::setDoubleSided):
     53        * platform/graphics/chromium/cc/CCPluginLayerImpl.cpp:
     54        (WebCore::CCPluginLayerImpl::draw):
     55        * platform/graphics/chromium/cc/CCPluginLayerImpl.h:
     56        * platform/graphics/chromium/cc/CCVideoLayerImpl.cpp:
     57        (WebCore::CCVideoLayerImpl::draw):
     58        * platform/graphics/chromium/cc/CCVideoLayerImpl.h:
     59
    1602011-07-06  John Sullivan  <sullivan@apple.com>
    261
  • trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp

    r90260 r90492  
    9393    : LayerChromium(owner)
    9494    , m_tilingOption(ContentLayerChromium::AutoTile)
    95     , m_isMask(false)
    9695{
    9796}
     
    102101}
    103102
    104 void ContentLayerChromium::paintContentsIfDirty(const IntRect& targetSurfaceRect)
     103void ContentLayerChromium::paintContentsIfDirty()
    105104{
    106105    ASSERT(drawsContent());
    107106    ASSERT(layerRenderer());
    108107
    109     updateLayerSize(layerBounds().size());
    110 
    111     IntRect layerRect = visibleLayerRect(targetSurfaceRect);
     108    updateLayerSize();
     109
     110    const IntRect& layerRect = visibleLayerRect();
    112111    if (layerRect.isEmpty())
    113112        return;
    114113
    115114    IntRect dirty = enclosingIntRect(m_dirtyRect);
    116     dirty.intersect(layerBounds());
     115    dirty.intersect(IntRect(IntPoint(), contentBounds()));
    117116    m_tiler->invalidateRect(dirty);
    118117
     
    153152{
    154153    TransformationMatrix transform = ccLayerImpl()->drawTransform();
    155     // Tiler draws from the upper left corner. The draw transform
    156     // specifies the middle of the layer.
    157     IntSize size = bounds();
    158     transform.translate(-size.width() / 2.0, -size.height() / 2.0);
     154
     155    if (contentBounds().isEmpty())
     156        return transform;
     157
     158    transform.scaleNonUniform(bounds().width() / static_cast<double>(contentBounds().width()),
     159                              bounds().height() / static_cast<double>(contentBounds().height()));
     160
     161    // Tiler draws with a different origin from other layers.
     162    transform.translate(-contentBounds().width() / 2.0, -contentBounds().height() / 2.0);
    159163
    160164    return transform;
    161165}
    162166
    163 IntRect ContentLayerChromium::visibleLayerRect(const IntRect& targetSurfaceRect)
    164 {
    165     if (targetSurfaceRect.isEmpty())
    166         return targetSurfaceRect;
    167 
    168     const IntRect layerBoundRect = layerBounds();
    169 
    170     // Mask layers don't have their own draw transform so we return the entire
    171     // layer bounds as the visible rect.
    172     if (m_isMask)
    173         return layerBoundRect;
    174 
    175     const TransformationMatrix transform = tilingTransform();
    176 
    177     // Is this layer fully contained within the target surface?
    178     IntRect layerInSurfaceSpace = transform.mapRect(layerBoundRect);
    179     if (targetSurfaceRect.contains(layerInSurfaceSpace))
    180         return layerBoundRect;
    181 
    182     // If the layer doesn't fill up the entire surface, then find the part of
    183     // the surface rect where the layer could be visible. This avoids trying to
    184     // project surface rect points that are behind the projection point.
    185     IntRect minimalSurfaceRect = targetSurfaceRect;
    186     minimalSurfaceRect.intersect(layerInSurfaceSpace);
    187 
    188     // Project the corners of the target surface rect into the layer space.
    189     // This bounding rectangle may be larger than it needs to be (being
    190     // axis-aligned), but is a reasonable filter on the space to consider.
    191     // Non-invertible transforms will create an empty rect here.
    192     const TransformationMatrix surfaceToLayer = transform.inverse();
    193     IntRect layerRect = surfaceToLayer.projectQuad(FloatQuad(FloatRect(minimalSurfaceRect))).enclosingBoundingBox();
    194     layerRect.intersect(layerBoundRect);
    195     return layerRect;
    196 }
    197 
    198 IntRect ContentLayerChromium::layerBounds() const
    199 {
    200     return IntRect(IntPoint(0, 0), bounds());
    201 }
    202 
    203 void ContentLayerChromium::updateLayerSize(const IntSize& layerSize)
     167IntSize ContentLayerChromium::contentBounds() const
     168{
     169    return bounds();
     170}
     171
     172void ContentLayerChromium::updateLayerSize()
    204173{
    205174    if (!m_tiler)
    206175        return;
    207176
    208     const IntSize tileSize(min(defaultTileSize, layerSize.width()), min(defaultTileSize, layerSize.height()));
     177    const IntSize tileSize(min(defaultTileSize, contentBounds().width()), min(defaultTileSize, contentBounds().height()));
    209178
    210179    // Tile if both dimensions large, or any one dimension large and the other
    211180    // extends into a second tile. This heuristic allows for long skinny layers
    212181    // (e.g. scrollbars) that are Nx1 tiles to minimize wasted texture space.
    213     const bool anyDimensionLarge = layerSize.width() > maxUntiledSize || layerSize.height() > maxUntiledSize;
    214     const bool anyDimensionOneTile = layerSize.width() <= defaultTileSize || layerSize.height() <= defaultTileSize;
     182    const bool anyDimensionLarge = contentBounds().width() > maxUntiledSize || contentBounds().height() > maxUntiledSize;
     183    const bool anyDimensionOneTile = contentBounds().width() <= defaultTileSize || contentBounds().height() <= defaultTileSize;
    215184    const bool autoTiled = anyDimensionLarge && !anyDimensionOneTile;
    216185
     
    223192        isTiled = autoTiled;
    224193
    225     IntSize requestedSize = isTiled ? tileSize : layerSize;
     194    IntSize requestedSize = isTiled ? tileSize : contentBounds();
    226195    const int maxSize = layerRenderer()->maxTextureSize();
    227196    IntSize clampedSize = requestedSize.shrunkTo(IntSize(maxSize, maxSize));
     
    229198}
    230199
    231 void ContentLayerChromium::draw(const IntRect& targetSurfaceRect)
    232 {
    233     const TransformationMatrix transform = tilingTransform();
    234     IntRect layerRect = visibleLayerRect(targetSurfaceRect);
     200void ContentLayerChromium::draw()
     201{
     202    const IntRect& layerRect = visibleLayerRect();
    235203    if (!layerRect.isEmpty())
    236         m_tiler->draw(layerRect, transform, ccLayerImpl()->drawOpacity(), m_textureUpdater.get());
     204        m_tiler->draw(layerRect, tilingTransform(), ccLayerImpl()->drawOpacity(), m_textureUpdater.get());
    237205}
    238206
     
    272240{
    273241    m_tilingOption = option;
    274     updateLayerSize(bounds());
     242    updateLayerSize();
    275243}
    276244
     
    290258{
    291259    setTilingOption(isMask ? NeverTile : AutoTile);
    292     m_isMask = isMask;
    293260}
    294261
  • trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h

    r90260 r90492  
    5353    virtual ~ContentLayerChromium();
    5454
    55     virtual void paintContentsIfDirty(const IntRect& targetSurfaceRect);
     55    virtual void paintContentsIfDirty();
    5656    virtual void updateCompositorResources();
    5757    virtual void setIsMask(bool);
    5858    virtual void bindContentsTexture();
    5959
    60     virtual void draw(const IntRect& targetSurfaceRect);
     60    virtual void draw();
    6161    virtual bool drawsContent() const;
    6262
     
    7070    virtual void setLayerRenderer(LayerRendererChromium*);
    7171
    72     virtual IntRect layerBounds() const;
     72    virtual IntSize contentBounds() const;
    7373
    74     virtual TransformationMatrix tilingTransform();
     74    TransformationMatrix tilingTransform();
    7575
    76     // For a given render surface rect that this layer will be transformed and
    77     // drawn into, return the layer space rect that is visible in that surface.
    78     IntRect visibleLayerRect(const IntRect&);
    79 
    80     void updateLayerSize(const IntSize&);
     76    void updateLayerSize();
    8177    void createTilerIfNeeded();
    8278    virtual void createTextureUpdaterIfNeeded();
     
    8682    OwnPtr<LayerTilerChromium> m_tiler;
    8783    TilingOption m_tilingOption;
    88     bool m_isMask;
    8984};
    9085
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp

    r90260 r90492  
    141141}
    142142
    143 void ImageLayerChromium::paintContentsIfDirty(const IntRect& targetSurfaceRect)
     143void ImageLayerChromium::paintContentsIfDirty()
    144144{
    145145    ASSERT(layerRenderer());
     
    149149        ImageLayerTextureUpdater* imageTextureUpdater = static_cast<ImageLayerTextureUpdater*>(m_textureUpdater.get());
    150150        imageTextureUpdater->updateFromImage(m_contents->nativeImageForCurrentFrame());
    151         updateLayerSize(imageTextureUpdater->imageSize());
    152         IntRect paintRect(IntPoint(0, 0), imageTextureUpdater->imageSize());
     151        updateLayerSize();
     152        IntRect paintRect(IntPoint(), contentBounds());
    153153        if (!m_dirtyRect.isEmpty()) {
    154154            m_tiler->invalidateRect(paintRect);
     
    156156        }
    157157    }
    158     IntRect layerRect = visibleLayerRect(targetSurfaceRect);
    159     if (layerRect.isEmpty())
    160         return;
    161158
    162     m_tiler->prepareToUpdate(layerRect, m_textureUpdater.get());
     159    m_tiler->prepareToUpdate(visibleLayerRect(), m_textureUpdater.get());
    163160}
    164161
     
    166163{
    167164    m_tiler->updateRect(m_textureUpdater.get());
    168 }
    169 
    170 void ImageLayerChromium::setLayerRenderer(LayerRendererChromium* newLayerRenderer)
    171 {
    172     if (newLayerRenderer != layerRenderer())
    173         m_textureUpdater.clear();
    174     ContentLayerChromium::setLayerRenderer(newLayerRenderer);
    175165}
    176166
     
    181171}
    182172
    183 IntRect ImageLayerChromium::layerBounds() const
     173IntSize ImageLayerChromium::contentBounds() const
    184174{
    185     if (!m_textureUpdater)
    186         return IntRect();
    187     ImageLayerTextureUpdater* imageTextureUpdater = static_cast<ImageLayerTextureUpdater*>(m_textureUpdater.get());
    188     return IntRect(IntPoint(), imageTextureUpdater->imageSize());
    189 }
    190 
    191 TransformationMatrix ImageLayerChromium::tilingTransform()
    192 {
    193     // Tiler draws from the upper left corner. The draw transform
    194     // specifies the middle of the layer.
    195     TransformationMatrix transform = ccLayerImpl()->drawTransform();
    196     const IntRect sourceRect = layerBounds();
    197     const IntSize destSize = bounds();
    198 
    199     transform.translate(-destSize.width() / 2.0, -destSize.height() / 2.0);
    200 
    201     // Tiler also draws at the original content size, so rescale the original
    202     // image dimensions to the bounds that it is meant to be drawn at.
    203     float scaleX = destSize.width() / static_cast<float>(sourceRect.size().width());
    204     float scaleY = destSize.height() / static_cast<float>(sourceRect.size().height());
    205     transform.scale3d(scaleX, scaleY, 1.0f);
    206 
    207     return transform;
     175    return m_contents->size();
    208176}
    209177
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h

    r89647 r90492  
    5252    virtual ~ImageLayerChromium();
    5353
    54     virtual void paintContentsIfDirty(const IntRect& targetSurfaceRect);
     54    virtual void paintContentsIfDirty();
    5555    virtual void updateCompositorResources();
    5656    virtual bool drawsContent() const { return m_contents; }
     
    6161    virtual const char* layerTypeAsString() const { return "ImageLayer"; }
    6262
    63     virtual void setLayerRenderer(LayerRendererChromium*);
    64 
    65     virtual TransformationMatrix tilingTransform();
    66     virtual IntRect layerBounds() const;
     63    virtual IntSize contentBounds() const;
    6764
    6865private:
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp

    r86652 r90492  
    292292    layer->setAnchorPointZ(m_anchorPointZ);
    293293    layer->setBounds(m_bounds);
     294    layer->setContentBounds(contentBounds());
    294295    layer->setDebugBorderColor(m_debugBorderColor);
    295296    layer->setDebugBorderWidth(m_debugBorderWidth);
     
    303304    layer->setSublayerTransform(m_sublayerTransform);
    304305    layer->setTransform(m_transform);
     306    layer->setVisibleLayerRect(m_visibleLayerRect);
    305307
    306308    if (maskLayer())
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h

    r87942 r90492  
    8787    void setBounds(const IntSize&);
    8888    const IntSize& bounds() const { return m_bounds; }
     89    virtual IntSize contentBounds() const { return bounds(); }
    8990
    9091    void setClearsContext(bool clears) { m_clearsContext = clears; setNeedsCommit(); }
     
    133134    const TransformationMatrix& transform() const { return m_transform; }
    134135
     136    const IntRect& visibleLayerRect() const { return m_visibleLayerRect; }
     137    void setVisibleLayerRect(const IntRect& visibleLayerRect) { m_visibleLayerRect = visibleLayerRect; }
     138
    135139    bool doubleSided() const { return m_doubleSided; }
    136140    void setDoubleSided(bool doubleSided) { m_doubleSided = doubleSided; setNeedsCommit(); }
     
    153157    // These methods typically need to be overwritten by derived classes.
    154158    virtual bool drawsContent() const { return false; }
    155     virtual void paintContentsIfDirty(const IntRect&) { }
    156159    virtual void paintContentsIfDirty() { }
    157160    virtual void updateCompositorResources() { }
     
    159162    virtual void unreserveContentsTexture() { }
    160163    virtual void bindContentsTexture() { }
    161     virtual void draw(const IntRect&) { }
     164    virtual void draw() { }
    162165
    163166    // These exists just for debugging (via drawDebugBorder()).
     
    250253    // Layer properties.
    251254    IntSize m_bounds;
     255    IntRect m_visibleLayerRect;
    252256    FloatPoint m_position;
    253257    FloatPoint m_anchorPoint;
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r90283 r90492  
    359359}
    360360
     361static IntRect calculateVisibleLayerRect(const IntRect& targetSurfaceRect, const IntSize& bounds, const IntSize& contentBounds, const TransformationMatrix& tilingTransform)
     362{
     363    if (targetSurfaceRect.isEmpty() || contentBounds.isEmpty())
     364        return targetSurfaceRect;
     365
     366    const IntRect layerBoundRect = IntRect(IntPoint(), contentBounds);
     367    TransformationMatrix transform = tilingTransform;
     368
     369    transform.scaleNonUniform(bounds.width() / static_cast<double>(contentBounds.width()),
     370                              bounds.height() / static_cast<double>(contentBounds.height()));
     371    transform.translate(-contentBounds.width() / 2.0, -contentBounds.height() / 2.0);
     372
     373    // Is this layer fully contained within the target surface?
     374    IntRect layerInSurfaceSpace = transform.mapRect(layerBoundRect);
     375    if (targetSurfaceRect.contains(layerInSurfaceSpace))
     376        return layerBoundRect;
     377
     378    // If the layer doesn't fill up the entire surface, then find the part of
     379    // the surface rect where the layer could be visible. This avoids trying to
     380    // project surface rect points that are behind the projection point.
     381    IntRect minimalSurfaceRect = targetSurfaceRect;
     382    minimalSurfaceRect.intersect(layerInSurfaceSpace);
     383
     384    // Project the corners of the target surface rect into the layer space.
     385    // This bounding rectangle may be larger than it needs to be (being
     386    // axis-aligned), but is a reasonable filter on the space to consider.
     387    // Non-invertible transforms will create an empty rect here.
     388    const TransformationMatrix surfaceToLayer = transform.inverse();
     389    IntRect layerRect = surfaceToLayer.projectQuad(FloatQuad(FloatRect(minimalSurfaceRect))).enclosingBoundingBox();
     390    layerRect.intersect(layerBoundRect);
     391    return layerRect;
     392}
     393
     394static void paintContentsIfDirty(LayerChromium* layer, const IntRect& visibleLayerRect)
     395{
     396    if (layer->drawsContent()) {
     397        layer->setVisibleLayerRect(visibleLayerRect);
     398        layer->paintContentsIfDirty();
     399    }
     400}
     401
    361402void LayerRendererChromium::paintLayerContents(const LayerList& renderSurfaceLayerList)
    362403{
     
    399440
    400441            if (layer->bounds().isEmpty())
    401               continue;
     442                continue;
    402443
    403444            IntRect targetSurfaceRect = ccLayerImpl->targetRenderSurface() ? ccLayerImpl->targetRenderSurface()->contentRect() : m_defaultRenderSurface->contentRect();
    404445            if (layer->ccLayerImpl()->usesLayerScissor())
    405446                targetSurfaceRect.intersect(layer->ccLayerImpl()->scissorRect());
    406 
    407             if (layer->drawsContent())
    408                 layer->paintContentsIfDirty(targetSurfaceRect);
    409             if (layer->maskLayer() && layer->maskLayer()->drawsContent())
    410                 layer->maskLayer()->paintContentsIfDirty(targetSurfaceRect);
    411             if (layer->replicaLayer() && layer->replicaLayer()->drawsContent())
    412                 layer->replicaLayer()->paintContentsIfDirty(targetSurfaceRect);
    413             if (layer->replicaLayer() && layer->replicaLayer()->maskLayer() && layer->replicaLayer()->maskLayer()->drawsContent())
    414                 layer->replicaLayer()->maskLayer()->paintContentsIfDirty(targetSurfaceRect);
     447            IntRect visibleLayerRect = calculateVisibleLayerRect(targetSurfaceRect, layer->bounds(), layer->contentBounds(), ccLayerImpl->drawTransform());
     448
     449            paintContentsIfDirty(layer, visibleLayerRect);
     450
     451            if (LayerChromium* maskLayer = layer->maskLayer()) {
     452                paintContentsIfDirty(maskLayer, IntRect(IntPoint(), maskLayer->contentBounds()));
     453            }
     454
     455            if (LayerChromium* replicaLayer = layer->replicaLayer()) {
     456                paintContentsIfDirty(replicaLayer, visibleLayerRect);
     457
     458                if (LayerChromium* replicaMaskLayer = replicaLayer->maskLayer()) {
     459                    paintContentsIfDirty(replicaMaskLayer, IntRect(IntPoint(), replicaMaskLayer->contentBounds()));
     460                }
     461            }
    415462        }
    416463    }
     
    9861033    }
    9871034
    988     layer->draw(targetSurfaceRect);
     1035    layer->draw();
    9891036
    9901037    // Draw the debug border if there is one.
  • trunk/Source/WebCore/platform/graphics/chromium/RenderSurfaceChromium.cpp

    r90260 r90492  
    167167
    168168    // Reflection draws before the layer.
    169     if (m_owningLayer->replicaLayer()) 
     169    if (m_owningLayer->replicaLayer())
    170170        drawSurface(replicaMaskLayer, m_replicaDrawTransform);
    171171
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.cpp

    r86975 r90492  
    4949}
    5050
    51 void CCCanvasLayerImpl::draw(const IntRect&)
     51void CCCanvasLayerImpl::draw()
    5252{
    5353    ASSERT(layerRenderer());
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCCanvasLayerImpl.h

    r86905 r90492  
    4343    typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexFlipAlpha> Program;
    4444
    45     virtual void draw(const IntRect&);
     45    virtual void draw();
    4646
    4747    virtual void dumpLayerProperties(TextStream&, int indent) const;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp

    r88496 r90492  
    143143}
    144144
    145 void CCLayerImpl::draw(const IntRect& targetSurfaceRect)
    146 {
    147     return m_owner->draw(targetSurfaceRect);
     145void CCLayerImpl::draw()
     146{
     147    return m_owner->draw();
    148148}
    149149
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h

    r88496 r90492  
    7070#endif
    7171
    72     virtual void draw(const IntRect& contentRect);
     72    virtual void draw();
    7373    virtual void updateCompositorResources();
    7474    void unreserveContentsTexture();
     
    128128    RenderSurfaceChromium* renderSurface() const { return m_renderSurface.get(); }
    129129    void clearRenderSurface() { m_renderSurface.clear(); }
     130
    130131    float drawOpacity() const { return m_drawOpacity; }
    131132    void setDrawOpacity(float opacity) { m_drawOpacity = opacity; }
     133
    132134    const IntRect& scissorRect() const { return m_scissorRect; }
    133135    void setScissorRect(const IntRect& rect) { m_scissorRect = rect; }
     136
    134137    RenderSurfaceChromium* targetRenderSurface() const { return m_targetRenderSurface; }
    135138    void setTargetRenderSurface(RenderSurfaceChromium* surface) { m_targetRenderSurface = surface; }
    136139
     140    const IntSize& bounds() const { return m_bounds; }
     141    void setBounds(const IntSize& bounds) { m_bounds = bounds; }
     142
     143    const IntSize& contentBounds() const { return m_contentBounds; }
     144    void setContentBounds(const IntSize& contentBounds) { m_contentBounds = contentBounds; }
     145
     146    const IntRect& visibleLayerRect() const { return m_visibleLayerRect; }
     147    void setVisibleLayerRect(const IntRect& visibleLayerRect) { m_visibleLayerRect = visibleLayerRect; }
     148
    137149    bool doubleSided() const { return m_doubleSided; }
    138150    void setDoubleSided(bool doubleSided) { m_doubleSided = doubleSided; }
    139     const IntSize& bounds() const { return m_bounds; }
    140     void setBounds(const IntSize& bounds) { m_bounds = bounds; }
    141151
    142152    // Returns the rect containtaining this layer in the current view's coordinate system.
     
    153163    LayerChromium* owner() const { return m_owner; }
    154164    void clearOwner() { m_owner = 0; }
     165
    155166protected:
    156167    // For now, CCLayerImpls have a back pointer to their LayerChromium.
     
    177188    float m_anchorPointZ;
    178189    IntSize m_bounds;
     190    IntSize m_contentBounds;
     191    IntRect m_visibleLayerRect;
    179192
    180193    // Whether the "back" of this layer should draw.
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.cpp

    r86975 r90492  
    4747}
    4848
    49 void CCPluginLayerImpl::draw(const IntRect&)
     49void CCPluginLayerImpl::draw()
    5050{
    5151    ASSERT(layerRenderer());
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCPluginLayerImpl.h

    r86652 r90492  
    4343    typedef ProgramBinding<VertexShaderPosTex, FragmentShaderRGBATexFlipAlpha> Program;
    4444
    45     virtual void draw(const IntRect&);
     45    virtual void draw();
    4646
    4747    virtual void dumpLayerProperties(TextStream&, int indent) const;
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.cpp

    r86975 r90492  
    7676}
    7777
    78 void CCVideoLayerImpl::draw(const IntRect&)
     78void CCVideoLayerImpl::draw()
    7979{
    8080    if (m_skipsDraw)
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCVideoLayerImpl.h

    r86652 r90492  
    4848    typedef ProgramBinding<VertexShaderPosTexYUVStretch, FragmentShaderYUVVideo> YUVProgram;
    4949
    50     virtual void draw(const IntRect&);
     50    virtual void draw();
    5151
    5252    virtual void dumpLayerProperties(TextStream&, int indent) const;
Note: See TracChangeset for help on using the changeset viewer.