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.
5 #ifndef CC_RESOURCES_PICTURE_PILE_H_
6 #define CC_RESOURCES_PICTURE_PILE_H_
8 #include "base/memory/ref_counted.h"
9 #include "cc/resources/picture_pile_base.h"
10 #include "ui/gfx/geometry/rect.h"
13 class PicturePileImpl;
15 class RenderingStatsInstrumentation;
17 class CC_EXPORT PicturePile : public PicturePileBase {
20 ~PicturePile() override;
22 // Re-record parts of the picture that are invalid.
23 // Invalidations are in layer space, and will be expanded to cover everything
24 // that was either recorded/changed or that has no recording, leaving out only
25 // pieces that we had a recording for and it was not changed.
26 // Return true iff the pile was modified.
27 bool UpdateAndExpandInvalidation(
28 ContentLayerClient* painter,
30 SkColor background_color,
32 bool contents_fill_bounds_completely,
33 const gfx::Size& layer_size,
34 const gfx::Rect& visible_layer_rect,
36 Picture::RecordingMode recording_mode,
37 RenderingStatsInstrumentation* stats_instrumentation);
39 void SetEmptyBounds();
41 void set_slow_down_raster_scale_factor(int factor) {
42 slow_down_raster_scale_factor_for_debug_ = factor;
45 void set_show_debug_picture_borders(bool show) {
46 show_debug_picture_borders_ = show;
49 bool is_suitable_for_gpu_rasterization() const {
50 return is_suitable_for_gpu_rasterization_;
52 void SetUnsuitableForGpuRasterizationForTesting() {
53 is_suitable_for_gpu_rasterization_ = false;
56 void SetPixelRecordDistanceForTesting(int d) { pixel_record_distance_ = d; }
59 // An internal CanRaster check that goes to the picture_map rather than
60 // using the recorded_viewport hint.
61 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const;
64 friend class PicturePileImpl;
66 void DetermineIfSolidColor();
68 bool is_suitable_for_gpu_rasterization_;
69 int pixel_record_distance_;
71 DISALLOW_COPY_AND_ASSIGN(PicturePile);
76 #endif // CC_RESOURCES_PICTURE_PILE_H_