| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_PLAYBACK_RASTER_SOURCE_H_ | 5 #ifndef CC_PLAYBACK_RASTER_SOURCE_H_ |
| 6 #define CC_PLAYBACK_RASTER_SOURCE_H_ | 6 #define CC_PLAYBACK_RASTER_SOURCE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "base/trace_event/memory_allocator_dump.h" | 15 #include "base/trace_event/memory_allocator_dump.h" |
| 16 #include "base/trace_event/memory_dump_provider.h" | 16 #include "base/trace_event/memory_dump_provider.h" |
| 17 #include "cc/base/cc_export.h" | 17 #include "cc/base/cc_export.h" |
| 18 #include "cc/debug/rendering_stats_instrumentation.h" | 18 #include "cc/debug/rendering_stats_instrumentation.h" |
| 19 #include "cc/playback/display_list_recording_source.h" | 19 #include "cc/playback/display_list_recording_source.h" |
| 20 #include "skia/ext/analysis_canvas.h" | 20 #include "skia/ext/analysis_canvas.h" |
| 21 #include "third_party/skia/include/core/SkPicture.h" | 21 #include "third_party/skia/include/core/SkPicture.h" |
| 22 #include "ui/gfx/geometry/vector2d_f.h" |
| 22 | 23 |
| 23 namespace cc { | 24 namespace cc { |
| 24 class DisplayItemList; | 25 class DisplayItemList; |
| 25 class DrawImage; | 26 class DrawImage; |
| 26 class ImageDecodeController; | 27 class ImageDecodeController; |
| 27 | 28 |
| 28 class CC_EXPORT RasterSource : public base::trace_event::MemoryDumpProvider, | 29 class CC_EXPORT RasterSource : public base::trace_event::MemoryDumpProvider, |
| 29 public base::RefCountedThreadSafe<RasterSource> { | 30 public base::RefCountedThreadSafe<RasterSource> { |
| 30 public: | 31 public: |
| 31 static scoped_refptr<RasterSource> CreateFromDisplayListRecordingSource( | 32 static scoped_refptr<RasterSource> CreateFromDisplayListRecordingSource( |
| (...skipping 24 matching lines...) Expand all Loading... |
| 56 const gfx::Rect& canvas_rect, | 57 const gfx::Rect& canvas_rect, |
| 57 float contents_scale, | 58 float contents_scale, |
| 58 bool include_images) const; | 59 bool include_images) const; |
| 59 | 60 |
| 60 // Returns whether the given rect at given scale is of solid color in | 61 // Returns whether the given rect at given scale is of solid color in |
| 61 // this raster source, as well as the solid color value. | 62 // this raster source, as well as the solid color value. |
| 62 bool PerformSolidColorAnalysis(const gfx::Rect& content_rect, | 63 bool PerformSolidColorAnalysis(const gfx::Rect& content_rect, |
| 63 float contents_scale, | 64 float contents_scale, |
| 64 SkColor* color) const; | 65 SkColor* color) const; |
| 65 | 66 |
| 67 void SetSubpixelOffset(const gfx::Vector2dF& subpixel_offset) { subpixel_offse
t_ = subpixel_offset; } |
| 68 |
| 66 // Returns true iff the whole raster source is of solid color. | 69 // Returns true iff the whole raster source is of solid color. |
| 67 bool IsSolidColor() const; | 70 bool IsSolidColor() const; |
| 68 | 71 |
| 69 // Returns the color of the raster source if it is solid color. The results | 72 // Returns the color of the raster source if it is solid color. The results |
| 70 // are unspecified if IsSolidColor returns false. | 73 // are unspecified if IsSolidColor returns false. |
| 71 SkColor GetSolidColor() const; | 74 SkColor GetSolidColor() const; |
| 72 | 75 |
| 73 // Returns the size of this raster source. | 76 // Returns the size of this raster source. |
| 74 gfx::Size GetSize() const; | 77 gfx::Size GetSize() const; |
| 75 | 78 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 float contents_scale) const; | 162 float contents_scale) const; |
| 160 | 163 |
| 161 void PrepareForPlaybackToCanvas(SkCanvas* canvas, | 164 void PrepareForPlaybackToCanvas(SkCanvas* canvas, |
| 162 const gfx::Rect& canvas_bitmap_rect, | 165 const gfx::Rect& canvas_bitmap_rect, |
| 163 const gfx::Rect& canvas_playback_rect, | 166 const gfx::Rect& canvas_playback_rect, |
| 164 float contents_scale) const; | 167 float contents_scale) const; |
| 165 | 168 |
| 166 // Used to ensure that memory dump logic always happens on the same thread. | 169 // Used to ensure that memory dump logic always happens on the same thread. |
| 167 base::ThreadChecker memory_dump_thread_checker_; | 170 base::ThreadChecker memory_dump_thread_checker_; |
| 168 | 171 |
| 172 gfx::Vector2dF subpixel_offset_; |
| 173 |
| 169 DISALLOW_COPY_AND_ASSIGN(RasterSource); | 174 DISALLOW_COPY_AND_ASSIGN(RasterSource); |
| 170 }; | 175 }; |
| 171 | 176 |
| 172 } // namespace cc | 177 } // namespace cc |
| 173 | 178 |
| 174 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ | 179 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ |
| OLD | NEW |