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

Side by Side Diff: cc/layers/scrollbar_layer.cc

Issue 12676029: cc: Fix capitalization style in chromified files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/scrollbar_layer.h ('k') | cc/layers/scrollbar_layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/scrollbar_layer.h" 5 #include "cc/layers/scrollbar_layer.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/layers/scrollbar_layer_impl.h" 9 #include "cc/layers/scrollbar_layer_impl.h"
10 #include "cc/resources/caching_bitmap_content_layer_updater.h" 10 #include "cc/resources/caching_bitmap_content_layer_updater.h"
(...skipping 12 matching lines...) Expand all
23 tree_impl, 23 tree_impl,
24 id(), 24 id(),
25 ScrollbarGeometryFixedThumb::Create(make_scoped_ptr(geometry_->clone()))) 25 ScrollbarGeometryFixedThumb::Create(make_scoped_ptr(geometry_->clone())))
26 .PassAs<LayerImpl>(); 26 .PassAs<LayerImpl>();
27 } 27 }
28 28
29 scoped_refptr<ScrollbarLayer> ScrollbarLayer::Create( 29 scoped_refptr<ScrollbarLayer> ScrollbarLayer::Create(
30 scoped_ptr<WebKit::WebScrollbar> scrollbar, 30 scoped_ptr<WebKit::WebScrollbar> scrollbar,
31 scoped_ptr<ScrollbarThemePainter> painter, 31 scoped_ptr<ScrollbarThemePainter> painter,
32 scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry, 32 scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry,
33 int scrollLayerId) { 33 int scroll_layer_id) {
34 return make_scoped_refptr(new ScrollbarLayer(scrollbar.Pass(), 34 return make_scoped_refptr(new ScrollbarLayer(scrollbar.Pass(),
35 painter.Pass(), 35 painter.Pass(),
36 geometry.Pass(), 36 geometry.Pass(),
37 scrollLayerId)); 37 scroll_layer_id));
38 } 38 }
39 39
40 ScrollbarLayer::ScrollbarLayer( 40 ScrollbarLayer::ScrollbarLayer(
41 scoped_ptr<WebKit::WebScrollbar> scrollbar, 41 scoped_ptr<WebKit::WebScrollbar> scrollbar,
42 scoped_ptr<ScrollbarThemePainter> painter, 42 scoped_ptr<ScrollbarThemePainter> painter,
43 scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry, 43 scoped_ptr<WebKit::WebScrollbarThemeGeometry> geometry,
44 int scrollLayerId) 44 int scroll_layer_id)
45 : scrollbar_(scrollbar.Pass()), 45 : scrollbar_(scrollbar.Pass()),
46 painter_(painter.Pass()), 46 painter_(painter.Pass()),
47 geometry_(geometry.Pass()), 47 geometry_(geometry.Pass()),
48 scroll_layer_id_(scrollLayerId), 48 scroll_layer_id_(scroll_layer_id),
49 texture_format_(GL_INVALID_ENUM) { 49 texture_format_(GL_INVALID_ENUM) {
50 if (!scrollbar_->isOverlay()) 50 if (!scrollbar_->isOverlay())
51 SetShouldScrollOnMainThread(true); 51 SetShouldScrollOnMainThread(true);
52 } 52 }
53 53
54 ScrollbarLayer::~ScrollbarLayer() {} 54 ScrollbarLayer::~ScrollbarLayer() {}
55 55
56 void ScrollbarLayer::SetScrollLayerId(int id) { 56 void ScrollbarLayer::SetScrollLayerId(int id) {
57 if (id == scroll_layer_id_) 57 if (id == scroll_layer_id_)
58 return; 58 return;
(...skipping 30 matching lines...) Expand all
89 else 89 else
90 return (MaxTextureSize() - 1) / static_cast<float>(bounds().height()); 90 return (MaxTextureSize() - 1) / static_cast<float>(bounds().height());
91 } 91 }
92 return scale; 92 return scale;
93 } 93 }
94 94
95 void ScrollbarLayer::CalculateContentsScale(float ideal_contents_scale, 95 void ScrollbarLayer::CalculateContentsScale(float ideal_contents_scale,
96 bool animating_transform_to_screen, 96 bool animating_transform_to_screen,
97 float* contents_scale_x, 97 float* contents_scale_x,
98 float* contents_scale_y, 98 float* contents_scale_y,
99 gfx::Size* contentBounds) { 99 gfx::Size* content_bounds) {
100 ContentsScalingLayer::CalculateContentsScale( 100 ContentsScalingLayer::CalculateContentsScale(
101 ClampScaleToMaxTextureSize(ideal_contents_scale), 101 ClampScaleToMaxTextureSize(ideal_contents_scale),
102 animating_transform_to_screen, 102 animating_transform_to_screen,
103 contents_scale_x, 103 contents_scale_x,
104 contents_scale_y, 104 contents_scale_y,
105 contentBounds); 105 content_bounds);
106 DCHECK_LE(contentBounds->width(), MaxTextureSize()); 106 DCHECK_LE(content_bounds->width(), MaxTextureSize());
107 DCHECK_LE(contentBounds->height(), MaxTextureSize()); 107 DCHECK_LE(content_bounds->height(), MaxTextureSize());
108 } 108 }
109 109
110 void ScrollbarLayer::PushPropertiesTo(LayerImpl* layer) { 110 void ScrollbarLayer::PushPropertiesTo(LayerImpl* layer) {
111 ContentsScalingLayer::PushPropertiesTo(layer); 111 ContentsScalingLayer::PushPropertiesTo(layer);
112 112
113 ScrollbarLayerImpl* scrollbar_layer = static_cast<ScrollbarLayerImpl*>(layer); 113 ScrollbarLayerImpl* scrollbar_layer = static_cast<ScrollbarLayerImpl*>(layer);
114 114
115 scrollbar_layer->SetScrollbarData(scrollbar_.get()); 115 scrollbar_layer->SetScrollbarData(scrollbar_.get());
116 scrollbar_layer->SetThumbSize(thumb_size_); 116 scrollbar_layer->SetThumbSize(thumb_size_);
117 117
118 if (back_track_ && back_track_->texture()->have_backing_texture()) { 118 if (back_track_ && back_track_->texture()->have_backing_texture()) {
119 scrollbar_layer->set_back_track_resource_id( 119 scrollbar_layer->set_back_track_resource_id(
120 back_track_->texture()->resource_id()); 120 back_track_->texture()->resource_id());
121 } else { 121 } else {
122 scrollbar_layer->set_back_track_resource_id(0); 122 scrollbar_layer->set_back_track_resource_id(0);
123 } 123 }
124 124
125 if (fore_track_ && fore_track_->texture()->have_backing_texture()) { 125 if (fore_track_ && fore_track_->texture()->have_backing_texture()) {
126 scrollbar_layer->set_fore_track_resource_id( 126 scrollbar_layer->set_fore_track_resource_id(
127 fore_track_->texture()->resource_id()); 127 fore_track_->texture()->resource_id());
128 } else { 128 } else {
129 scrollbar_layer->set_fore_track_resource_id(0); 129 scrollbar_layer->set_fore_track_resource_id(0);
130 } 130 }
131 131
132 if (thumb_ && thumb_->texture()->have_backing_texture()) 132 if (thumb_ && thumb_->texture()->have_backing_texture())
133 scrollbar_layer->set_thumb_resource_id(thumb_->texture()->resource_id()); 133 scrollbar_layer->set_thumb_resource_id(thumb_->texture()->resource_id());
134 else 134 else
135 scrollbar_layer->set_thumb_resource_id(0); 135 scrollbar_layer->set_thumb_resource_id(0);
136 136
137 // Pinch zoom scrollbarLayerImpl does not get its scroll_layer_id_ 137 // Pinch zoom ScrollbarLayerImpl does not get its scroll_layer_id_
138 // set in LayerImpl, so we need to push it here. 138 // set in LayerImpl, so we need to push it here.
139 if (scroll_layer_id_ == Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID) 139 if (scroll_layer_id_ == Layer::PINCH_ZOOM_ROOT_SCROLL_LAYER_ID)
140 scrollbar_layer->set_scroll_layer_id(scroll_layer_id_); 140 scrollbar_layer->set_scroll_layer_id(scroll_layer_id_);
141 } 141 }
142 142
143 ScrollbarLayer* ScrollbarLayer::ToScrollbarLayer() { 143 ScrollbarLayer* ScrollbarLayer::ToScrollbarLayer() {
144 return this; 144 return this;
145 } 145 }
146 146
147 class ScrollbarBackgroundPainter : public LayerPainter { 147 class ScrollbarBackgroundPainter : public LayerPainter {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 gfx::Rect painted_opaque_rect; 331 gfx::Rect painted_opaque_rect;
332 painter->PrepareToUpdate(rect, 332 painter->PrepareToUpdate(rect,
333 rect.size(), 333 rect.size(),
334 contents_scale_x(), 334 contents_scale_x(),
335 contents_scale_y(), 335 contents_scale_y(),
336 &painted_opaque_rect, 336 &painted_opaque_rect,
337 stats); 337 stats);
338 if (!painter->pixels_did_change() && 338 if (!painter->pixels_did_change() &&
339 resource->texture()->have_backing_texture()) { 339 resource->texture()->have_backing_texture()) {
340 TRACE_EVENT_INSTANT0("cc", 340 TRACE_EVENT_INSTANT0("cc",
341 "ScrollbarLayer::updatePart no texture upload needed"); 341 "ScrollbarLayer::UpdatePart no texture upload needed");
342 return; 342 return;
343 } 343 }
344 344
345 bool partial_updates_allowed = 345 bool partial_updates_allowed =
346 layer_tree_host()->settings().max_partial_texture_updates > 0; 346 layer_tree_host()->settings().max_partial_texture_updates > 0;
347 if (!partial_updates_allowed) 347 if (!partial_updates_allowed)
348 resource->texture()->ReturnBackingTexture(); 348 resource->texture()->ReturnBackingTexture();
349 349
350 gfx::Vector2d dest_offset(0, 0); 350 gfx::Vector2d dest_offset(0, 0);
351 resource->Update(queue, rect, dest_offset, partial_updates_allowed, stats); 351 resource->Update(queue, rect, dest_offset, partial_updates_allowed, stats);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 thumb_.get(), 432 thumb_.get(),
433 origin_thumb_rect, 433 origin_thumb_rect,
434 queue, 434 queue,
435 stats); 435 stats);
436 } 436 }
437 437
438 dirty_rect_ = gfx::RectF(); 438 dirty_rect_ = gfx::RectF();
439 } 439 }
440 440
441 } // namespace cc 441 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/scrollbar_layer.h ('k') | cc/layers/scrollbar_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698