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, and will be expanded to cover everything
22  // that was either recorded/changed or that has no recording, leaving out only
23  // pieces that we had a recording for and it was not changed.
24  // Return true iff the pile was modified.
25  bool UpdateAndExpandInvalidation(
26      ContentLayerClient* painter,
27      Region* invalidation,
28      SkColor background_color,
29      bool contents_opaque,
30      bool contents_fill_bounds_completely,
31      const gfx::Rect& visible_layer_rect,
32      int frame_number,
33      Picture::RecordingMode recording_mode,
34      RenderingStatsInstrumentation* stats_instrumentation);
35
36  void set_slow_down_raster_scale_factor(int factor) {
37    slow_down_raster_scale_factor_for_debug_ = factor;
38  }
39
40  void set_show_debug_picture_borders(bool show) {
41    show_debug_picture_borders_ = show;
42  }
43
44  bool is_suitable_for_gpu_rasterization() const {
45    return is_suitable_for_gpu_rasterization_;
46  }
47  void SetUnsuitableForGpuRasterizationForTesting() {
48    is_suitable_for_gpu_rasterization_ = false;
49  }
50
51 protected:
52  virtual ~PicturePile();
53
54 private:
55  friend class PicturePileImpl;
56
57  bool is_suitable_for_gpu_rasterization_;
58
59  DISALLOW_COPY_AND_ASSIGN(PicturePile);
60};
61
62}  // namespace cc
63
64#endif  // CC_RESOURCES_PICTURE_PILE_H_
65