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