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

Side by Side Diff: cc/scrollbar_layer.cc

Issue 11503005: cc: Refactor content scale/bounds into draw properties (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
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/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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 gfx::Size scaledBounds = computeContentBoundsForScale(scale, scale); 61 gfx::Size scaledBounds = computeContentBoundsForScale(scale, scale);
62 if (scaledBounds.width() > maxTextureSize() || scaledBounds.height() > maxTe xtureSize()) { 62 if (scaledBounds.width() > maxTextureSize() || scaledBounds.height() > maxTe xtureSize()) {
63 if (scaledBounds.width() > scaledBounds.height()) 63 if (scaledBounds.width() > scaledBounds.height())
64 return (maxTextureSize() - 1) / static_cast<float>(bounds().width() ); 64 return (maxTextureSize() - 1) / static_cast<float>(bounds().width() );
65 else 65 else
66 return (maxTextureSize() - 1) / static_cast<float>(bounds().height( )); 66 return (maxTextureSize() - 1) / static_cast<float>(bounds().height( ));
67 } 67 }
68 return scale; 68 return scale;
69 } 69 }
70 70
71 void ScrollbarLayer::setContentsScale(float contentsScale) { 71 void ScrollbarLayer::setIdealContentsScale(float scale)
72 contentsScale = clampScaleToMaxTextureSize(contentsScale); 72 {
73 ContentsScalingLayer::setContentsScale(contentsScale); 73 float contentsScale = clampScaleToMaxTextureSize(scale);
74 ContentsScalingLayer::setIdealContentsScale(contentsScale);
74 DCHECK_LE(contentBounds().width(), maxTextureSize()); 75 DCHECK_LE(contentBounds().width(), maxTextureSize());
75 DCHECK_LE(contentBounds().height(), maxTextureSize()); 76 DCHECK_LE(contentBounds().height(), maxTextureSize());
76 } 77 }
77 78
78 void ScrollbarLayer::pushPropertiesTo(LayerImpl* layer) 79 void ScrollbarLayer::pushPropertiesTo(LayerImpl* layer)
79 { 80 {
80 ContentsScalingLayer::pushPropertiesTo(layer); 81 ContentsScalingLayer::pushPropertiesTo(layer);
81 82
82 ScrollbarLayerImpl* scrollbarLayer = static_cast<ScrollbarLayerImpl*>(layer) ; 83 ScrollbarLayerImpl* scrollbarLayer = static_cast<ScrollbarLayerImpl*>(layer) ;
83 84
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, que ue, stats); 305 updatePart(m_foreTrackUpdater.get(), m_foreTrack.get(), contentRect, que ue, stats);
305 306
306 // Consider the thumb to be at the origin when painting. 307 // Consider the thumb to be at the origin when painting.
307 WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get()); 308 WebKit::WebRect thumbRect = m_geometry->thumbRect(m_scrollbar.get());
308 gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(0, 0, thumbRect.width, thumbRect.height)); 309 gfx::Rect originThumbRect = scrollbarLayerRectToContentRect(gfx::Rect(0, 0, thumbRect.width, thumbRect.height));
309 if (!originThumbRect.IsEmpty()) 310 if (!originThumbRect.IsEmpty())
310 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue, stats); 311 updatePart(m_thumbUpdater.get(), m_thumb.get(), originThumbRect, queue, stats);
311 } 312 }
312 313
313 } // namespace cc 314 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698