Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: cc/scrollbar_layer.cc

Issue 11464041: cc: Don't use partial updates for scrollbars when they are not allowed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/scrollbar_layer.h ('k') | cc/test/fake_scrollbar_layer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scrollbar_layer.cc
diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc
index f35b8650973d068b105e27e3f9691b9b6d89c6ac..c6ca1b1d2f32bb037047efdaa07f7a9d243f7a05 100644
--- a/cc/scrollbar_layer.cc
+++ b/cc/scrollbar_layer.cc
@@ -249,7 +249,7 @@ void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, Layer
// we already have valid texture data.
if (resource->texture()->haveBackingTexture() &&
resource->texture()->size() == rect.size() &&
- m_updateRect.IsEmpty())
+ !isDirty())
return;
// We should always have enough memory for UI.
@@ -265,8 +265,12 @@ void ScrollbarLayer::updatePart(CachingBitmapContentLayerUpdater* painter, Layer
return;
}
+ bool partialUpdatesAllowed = layerTreeHost()->settings().maxPartialTextureUpdates > 0;
+ if (!partialUpdatesAllowed)
+ resource->texture()->returnBackingTexture();
+
gfx::Vector2d destOffset(0, 0);
- resource->update(queue, rect, destOffset, false, stats);
+ resource->update(queue, rect, destOffset, partialUpdatesAllowed, stats);
}
gfx::Rect ScrollbarLayer::scrollbarLayerRectToContentRect(const gfx::Rect& layerRect) const
@@ -306,8 +310,13 @@ void ScrollbarLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker*
{
ContentsScalingLayer::update(queue, occlusion, stats);
+ m_dirtyRect.Union(m_updateRect);
if (contentBounds().IsEmpty())
return;
+ if (visibleContentRect().IsEmpty())
+ return;
+ if (!isDirty())
+ return;
createUpdaterIfNeeded();
@@ -317,10 +326,12 @@ void ScrollbarLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker*
updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, queue, stats);
// Consider the thumb to be at the origin when painting.
- WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get());
- gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(0, 0, thumbRect.width, thumbRect.height));
+ gfx::Rect thumbRect = m_geometry->thumbRect(m_scrollbar.get());
+ gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(thumbRect.size()));
if (!originThumbRect.IsEmpty())
updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue, stats);
+
+ m_dirtyRect = gfx::RectF();
}
} // namespace cc
« no previous file with comments | « cc/scrollbar_layer.h ('k') | cc/test/fake_scrollbar_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698