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/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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/stubs/tiling_data.h ('k') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..6d052c0c944ea66a6222dc080e5de84857e7e942
--- /dev/null
+++ b/cc/tiling_data.h
@@ -0,0 +1,71 @@
+// Copyright 2010 The Chromium Authors. All rights reserved.
tfarina 2012/11/02 00:19:07 2010 -> 2012?
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_TILING_DATA_H_
+#define CC_TILING_DATA_H_
+
+#include "base/basictypes.h"
+#include "base/logging.h"
+#include "ui/gfx/size.h"
+
+namespace gfx {
+class Rect;
+class Vector2d;
+}
+
+namespace cc {
+
+class TilingData {
+ public:
+ TilingData(gfx::Size max_texture_size, gfx::Size total_size, bool has_border_texels);
+ ~TilingData();
+
+ gfx::Size total_size() const { return total_size_; }
tfarina 2012/11/02 00:18:46 const-ref as well.
danakj 2012/11/02 00:28:03 no const ref for <= 4 ints :)
+ void SetTotalSize(const gfx::Size total_size);
tfarina 2012/11/02 00:18:46 const-ref!
+
+ gfx::Size max_texture_size() const { return max_texture_size_; }
+ void SetMaxTextureSize(gfx::Size max_texture_size);
tfarina 2012/11/02 00:18:46 const-ref! Same at the ctor!
+
+ int border_texels() const { return border_texels_; }
+ void SetHasBorderTexels(bool has_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_; }
+ int TileXIndexFromSrcCoord(int src_position) const;
+ int TileYIndexFromSrcCoord(int src_position) const;
+
+ gfx::Rect TileBounds(int i, int j) const;
+ gfx::Rect TileBoundsWithBorder(int i, int j) const;
+ int TilePositionX(int x_index) const;
+ int TilePositionY(int y_index) const;
+ int TileSizeX(int x_index) const;
+ int TileSizeY(int y_index) const;
+
+ // Difference between TileBound's and TileBoundWithBorder's origin().
+ gfx::Vector2d TextureOffset(int x_index, int y_index) const;
+
+ private:
+ void AssertTile(int i, int j) const {
+ DCHECK_GE(i, 0);
+ DCHECK_LT(i, num_tiles_x_);
+ DCHECK_GE(j, 0);
+ DCHECK_LT(j, num_tiles_y_);
+ }
+
+ void RecomputeNumTiles();
+
+ gfx::Size max_texture_size_;
+ gfx::Size total_size_;
+ // This value is always 0 or 1.
+ int border_texels_;
+
+ // These are computed values.
+ int num_tiles_x_;
+ int num_tiles_y_;
+};
+
+} // namespace cc
+
+#endif // CC_TILING_DATA_H_
« no previous file with comments | « cc/stubs/tiling_data.h ('k') | cc/tiling_data.cc » ('j') | cc/tiling_data.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698