| 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_PILE_IMPL_H_ | 5 #ifndef CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
| 6 #define CC_RESOURCES_PICTURE_PILE_IMPL_H_ | 6 #define CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 namespace gfx { | 24 namespace gfx { |
| 25 class Rect; | 25 class Rect; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace cc { | 28 namespace cc { |
| 29 | 29 |
| 30 class CC_EXPORT PicturePileImpl : public RasterSource { | 30 class CC_EXPORT PicturePileImpl : public RasterSource { |
| 31 public: | 31 public: |
| 32 static scoped_refptr<PicturePileImpl> CreateFromPicturePile( | 32 static scoped_refptr<PicturePileImpl> CreateFromPicturePile( |
| 33 const PicturePile* other, | 33 const PicturePile* other); |
| 34 bool can_use_lcd_text); | |
| 35 | 34 |
| 36 // RasterSource overrides. See RasterSource header for full description. | 35 // RasterSource overrides. See RasterSource header for full description. |
| 37 // When slow-down-raster-scale-factor is set to a value greater than 1, the | 36 // When slow-down-raster-scale-factor is set to a value greater than 1, the |
| 38 // reported rasterize time (in stats_instrumentation) is the minimum measured | 37 // reported rasterize time (in stats_instrumentation) is the minimum measured |
| 39 // value over all runs. | 38 // value over all runs. |
| 40 void PlaybackToCanvas(SkCanvas* canvas, | 39 void PlaybackToCanvas(SkCanvas* canvas, |
| 41 const gfx::Rect& canvas_rect, | 40 const gfx::Rect& canvas_rect, |
| 42 float contents_scale) const override; | 41 float contents_scale) const override; |
| 43 void PlaybackToSharedCanvas(SkCanvas* canvas, | 42 void PlaybackToSharedCanvas(SkCanvas* canvas, |
| 44 const gfx::Rect& canvas_rect, | 43 const gfx::Rect& canvas_rect, |
| 45 float contents_scale) const override; | 44 float contents_scale) const override; |
| 46 void PerformSolidColorAnalysis( | 45 void PerformSolidColorAnalysis( |
| 47 const gfx::Rect& content_rect, | 46 const gfx::Rect& content_rect, |
| 48 float contents_scale, | 47 float contents_scale, |
| 49 RasterSource::SolidColorAnalysis* analysis) const override; | 48 RasterSource::SolidColorAnalysis* analysis) const override; |
| 50 void GatherPixelRefs(const gfx::Rect& content_rect, | 49 void GatherPixelRefs(const gfx::Rect& content_rect, |
| 51 float contents_scale, | 50 float contents_scale, |
| 52 std::vector<SkPixelRef*>* pixel_refs) const override; | 51 std::vector<SkPixelRef*>* pixel_refs) const override; |
| 53 bool CoversRect(const gfx::Rect& content_rect, | 52 bool CoversRect(const gfx::Rect& content_rect, |
| 54 float contents_scale) const override; | 53 float contents_scale) const override; |
| 55 void SetShouldAttemptToUseDistanceFieldText() override; | 54 void SetShouldAttemptToUseDistanceFieldText() override; |
| 56 bool ShouldAttemptToUseDistanceFieldText() const override; | 55 bool ShouldAttemptToUseDistanceFieldText() const override; |
| 57 gfx::Size GetSize() const override; | 56 gfx::Size GetSize() const override; |
| 58 bool IsSolidColor() const override; | 57 bool IsSolidColor() const override; |
| 59 SkColor GetSolidColor() const override; | 58 SkColor GetSolidColor() const override; |
| 60 bool HasRecordings() const override; | 59 bool HasRecordings() const override; |
| 61 bool CanUseLCDText() const override; | 60 bool CanUseLCDText() const override; |
| 62 scoped_refptr<RasterSource> CreateCloneWithoutLCDText() const override; | |
| 63 | 61 |
| 64 // Tracing functionality. | 62 // Tracing functionality. |
| 65 void DidBeginTracing() override; | 63 void DidBeginTracing() override; |
| 66 void AsValueInto(base::trace_event::TracedValue* array) const override; | 64 void AsValueInto(base::trace_event::TracedValue* array) const override; |
| 67 skia::RefPtr<SkPicture> GetFlattenedPicture() override; | 65 skia::RefPtr<SkPicture> GetFlattenedPicture() override; |
| 68 size_t GetPictureMemoryUsage() const override; | 66 size_t GetPictureMemoryUsage() const override; |
| 69 | 67 |
| 70 // Iterator used to return SkPixelRefs from this picture pile. | 68 // Iterator used to return SkPixelRefs from this picture pile. |
| 71 // Public for testing. | 69 // Public for testing. |
| 72 class CC_EXPORT PixelRefIterator { | 70 class CC_EXPORT PixelRefIterator { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 94 protected: | 92 protected: |
| 95 friend class PicturePile; | 93 friend class PicturePile; |
| 96 friend class PixelRefIterator; | 94 friend class PixelRefIterator; |
| 97 | 95 |
| 98 // TODO(vmpstr): Change this when pictures are split from invalidation info. | 96 // TODO(vmpstr): Change this when pictures are split from invalidation info. |
| 99 using PictureMapKey = PicturePile::PictureMapKey; | 97 using PictureMapKey = PicturePile::PictureMapKey; |
| 100 using PictureMap = PicturePile::PictureMap; | 98 using PictureMap = PicturePile::PictureMap; |
| 101 using PictureInfo = PicturePile::PictureInfo; | 99 using PictureInfo = PicturePile::PictureInfo; |
| 102 | 100 |
| 103 PicturePileImpl(); | 101 PicturePileImpl(); |
| 104 explicit PicturePileImpl(const PicturePile* other, bool can_use_lcd_text); | 102 explicit PicturePileImpl(const PicturePile* other); |
| 105 explicit PicturePileImpl(const PicturePileImpl* other, bool can_use_lcd_text); | |
| 106 ~PicturePileImpl() override; | 103 ~PicturePileImpl() override; |
| 107 | 104 |
| 108 int buffer_pixels() const { return tiling_.border_texels(); } | 105 int buffer_pixels() const { return tiling_.border_texels(); } |
| 109 | 106 |
| 110 // These members are const as this raster source may be in use on another | 107 // These members are const as this raster source may be in use on another |
| 111 // thread and so should not be touched after construction. | 108 // thread and so should not be touched after construction. |
| 112 const PictureMap picture_map_; | 109 const PictureMap picture_map_; |
| 113 const TilingData tiling_; | 110 const TilingData tiling_; |
| 114 const SkColor background_color_; | 111 const SkColor background_color_; |
| 115 const bool requires_clear_; | 112 const bool requires_clear_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const; | 148 bool CanRasterSlowTileCheck(const gfx::Rect& layer_rect) const; |
| 152 | 149 |
| 153 gfx::Rect PaddedRect(const PictureMapKey& key) const; | 150 gfx::Rect PaddedRect(const PictureMapKey& key) const; |
| 154 | 151 |
| 155 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); | 152 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); |
| 156 }; | 153 }; |
| 157 | 154 |
| 158 } // namespace cc | 155 } // namespace cc |
| 159 | 156 |
| 160 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ | 157 #endif // CC_RESOURCES_PICTURE_PILE_IMPL_H_ |
| OLD | NEW |