In iossim, ignore harmless messages from launchd.
[chromium-blink-merge.git] / cc / tiling_data.h
blob0eb54d202d0526728b26ac149adae3c8a99132c3
1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CC_TILING_DATA_H_
6 #define CC_TILING_DATA_H_
8 #include "base/basictypes.h"
9 #include "base/logging.h"
10 #include "cc/cc_export.h"
11 #include "ui/gfx/size.h"
13 namespace gfx {
14 class Rect;
15 class Vector2d;
18 namespace cc {
20 class CC_EXPORT TilingData {
21 public:
22 TilingData(gfx::Size max_texture_size, gfx::Size total_size, bool has_border_texels);
23 ~TilingData();
25 gfx::Size total_size() const { return total_size_; }
26 void SetTotalSize(const gfx::Size total_size);
28 gfx::Size max_texture_size() const { return max_texture_size_; }
29 void SetMaxTextureSize(gfx::Size max_texture_size);
31 int border_texels() const { return border_texels_; }
32 void SetHasBorderTexels(bool has_border_texels);
34 bool has_empty_bounds() const { return !num_tiles_x_ || !num_tiles_y_; }
35 int num_tiles_x() const { return num_tiles_x_; }
36 int num_tiles_y() const { return num_tiles_y_; }
37 int TileXIndexFromSrcCoord(int src_position) const;
38 int TileYIndexFromSrcCoord(int src_position) const;
40 gfx::Rect TileBounds(int i, int j) const;
41 gfx::Rect TileBoundsWithBorder(int i, int j) const;
42 int TilePositionX(int x_index) const;
43 int TilePositionY(int y_index) const;
44 int TileSizeX(int x_index) const;
45 int TileSizeY(int y_index) const;
47 // Difference between TileBound's and TileBoundWithBorder's origin().
48 gfx::Vector2d TextureOffset(int x_index, int y_index) const;
50 private:
51 void AssertTile(int i, int j) const {
52 DCHECK_GE(i, 0);
53 DCHECK_LT(i, num_tiles_x_);
54 DCHECK_GE(j, 0);
55 DCHECK_LT(j, num_tiles_y_);
58 void RecomputeNumTiles();
60 gfx::Size max_texture_size_;
61 gfx::Size total_size_;
62 // This value is always 0 or 1.
63 int border_texels_;
65 // These are computed values.
66 int num_tiles_x_;
67 int num_tiles_y_;
70 } // namespace cc
72 #endif // CC_TILING_DATA_H_