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

Unified Diff: cc/layer_tiling_data.cc

Issue 11264056: cc: Use gfx:: Geometry types for positions, bounds, and related things. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ScaleAsVector 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layer_tiling_data.h ('k') | cc/layer_tree_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layer_tiling_data.cc
diff --git a/cc/layer_tiling_data.cc b/cc/layer_tiling_data.cc
index a38d8ebc042e81d10c654a8b50e90ae909d169f2..b3ba58d6b0a3be4b44e587e45c2f306bd9410a9a 100644
--- a/cc/layer_tiling_data.cc
+++ b/cc/layer_tiling_data.cc
@@ -13,13 +13,13 @@ using namespace std;
namespace cc {
-scoped_ptr<LayerTilingData> LayerTilingData::create(const IntSize& tileSize, BorderTexelOption border)
+scoped_ptr<LayerTilingData> LayerTilingData::create(const gfx::Size& tileSize, BorderTexelOption border)
{
return make_scoped_ptr(new LayerTilingData(tileSize, border));
}
-LayerTilingData::LayerTilingData(const IntSize& tileSize, BorderTexelOption border)
- : m_tilingData(tileSize, IntSize(), border == HasBorderTexels)
+LayerTilingData::LayerTilingData(const gfx::Size& tileSize, BorderTexelOption border)
+ : m_tilingData(cc::IntSize(tileSize), cc::IntSize(), border == HasBorderTexels)
{
setTileSize(tileSize);
}
@@ -28,19 +28,19 @@ LayerTilingData::~LayerTilingData()
{
}
-void LayerTilingData::setTileSize(const IntSize& size)
+void LayerTilingData::setTileSize(const gfx::Size& size)
{
if (tileSize() == size)
return;
reset();
- m_tilingData.setMaxTextureSize(size);
+ m_tilingData.setMaxTextureSize(cc::IntSize(size));
}
-IntSize LayerTilingData::tileSize() const
+gfx::Size LayerTilingData::tileSize() const
{
- return m_tilingData.maxTextureSize();
+ return cc::IntSize(m_tilingData.maxTextureSize());
}
void LayerTilingData::setBorderTexelOption(BorderTexelOption borderTexelOption)
@@ -82,29 +82,29 @@ void LayerTilingData::reset()
m_tiles.clear();
}
-void LayerTilingData::contentRectToTileIndices(const IntRect& contentRect, int& left, int& top, int& right, int& bottom) const
+void LayerTilingData::contentRectToTileIndices(const gfx::Rect& contentRect, int& left, int& top, int& right, int& bottom) const
{
// An empty rect doesn't result in an empty set of tiles, so don't pass an empty rect.
// FIXME: Possibly we should fill a vector of tiles instead,
// since the normal use of this function is to enumerate some tiles.
- DCHECK(!contentRect.isEmpty());
+ DCHECK(!contentRect.IsEmpty());
left = m_tilingData.tileXIndexFromSrcCoord(contentRect.x());
top = m_tilingData.tileYIndexFromSrcCoord(contentRect.y());
- right = m_tilingData.tileXIndexFromSrcCoord(contentRect.maxX() - 1);
- bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.maxY() - 1);
+ right = m_tilingData.tileXIndexFromSrcCoord(contentRect.right() - 1);
+ bottom = m_tilingData.tileYIndexFromSrcCoord(contentRect.bottom() - 1);
}
-IntRect LayerTilingData::tileRect(const Tile* tile) const
+gfx::Rect LayerTilingData::tileRect(const Tile* tile) const
{
- IntRect tileRect = m_tilingData.tileBoundsWithBorder(tile->i(), tile->j());
- tileRect.setSize(tileSize());
+ gfx::Rect tileRect = cc::IntRect(m_tilingData.tileBoundsWithBorder(tile->i(), tile->j()));
+ tileRect.set_size(tileSize());
return tileRect;
}
-Region LayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) const
+Region LayerTilingData::opaqueRegionInContentRect(const gfx::Rect& contentRect) const
{
- if (contentRect.isEmpty())
+ if (contentRect.IsEmpty())
return Region();
Region opaqueRegion;
@@ -116,24 +116,24 @@ Region LayerTilingData::opaqueRegionInContentRect(const IntRect& contentRect) co
if (!tile)
continue;
- IntRect tileOpaqueRect = intersection(contentRect, tile->opaqueRect());
- opaqueRegion.unite(tileOpaqueRect);
+ gfx::Rect tileOpaqueRect = gfx::IntersectRects(contentRect, tile->opaqueRect());
+ opaqueRegion.unite(cc::IntRect(tileOpaqueRect));
}
}
return opaqueRegion;
}
-void LayerTilingData::setBounds(const IntSize& size)
+void LayerTilingData::setBounds(const gfx::Size& size)
{
- m_tilingData.setTotalSize(size);
- if (size.isEmpty()) {
+ m_tilingData.setTotalSize(cc::IntSize(size));
+ if (size.IsEmpty()) {
m_tiles.clear();
return;
}
// Any tiles completely outside our new bounds are invalid and should be dropped.
int left, top, right, bottom;
- contentRectToTileIndices(IntRect(IntPoint(), size), left, top, right, bottom);
+ contentRectToTileIndices(gfx::Rect(gfx::Point(), size), left, top, right, bottom);
std::vector<TileMapKey> invalidTileKeys;
for (TileMap::const_iterator it = m_tiles.begin(); it != m_tiles.end(); ++it) {
if (it->first.first > right || it->first.second > bottom)
@@ -143,9 +143,9 @@ void LayerTilingData::setBounds(const IntSize& size)
m_tiles.erase(invalidTileKeys[i]);
}
-IntSize LayerTilingData::bounds() const
+gfx::Size LayerTilingData::bounds() const
{
- return m_tilingData.totalSize();
+ return cc::IntSize(m_tilingData.totalSize());
}
} // namespace cc
« no previous file with comments | « cc/layer_tiling_data.h ('k') | cc/layer_tree_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698