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

Side by Side Diff: cc/layer_tiling_data.h

Issue 11359030: Create cc::TilingData based on WebCore::TilingData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 5
6 #ifndef CCLayerTilingData_h 6 #ifndef CCLayerTilingData_h
7 #define CCLayerTilingData_h 7 #define CCLayerTilingData_h
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "cc/hash_pair.h" 11 #include "cc/hash_pair.h"
12 #include "cc/scoped_ptr_hash_map.h" 12 #include "cc/scoped_ptr_hash_map.h"
13 #include "cc/tiling_data.h"
13 #include "ui/gfx/rect.h" 14 #include "ui/gfx/rect.h"
14 #include "Region.h" 15 #include "Region.h"
15 #include "TilingData.h"
16 16
17 namespace cc { 17 namespace cc {
18 class IntRect;
19 18
20 class LayerTilingData { 19 class LayerTilingData {
21 public: 20 public:
22 enum BorderTexelOption { HasBorderTexels, NoBorderTexels }; 21 enum BorderTexelOption { HasBorderTexels, NoBorderTexels };
23 22
24 ~LayerTilingData(); 23 ~LayerTilingData();
25 24
26 static scoped_ptr<LayerTilingData> create(const gfx::Size& tileSize, BorderT exelOption); 25 static scoped_ptr<LayerTilingData> create(const gfx::Size& tileSize, BorderT exelOption);
27 26
28 bool hasEmptyBounds() const { return m_tilingData.hasEmptyBounds(); } 27 bool hasEmptyBounds() const { return m_tilingData.has_empty_bounds(); }
29 int numTilesX() const { return m_tilingData.numTilesX(); } 28 int numTilesX() const { return m_tilingData.num_tiles_x(); }
30 int numTilesY() const { return m_tilingData.numTilesY(); } 29 int numTilesY() const { return m_tilingData.num_tiles_y(); }
31 gfx::Rect tileBounds(int i, int j) const { return cc::IntRect(m_tilingData.t ileBounds(i, j)); } 30 gfx::Rect tileBounds(int i, int j) const { return m_tilingData.TileBounds(i, j); }
32 gfx::Vector2d textureOffset(int xIndex, int yIndex) const { 31 gfx::Vector2d textureOffset(int xIndex, int yIndex) const { return m_tilingD ata.TextureOffset(xIndex, yIndex); }
33 cc::IntPoint p(m_tilingData.textureOffset(xIndex, yIndex));
34 return gfx::Vector2d(p.x(), p.y());
35 }
36 32
37 // Change the tile size. This may invalidate all the existing tiles. 33 // Change the tile size. This may invalidate all the existing tiles.
38 void setTileSize(const gfx::Size&); 34 void setTileSize(const gfx::Size&);
39 gfx::Size tileSize() const; 35 gfx::Size tileSize() const;
40 // Change the border texel setting. This may invalidate all existing tiles. 36 // Change the border texel setting. This may invalidate all existing tiles.
41 void setBorderTexelOption(BorderTexelOption); 37 void setBorderTexelOption(BorderTexelOption);
42 bool hasBorderTexels() const { return m_tilingData.borderTexels(); } 38 bool hasBorderTexels() const { return m_tilingData.border_texels(); }
43 39
44 bool isEmpty() const { return hasEmptyBounds() || !tiles().size(); } 40 bool isEmpty() const { return hasEmptyBounds() || !tiles().size(); }
45 41
46 const LayerTilingData& operator=(const LayerTilingData&); 42 const LayerTilingData& operator=(const LayerTilingData&);
47 43
48 class Tile { 44 class Tile {
49 public: 45 public:
50 Tile() : m_i(-1), m_j(-1) { } 46 Tile() : m_i(-1), m_j(-1) { }
51 virtual ~Tile() { } 47 virtual ~Tile() { }
52 48
(...skipping 30 matching lines...) Expand all
83 protected: 79 protected:
84 LayerTilingData(const gfx::Size& tileSize, BorderTexelOption); 80 LayerTilingData(const gfx::Size& tileSize, BorderTexelOption);
85 81
86 TileMap m_tiles; 82 TileMap m_tiles;
87 TilingData m_tilingData; 83 TilingData m_tilingData;
88 }; 84 };
89 85
90 } 86 }
91 87
92 #endif 88 #endif
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/layer_tiling_data.cc » ('j') | cc/tiling_data.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698