| OLD | NEW |
| 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/scrollbar_layer.h" | 5 #include "cc/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/layer_painter.h" | 9 #include "cc/layer_painter.h" |
| 10 #include "cc/layer_tree_host.h" | 10 #include "cc/layer_tree_host.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 , m_geometry(geometry.Pass()) | 33 , m_geometry(geometry.Pass()) |
| 34 , m_scrollLayerId(scrollLayerId) | 34 , m_scrollLayerId(scrollLayerId) |
| 35 , m_textureFormat(GL_INVALID_ENUM) | 35 , m_textureFormat(GL_INVALID_ENUM) |
| 36 { | 36 { |
| 37 } | 37 } |
| 38 | 38 |
| 39 ScrollbarLayer::~ScrollbarLayer() | 39 ScrollbarLayer::~ScrollbarLayer() |
| 40 { | 40 { |
| 41 } | 41 } |
| 42 | 42 |
| 43 void ScrollbarLayer::setScrollLayerId(int id) |
| 44 { |
| 45 if (id == m_scrollLayerId) |
| 46 return; |
| 47 |
| 48 m_scrollLayerId = id; |
| 49 setNeedsFullTreeSync(); |
| 50 } |
| 51 |
| 43 int ScrollbarLayer::maxTextureSize() { | 52 int ScrollbarLayer::maxTextureSize() { |
| 44 DCHECK(layerTreeHost()); | 53 DCHECK(layerTreeHost()); |
| 45 return layerTreeHost()->rendererCapabilities().maxTextureSize; | 54 return layerTreeHost()->rendererCapabilities().maxTextureSize; |
| 46 } | 55 } |
| 47 | 56 |
| 48 float ScrollbarLayer::clampScaleToMaxTextureSize(float scale) { | 57 float ScrollbarLayer::clampScaleToMaxTextureSize(float scale) { |
| 49 // If the scaled contentBounds() is bigger than the max texture size of the | 58 // If the scaled contentBounds() is bigger than the max texture size of the |
| 50 // device, we need to clamp it by rescaling, since contentBounds() is used | 59 // device, we need to clamp it by rescaling, since contentBounds() is used |
| 51 // below to set the texture size. | 60 // below to set the texture size. |
| 52 gfx::Size scaledBounds = computeContentBoundsForScale(scale, scale); | 61 gfx::Size scaledBounds = computeContentBoundsForScale(scale, scale); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, que
ue, stats); | 304 updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, que
ue, stats); |
| 296 | 305 |
| 297 // Consider the thumb to be at the origin when painting. | 306 // Consider the thumb to be at the origin when painting. |
| 298 WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get()); | 307 WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get()); |
| 299 gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(0, 0,
thumbRect.width, thumbRect.height)); | 308 gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(0, 0,
thumbRect.width, thumbRect.height)); |
| 300 if (!originThumbRect.IsEmpty()) | 309 if (!originThumbRect.IsEmpty()) |
| 301 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue,
stats); | 310 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue,
stats); |
| 302 } | 311 } |
| 303 | 312 |
| 304 } // namespace cc | 313 } // namespace cc |
| OLD | NEW |