Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: cc/playback/raster_source.h

Issue 1405883002: cc: Remove the base RasterSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge more Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CC_PLAYBACK_RASTER_SOURCE_H_
6 #define CC_PLAYBACK_RASTER_SOURCE_H_
7
8 #include <vector>
9
10 #include "base/memory/ref_counted.h"
11 #include "cc/base/cc_export.h"
12 #include "cc/debug/traced_value.h"
13 #include "cc/playback/discardable_image_map.h"
14 #include "skia/ext/refptr.h"
15 #include "third_party/skia/include/core/SkColor.h"
16 #include "ui/gfx/geometry/rect.h"
17 #include "ui/gfx/geometry/size.h"
18
19 class SkCanvas;
20 class SkPicture;
21
22 namespace cc {
23
24 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> {
25 public:
26 struct CC_EXPORT SolidColorAnalysis {
27 SolidColorAnalysis()
28 : is_solid_color(false), solid_color(SK_ColorTRANSPARENT) {}
29 ~SolidColorAnalysis() {}
30
31 bool is_solid_color;
32 SkColor solid_color;
33 };
34
35 // Raster a subrect of this RasterSource into the given canvas. It is
36 // assumed that contents_scale has already been applied to this canvas.
37 // Writes the total number of pixels rasterized and the time spent
38 // rasterizing to the stats if the respective pointer is not nullptr.
39 // It is assumed that the canvas passed here will only be rasterized by
40 // this raster source via this call.
41 virtual void PlaybackToCanvas(SkCanvas* canvas,
42 const gfx::Rect& canvas_bitmap_rect,
43 const gfx::Rect& canvas_playback_rect,
44 float contents_scale) const = 0;
45
46 // Similar to above, except that the canvas passed here can (or was already)
47 // rasterized into by another raster source. That is, it is not safe to clear
48 // the canvas or discard its underlying memory.
49 virtual void PlaybackToSharedCanvas(SkCanvas* canvas,
50 const gfx::Rect& canvas_rect,
51 float contents_scale) const = 0;
52
53 // Analyze to determine if the given rect at given scale is of solid color in
54 // this raster source.
55 virtual void PerformSolidColorAnalysis(
56 const gfx::Rect& content_rect,
57 float contents_scale,
58 SolidColorAnalysis* analysis) const = 0;
59
60 // Returns true iff the whole raster source is of solid color.
61 virtual bool IsSolidColor() const = 0;
62
63 // Returns the color of the raster source if it is solid color. The results
64 // are unspecified if IsSolidColor returns false.
65 virtual SkColor GetSolidColor() const = 0;
66
67 // Returns the size of this raster source.
68 virtual gfx::Size GetSize() const = 0;
69
70 // Populate the given list with all images that may overlap the given
71 // rect in layer space.
72 virtual void GetDiscardableImagesInRect(
73 const gfx::Rect& layer_rect,
74 std::vector<DrawImage>* images) const = 0;
75
76 // Return true iff this raster source can raster the given rect in layer
77 // space.
78 virtual bool CoversRect(const gfx::Rect& layer_rect) const = 0;
79
80 // Returns true if this raster source has anything to rasterize.
81 virtual bool HasRecordings() const = 0;
82
83 // Valid rectangle in which everything is recorded and can be rastered from.
84 virtual gfx::Rect RecordedViewport() const = 0;
85
86 // Informs the raster source that it should attempt to use distance field text
87 // during rasterization.
88 virtual void SetShouldAttemptToUseDistanceFieldText() = 0;
89
90 // Return true iff this raster source would benefit from using distance
91 // field text.
92 virtual bool ShouldAttemptToUseDistanceFieldText() const = 0;
93
94 // Tracing functionality.
95 virtual void DidBeginTracing() = 0;
96 virtual void AsValueInto(base::trace_event::TracedValue* array) const = 0;
97 virtual skia::RefPtr<SkPicture> GetFlattenedPicture() = 0;
98 virtual size_t GetPictureMemoryUsage() const = 0;
99
100 // Return true if LCD anti-aliasing may be used when rastering text.
101 virtual bool CanUseLCDText() const = 0;
102
103 virtual scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const = 0;
104
105 protected:
106 friend class base::RefCountedThreadSafe<RasterSource>;
107
108 RasterSource() {}
109 virtual ~RasterSource() {}
110
111 private:
112 DISALLOW_COPY_AND_ASSIGN(RasterSource);
113 };
114
115 } // namespace cc
116
117 #endif // CC_PLAYBACK_RASTER_SOURCE_H_
OLDNEW
« no previous file with comments | « cc/playback/display_list_recording_source_unittest.cc ('k') | cc/playback/raster_source_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698