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

Unified Diff: cc/picture_layer_tiling.h

Issue 11377176: cc: Add PictureLayerTiling for impl-side painting (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
Index: cc/picture_layer_tiling.h
diff --git a/cc/picture_layer_tiling.h b/cc/picture_layer_tiling.h
new file mode 100644
index 0000000000000000000000000000000000000000..f39b3d65325967bb09c44f02b89708a60290a9bc
--- /dev/null
+++ b/cc/picture_layer_tiling.h
@@ -0,0 +1,99 @@
+// Copyright 2011 The Chromium Authors. All rights reserved.
tfarina 2012/11/15 01:49:28 2011 -> 2012?
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
tfarina 2012/11/15 01:49:28 rm extra blank line.
+
+#ifndef CC_PICTURE_LAYER_TILING_H_
+#define CC_PICTURE_LAYER_TILING_H_
+
+#include "base/basictypes.h"
+#include "base/hash_tables.h"
+#include "base/memory/scoped_ptr.h"
+#include "cc/cc_export.h"
+#include "cc/hash_pair.h"
+#include "cc/region.h"
+#include "cc/tile.h"
+#include "cc/tiling_data.h"
+#include "ui/gfx/rect.h"
+
+namespace cc {
+
+class PictureLayerTiling;
+
+class PictureLayerTilingClient {
+ public:
+ virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*, gfx::Rect) = 0;
+};
+
+class CC_EXPORT PictureLayerTiling {
nduca 2012/11/15 02:19:05 I think this object probably needs to manage multi
+ public:
+ ~PictureLayerTiling();
+
+ static scoped_ptr<PictureLayerTiling> Create(const gfx::Size& tile_size);
+ scoped_ptr<PictureLayerTiling> Clone() const;
+
+ const PictureLayerTiling& operator=(const PictureLayerTiling&);
+
+ void set_bounds(const gfx::Size&);
tfarina 2012/11/15 01:49:28 SetBounds
+ gfx::Size bounds() const { return tiling_data_.total_size(); }
+
+ void create_tiles(gfx::Rect);
tfarina 2012/11/15 01:49:28 we use to name the parameters in chromium
tfarina 2012/11/15 01:49:28 if you don't inline on the header file, i.e, if th
+ void set_client(PictureLayerTilingClient* client);
+
+ class Iterator {
+ public:
+ Iterator(PictureLayerTiling* tiling_, gfx::Rect content_rect);
tfarina 2012/11/15 01:49:28 trailing _ in tiling_
+ ~Iterator();
+
+ // Visible rect (no borders)
+ gfx::Rect geometry_rect() const;
+ // Full tile rect (not clipped, with borders)
+ gfx::Rect full_tile_rect() const;
+ // Texture rect (in texels) for geometry_rect
+ gfx::Rect texture_rect() const;
+ gfx::Rect opaque_rect() const;
+ gfx::Size texture_size() const;
+
+ Tile* operator->() const { return current_tile_; }
+ Tile* operator*() const { return current_tile_; }
+
+ Iterator& operator++();
+ bool operator==(const Iterator& other) const;
+ bool operator!=(const Iterator& other) const;
+ operator bool() const { return current_tile_; }
+
+ private:
+ PictureLayerTiling* tiling_;
+ Tile* current_tile_;
+ gfx::Rect content_rect_;
+ int tile_i_;
+ int tile_j_;
+ int left_;
+ int top_;
+ int right_;
+ int bottom_;
+
+ friend class PictureLayerTiling;
tfarina 2012/11/15 01:49:28 this goes at the beginning of the section.
+ };
+
+ Region OpaqueRegionInContentRect(const gfx::Rect&) const;
+
+ void Reset() { return tiles_.clear(); }
+
+ protected:
+ typedef std::pair<int, int> TileMapKey;
+ typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap;
+
+ PictureLayerTiling(const gfx::Size& tileSize);
tfarina 2012/11/15 01:49:28 I though James and Dana wanted to pass small struc
+ Tile* TileAt(int, int) const;
+
+ PictureLayerTilingClient* client_;
tfarina 2012/11/15 01:49:28 data member variables should be private
+ TileMap tiles_;
+ TilingData tiling_data_;
+
+ friend class Iterator;
tfarina 2012/11/15 01:49:28 this goes at the beginning of the section.
+};
tfarina 2012/11/15 01:49:28 DISALLOW_CO...?
+
+} // namespace cc
+
+#endif // CC_PICTURE_LAYER_TILING_H_

Powered by Google App Engine
This is Rietveld 408576698