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

Side by Side Diff: cc/tiled_layer.cc

Issue 11361186: ui: Add methods to clamp Sizes, Points, and Vectors from above or below. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 1 month 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/page_scale_animation.cc ('k') | ui/gfx/point_base.h » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "config.h" 5 #include "config.h"
6 6
7 #include "cc/tiled_layer.h" 7 #include "cc/tiled_layer.h"
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "cc/geometry.h" 10 #include "cc/geometry.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 bool isTiled; 127 bool isTiled;
128 if (m_tilingOption == AlwaysTile) 128 if (m_tilingOption == AlwaysTile)
129 isTiled = true; 129 isTiled = true;
130 else if (m_tilingOption == NeverTile) 130 else if (m_tilingOption == NeverTile)
131 isTiled = false; 131 isTiled = false;
132 else 132 else
133 isTiled = autoTiled; 133 isTiled = autoTiled;
134 134
135 gfx::Size requestedSize = isTiled ? tileSize : contentBounds(); 135 gfx::Size requestedSize = isTiled ? tileSize : contentBounds();
136 const int maxSize = layerTreeHost()->rendererCapabilities().maxTextureSize; 136 const int maxSize = layerTreeHost()->rendererCapabilities().maxTextureSize;
137 gfx::Size clampedSize = ClampSizeFromAbove(requestedSize, gfx::Size(maxSize, maxSize)); 137 requestedSize.ClampToMax(gfx::Size(maxSize, maxSize));
138 setTileSize(clampedSize); 138 setTileSize(requestedSize);
139 } 139 }
140 140
141 void TiledLayer::updateBounds() 141 void TiledLayer::updateBounds()
142 { 142 {
143 gfx::Size oldBounds = m_tiler->bounds(); 143 gfx::Size oldBounds = m_tiler->bounds();
144 gfx::Size newBounds = contentBounds(); 144 gfx::Size newBounds = contentBounds();
145 if (oldBounds == newBounds) 145 if (oldBounds == newBounds)
146 return; 146 return;
147 m_tiler->setBounds(newBounds); 147 m_tiler->setBounds(newBounds);
148 148
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 gfx::Rect prepaintRect = visibleContentRect(); 776 gfx::Rect prepaintRect = visibleContentRect();
777 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns, 777 prepaintRect.Inset(-m_tiler->tileSize().width() * prepaintColumns,
778 -m_tiler->tileSize().height() * prepaintRows); 778 -m_tiler->tileSize().height() * prepaintRows);
779 gfx::Rect contentRect(gfx::Point(), contentBounds()); 779 gfx::Rect contentRect(gfx::Point(), contentBounds());
780 prepaintRect.Intersect(contentRect); 780 prepaintRect.Intersect(contentRect);
781 781
782 return prepaintRect; 782 return prepaintRect;
783 } 783 }
784 784
785 } // namespace cc 785 } // namespace cc
OLDNEW
« no previous file with comments | « cc/page_scale_animation.cc ('k') | ui/gfx/point_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698