[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-changes
Subject:    [webkit-changes] [81973]
From:       enne () google ! com
Date:       2011-03-25 18:44:54
Message-ID: 20110325184454.691531482FE2 () lists ! macosforge ! org
[Download RAW message or body]

[Attachment #2 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[81973] branches/chromium/696/Source/WebCore/platform/graphics/chromium</title>
 </head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: \
verdana,arial,helvetica,sans-serif; font-size: 10pt;  } #msg dl a { font-weight: \
bold} #msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: \
bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: \
6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em \
0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg \
h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } \
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; \
} #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: \
-1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em \
1em 0 1em; background: white;} #logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid \
#fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { \
text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted \
#fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: \
0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid \
#fa0; } #logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: \
6px; } #patch { width: 100%; }
#patch h4 {font-family: \
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
 #patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, \
#patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins \
{background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del \
{background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, \
                .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a \
href="http://trac.webkit.org/projects/webkit/changeset/81973">81973</a></dd> \
<dt>Author</dt> <dd>enne@google.com</dd> <dt>Date</dt> <dd>2011-03-25 11:44:52 -0700 \
(Fri, 25 Mar 2011)</dd> </dl>

<h3>Log Message</h3>
<pre>Merge 80767 - 2011-03-10  Adrienne Walker  &lt;enne@google.com&gt;

        Reviewed by Kenneth Russell.

        [chromium] Make tiled compositor data structure more efficient.
        https://bugs.webkit.org/show_bug.cgi?id=54133

        Previously, the compositor had a sparse 2D array of tiles for the
        whole page, most of which were null.  The tiles were implicitly
        located based on their position in the array. This was inefficient
        when the page grew (e.g. infinite scrolling) and caused some bugs
        (e.g. width * height &gt; MAX_INT).  This change modifies tiles to have
        explicit positions so they can be stored in a hash map.

        Tests: LayoutTests/compositing/

        * platform/graphics/chromium/LayerTilerChromium.cpp:
        (WebCore::LayerTilerChromium::reset):
        (WebCore::LayerTilerChromium::createTile):
        (WebCore::LayerTilerChromium::invalidateTiles):
        (WebCore::LayerTilerChromium::contentRectToTileIndices):
        (WebCore::LayerTilerChromium::tileAt):
        (WebCore::LayerTilerChromium::tileContentRect):
        (WebCore::LayerTilerChromium::tileLayerRect):
        (WebCore::LayerTilerChromium::invalidateRect):
        (WebCore::LayerTilerChromium::invalidateEntireLayer):
        (WebCore::LayerTilerChromium::update):
        (WebCore::LayerTilerChromium::updateFromPixels):
        (WebCore::LayerTilerChromium::draw):
        (WebCore::LayerTilerChromium::growLayerToContain):
        * platform/graphics/chromium/LayerTilerChromium.h:
        (WebCore::LayerTilerChromium::Tile::Tile):
        (WebCore::LayerTilerChromium::Tile::i):
        (WebCore::LayerTilerChromium::Tile::j):
        (WebCore::LayerTilerChromium::Tile::moveTo):
        (WebCore::LayerTilerChromium::TileMapKeyTraits::emptyValue):
        (WebCore::LayerTilerChromium::TileMapKeyTraits::constructDeletedValue):
        (WebCore::LayerTilerChromium::TileMapKeyTraits::isDeletedValue):

TBR=enne@google.com</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#brancheschromium696SourceWebCoreplatformgraphicschromiumLayerTilerChromi \
umcpp">branches/chromium/696/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp</a></li>
 <li><a href="#brancheschromium696SourceWebCoreplatformgraphicschromiumLayerTilerChrom \
iumh">branches/chromium/696/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h</a></li>
 </ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="brancheschromium696SourceWebCoreplatformgraphicschromiumLayerTilerChromiumcpp"></a>
 <div class="modfile"><h4>Modified: \
branches/chromium/696/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp \
(81972 => 81973)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/chromium/696/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp	2011-03-25 \
                18:26:16 UTC (rev 81972)
+++ branches/chromium/696/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp	2011-03-25 \
18:44:52 UTC (rev 81973) </span><span class="lines">@@ -84,58 +84,50 @@
</span><span class="cx"> {
</span><span class="cx">     m_tiles.clear();
</span><span class="cx">     m_unusedTiles.clear();
</span><del>-
</del><span class="cx">     m_tilingData.setTotalSize(0, 0);
</span><del>-    m_lastUpdateLayerRect = IntRect();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> LayerTilerChromium::Tile* LayerTilerChromium::createTile(int \
i, int j) </span><span class="cx"> {
</span><del>-    const int index = tileIndex(i, j);
-    ASSERT(!m_tiles[index]);
</del><ins>+    ASSERT(!tileAt(i, j));
</ins><span class="cx"> 
</span><ins>+    RefPtr&lt;Tile&gt; tile;
</ins><span class="cx">     if (m_unusedTiles.size() &gt; 0) {
</span><del>-        m_tiles[index] = m_unusedTiles.last().release();
</del><ins>+        tile = m_unusedTiles.last().release();
</ins><span class="cx">         m_unusedTiles.removeLast();
</span><ins>+        ASSERT(tile-&gt;refCount() == 1);
</ins><span class="cx">     } else {
</span><span class="cx">         GraphicsContext3D* context = layerRendererContext();
</span><span class="cx">         TextureManager* manager = \
layerRenderer()-&gt;textureManager(); </span><del>-        OwnPtr&lt;Tile&gt; tile = \
                adoptPtr(new Tile(LayerTexture::create(context, manager)));
-        m_tiles[index] = tile.release();
</del><ins>+        tile = adoptRef(new Tile(LayerTexture::create(context, \
manager))); </ins><span class="cx">     }
</span><ins>+    m_tiles.add(make_pair(i, j), tile);
</ins><span class="cx"> 
</span><del>-    m_tiles[index]-&gt;m_dirtyLayerRect = tileLayerRect(i, j);
-    return m_tiles[index].get();
</del><ins>+    tile-&gt;moveTo(i, j);
+    tile-&gt;m_dirtyLayerRect = tileLayerRect(tile.get());
+
+    return tile.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void LayerTilerChromium::invalidateTiles(const IntRect&amp; \
oldLayerRect, const IntRect&amp; newLayerRect) </del><ins>+void \
LayerTilerChromium::invalidateTiles(const IntRect&amp; contentRect) </ins><span \
class="cx"> { </span><span class="cx">     if (!m_tiles.size())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    IntRect oldContentRect = layerRectToContentRect(oldLayerRect);
-    int oldLeft, oldTop, oldRight, oldBottom;
-    contentRectToTileIndices(oldContentRect, oldLeft, oldTop, oldRight, oldBottom);
-
-    IntRect newContentRect = layerRectToContentRect(newLayerRect);
-    int newLeft, newTop, newRight, newBottom;
-    contentRectToTileIndices(newContentRect, newLeft, newTop, newRight, newBottom);
-
-    // Iterating through just the old tile indices is an optimization to avoid
-    // iterating through the entire m_tiles array.
-    for (int j = oldTop; j &lt;= oldBottom; ++j) {
-        for (int i = oldLeft; i &lt;= oldRight; ++i) {
-            if (i &gt;= newLeft &amp;&amp; i &lt;= newRight &amp;&amp; j &gt;= \
                newTop &amp;&amp; j &lt;= newBottom)
-                continue;
-
-            const int index = tileIndex(i, j);
-            if (m_tiles[index])
-                m_unusedTiles.append(m_tiles[index].release());
-        }
</del><ins>+    Vector&lt;TileMapKey&gt; removeKeys;
+    for (TileMap::iterator iter = m_tiles.begin(); iter != m_tiles.end(); ++iter) {
+        Tile* tile = iter-&gt;second.get();
+        IntRect tileRect = tileContentRect(tile);
+        if (tileRect.intersects(contentRect))
+            continue;
+        removeKeys.append(iter-&gt;first);
</ins><span class="cx">     }
</span><ins>+
+    for (size_t i = 0; i &lt; removeKeys.size(); ++i)
+        m_unusedTiles.append(m_tiles.take(removeKeys[i]));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void LayerTilerChromium::contentRectToTileIndices(const IntRect&amp; \
contentRect, int &amp;left, int &amp;top, int &amp;right, int &amp;bottom) const \
</del><ins>+void LayerTilerChromium::contentRectToTileIndices(const IntRect&amp; \
contentRect, int&amp; left, int&amp; top, int&amp; right, int&amp; bottom) const \
</ins><span class="cx"> { </span><span class="cx">     const IntRect layerRect = \
contentRectToLayerRect(contentRect); </span><span class="cx"> 
</span><span class="lines">@@ -163,36 +155,28 @@
</span><span class="cx">     return contentRect;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-int LayerTilerChromium::tileIndex(int i, int j) const
</del><ins>+LayerTilerChromium::Tile* LayerTilerChromium::tileAt(int i, int j) const
</ins><span class="cx"> {
</span><del>-    return m_tilingData.tileIndex(i, j);
</del><ins>+    Tile* tile = m_tiles.get(make_pair(i, j)).get();
+    ASSERT(!tile || tile-&gt;refCount() == 1);
+    return tile;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntRect LayerTilerChromium::tileContentRect(int i, int j) const
</del><ins>+IntRect LayerTilerChromium::tileContentRect(const Tile* tile) const
</ins><span class="cx"> {
</span><del>-    IntRect contentRect = tileLayerRect(i, j);
</del><ins>+    IntRect contentRect = tileLayerRect(tile);
</ins><span class="cx">     contentRect.move(m_layerPosition.x(), \
m_layerPosition.y()); </span><span class="cx">     return contentRect;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntRect LayerTilerChromium::tileLayerRect(int i, int j) const
</del><ins>+IntRect LayerTilerChromium::tileLayerRect(const Tile* tile) const
</ins><span class="cx"> {
</span><del>-    const int index = m_tilingData.tileIndex(i, j);
</del><ins>+    const int index = m_tilingData.tileIndex(tile-&gt;i(), tile-&gt;j());
</ins><span class="cx">     IntRect layerRect = \
m_tilingData.tileBoundsWithBorder(index); </span><span class="cx">     \
layerRect.setSize(m_tileSize); </span><span class="cx">     return layerRect;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntSize LayerTilerChromium::layerSize() const
-{
-    return IntSize(m_tilingData.totalSizeX(), m_tilingData.totalSizeY());
-}
-
-IntSize LayerTilerChromium::layerTileSize() const
-{
-    return IntSize(m_tilingData.numTilesX(), m_tilingData.numTilesY());
-}
-
</del><span class="cx"> void LayerTilerChromium::invalidateRect(const IntRect&amp; \
contentRect) </span><span class="cx"> {
</span><span class="cx">     if (contentRect.isEmpty())
</span><span class="lines">@@ -202,16 +186,16 @@
</span><span class="cx"> 
</span><span class="cx">     // Dirty rects are always in layer space, as the layer \
could be repositioned </span><span class="cx">     // after invalidation.
</span><del>-    IntRect layerRect = contentRectToLayerRect(contentRect);
</del><ins>+    const IntRect layerRect = contentRectToLayerRect(contentRect);
</ins><span class="cx"> 
</span><span class="cx">     int left, top, right, bottom;
</span><span class="cx">     contentRectToTileIndices(contentRect, left, top, right, \
bottom); </span><span class="cx">     for (int j = top; j &lt;= bottom; ++j) {
</span><span class="cx">         for (int i = left; i &lt;= right; ++i) {
</span><del>-            Tile* tile = m_tiles[tileIndex(i, j)].get();
</del><ins>+            Tile* tile = tileAt(i, j);
</ins><span class="cx">             if (!tile)
</span><span class="cx">                 continue;
</span><del>-            IntRect bound = tileLayerRect(i, j);
</del><ins>+            IntRect bound = tileLayerRect(tile);
</ins><span class="cx">             bound.intersect(layerRect);
</span><span class="cx">             tile-&gt;m_dirtyLayerRect.unite(bound);
</span><span class="cx">         }
</span><span class="lines">@@ -220,14 +204,13 @@
</span><span class="cx"> 
</span><span class="cx"> void LayerTilerChromium::invalidateEntireLayer()
</span><span class="cx"> {
</span><del>-    for (size_t i = 0; i &lt; m_tiles.size(); ++i) {
-        if (m_tiles[i])
-            m_unusedTiles.append(m_tiles[i].release());
</del><ins>+    for (TileMap::iterator iter = m_tiles.begin(); iter != m_tiles.end(); \
++iter) { +        ASSERT(iter-&gt;second-&gt;refCount() == 1);
+        m_unusedTiles.append(iter-&gt;second.release());
</ins><span class="cx">     }
</span><span class="cx">     m_tiles.clear();
</span><span class="cx"> 
</span><span class="cx">     m_tilingData.setTotalSize(0, 0);
</span><del>-    m_lastUpdateLayerRect = IntRect();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void LayerTilerChromium::update(TilePaintInterface&amp; \
painter, const IntRect&amp; contentRect) </span><span class="lines">@@ -237,10 +220,7 \
@@ </span><span class="cx"> 
</span><span class="cx">     // Invalidate old tiles that were previously used but \
aren't in use this </span><span class="cx">     // frame so that they can get reused \
for new tiles. </span><del>-    IntRect layerRect = \
                contentRectToLayerRect(contentRect);
-    invalidateTiles(m_lastUpdateLayerRect, layerRect);
-    m_lastUpdateLayerRect = layerRect;
-
</del><ins>+    invalidateTiles(contentRect);
</ins><span class="cx">     growLayerToContain(contentRect);
</span><span class="cx"> 
</span><span class="cx">     // Create tiles as needed, expanding a dirty rect to \
contain all </span><span class="lines">@@ -250,11 +230,11 @@
</span><span class="cx">     contentRectToTileIndices(contentRect, left, top, right, \
bottom); </span><span class="cx">     for (int j = top; j &lt;= bottom; ++j) {
</span><span class="cx">         for (int i = left; i &lt;= right; ++i) {
</span><del>-            Tile* tile = m_tiles[tileIndex(i, j)].get();
</del><ins>+            Tile* tile = tileAt(i, j);
</ins><span class="cx">             if (!tile)
</span><span class="cx">                 tile = createTile(i, j);
</span><span class="cx">             if (!tile-&gt;texture()-&gt;isValid(m_tileSize, \
GraphicsContext3D::RGBA)) </span><del>-                tile-&gt;m_dirtyLayerRect = \
tileLayerRect(i, j); </del><ins>+                tile-&gt;m_dirtyLayerRect = \
tileLayerRect(tile); </ins><span class="cx">             \
dirtyLayerRect.unite(tile-&gt;m_dirtyLayerRect); </span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -285,14 +265,14 @@
</span><span class="cx">     contentRectToTileIndices(paintRect, left, top, right, \
bottom); </span><span class="cx">     for (int j = top; j &lt;= bottom; ++j) {
</span><span class="cx">         for (int i = left; i &lt;= right; ++i) {
</span><del>-            Tile* tile = m_tiles[tileIndex(i, j)].get();
</del><ins>+            Tile* tile = tileAt(i, j);
</ins><span class="cx">             if (!tile)
</span><span class="cx">                 CRASH();
</span><span class="cx">             if (!tile-&gt;dirty())
</span><span class="cx">                 continue;
</span><span class="cx"> 
</span><span class="cx">             // Calculate page-space rectangle to copy from.
</span><del>-            IntRect sourceRect = tileContentRect(i, j);
</del><ins>+            IntRect sourceRect = tileContentRect(tile);
</ins><span class="cx">             const IntPoint anchor = sourceRect.location();
</span><span class="cx">             \
sourceRect.intersect(layerRectToContentRect(tile-&gt;m_dirtyLayerRect)); </span><span \
class="cx">             if (sourceRect.isEmpty()) </span><span class="lines">@@ \
-366,8 +346,7 @@ </span><span class="cx">     contentRectToTileIndices(contentRect, \
left, top, right, bottom); </span><span class="cx">     for (int j = top; j &lt;= \
bottom; ++j) { </span><span class="cx">         for (int i = left; i &lt;= right; \
++i) { </span><del>-            const int index = tileIndex(i, j);
-            Tile* tile = m_tiles[index].get();
</del><ins>+            Tile* tile = tileAt(i, j);
</ins><span class="cx">             ASSERT(tile);
</span><span class="cx"> 
</span><span class="cx">             tile-&gt;texture()-&gt;bindTexture();
</span><span class="lines">@@ -376,11 +355,11 @@
</span><span class="cx"> 
</span><span class="cx">             // Don't use tileContentRect here, as that \
contains the full </span><span class="cx">             // rect with border texels \
which shouldn't be drawn. </span><del>-            IntRect tileRect = \
m_tilingData.tileBounds(index); </del><ins>+            IntRect tileRect = \
m_tilingData.tileBounds(m_tilingData.tileIndex(tile-&gt;i(), tile-&gt;j())); \
</ins><span class="cx">             tileRect.move(m_layerPosition.x(), \
m_layerPosition.y()); </span><span class="cx">             \
tileMatrix.translate3d(tileRect.x() - contentRect.x() + tileRect.width() / 2.0, \
tileRect.y() - contentRect.y() + tileRect.height() / 2.0, 0); </span><span \
class="cx">  </span><del>-            IntPoint texOffset = \
m_tilingData.textureOffset(i, j); </del><ins>+            IntPoint texOffset = \
m_tilingData.textureOffset(tile-&gt;i(), tile-&gt;j()); </ins><span class="cx">       \
float tileWidth = static_cast&lt;float&gt;(m_tileSize.width()); </span><span \
class="cx">             float tileHeight = \
static_cast&lt;float&gt;(m_tileSize.height()); </span><span class="cx">             \
float texTranslateX = texOffset.x() / tileWidth; </span><span class="lines">@@ \
-395,37 +374,15 @@ </span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void LayerTilerChromium::resizeLayer(const IntSize&amp; size)
-{
-    if (layerSize() == size)
-        return;
-
-    const IntSize oldTileSize = layerTileSize();
-    m_tilingData.setTotalSize(size.width(), size.height());
-    const IntSize newTileSize = layerTileSize();
-
-    if (oldTileSize == newTileSize)
-        return;
-
-    if (newTileSize.height() &amp;&amp; (newTileSize.width() &gt; INT_MAX / \
                newTileSize.height()))
-        CRASH();
-
-    Vector&lt;OwnPtr&lt;Tile&gt; &gt; newTiles;
-    newTiles.resize(newTileSize.width() * newTileSize.height());
-    for (int j = 0; j &lt; oldTileSize.height(); ++j)
-        for (int i = 0; i &lt; oldTileSize.width(); ++i)
-            newTiles[i + j * newTileSize.width()].swap(m_tiles[i + j * \
                oldTileSize.width()]);
-    m_tiles.swap(newTiles);
-}
-
</del><span class="cx"> void LayerTilerChromium::growLayerToContain(const \
IntRect&amp; contentRect) </span><span class="cx"> {
</span><span class="cx">     // Grow the tile array to contain this content rect.
</span><span class="cx">     IntRect layerRect = contentRectToLayerRect(contentRect);
</span><span class="cx">     IntSize rectSize = IntSize(layerRect.maxX(), \
layerRect.maxY()); </span><span class="cx"> 
</span><del>-    IntSize newSize = rectSize.expandedTo(layerSize());
-    resizeLayer(newSize);
</del><ins>+    IntSize oldLayerSize(m_tilingData.totalSizeX(), \
m_tilingData.totalSizeY()); +    IntSize newSize = rectSize.expandedTo(oldLayerSize);
+    m_tilingData.setTotalSize(newSize.width(), newSize.height());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void LayerTilerChromium::drawTexturedQuad(GraphicsContext3D* \
context, const TransformationMatrix&amp; projectionMatrix, const \
TransformationMatrix&amp; drawMatrix, </span></span></pre></div>
<a id="brancheschromium696SourceWebCoreplatformgraphicschromiumLayerTilerChromiumh"></a>
 <div class="modfile"><h4>Modified: \
branches/chromium/696/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h \
(81972 => 81973)</h4> <pre class="diff"><span>
<span class="info">--- \
branches/chromium/696/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h	2011-03-25 \
                18:26:16 UTC (rev 81972)
+++ branches/chromium/696/Source/WebCore/platform/graphics/chromium/LayerTilerChromium.h	2011-03-25 \
18:44:52 UTC (rev 81973) </span><span class="lines">@@ -33,7 +33,9 @@
</span><span class="cx"> #include &quot;LayerTexture.h&quot;
</span><span class="cx"> #include &quot;PlatformCanvas.h&quot;
</span><span class="cx"> #include &quot;TilingData.h&quot;
</span><ins>+#include &lt;wtf/HashTraits.h&gt;
</ins><span class="cx"> #include &lt;wtf/OwnArrayPtr.h&gt;
</span><ins>+#include &lt;wtf/RefCounted.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -70,20 +72,26 @@
</span><span class="cx"> private:
</span><span class="cx">     LayerTilerChromium(LayerRendererChromium*, const \
IntSize&amp; tileSize, BorderTexelOption); </span><span class="cx"> 
</span><del>-    class Tile {
</del><ins>+    class Tile : public RefCounted&lt;Tile&gt; {
</ins><span class="cx">         WTF_MAKE_NONCOPYABLE(Tile);
</span><span class="cx">     public:
</span><del>-        explicit Tile(PassOwnPtr&lt;LayerTexture&gt; tex) : m_tex(tex) \
{} </del><ins>+        explicit Tile(PassOwnPtr&lt;LayerTexture&gt; tex) : \
m_tex(tex), m_i(-1), m_j(-1) {} </ins><span class="cx"> 
</span><span class="cx">         LayerTexture* texture() { return m_tex.get(); }
</span><span class="cx"> 
</span><span class="cx">         bool dirty() const { return \
!m_dirtyLayerRect.isEmpty(); } </span><span class="cx">         void clearDirty() { \
m_dirtyLayerRect = IntRect(); } </span><span class="cx"> 
</span><ins>+        int i() const { return m_i; }
+        int j() const { return m_j; }
+        void moveTo(int i, int j) { m_i = i; m_j = j; }
+
</ins><span class="cx">         // Layer-space dirty rectangle that needs to be \
repainted. </span><span class="cx">         IntRect m_dirtyLayerRect;
</span><span class="cx">     private:
</span><span class="cx">         OwnPtr&lt;LayerTexture&gt; m_tex;
</span><ins>+        int m_i;
+        int m_j;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     void drawTexturedQuad(GraphicsContext3D*, const \
TransformationMatrix&amp; projectionMatrix, const TransformationMatrix&amp; \
drawMatrix, </span><span class="lines">@@ -92,40 +100,45 @@
</span><span class="cx">                           float texScaleX, float texScaleY,
</span><span class="cx">                           const \
LayerTilerChromium::Program*); </span><span class="cx"> 
</span><del>-    void resizeLayer(const IntSize&amp; size);
</del><span class="cx">     // Grow layer size to contain this rectangle.
</span><span class="cx">     void growLayerToContain(const IntRect&amp; contentRect);
</span><span class="cx"> 
</span><span class="cx">     LayerRendererChromium* layerRenderer() const { return \
m_layerRenderer; } </span><span class="cx">     GraphicsContext3D* \
layerRendererContext() const; </span><span class="cx">     Tile* createTile(int i, \
int j); </span><del>-    // Invalidate any tiles which do not intersect with the \
                newLayerRect.
-    void invalidateTiles(const IntRect&amp; oldLayerRect, const IntRect&amp; \
newLayerRect); </del><ins>+    // Invalidate any tiles which do not intersect with \
the contentRect +    void invalidateTiles(const IntRect&amp; contentRect);
</ins><span class="cx">     void reset();
</span><span class="cx">     void contentRectToTileIndices(const IntRect&amp; \
contentRect, int &amp;left, int &amp;top, int &amp;right, int &amp;bottom) const; \
</span><span class="cx">     IntRect contentRectToLayerRect(const IntRect&amp; \
contentRect) const; </span><span class="cx">     IntRect layerRectToContentRect(const \
IntRect&amp; layerRect) const; </span><span class="cx"> 
</span><del>-    // Returns the index into m_tiles for a given tile location.
-    int tileIndex(int i, int j) const;
-    // Returns the bounds in content space for a given tile location.
-    IntRect tileContentRect(int i, int j) const;
-    // Returns the bounds in layer space for a given tile location.
-    IntRect tileLayerRect(int i, int j) const;
</del><ins>+    Tile* tileAt(int, int) const;
+    IntRect tileContentRect(const Tile*) const;
+    IntRect tileLayerRect(const Tile*) const;
</ins><span class="cx"> 
</span><del>-    IntSize layerSize() const;
-    IntSize layerTileSize() const;
-
</del><span class="cx">     IntSize m_tileSize;
</span><del>-    IntRect m_lastUpdateLayerRect;
</del><span class="cx">     IntPoint m_layerPosition;
</span><span class="cx"> 
</span><span class="cx">     bool m_skipsDraw;
</span><span class="cx"> 
</span><del>-    // Logical 2D array of tiles (dimensions of m_layerTileSize)
-    Vector&lt;OwnPtr&lt;Tile&gt; &gt; m_tiles;
-    // Linear array of unused tiles.
-    Vector&lt;OwnPtr&lt;Tile&gt; &gt; m_unusedTiles;
</del><ins>+    // Default hash key traits for integers disallow 0 and -1 as a key, \
so +    // use a custom hash trait which disallows -1 and -2 instead.
+    typedef std::pair&lt;int, int&gt; TileMapKey;
+    struct TileMapKeyTraits : HashTraits&lt;TileMapKey&gt; {
+        static const bool emptyValueIsZero = false;
+        static const bool needsDestruction = false;
+        static TileMapKey emptyValue() { return std::make_pair(-1, -1); }
+        static void constructDeletedValue(TileMapKey&amp; slot) { slot = \
std::make_pair(-2, -2); } +        static bool isDeletedValue(TileMapKey value) { \
return value.first == -2 &amp;&amp; value.second == -2; } +    };
+    // FIXME: The mapped value in TileMap should really be an OwnPtr, as the
+    // refcount of a Tile should never be more than 1. However, HashMap
+    // doesn't easily support OwnPtr as a value.
+    typedef HashMap&lt;TileMapKey, RefPtr&lt;Tile&gt;, \
DefaultHash&lt;TileMapKey&gt;::Hash, TileMapKeyTraits&gt; TileMap; +    TileMap \
m_tiles; +    // Tightly packed set of unused tiles.
+    Vector&lt;RefPtr&lt;Tile&gt; &gt; m_unusedTiles;
</ins><span class="cx"> 
</span><span class="cx">     PlatformCanvas m_canvas;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>



_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic