1 // Copyright 2014 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_PLAYBACK_RECORDING_SOURCE_H_
6 #define CC_PLAYBACK_RECORDING_SOURCE_H_
8 #include "base/memory/ref_counted.h"
9 #include "cc/base/cc_export.h"
10 #include "third_party/skia/include/core/SkColor.h"
11 #include "ui/gfx/geometry/rect.h"
12 #include "ui/gfx/geometry/size.h"
15 class ContentLayerClient
;
19 class CC_EXPORT RecordingSource
{
21 // TODO(schenney) Remove RECORD_WITH_SK_NULL_CANVAS when we no longer
22 // support a non-Slimming Paint path.
25 RECORD_WITH_SK_NULL_CANVAS
,
26 RECORD_WITH_PAINTING_DISABLED
,
27 RECORD_WITH_CACHING_DISABLED
,
28 RECORD_WITH_CONSTRUCTION_DISABLED
,
29 RECORDING_MODE_COUNT
, // Must be the last entry.
32 virtual ~RecordingSource() {}
33 // Re-record parts of the picture that are invalid.
34 // Invalidations are in layer space, and will be expanded to cover everything
35 // that was either recorded/changed or that has no recording, leaving out only
36 // pieces that we had a recording for and it was not changed.
37 // Return true iff the pile was modified.
38 virtual bool UpdateAndExpandInvalidation(ContentLayerClient
* painter
,
40 const gfx::Size
& layer_size
,
41 const gfx::Rect
& visible_layer_rect
,
43 RecordingMode recording_mode
) = 0;
45 virtual scoped_refptr
<RasterSource
> CreateRasterSource(
46 bool can_use_lcd_text
) const = 0;
48 virtual gfx::Size
GetSize() const = 0;
49 virtual void SetEmptyBounds() = 0;
50 virtual void SetSlowdownRasterScaleFactor(int factor
) = 0;
51 virtual void SetGatherDiscardableImages(bool gather_images
) = 0;
52 virtual void SetBackgroundColor(SkColor background_color
) = 0;
53 virtual void SetRequiresClear(bool requires_clear
) = 0;
54 virtual bool IsSuitableForGpuRasterization() const = 0;
56 // TODO(hendrikw): Figure out how to remove this.
57 virtual void SetUnsuitableForGpuRasterizationForTesting() = 0;
58 virtual gfx::Size
GetTileGridSizeForTesting() const = 0;
63 #endif // CC_PLAYBACK_RECORDING_SOURCE_H_