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

Unified Diff: cc/tiling_data.h

Issue 11887027: cc: Add iterator and big border support to TilingData (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months 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 | « no previous file | cc/tiling_data.cc » ('j') | cc/tiling_data.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiling_data.h
diff --git a/cc/tiling_data.h b/cc/tiling_data.h
index 0eb54d202d0526728b26ac149adae3c8a99132c3..a7cecb2936196d58cba0e1aa3b85349bdaf9edbf 100644
--- a/cc/tiling_data.h
+++ b/cc/tiling_data.h
@@ -8,10 +8,10 @@
#include "base/basictypes.h"
#include "base/logging.h"
#include "cc/cc_export.h"
+#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
namespace gfx {
-class Rect;
class Vector2d;
}
@@ -19,8 +19,14 @@ namespace cc {
class CC_EXPORT TilingData {
public:
- TilingData(gfx::Size max_texture_size, gfx::Size total_size, bool has_border_texels);
- ~TilingData();
+ TilingData(
+ gfx::Size max_texture_size,
+ gfx::Size total_size,
+ bool has_border_texels);
+ TilingData(
+ gfx::Size max_texture_size,
+ gfx::Size total_size,
+ int border_texels);
danakj 2013/01/15 23:09:05 can the compiler really tell apart bool/int and kn
enne (OOO) 2013/01/15 23:31:40 Yes it can. If bool doesn't exist, bool values wi
gfx::Size total_size() const { return total_size_; }
void SetTotalSize(const gfx::Size total_size);
@@ -30,12 +36,17 @@ class CC_EXPORT TilingData {
int border_texels() const { return border_texels_; }
void SetHasBorderTexels(bool has_border_texels);
+ void SetBorderTexels(int border_texels);
bool has_empty_bounds() const { return !num_tiles_x_ || !num_tiles_y_; }
int num_tiles_x() const { return num_tiles_x_; }
int num_tiles_y() const { return num_tiles_y_; }
+ // Return the tile coordinate whose non-border texels include src_position
danakj 2013/01/15 23:09:05 nit: comments end with period (sorry 80 cols :( )
enne (OOO) 2013/01/15 23:31:40 Done. Exactly 80. \o/
int TileXIndexFromSrcCoord(int src_position) const;
int TileYIndexFromSrcCoord(int src_position) const;
+ // Return the lowest tile coordinate whose border texels include src_position
+ int BorderTileXIndexFromSrcCoord(int src_position) const;
+ int BorderTileYIndexFromSrcCoord(int src_position) const;
gfx::Rect TileBounds(int i, int j) const;
gfx::Rect TileBoundsWithBorder(int i, int j) const;
@@ -47,6 +58,25 @@ class CC_EXPORT TilingData {
// Difference between TileBound's and TileBoundWithBorder's origin().
gfx::Vector2d TextureOffset(int x_index, int y_index) const;
+ // Iterate through all indices whose bounds + border intersect with this rect
+ class Iterator {
danakj 2013/01/15 23:09:05 WDYT of IntersectionIterator?
enne (OOO) 2013/01/15 23:31:40 Only when somebody adds NonIntersectionIterator an
+ public:
+ Iterator(const TilingData* tiling_data, gfx::Rect rect);
+ Iterator& operator++();
+ operator bool() const;
+
+ int index_x() const { return index_x_; }
+ int index_y() const { return index_y_; }
+
+ private:
+ void done();
+
+ const TilingData* tiling_data_;
+ gfx::Rect rect_;
+ int index_x_;
+ int index_y_;
+ };
+
private:
void AssertTile(int i, int j) const {
DCHECK_GE(i, 0);
@@ -59,7 +89,6 @@ class CC_EXPORT TilingData {
gfx::Size max_texture_size_;
gfx::Size total_size_;
- // This value is always 0 or 1.
int border_texels_;
// These are computed values.
« no previous file with comments | « no previous file | cc/tiling_data.cc » ('j') | cc/tiling_data.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698