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

Unified Diff: cc/layers/painted_scrollbar_layer.cc

Issue 1458703010: Mac: Don't repaint scrollbars every frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master2
Patch Set: Rebase and resolve Created 5 years, 1 month 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/layers/painted_scrollbar_layer.h ('k') | cc/layers/painted_scrollbar_layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/painted_scrollbar_layer.cc
diff --git a/cc/layers/painted_scrollbar_layer.cc b/cc/layers/painted_scrollbar_layer.cc
index a074850152901b7361bcc77718fe0a37dc710a02..0d25dbcc09a81250e493a07174e5ab0da74fa99e 100644
--- a/cc/layers/painted_scrollbar_layer.cc
+++ b/cc/layers/painted_scrollbar_layer.cc
@@ -49,7 +49,8 @@ PaintedScrollbarLayer::PaintedScrollbarLayer(const LayerSettings& settings,
thumb_thickness_(scrollbar_->ThumbThickness()),
thumb_length_(scrollbar_->ThumbLength()),
is_overlay_(scrollbar_->IsOverlay()),
- has_thumb_(scrollbar_->HasThumb()) {
+ has_thumb_(scrollbar_->HasThumb()),
+ thumb_opacity_(scrollbar_->ThumbOpacity()) {
if (!scrollbar_->IsOverlay())
SetShouldScrollOnMainThread(true);
}
@@ -127,6 +128,8 @@ void PaintedScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
else
scrollbar_layer->set_thumb_ui_resource_id(0);
+ scrollbar_layer->set_thumb_opacity(thumb_opacity_);
+
scrollbar_layer->set_is_overlay_scrollbar(is_overlay_);
}
@@ -244,17 +247,24 @@ bool PaintedScrollbarLayer::Update() {
if (update_rect_.IsEmpty() && track_resource_)
return updated;
- track_resource_ = ScopedUIResource::Create(
- layer_tree_host(),
- RasterizeScrollbarPart(track_layer_rect, scaled_track_rect, TRACK));
+ if (!track_resource_ || scrollbar_->NeedsPaintPart(TRACK)) {
+ track_resource_ = ScopedUIResource::Create(
+ layer_tree_host(),
+ RasterizeScrollbarPart(track_layer_rect, scaled_track_rect, TRACK));
+ }
gfx::Rect thumb_layer_rect = OriginThumbRect();
gfx::Rect scaled_thumb_rect =
ScrollbarLayerRectToContentRect(thumb_layer_rect);
if (has_thumb_ && !scaled_thumb_rect.IsEmpty()) {
- thumb_resource_ = ScopedUIResource::Create(
- layer_tree_host(),
- RasterizeScrollbarPart(thumb_layer_rect, scaled_thumb_rect, THUMB));
+ if (!thumb_resource_ || scrollbar_->NeedsPaintPart(THUMB) ||
+ scaled_thumb_rect.size() !=
+ thumb_resource_->GetBitmap(0, false).GetSize()) {
+ thumb_resource_ = ScopedUIResource::Create(
+ layer_tree_host(),
+ RasterizeScrollbarPart(thumb_layer_rect, scaled_thumb_rect, THUMB));
+ }
+ thumb_opacity_ = scrollbar_->ThumbOpacity();
}
// UI resources changed so push properties is needed.
« no previous file with comments | « cc/layers/painted_scrollbar_layer.h ('k') | cc/layers/painted_scrollbar_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698