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

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

Issue 1144693002: cc: Move files out of cc/resources/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resources: android Created 5 years, 7 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
« no previous file with comments | « cc/resources/raster_buffer.cc ('k') | cc/resources/raster_source_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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/traced_value.h"
13 #include "skia/ext/refptr.h"
14 #include "third_party/skia/include/core/SkColor.h"
15 #include "third_party/skia/include/core/SkPixelRef.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 Picture;
25
26 class CC_EXPORT RasterSource : public base::RefCountedThreadSafe<RasterSource> {
27 public:
28 struct CC_EXPORT SolidColorAnalysis {
29 SolidColorAnalysis()
30 : is_solid_color(false), solid_color(SK_ColorTRANSPARENT) {}
31 ~SolidColorAnalysis() {}
32
33 bool is_solid_color;
34 SkColor solid_color;
35 };
36
37 // Raster a subrect of this RasterSource into the given canvas. It is
38 // assumed that contents_scale has already been applied to this canvas.
39 // Writes the total number of pixels rasterized and the time spent
40 // rasterizing to the stats if the respective pointer is not nullptr.
41 // It is assumed that the canvas passed here will only be rasterized by
42 // this raster source via this call.
43 virtual void PlaybackToCanvas(SkCanvas* canvas,
44 const gfx::Rect& canvas_rect,
45 float contents_scale) const = 0;
46
47 // Similar to above, except that the canvas passed here can (or was already)
48 // rasterized into by another raster source. That is, it is not safe to clear
49 // the canvas or discard its underlying memory.
50 virtual void PlaybackToSharedCanvas(SkCanvas* canvas,
51 const gfx::Rect& canvas_rect,
52 float contents_scale) const = 0;
53
54 // Analyze to determine if the given rect at given scale is of solid color in
55 // this raster source.
56 virtual void PerformSolidColorAnalysis(
57 const gfx::Rect& content_rect,
58 float contents_scale,
59 SolidColorAnalysis* analysis) const = 0;
60
61 // Returns true iff the whole raster source is of solid color.
62 virtual bool IsSolidColor() const = 0;
63
64 // Returns the color of the raster source if it is solid color. The results
65 // are unspecified if IsSolidColor returns false.
66 virtual SkColor GetSolidColor() const = 0;
67
68 // Returns the size of this raster source.
69 virtual gfx::Size GetSize() const = 0;
70
71 // Populate the given list with all SkPixelRefs that may overlap the given
72 // rect at given scale.
73 virtual void GatherPixelRefs(const gfx::Rect& content_rect,
74 float contents_scale,
75 std::vector<SkPixelRef*>* pixel_refs) const = 0;
76
77 // Return true iff this raster source can raster the given rect at given
78 // scale.
79 virtual bool CoversRect(const gfx::Rect& content_rect,
80 float contents_scale) const = 0;
81
82 // Returns true if this raster source has anything to rasterize.
83 virtual bool HasRecordings() const = 0;
84
85 // Informs the raster source that it should attempt to use distance field text
86 // during rasterization.
87 virtual void SetShouldAttemptToUseDistanceFieldText() = 0;
88
89 // Return true iff this raster source would benefit from using distance
90 // field text.
91 virtual bool ShouldAttemptToUseDistanceFieldText() const = 0;
92
93 // Tracing functionality.
94 virtual void DidBeginTracing() = 0;
95 virtual void AsValueInto(base::trace_event::TracedValue* array) const = 0;
96 virtual skia::RefPtr<SkPicture> GetFlattenedPicture() = 0;
97 virtual size_t GetPictureMemoryUsage() const = 0;
98
99 // Return true if LCD anti-aliasing may be used when rastering text.
100 virtual bool CanUseLCDText() const = 0;
101
102 virtual scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const = 0;
103
104 protected:
105 friend class base::RefCountedThreadSafe<RasterSource>;
106
107 RasterSource() {}
108 virtual ~RasterSource() {}
109
110 private:
111 DISALLOW_COPY_AND_ASSIGN(RasterSource);
112 };
113
114 } // namespace cc
115
116 #endif // CC_RESOURCES_RASTER_SOURCE_H_
OLDNEW
« no previous file with comments | « cc/resources/raster_buffer.cc ('k') | cc/resources/raster_source_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698