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" | |
13 #include "third_party/skia/include/core/SkCanvas.h" | |
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 }; | |
26 | |
27 // Raster a subrect of this PicturePileImpl into the given canvas. It is | |
enne (OOO)
2014/10/24 22:27:35
"PicturePileImpl"
vmpstr
2014/10/24 23:15:23
Oops. Done.
| |
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 NULL. When | |
enne (OOO)
2014/10/24 22:27:35
Maybe the slow-down-raster-scale-factor bit should
vmpstr
2014/10/24 23:15:23
Done.
| |
31 // slow-down-raster-scale-factor is set to a value greater than 1, the | |
32 // reported rasterize time is the minimum measured value over all runs. | |
33 virtual void RasterToBitmap( | |
34 SkCanvas* canvas, | |
35 const gfx::Rect& canvas_rect, | |
36 float contents_scale, | |
37 RenderingStatsInstrumentation* rendering_stats_instrumentation) const = 0; | |
38 | |
39 // Analyze to determine if the given rect at given scale is of solid color in | |
40 // this raster source. | |
41 virtual void AnalyzeInRect( | |
42 const gfx::Rect& content_rect, | |
43 float contents_scale, | |
44 Analysis* analysis, | |
45 RenderingStatsInstrumentation* rendering_stats_instrumentation) const = 0; | |
46 | |
47 // Populate the given list with all SkPixelRefs that may overlap the given | |
48 // rect at given scale. | |
49 virtual void GatherPixelRefs(const gfx::Rect& content_rect, | |
50 float contents_scale, | |
51 std::vector<SkPixelRef*>* pixel_refs) const = 0; | |
52 | |
53 // Return true iff this raster source can raster the given rect at given | |
54 // scale. | |
55 virtual bool RasterCoversRect(const gfx::Rect& content_rect, | |
56 float contents_scale) const = 0; | |
57 | |
58 // Return true iff this raster source would benefit from using distance | |
59 // fiend text. | |
60 virtual bool SuitableForDistanceFieldText() const = 0; | |
61 | |
62 protected: | |
63 friend class base::RefCountedThreadSafe<RasterSource>; | |
64 | |
65 RasterSource() {} | |
66 virtual ~RasterSource() {} | |
67 | |
68 private: | |
69 DISALLOW_COPY_AND_ASSIGN(RasterSource); | |
70 }; | |
71 | |
72 } // namespace cc | |
73 | |
74 #endif // CC_RESOURCES_RASTER_SOURCE_H_ | |
OLD | NEW |