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

Unified Diff: cc/layers/scrollbar_layer.cc

Issue 17550008: Make IsSolidColor() a property on CC scrollbar layers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use DCHECK(layer_tree_host()) instead. Created 7 years, 6 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
Index: cc/layers/scrollbar_layer.cc
diff --git a/cc/layers/scrollbar_layer.cc b/cc/layers/scrollbar_layer.cc
index 30e2a93ba5bf453eba0b0d1bcff9965f9dfeacab..d3c8ded34c0084377c3d620d4a35f07e09c5703b 100644
--- a/cc/layers/scrollbar_layer.cc
+++ b/cc/layers/scrollbar_layer.cc
@@ -21,21 +21,26 @@ namespace cc {
scoped_ptr<LayerImpl> ScrollbarLayer::CreateLayerImpl(
LayerTreeImpl* tree_impl) {
return ScrollbarLayerImpl::Create(
- tree_impl, id(), scrollbar_->Orientation()).PassAs<LayerImpl>();
+ tree_impl, id(), scrollbar_->Orientation(), is_solid_color_)
+ .PassAs<LayerImpl>();
}
scoped_refptr<ScrollbarLayer> ScrollbarLayer::Create(
scoped_ptr<Scrollbar> scrollbar,
- int scroll_layer_id) {
+ int scroll_layer_id,
+ bool is_solid_color) {
return make_scoped_refptr(new ScrollbarLayer(scrollbar.Pass(),
- scroll_layer_id));
+ scroll_layer_id,
+ is_solid_color));
}
ScrollbarLayer::ScrollbarLayer(
scoped_ptr<Scrollbar> scrollbar,
- int scroll_layer_id)
+ int scroll_layer_id,
+ bool is_solid_color)
: scrollbar_(scrollbar.Pass()),
scroll_layer_id_(scroll_layer_id),
+ is_solid_color_(is_solid_color),
texture_format_(GL_INVALID_ENUM) {
if (!scrollbar_->IsOverlay())
SetShouldScrollOnMainThread(true);
@@ -59,13 +64,19 @@ ScrollbarOrientation ScrollbarLayer::Orientation() const {
return scrollbar_->Orientation();
}
+bool ScrollbarLayer::IsSolidColor() const {
+ DCHECK(layer_tree_host());
enne (OOO) 2013/06/26 17:39:05 This seems dangerous. cc::Layers can be detached
wjmaclean 2013/06/26 18:16:00 There isn't a command line flag for force_solid_co
enne (OOO) 2013/06/26 20:02:11 Right now it can't differ, and is always true on A
+ return is_solid_color_ ||
+ layer_tree_host()->settings().force_solid_color_scrollbars;
+}
+
int ScrollbarLayer::MaxTextureSize() {
DCHECK(layer_tree_host());
return layer_tree_host()->GetRendererCapabilities().max_texture_size;
}
float ScrollbarLayer::ClampScaleToMaxTextureSize(float scale) {
- if (layer_tree_host()->settings().solid_color_scrollbars)
+ if (IsSolidColor())
return scale;
// If the scaled content_bounds() is bigger than the max texture size of the
@@ -104,8 +115,7 @@ void ScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
ScrollbarLayerImpl* scrollbar_layer = static_cast<ScrollbarLayerImpl*>(layer);
- if (layer_tree_host() &&
- layer_tree_host()->settings().solid_color_scrollbars) {
+ if (layer_tree_host() && IsSolidColor()) {
int thickness_override =
layer_tree_host()->settings().solid_color_scrollbar_thickness_dip;
if (thickness_override != -1) {
@@ -127,6 +137,7 @@ void ScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
scrollbar_layer->set_track_start(track_rect_.y());
scrollbar_layer->set_track_length(track_rect_.height());
}
+ scrollbar_layer->set_is_solid_color(IsSolidColor());
if (track_ && track_->texture()->have_backing_texture())
scrollbar_layer->set_track_resource_id(track_->texture()->resource_id());
@@ -174,7 +185,7 @@ class ScrollbarPartPainter : public LayerPainter {
};
void ScrollbarLayer::CreateUpdaterIfNeeded() {
- if (layer_tree_host()->settings().solid_color_scrollbars)
+ if (IsSolidColor())
return;
texture_format_ =
@@ -212,7 +223,7 @@ void ScrollbarLayer::UpdatePart(CachingBitmapContentLayerUpdater* painter,
gfx::Rect rect,
ResourceUpdateQueue* queue,
RenderingStats* stats) {
- if (layer_tree_host()->settings().solid_color_scrollbars)
+ if (IsSolidColor())
return;
// Skip painting and uploading if there are no invalidations and
@@ -267,7 +278,7 @@ gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect(
void ScrollbarLayer::SetTexturePriorities(
const PriorityCalculator& priority_calc) {
- if (layer_tree_host()->settings().solid_color_scrollbars)
+ if (IsSolidColor())
return;
if (content_bounds().IsEmpty())
@@ -296,7 +307,7 @@ void ScrollbarLayer::Update(ResourceUpdateQueue* queue,
RenderingStats* stats) {
track_rect_ = scrollbar_->TrackRect();
- if (layer_tree_host()->settings().solid_color_scrollbars)
+ if (IsSolidColor())
return;
{

Powered by Google App Engine
This is Rietveld 408576698