OLD | NEW |
1 | 1 |
2 // Copyright 2012 The Chromium Authors. All rights reserved. | 2 // Copyright 2012 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "cc/layers/scrollbar_layer.h" | 6 #include "cc/layers/scrollbar_layer.h" |
7 | 7 |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 DCHECK(resource->texture()->can_acquire_backing_texture()); | 226 DCHECK(resource->texture()->can_acquire_backing_texture()); |
227 if (!resource->texture()->can_acquire_backing_texture()) | 227 if (!resource->texture()->can_acquire_backing_texture()) |
228 return; | 228 return; |
229 | 229 |
230 // Paint and upload the entire part. | 230 // Paint and upload the entire part. |
231 gfx::Rect painted_opaque_rect; | 231 gfx::Rect painted_opaque_rect; |
232 painter->PrepareToUpdate(rect, | 232 painter->PrepareToUpdate(rect, |
233 rect.size(), | 233 rect.size(), |
234 contents_scale_x(), | 234 contents_scale_x(), |
235 contents_scale_y(), | 235 contents_scale_y(), |
236 &painted_opaque_rect, | 236 &painted_opaque_rect); |
237 stats); | |
238 if (!painter->pixels_did_change() && | 237 if (!painter->pixels_did_change() && |
239 resource->texture()->have_backing_texture()) { | 238 resource->texture()->have_backing_texture()) { |
240 TRACE_EVENT_INSTANT0("cc", | 239 TRACE_EVENT_INSTANT0("cc", |
241 "ScrollbarLayer::UpdatePart no texture upload needed", | 240 "ScrollbarLayer::UpdatePart no texture upload needed", |
242 TRACE_EVENT_SCOPE_THREAD); | 241 TRACE_EVENT_SCOPE_THREAD); |
243 return; | 242 return; |
244 } | 243 } |
245 | 244 |
246 bool partial_updates_allowed = | 245 bool partial_updates_allowed = |
247 layer_tree_host()->settings().max_partial_texture_updates > 0; | 246 layer_tree_host()->settings().max_partial_texture_updates > 0; |
248 if (!partial_updates_allowed) | 247 if (!partial_updates_allowed) |
249 resource->texture()->ReturnBackingTexture(); | 248 resource->texture()->ReturnBackingTexture(); |
250 | 249 |
251 gfx::Vector2d dest_offset(0, 0); | 250 gfx::Vector2d dest_offset(0, 0); |
252 resource->Update(queue, rect, dest_offset, partial_updates_allowed, stats); | 251 resource->Update(queue, rect, dest_offset, partial_updates_allowed); |
253 } | 252 } |
254 | 253 |
255 gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect( | 254 gfx::Rect ScrollbarLayer::ScrollbarLayerRectToContentRect( |
256 gfx::Rect layer_rect) const { | 255 gfx::Rect layer_rect) const { |
257 // Don't intersect with the bounds as in LayerRectToContentRect() because | 256 // Don't intersect with the bounds as in LayerRectToContentRect() because |
258 // layer_rect here might be in coordinates of the containing layer. | 257 // layer_rect here might be in coordinates of the containing layer. |
259 gfx::Rect expanded_rect = gfx::ScaleToEnclosingRect( | 258 gfx::Rect expanded_rect = gfx::ScaleToEnclosingRect( |
260 layer_rect, contents_scale_y(), contents_scale_y()); | 259 layer_rect, contents_scale_y(), contents_scale_y()); |
261 // We should never return a rect bigger than the content_bounds(). | 260 // We should never return a rect bigger than the content_bounds(). |
262 gfx::Size clamped_size = expanded_rect.size(); | 261 gfx::Size clamped_size = expanded_rect.size(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 thumb_size = gfx::Size(scrollbar_->ThumbLength(), | 342 thumb_size = gfx::Size(scrollbar_->ThumbLength(), |
344 scrollbar_->ThumbThickness()); | 343 scrollbar_->ThumbThickness()); |
345 } else { | 344 } else { |
346 thumb_size = gfx::Size(scrollbar_->ThumbThickness(), | 345 thumb_size = gfx::Size(scrollbar_->ThumbThickness(), |
347 scrollbar_->ThumbLength()); | 346 scrollbar_->ThumbLength()); |
348 } | 347 } |
349 return ScrollbarLayerRectToContentRect(gfx::Rect(thumb_size)); | 348 return ScrollbarLayerRectToContentRect(gfx::Rect(thumb_size)); |
350 } | 349 } |
351 | 350 |
352 } // namespace cc | 351 } // namespace cc |
OLD | NEW |