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

Unified Diff: cc/ScrollbarLayerChromium.cpp

Issue 11044003: Reduce texture uploads during scrollbar invalidations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove virtual pixelsDidChange, fix nits. Created 8 years, 2 months 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/ScrollbarLayerChromium.h ('k') | cc/caching_bitmap_canvas_layer_texture_updater.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/ScrollbarLayerChromium.cpp
diff --git a/cc/ScrollbarLayerChromium.cpp b/cc/ScrollbarLayerChromium.cpp
index 4f3a09fa5e47e6f2b4ff938adb24fb727fbff76d..67faf20ea2838f3a5084eba134195a5837d5db8b 100644
--- a/cc/ScrollbarLayerChromium.cpp
+++ b/cc/ScrollbarLayerChromium.cpp
@@ -9,7 +9,6 @@
#include "ScrollbarLayerChromium.h"
#include "base/basictypes.h"
-#include "BitmapCanvasLayerTextureUpdater.h"
#include "CCLayerTreeHost.h"
#include "CCScrollbarLayerImpl.h"
#include "CCTextureUpdateQueue.h"
@@ -193,25 +192,25 @@ void ScrollbarLayerChromium::createTextureUpdaterIfNeeded()
m_textureFormat = layerTreeHost()->rendererCapabilities().bestTextureFormat;
if (!m_backTrackUpdater)
- m_backTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::BackTrackPart));
+ m_backTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::BackTrackPart));
if (!m_backTrack)
m_backTrack = m_backTrackUpdater->createTexture(layerTreeHost()->contentsTextureManager());
// Only create two-part track if we think the two parts could be different in appearance.
if (m_scrollbar->isCustomScrollbar()) {
if (!m_foreTrackUpdater)
- m_foreTrackUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::ForwardTrackPart));
+ m_foreTrackUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarBackgroundPainter::create(m_scrollbar.get(), m_painter, m_geometry.get(), WebKit::WebScrollbar::ForwardTrackPart));
if (!m_foreTrack)
m_foreTrack = m_foreTrackUpdater->createTexture(layerTreeHost()->contentsTextureManager());
}
if (!m_thumbUpdater)
- m_thumbUpdater = BitmapCanvasLayerTextureUpdater::create(ScrollbarThumbPainter::create(m_scrollbar.get(), m_painter, m_geometry.get()));
+ m_thumbUpdater = CachingBitmapCanvasLayerTextureUpdater::Create(ScrollbarThumbPainter::create(m_scrollbar.get(), m_painter, m_geometry.get()));
if (!m_thumb)
m_thumb = m_thumbUpdater->createTexture(layerTreeHost()->contentsTextureManager());
}
-void ScrollbarLayerChromium::updatePart(LayerTextureUpdater* painter, LayerTextureUpdater::Texture* texture, const IntRect& rect, CCTextureUpdateQueue& queue, CCRenderingStats& stats)
+void ScrollbarLayerChromium::updatePart(CachingBitmapCanvasLayerTextureUpdater* painter, LayerTextureUpdater::Texture* texture, const IntRect& rect, CCTextureUpdateQueue& queue, CCRenderingStats& stats)
{
// Skip painting and uploading if there are no invalidations and
// we already have valid texture data.
@@ -230,6 +229,9 @@ void ScrollbarLayerChromium::updatePart(LayerTextureUpdater* painter, LayerTextu
float heightScale = static_cast<float>(contentBounds().height()) / bounds().height();
IntRect paintedOpaqueRect;
painter->prepareToUpdate(rect, rect.size(), widthScale, heightScale, paintedOpaqueRect, stats);
+ if (!painter->pixelsDidChange() && texture->texture()->haveBackingTexture())
+ return;
jamesr 2012/10/03 20:22:33 place add a TRACE_INSTANT0("cc", ...) here so we c
wjmaclean 2012/10/03 21:30:53 Good plan - done!
+
texture->prepareRect(rect, stats);
IntSize destOffset(0, 0);
« no previous file with comments | « cc/ScrollbarLayerChromium.h ('k') | cc/caching_bitmap_canvas_layer_texture_updater.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698