blob: feae72b82827b2e655889cb7602e0ebdb1533b8d [file] [log] [blame]
[email protected]84339432013-01-17 03:00:111// Copyright 2013 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.
4
5#ifndef CC_PICTURE_PILE_BASE_H_
6#define CC_PICTURE_PILE_BASE_H_
7
8#include <list>
9
[email protected]fd3eec62013-01-24 19:54:0310#include "base/hash_tables.h"
[email protected]84339432013-01-17 03:00:1111#include "base/memory/ref_counted.h"
12#include "cc/cc_export.h"
[email protected]fd3eec62013-01-24 19:54:0313#include "cc/hash_pair.h"
[email protected]84339432013-01-17 03:00:1114#include "cc/picture.h"
[email protected]fd3eec62013-01-24 19:54:0315#include "cc/region.h"
16#include "cc/tiling_data.h"
[email protected]84339432013-01-17 03:00:1117#include "ui/gfx/size.h"
18
19namespace cc {
20
21class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> {
22 public:
23 PicturePileBase();
24
25 void Resize(gfx::Size size);
[email protected]fd3eec62013-01-24 19:54:0326 gfx::Size size() const { return tiling_.total_size(); }
[email protected]84339432013-01-17 03:00:1127 void SetMinContentsScale(float min_contents_scale);
28
29 void PushPropertiesTo(PicturePileBase* other);
30
[email protected]fd3eec62013-01-24 19:54:0331 void UpdateRecordedRegion();
32 const Region& recorded_region() const { return recorded_region_; }
33
34 int num_tiles_x() const { return tiling_.num_tiles_x(); }
35 int num_tiles_y() const { return tiling_.num_tiles_y(); }
36 gfx::Rect tile_bounds(int x, int y) const { return tiling_.TileBounds(x, y); }
37 bool HasRecordingAt(int x, int y);
[email protected]b06a972d2013-02-27 02:03:0438 bool CanRaster(float contents_scale, gfx::Rect content_rect);
[email protected]fd3eec62013-01-24 19:54:0339
[email protected]f974be62013-02-28 19:12:2640 void SetTileGridSize(const gfx::Size& tile_grid_size);
41
[email protected]84339432013-01-17 03:00:1142 protected:
[email protected]c059dab2013-01-25 10:39:5443 virtual ~PicturePileBase();
[email protected]84339432013-01-17 03:00:1144
[email protected]fd3eec62013-01-24 19:54:0345 int buffer_pixels() const { return tiling_.border_texels(); }
46 void Clear();
47
48 typedef std::pair<int, int> PictureListMapKey;
49 typedef std::list<scoped_refptr<Picture> > PictureList;
50 typedef base::hash_map<PictureListMapKey, PictureList> PictureListMap;
51
52 // A picture pile is a tiled set of picture lists. The picture list map
53 // is a map of tile indices to picture lists.
54 PictureListMap picture_list_map_;
55 TilingData tiling_;
56 Region recorded_region_;
[email protected]84339432013-01-17 03:00:1157 float min_contents_scale_;
[email protected]f974be62013-02-28 19:12:2658 SkTileGridPicture::TileGridInfo tile_grid_info_;
[email protected]43f7c3d2013-03-02 18:00:4059 SkColor background_color_;
[email protected]e6ac3a72013-03-13 03:50:5360 int slow_down_raster_scale_factor_for_debug_;
[email protected]fd3eec62013-01-24 19:54:0361
62 private:
63 void SetBufferPixels(int buffer_pixels);
[email protected]84339432013-01-17 03:00:1164
65 friend class base::RefCounted<PicturePileBase>;
66 DISALLOW_COPY_AND_ASSIGN(PicturePileBase);
67};
68
69} // namespace cc
70
71#endif // CC_PICTURE_PILE_H_