Changeset 90963 in webkit


Ignore:
Timestamp:
Jul 13, 2011 4:14:57 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

Patch by James Robinson <jamesr@chromium.org> on 2011-07-13
Reviewed by Kenneth Russell.

[chromium] Move draw implementation for ContentLayerChromium/ImageLayerChromium to the appropriate CCLayerImpl subclass
https://bugs.webkit.org/show_bug.cgi?id=58833

Adds a TiledLayerChromium class to handle the tiling logic shared by ContentLayerChromium and ImageLayerChromium
so that they can be siblings in the class hierarchy instead of children. Also adds a CCTiledLayerImpl to handle
the drawing responsibilities for tiled layers.

TiledLayerChromium maintains a tiler, tiling options, and calculates the tiling transform. Subclasses are
responsible for providing an appropriate texture updater implementation. CCTiledLayerImpl takes the tiler,
tiling transform and layer properties and draws the layer. Longer term it'd be better of the CCTiledLayerImpl
owned the tiler and the TiledLayerChromium only owned an updater, but getting there will require changing the
way tile eviction works.

  • WebCore.gypi:
  • platform/graphics/chromium/ContentLayerChromium.cpp:

(WebCore::ContentLayerChromium::ContentLayerChromium):
(WebCore::ContentLayerChromium::paintContentsIfDirty):
(WebCore::ContentLayerChromium::drawsContent):

  • platform/graphics/chromium/ContentLayerChromium.h:

(WebCore::ContentLayerChromium::textureUpdater):

  • platform/graphics/chromium/ImageLayerChromium.cpp:

(WebCore::ImageLayerChromium::ImageLayerChromium):
(WebCore::ImageLayerChromium::cleanupResources):
(WebCore::ImageLayerChromium::paintContentsIfDirty):
(WebCore::ImageLayerChromium::textureUpdater):
(WebCore::ImageLayerChromium::contentBounds):
(WebCore::ImageLayerChromium::drawsContent):
(WebCore::ImageLayerChromium::createTextureUpdaterIfNeeded):

  • platform/graphics/chromium/ImageLayerChromium.h:
  • platform/graphics/chromium/LayerChromium.cpp:

(WebCore::LayerChromium::pushPropertiesTo):
(WebCore::LayerChromium::ccLayerImpl):

  • platform/graphics/chromium/LayerChromium.h:
  • platform/graphics/chromium/LayerRendererChromium.cpp:

(WebCore::LayerRendererChromium::drawRootLayer):

  • platform/graphics/chromium/LayerTilerChromium.cpp:

(WebCore::LayerTilerChromium::updateRect):
(WebCore::LayerTilerChromium::draw):
(WebCore::LayerTilerChromium::drawTiles):

  • platform/graphics/chromium/LayerTilerChromium.h:
  • platform/graphics/chromium/TiledLayerChromium.cpp: Added.

(WebCore::TiledLayerChromium::TiledLayerChromium):
(WebCore::TiledLayerChromium::~TiledLayerChromium):
(WebCore::TiledLayerChromium::createCCLayerImpl):
(WebCore::TiledLayerChromium::cleanupResources):
(WebCore::TiledLayerChromium::setLayerRenderer):
(WebCore::TiledLayerChromium::updateTileSizeAndTilingOption):
(WebCore::TiledLayerChromium::drawsContent):
(WebCore::TiledLayerChromium::createTilerIfNeeded):
(WebCore::TiledLayerChromium::updateCompositorResources):
(WebCore::TiledLayerChromium::setTilingOption):
(WebCore::TiledLayerChromium::setIsMask):
(WebCore::TiledLayerChromium::tilingTransform):
(WebCore::TiledLayerChromium::pushPropertiesTo):
(WebCore::writeIndent):
(WebCore::TiledLayerChromium::dumpLayerProperties):

  • platform/graphics/chromium/TiledLayerChromium.h: Added.
  • platform/graphics/chromium/cc/CCLayerImpl.cpp:

(WebCore::CCLayerImpl::draw):

  • platform/graphics/chromium/cc/CCLayerImpl.h:

(WebCore::CCLayerImpl::setDrawsContent):
(WebCore::CCLayerImpl::drawsContent):

  • platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: Added.

(WebCore::CCTiledLayerImpl::CCTiledLayerImpl):
(WebCore::CCTiledLayerImpl::~CCTiledLayerImpl):
(WebCore::CCTiledLayerImpl::draw):
(WebCore::CCTiledLayerImpl::bindContentsTexture):
(WebCore::CCTiledLayerImpl::dumpLayerProperties):

  • platform/graphics/chromium/cc/CCTiledLayerImpl.h: Added.

(WebCore::CCTiledLayerImpl::create):
(WebCore::CCTiledLayerImpl::setTilingTransform):
(WebCore::CCTiledLayerImpl::setTiler):

Location:
trunk/Source/WebCore
Files:
4 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90961 r90963  
     12011-07-13  James Robinson  <jamesr@chromium.org>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        [chromium] Move draw implementation for ContentLayerChromium/ImageLayerChromium to the appropriate CCLayerImpl subclass
     6        https://bugs.webkit.org/show_bug.cgi?id=58833
     7
     8        Adds a TiledLayerChromium class to handle the tiling logic shared by ContentLayerChromium and ImageLayerChromium
     9        so that they can be siblings in the class hierarchy instead of children. Also adds a CCTiledLayerImpl to handle
     10        the drawing responsibilities for tiled layers.
     11
     12        TiledLayerChromium maintains a tiler, tiling options, and calculates the tiling transform. Subclasses are
     13        responsible for providing an appropriate texture updater implementation. CCTiledLayerImpl takes the tiler,
     14        tiling transform and layer properties and draws the layer.  Longer term it'd be better of the CCTiledLayerImpl
     15        owned the tiler and the TiledLayerChromium only owned an updater, but getting there will require changing the
     16        way tile eviction works.
     17
     18        * WebCore.gypi:
     19        * platform/graphics/chromium/ContentLayerChromium.cpp:
     20        (WebCore::ContentLayerChromium::ContentLayerChromium):
     21        (WebCore::ContentLayerChromium::paintContentsIfDirty):
     22        (WebCore::ContentLayerChromium::drawsContent):
     23        * platform/graphics/chromium/ContentLayerChromium.h:
     24        (WebCore::ContentLayerChromium::textureUpdater):
     25        * platform/graphics/chromium/ImageLayerChromium.cpp:
     26        (WebCore::ImageLayerChromium::ImageLayerChromium):
     27        (WebCore::ImageLayerChromium::cleanupResources):
     28        (WebCore::ImageLayerChromium::paintContentsIfDirty):
     29        (WebCore::ImageLayerChromium::textureUpdater):
     30        (WebCore::ImageLayerChromium::contentBounds):
     31        (WebCore::ImageLayerChromium::drawsContent):
     32        (WebCore::ImageLayerChromium::createTextureUpdaterIfNeeded):
     33        * platform/graphics/chromium/ImageLayerChromium.h:
     34        * platform/graphics/chromium/LayerChromium.cpp:
     35        (WebCore::LayerChromium::pushPropertiesTo):
     36        (WebCore::LayerChromium::ccLayerImpl):
     37        * platform/graphics/chromium/LayerChromium.h:
     38        * platform/graphics/chromium/LayerRendererChromium.cpp:
     39        (WebCore::LayerRendererChromium::drawRootLayer):
     40        * platform/graphics/chromium/LayerTilerChromium.cpp:
     41        (WebCore::LayerTilerChromium::updateRect):
     42        (WebCore::LayerTilerChromium::draw):
     43        (WebCore::LayerTilerChromium::drawTiles):
     44        * platform/graphics/chromium/LayerTilerChromium.h:
     45        * platform/graphics/chromium/TiledLayerChromium.cpp: Added.
     46        (WebCore::TiledLayerChromium::TiledLayerChromium):
     47        (WebCore::TiledLayerChromium::~TiledLayerChromium):
     48        (WebCore::TiledLayerChromium::createCCLayerImpl):
     49        (WebCore::TiledLayerChromium::cleanupResources):
     50        (WebCore::TiledLayerChromium::setLayerRenderer):
     51        (WebCore::TiledLayerChromium::updateTileSizeAndTilingOption):
     52        (WebCore::TiledLayerChromium::drawsContent):
     53        (WebCore::TiledLayerChromium::createTilerIfNeeded):
     54        (WebCore::TiledLayerChromium::updateCompositorResources):
     55        (WebCore::TiledLayerChromium::setTilingOption):
     56        (WebCore::TiledLayerChromium::setIsMask):
     57        (WebCore::TiledLayerChromium::tilingTransform):
     58        (WebCore::TiledLayerChromium::pushPropertiesTo):
     59        (WebCore::writeIndent):
     60        (WebCore::TiledLayerChromium::dumpLayerProperties):
     61        * platform/graphics/chromium/TiledLayerChromium.h: Added.
     62        * platform/graphics/chromium/cc/CCLayerImpl.cpp:
     63        (WebCore::CCLayerImpl::draw):
     64        * platform/graphics/chromium/cc/CCLayerImpl.h:
     65        (WebCore::CCLayerImpl::setDrawsContent):
     66        (WebCore::CCLayerImpl::drawsContent):
     67        * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: Added.
     68        (WebCore::CCTiledLayerImpl::CCTiledLayerImpl):
     69        (WebCore::CCTiledLayerImpl::~CCTiledLayerImpl):
     70        (WebCore::CCTiledLayerImpl::draw):
     71        (WebCore::CCTiledLayerImpl::bindContentsTexture):
     72        (WebCore::CCTiledLayerImpl::dumpLayerProperties):
     73        * platform/graphics/chromium/cc/CCTiledLayerImpl.h: Added.
     74        (WebCore::CCTiledLayerImpl::create):
     75        (WebCore::CCTiledLayerImpl::setTilingTransform):
     76        (WebCore::CCTiledLayerImpl::setTiler):
     77
    1782011-07-13  Julien Chaffraix  <jchaffraix@webkit.org>
    279
  • trunk/Source/WebCore/WebCore.gypi

    r90911 r90963  
    41434143            'platform/graphics/chromium/TextureManager.cpp',
    41444144            'platform/graphics/chromium/TextureManager.h',
     4145            'platform/graphics/chromium/TiledLayerChromium.cpp',
     4146            'platform/graphics/chromium/TiledLayerChromium.h',
    41454147            'platform/graphics/chromium/TransparencyWin.cpp',
    41464148            'platform/graphics/chromium/TransparencyWin.h',
     
    41844186            'platform/graphics/chromium/cc/CCThread.h',
    41854187            'platform/graphics/chromium/cc/CCThreadTask.h',
     4188            'platform/graphics/chromium/cc/CCTiledLayerImpl.cpp',
     4189            'platform/graphics/chromium/cc/CCTiledLayerImpl.h',
    41864190            'platform/graphics/chromium/cc/CCVideoLayerImpl.cpp',
    41874191            'platform/graphics/chromium/cc/CCVideoLayerImpl.h',
  • trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp

    r90859 r90963  
    3535#include "ContentLayerChromium.h"
    3636
    37 #include "cc/CCLayerImpl.h"
    38 #include "GraphicsContext3D.h"
    3937#include "LayerPainterChromium.h"
    4038#include "LayerRendererChromium.h"
    41 #include "LayerTexture.h"
    4239#include "LayerTextureUpdaterCanvas.h"
    43 #include "LayerTilerChromium.h"
    4440#include "PlatformBridge.h"
    45 #include "RenderLayerBacking.h"
    46 #include "TextStream.h"
    4741#include <wtf/CurrentTime.h>
    48 
    49 // Start tiling when the width and height of a layer are larger than this size.
    50 static int maxUntiledSize = 510;
    51 
    52 // When tiling is enabled, use tiles of this dimension squared.
    53 static int defaultTileSize = 256;
    54 
    55 using namespace std;
    5642
    5743namespace WebCore {
     
    9177
    9278ContentLayerChromium::ContentLayerChromium(GraphicsLayerChromium* owner)
    93     : LayerChromium(owner)
    94     , m_tilingOption(ContentLayerChromium::AutoTile)
    95     , m_borderTexels(true)
     79    : TiledLayerChromium(owner)
    9680{
    9781}
     
    10791    ASSERT(layerRenderer());
    10892
    109     updateLayerSize();
     93    updateTileSizeAndTilingOption();
    11094
    11195    const IntRect& layerRect = visibleLayerRect();
     
    120104        return;
    121105
    122     m_tiler->prepareToUpdate(layerRect, m_textureUpdater.get());
     106    m_tiler->prepareToUpdate(layerRect, textureUpdater());
    123107    m_dirtyRect = FloatRect();
    124108}
    125109
    126 void ContentLayerChromium::cleanupResources()
     110bool ContentLayerChromium::drawsContent() const
    127111{
    128     m_textureUpdater.clear();
    129     m_tiler.clear();
    130     LayerChromium::cleanupResources();
    131 }
    132 
    133 void ContentLayerChromium::setLayerRenderer(LayerRendererChromium* layerRenderer)
    134 {
    135     LayerChromium::setLayerRenderer(layerRenderer);
    136     createTilerIfNeeded();
     112    return m_owner && m_owner->drawsContent() && TiledLayerChromium::drawsContent();
    137113}
    138114
     
    150126}
    151127
    152 TransformationMatrix ContentLayerChromium::tilingTransform()
    153 {
    154     TransformationMatrix transform = ccLayerImpl()->drawTransform();
    155 
    156     if (contentBounds().isEmpty())
    157         return transform;
    158 
    159     transform.scaleNonUniform(bounds().width() / static_cast<double>(contentBounds().width()),
    160                               bounds().height() / static_cast<double>(contentBounds().height()));
    161 
    162     // Tiler draws with a different origin from other layers.
    163     transform.translate(-contentBounds().width() / 2.0, -contentBounds().height() / 2.0);
    164 
    165     return transform;
    166 }
    167 
    168 IntSize ContentLayerChromium::contentBounds() const
    169 {
    170     return bounds();
    171 }
    172 
    173 void ContentLayerChromium::updateLayerSize()
    174 {
    175     if (!m_tiler)
    176         return;
    177 
    178     const IntSize tileSize(defaultTileSize, defaultTileSize);
    179 
    180     // Tile if both dimensions large, or any one dimension large and the other
    181     // extends into a second tile. This heuristic allows for long skinny layers
    182     // (e.g. scrollbars) that are Nx1 tiles to minimize wasted texture space.
    183     const bool anyDimensionLarge = contentBounds().width() > maxUntiledSize || contentBounds().height() > maxUntiledSize;
    184     const bool anyDimensionOneTile = contentBounds().width() <= defaultTileSize || contentBounds().height() <= defaultTileSize;
    185     const bool autoTiled = anyDimensionLarge && !anyDimensionOneTile;
    186 
    187     bool isTiled;
    188     if (m_tilingOption == AlwaysTile)
    189         isTiled = true;
    190     else if (m_tilingOption == NeverTile)
    191         isTiled = false;
    192     else
    193         isTiled = autoTiled;
    194 
    195     // Empty tile size tells the tiler to avoid tiling.
    196     IntSize requestedSize = isTiled ? tileSize : IntSize();
    197     const int maxSize = layerRenderer()->maxTextureSize();
    198     IntSize clampedSize = requestedSize.shrunkTo(IntSize(maxSize, maxSize));
    199     m_tiler->setTileSize(clampedSize);
    200 }
    201 
    202 void ContentLayerChromium::draw()
    203 {
    204     const IntRect& layerRect = visibleLayerRect();
    205     if (!layerRect.isEmpty())
    206         m_tiler->draw(layerRect, tilingTransform(), ccLayerImpl()->drawOpacity(), m_textureUpdater.get());
    207 }
    208 
    209 bool ContentLayerChromium::drawsContent() const
    210 {
    211     if (!m_owner || !m_owner->drawsContent())
    212         return false;
    213 
    214     if (!m_tiler)
    215         return true;
    216 
    217     if (m_tilingOption == NeverTile && m_tiler->numTiles() > 1)
    218         return false;
    219 
    220     return !m_tiler->skipsDraw();
    221 }
    222 
    223 void ContentLayerChromium::createTilerIfNeeded()
    224 {
    225     if (m_tiler)
    226         return;
    227 
    228     createTextureUpdaterIfNeeded();
    229 
    230     m_tiler = LayerTilerChromium::create(
    231         layerRenderer(),
    232         IntSize(defaultTileSize, defaultTileSize),
    233         m_borderTexels ? LayerTilerChromium::HasBorderTexels :
    234         LayerTilerChromium::NoBorderTexels);
    235 }
    236 
    237 void ContentLayerChromium::updateCompositorResources()
    238 {
    239     m_tiler->updateRect(m_textureUpdater.get());
    240 }
    241 
    242 void ContentLayerChromium::setTilingOption(TilingOption option)
    243 {
    244     m_tilingOption = option;
    245     updateLayerSize();
    246 }
    247 
    248 void ContentLayerChromium::bindContentsTexture()
    249 {
    250     // This function is only valid for single texture layers, e.g. masks.
    251     ASSERT(m_tilingOption == NeverTile);
    252     ASSERT(m_tiler);
    253 
    254     LayerTexture* texture = m_tiler->getSingleTexture();
    255     ASSERT(texture);
    256 
    257     texture->bindTexture();
    258 }
    259 
    260 void ContentLayerChromium::setIsMask(bool isMask)
    261 {
    262     m_borderTexels = false;
    263     setTilingOption(isMask ? NeverTile : AutoTile);
    264 }
    265 
    266 static void writeIndent(TextStream& ts, int indent)
    267 {
    268     for (int i = 0; i != indent; ++i)
    269         ts << "  ";
    270 }
    271 
    272 void ContentLayerChromium::dumpLayerProperties(TextStream& ts, int indent) const
    273 {
    274     LayerChromium::dumpLayerProperties(ts, indent);
    275     writeIndent(ts, indent);
    276     ts << "skipsDraw: " << (!m_tiler || m_tiler->skipsDraw()) << "\n";
    277 }
    278 
    279128}
    280129#endif // USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebCore/platform/graphics/chromium/ContentLayerChromium.h

    r90859 r90963  
    3535#if USE(ACCELERATED_COMPOSITING)
    3636
    37 #include "LayerChromium.h"
     37#include "TiledLayerChromium.h"
     38#include "cc/CCTiledLayerImpl.h"
    3839
    3940namespace WebCore {
     
    4445
    4546// A Layer that requires a GraphicsContext to render its contents.
    46 class ContentLayerChromium : public LayerChromium {
    47     friend class LayerRendererChromium;
     47class ContentLayerChromium : public TiledLayerChromium {
    4848public:
    49     enum TilingOption { AlwaysTile, NeverTile, AutoTile };
    50 
    5149    static PassRefPtr<ContentLayerChromium> create(GraphicsLayerChromium* owner = 0);
    5250
     
    5452
    5553    virtual void paintContentsIfDirty();
    56     virtual void updateCompositorResources();
    57     virtual void setIsMask(bool);
    58     virtual void bindContentsTexture();
    5954
    60     virtual void draw();
    61     virtual bool drawsContent() const;
    62 
    63 protected:
     55private:
    6456    explicit ContentLayerChromium(GraphicsLayerChromium* owner);
    6557
    6658    virtual const char* layerTypeAsString() const { return "ContentLayer"; }
    67     virtual void dumpLayerProperties(TextStream&, int indent) const;
    6859
    69     virtual void cleanupResources();
    70     virtual void setLayerRenderer(LayerRendererChromium*);
    71 
    72     virtual IntSize contentBounds() const;
    73 
    74     TransformationMatrix tilingTransform();
    75 
    76     void updateLayerSize();
    77     void createTilerIfNeeded();
     60    virtual bool drawsContent() const;
    7861    virtual void createTextureUpdaterIfNeeded();
    79     void setTilingOption(TilingOption);
     62    virtual LayerTextureUpdater* textureUpdater() const { return m_textureUpdater.get(); }
    8063
    8164    OwnPtr<LayerTextureUpdater> m_textureUpdater;
    82     OwnPtr<LayerTilerChromium> m_tiler;
    83     TilingOption m_tilingOption;
    84     bool m_borderTexels;
    8565};
    8666
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp

    r90859 r90963  
    116116
    117117ImageLayerChromium::ImageLayerChromium(GraphicsLayerChromium* owner)
    118     : ContentLayerChromium(owner)
     118    : TiledLayerChromium(owner)
    119119    , m_imageForCurrentFrame(0)
    120     , m_contents(0)
    121120{
    122121}
     
    124123ImageLayerChromium::~ImageLayerChromium()
    125124{
     125}
     126
     127void ImageLayerChromium::cleanupResources()
     128{
     129    m_textureUpdater.clear();
     130    TiledLayerChromium::cleanupResources();
    126131}
    127132
     
    146151
    147152    if (!m_dirtyRect.isEmpty()) {
    148         // FIXME: This downcast is bad. The fix is to make ImageLayerChromium not derive from ContentLayerChromium.
    149         ImageLayerTextureUpdater* imageTextureUpdater = static_cast<ImageLayerTextureUpdater*>(m_textureUpdater.get());
    150         imageTextureUpdater->updateFromImage(m_contents->nativeImageForCurrentFrame());
    151         updateLayerSize();
     153        m_textureUpdater->updateFromImage(m_contents->nativeImageForCurrentFrame());
     154        updateTileSizeAndTilingOption();
    152155        IntRect paintRect(IntPoint(), contentBounds());
    153156        if (!m_dirtyRect.isEmpty()) {
     
    157160    }
    158161
     162    if (visibleLayerRect().isEmpty())
     163        return;
     164
    159165    m_tiler->prepareToUpdate(visibleLayerRect(), m_textureUpdater.get());
    160166}
    161167
    162 void ImageLayerChromium::updateCompositorResources()
     168LayerTextureUpdater* ImageLayerChromium::textureUpdater() const
    163169{
    164     m_tiler->updateRect(m_textureUpdater.get());
     170    return m_textureUpdater.get();
     171}
     172
     173IntSize ImageLayerChromium::contentBounds() const
     174{
     175    if (!m_contents)
     176        return IntSize();
     177    return m_contents->size();
     178}
     179
     180bool ImageLayerChromium::drawsContent() const
     181{
     182    return m_contents && TiledLayerChromium::drawsContent();
    165183}
    166184
     
    171189}
    172190
    173 IntSize ImageLayerChromium::contentBounds() const
    174 {
    175     return m_contents->size();
    176 }
    177 
    178191}
    179192#endif // USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebCore/platform/graphics/chromium/ImageLayerChromium.h

    r90859 r90963  
    4545
    4646class Image;
     47class ImageLayerTextureUpdater;
    4748
    4849// A Layer that contains only an Image element.
    49 class ImageLayerChromium : public ContentLayerChromium {
     50class ImageLayerChromium : public TiledLayerChromium {
    5051public:
    5152    static PassRefPtr<ImageLayerChromium> create(GraphicsLayerChromium* owner = 0);
    5253    virtual ~ImageLayerChromium();
    5354
     55    virtual bool drawsContent() const;
    5456    virtual void paintContentsIfDirty();
    55     virtual void updateCompositorResources();
    56     virtual bool drawsContent() const { return m_contents; }
    5757
    5858    void setContents(Image* image);
     
    6161    virtual const char* layerTypeAsString() const { return "ImageLayer"; }
    6262
    63     virtual IntSize contentBounds() const;
    64 
    6563private:
    6664    ImageLayerChromium(GraphicsLayerChromium* owner);
    6765
     66    virtual void cleanupResources();
    6867    virtual void createTextureUpdaterIfNeeded();
     68    void setTilingOption(TilingOption);
     69
     70    virtual LayerTextureUpdater* textureUpdater() const;
     71    virtual IntSize contentBounds() const;
    6972
    7073    NativeImagePtr m_imageForCurrentFrame;
    7174    RefPtr<Image> m_contents;
     75
     76    OwnPtr<ImageLayerTextureUpdater> m_textureUpdater;
    7277};
    7378
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp

    r90859 r90963  
    296296    layer->setDebugBorderWidth(m_debugBorderWidth);
    297297    layer->setDoubleSided(m_doubleSided);
     298    layer->setDrawsContent(drawsContent());
    298299    layer->setLayerRenderer(m_layerRenderer.get());
    299300    layer->setMasksToBounds(m_masksToBounds);
     
    384385}
    385386
    386 CCLayerImpl* LayerChromium::ccLayerImpl()
     387CCLayerImpl* LayerChromium::ccLayerImpl() const
    387388{
    388389    return m_ccLayerImpl;
  • trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h

    r90859 r90963  
    162162    virtual void unreserveContentsTexture() { }
    163163    virtual void bindContentsTexture() { }
    164     virtual void draw() { }
    165164
    166165    // These exists just for debugging (via drawDebugBorder()).
     
    173172
    174173    // Everything from here down in the public section will move to CCLayerImpl.
    175     CCLayerImpl* ccLayerImpl();
     174    CCLayerImpl* ccLayerImpl() const;
    176175
    177176    static void drawTexturedQuad(GraphicsContext3D*, const TransformationMatrix& projectionMatrix, const TransformationMatrix& layerMatrix,
  • trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp

    r90859 r90963  
    228228    scroll.translate(-m_viewportVisibleRect.x(), -m_viewportVisibleRect.y());
    229229
    230     m_rootLayerContentTiler->draw(m_viewportVisibleRect, scroll, 1.0f, m_rootLayerTextureUpdater.get());
     230    m_rootLayerContentTiler->draw(m_viewportVisibleRect, scroll, 1.0f);
    231231}
    232232
     
    963963        updateCompositorResources(ccLayerImpl->replicaLayer());
    964964
    965     if (ccLayerImpl->drawsContent())
    966         ccLayerImpl->updateCompositorResources();
     965    if (layer->drawsContent())
     966        layer->updateCompositorResources();
    967967
    968968    layer->pushPropertiesTo(ccLayerImpl);
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTextureUpdater.h

    r89647 r90963  
    4646    enum Orientation {
    4747        BottomUpOrientation,
    48         TopDownOrientation
     48        TopDownOrientation,
     49        InvalidOrientation,
    4950    };
    5051    enum SampledTexelFormat {
    5152        SampledTexelFormatRGBA,
    52         SampledTexelFormatBGRA
     53        SampledTexelFormatBGRA,
     54        SampledTexelFormatInvalid,
    5355    };
    5456    // Returns the orientation of the texture uploaded by this interface.
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp

    r90887 r90963  
    5858    : m_textureFormat(PlatformColor::bestTextureFormat(layerRenderer->context()))
    5959    , m_skipsDraw(false)
     60    , m_textureOrientation(LayerTextureUpdater::InvalidOrientation)
     61    , m_sampledTexelFormat(LayerTextureUpdater::SampledTexelFormatInvalid)
    6062    , m_tilingData(max(tileSize.width(), tileSize.height()), 0, 0, border == HasBorderTexels)
    6163    , m_layerRenderer(layerRenderer)
     
    327329
    328330    GraphicsContext3D* context = layerRendererContext();
     331    m_textureOrientation = textureUpdater->orientation();
     332    m_sampledTexelFormat = textureUpdater->sampledTexelFormat(m_textureFormat);
    329333
    330334    int left, top, right, bottom;
     
    386390}
    387391
    388 void LayerTilerChromium::draw(const IntRect& contentRect, const TransformationMatrix& globalTransform, float opacity, LayerTextureUpdater* textureUpdater)
     392void LayerTilerChromium::draw(const IntRect& contentRect, const TransformationMatrix& globalTransform, float opacity)
    389393{
    390394    if (m_skipsDraw || !m_tiles.size() || contentRect.isEmpty())
    391395        return;
    392396
    393     switch (textureUpdater->sampledTexelFormat(m_textureFormat)) {
     397    switch (m_sampledTexelFormat) {
    394398    case LayerTextureUpdater::SampledTexelFormatRGBA:
    395         drawTiles(contentRect, globalTransform, opacity, layerRenderer()->tilerProgram(), textureUpdater);
     399        drawTiles(contentRect, globalTransform, opacity, layerRenderer()->tilerProgram());
    396400        break;
    397401    case LayerTextureUpdater::SampledTexelFormatBGRA:
    398         drawTiles(contentRect, globalTransform, opacity, layerRenderer()->tilerProgramSwizzle(), textureUpdater);
     402        drawTiles(contentRect, globalTransform, opacity, layerRenderer()->tilerProgramSwizzle());
    399403        break;
    400404    default:
     
    454458
    455459template <class T>
    456 void LayerTilerChromium::drawTiles(const IntRect& contentRect, const TransformationMatrix& globalTransform, float opacity, const T* program, LayerTextureUpdater* textureUpdater)
     460void LayerTilerChromium::drawTiles(const IntRect& contentRect, const TransformationMatrix& globalTransform, float opacity, const T* program)
    457461{
    458462    GraphicsContext3D* context = layerRendererContext();
     
    552556            // OpenGL coordinate system is bottom-up.
    553557            // If tile texture is top-down, we need to flip the texture coordinates.
    554             if (textureUpdater->orientation() == LayerTextureUpdater::TopDownOrientation) {
     558            if (m_textureOrientation == LayerTextureUpdater::TopDownOrientation) {
    555559                texTranslateY = 1.0 - texTranslateY;
    556560                texScaleY *= -1.0;
  • trunk/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h

    r90859 r90963  
    3232#include "LayerChromium.h"
    3333#include "LayerTexture.h"
     34#include "LayerTextureUpdater.h"
    3435#include "TilingData.h"
    3536#include <wtf/HashTraits.h>
     
    6061    void updateRect(LayerTextureUpdater*);
    6162    // Draw all tiles that intersect with the content rect.
    62     void draw(const IntRect& contentRect, const TransformationMatrix&, float opacity, LayerTextureUpdater*);
     63    void draw(const IntRect& contentRect, const TransformationMatrix&, float opacity);
    6364
    6465    int numTiles() const { return m_tilingData.numTiles(); }
     
    110111    // Draw all tiles that intersect with contentRect.
    111112    template <class T>
    112     void drawTiles(const IntRect& contentRect, const TransformationMatrix&, float opacity, const T* program, LayerTextureUpdater*);
     113    void drawTiles(const IntRect& contentRect, const TransformationMatrix&, float opacity, const T* program);
    113114
    114115    template <class T>
     
    166167    IntRect m_updateRect;
    167168
     169    LayerTextureUpdater::Orientation m_textureOrientation;
     170    LayerTextureUpdater::SampledTexelFormat m_sampledTexelFormat;
    168171    TilingData m_tilingData;
    169172
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp

    r90859 r90963  
    7272    , m_preserves3D(false)
    7373    , m_usesLayerScissor(false)
     74    , m_drawsContent(false)
    7475    , m_targetRenderSurface(0)
    7576    , m_drawDepth(0)
     
    137138}
    138139
    139 // These belong on CCLayerImpl, but should be overridden by each type and not defer to the LayerChromium subtypes.
    140 bool CCLayerImpl::drawsContent() const
    141 {
    142     return m_owner->drawsContent();
    143 }
    144 
    145140void CCLayerImpl::draw()
    146141{
    147     return m_owner->draw();
     142    ASSERT_NOT_REACHED();
    148143}
    149144
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h

    r90859 r90963  
    7373    virtual void updateCompositorResources();
    7474    void unreserveContentsTexture();
    75     void bindContentsTexture();
     75    virtual void bindContentsTexture();
    7676
    7777    // Returns true if this layer has content to draw.
    78     virtual bool drawsContent() const;
     78    void setDrawsContent(bool drawsContent) { m_drawsContent = drawsContent; }
     79    bool drawsContent() const { return m_drawsContent; }
    7980
    8081    // Returns true if any of the layer's descendants has content to draw.
     
    202203    bool m_usesLayerScissor;
    203204
     205    bool m_drawsContent;
     206
    204207    // Properties owned exclusively by this CCLayerImpl.
    205208    // Debugging.
Note: See TracChangeset for help on using the changeset viewer.