OLD | NEW |
---|---|
(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_RESOURCES_RASTER_SOURCE_H_ | |
6 #define CC_RESOURCES_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/rendering_stats_instrumentation.h" | |
reveman
2014/10/27 14:39:46
Can you forward declare RenderingStatsInstrumentat
vmpstr
2014/10/27 15:55:11
Done.
| |
13 #include "third_party/skia/include/core/SkCanvas.h" | |
reveman
2014/10/27 14:39:46
forward declare SkCanvas instead?
vmpstr
2014/10/27 15:55:11
Done.
| |
14 | |
15 namespace cc { | |
16 | |
17 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> { | |
18 public: | |
19 struct CC_EXPORT Analysis { | |
20 Analysis() : is_solid_color(false) {} | |
21 ~Analysis() {} | |
22 | |
23 bool is_solid_color; | |
24 SkColor solid_color; | |
25 }; | |
reveman
2014/10/27 14:39:46
Seems a bit silly to keep this struct when it's on
vmpstr
2014/10/27 15:55:10
I've kept this for now and added a TODO. Currently
reveman
2014/10/27 17:14:43
Ok, can you change the name to SolidColorAnalysis
vmpstr
2014/10/27 18:46:40
Done.
| |
26 | |
27 // Raster a subrect of this RasterSource into the given canvas. It is | |
28 // assumed that contents_scale has already been applied to this canvas. | |
29 // Writes the total number of pixels rasterized and the time spent | |
30 // rasterizing to the stats if the respective pointer is not nullptr. | |
31 virtual void RasterToBitmap( | |
reveman
2014/10/27 14:39:46
hm, ToBitmap doesn't seem right. RasterToCanvas? o
vmpstr
2014/10/27 15:55:11
Changed to PlaybackToCanvas
| |
32 SkCanvas* canvas, | |
33 const gfx::Rect& canvas_rect, | |
34 float contents_scale, | |
35 RenderingStatsInstrumentation* rendering_stats_instrumentation) const = 0; | |
reveman
2014/10/27 14:39:46
Do we need to be passing this RenderingStatsInstru
vmpstr
2014/10/27 15:55:11
Good question. I'll talk to ernstm to see whether
reveman
2014/10/27 17:14:43
Acknowledged.
| |
36 | |
37 // Analyze to determine if the given rect at given scale is of solid color in | |
38 // this raster source. | |
39 virtual void AnalyzeInRect( | |
40 const gfx::Rect& content_rect, | |
41 float contents_scale, | |
42 Analysis* analysis, | |
43 RenderingStatsInstrumentation* rendering_stats_instrumentation) const = 0; | |
44 | |
45 // Populate the given list with all SkPixelRefs that may overlap the given | |
46 // rect at given scale. | |
47 virtual void GatherPixelRefs(const gfx::Rect& content_rect, | |
48 float contents_scale, | |
49 std::vector<SkPixelRef*>* pixel_refs) const = 0; | |
50 | |
51 // Return true iff this raster source can raster the given rect at given | |
52 // scale. | |
53 virtual bool RasterCoversRect(const gfx::Rect& content_rect, | |
reveman
2014/10/27 14:39:46
CoversRect? RasterSource::CoversRect looks better
vmpstr
2014/10/27 15:55:11
Done.
| |
54 float contents_scale) const = 0; | |
55 | |
56 // Return true iff this raster source would benefit from using distance | |
57 // fiend text. | |
reveman
2014/10/27 14:39:46
typo: fiend
vmpstr
2014/10/27 15:55:11
Done.
| |
58 virtual bool SuitableForDistanceFieldText() const = 0; | |
59 | |
60 protected: | |
61 friend class base::RefCountedThreadSafe<RasterSource>; | |
62 | |
63 RasterSource() {} | |
64 virtual ~RasterSource() {} | |
65 | |
66 private: | |
67 DISALLOW_COPY_AND_ASSIGN(RasterSource); | |
68 }; | |
69 | |
70 } // namespace cc | |
71 | |
72 #endif // CC_RESOURCES_RASTER_SOURCE_H_ | |
OLD | NEW |