OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_RESOURCES_PICTURE_H_ | 5 #ifndef CC_RESOURCES_PICTURE_H_ |
6 #define CC_RESOURCES_PICTURE_H_ | 6 #define CC_RESOURCES_PICTURE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
14 #include "base/lazy_instance.h" | 14 #include "base/lazy_instance.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/trace_event/trace_event.h" | 18 #include "base/trace_event/trace_event.h" |
19 #include "cc/base/cc_export.h" | 19 #include "cc/base/cc_export.h" |
20 #include "cc/base/region.h" | 20 #include "cc/base/region.h" |
21 #include "cc/resources/recording_source.h" | 21 #include "cc/resources/recording_source.h" |
22 #include "skia/ext/refptr.h" | 22 #include "skia/ext/refptr.h" |
23 #include "third_party/skia/include/core/SkPicture.h" | 23 #include "third_party/skia/include/core/SkPicture.h" |
24 #include "ui/gfx/geometry/rect.h" | 24 #include "ui/gfx/geometry/rect.h" |
25 | 25 |
26 class SkDrawPictureCallback; | |
27 class SkPixelRef; | 26 class SkPixelRef; |
28 | 27 |
29 namespace base { | 28 namespace base { |
30 class Value; | 29 class Value; |
31 } | 30 } |
32 | 31 |
33 namespace skia { | 32 namespace skia { |
34 class AnalysisCanvas; | 33 class AnalysisCanvas; |
35 } | 34 } |
36 | 35 |
(...skipping 26 matching lines...) Expand all Loading... |
63 int ApproximateOpCount() const; | 62 int ApproximateOpCount() const; |
64 size_t ApproximateMemoryUsage() const; | 63 size_t ApproximateMemoryUsage() const; |
65 | 64 |
66 bool HasText() const; | 65 bool HasText() const; |
67 | 66 |
68 // Apply this scale and raster the negated region into the canvas. | 67 // Apply this scale and raster the negated region into the canvas. |
69 // |negated_content_region| specifies the region to be clipped out of the | 68 // |negated_content_region| specifies the region to be clipped out of the |
70 // raster operation, i.e., the parts of the canvas which will not get drawn | 69 // raster operation, i.e., the parts of the canvas which will not get drawn |
71 // to. | 70 // to. |
72 int Raster(SkCanvas* canvas, | 71 int Raster(SkCanvas* canvas, |
73 SkDrawPictureCallback* callback, | 72 SkPicture::AbortCallback* callback, |
74 const Region& negated_content_region, | 73 const Region& negated_content_region, |
75 float contents_scale) const; | 74 float contents_scale) const; |
76 | 75 |
77 // Draw the picture directly into the given canvas, without applying any | 76 // Draw the picture directly into the given canvas, without applying any |
78 // clip/scale/layer transformations. | 77 // clip/scale/layer transformations. |
79 void Replay(SkCanvas* canvas); | 78 void Replay(SkCanvas* canvas, SkPicture::AbortCallback* callback = NULL); |
80 | 79 |
81 scoped_ptr<base::Value> AsValue() const; | 80 scoped_ptr<base::Value> AsValue() const; |
82 | 81 |
83 // This iterator imprecisely returns the set of pixel refs that are needed to | 82 // This iterator imprecisely returns the set of pixel refs that are needed to |
84 // raster this layer rect from this picture. Internally, pixel refs are | 83 // raster this layer rect from this picture. Internally, pixel refs are |
85 // clumped into tile grid buckets, so there may be false positives. | 84 // clumped into tile grid buckets, so there may be false positives. |
86 class CC_EXPORT PixelRefIterator { | 85 class CC_EXPORT PixelRefIterator { |
87 public: | 86 public: |
88 PixelRefIterator(); | 87 PixelRefIterator(); |
89 PixelRefIterator(const gfx::Rect& layer_rect, const Picture* picture); | 88 PixelRefIterator(const gfx::Rect& layer_rect, const Picture* picture); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 AsTraceableRecordData() const; | 154 AsTraceableRecordData() const; |
156 | 155 |
157 friend class base::RefCountedThreadSafe<Picture>; | 156 friend class base::RefCountedThreadSafe<Picture>; |
158 friend class PixelRefIterator; | 157 friend class PixelRefIterator; |
159 DISALLOW_COPY_AND_ASSIGN(Picture); | 158 DISALLOW_COPY_AND_ASSIGN(Picture); |
160 }; | 159 }; |
161 | 160 |
162 } // namespace cc | 161 } // namespace cc |
163 | 162 |
164 #endif // CC_RESOURCES_PICTURE_H_ | 163 #endif // CC_RESOURCES_PICTURE_H_ |
OLD | NEW |