1// Copyright 2012 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_RESOURCES_PICTURE_PILE_H_
6#define CC_RESOURCES_PICTURE_PILE_H_
7
8#include "cc/resources/picture_pile_base.h"
9#include "ui/gfx/rect.h"
10
11namespace cc {
12class PicturePileImpl;
13class Region;
14class RenderingStatsInstrumentation;
15
16class CC_EXPORT PicturePile : public PicturePileBase {
17 public:
18  PicturePile();
19
20  // Re-record parts of the picture that are invalid.
21  // Invalidations are in layer space.
22  // Return true iff the pile was modified.
23  bool Update(
24      ContentLayerClient* painter,
25      SkColor background_color,
26      bool contents_opaque,
27      const Region& invalidation,
28      gfx::Rect visible_layer_rect,
29      RenderingStatsInstrumentation* stats_instrumentation);
30
31  void set_num_raster_threads(int num_raster_threads) {
32    num_raster_threads_ = num_raster_threads;
33  }
34
35  void set_slow_down_raster_scale_factor(int factor) {
36    slow_down_raster_scale_factor_for_debug_ = factor;
37  }
38
39  void set_show_debug_picture_borders(bool show) {
40    show_debug_picture_borders_ = show;
41  }
42
43 protected:
44  virtual ~PicturePile();
45
46 private:
47  friend class PicturePileImpl;
48
49  // Add an invalidation to this picture list.  If the list needs to be
50  // entirely recreated, leave it empty.  Do not call this on an empty list.
51  void InvalidateRect(
52      PictureList& picture_list,
53      gfx::Rect invalidation);
54
55  DISALLOW_COPY_AND_ASSIGN(PicturePile);
56};
57
58}  // namespace cc
59
60#endif  // CC_RESOURCES_PICTURE_PILE_H_
61