| 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_RASTER_RASTER_SOURCE_H_ | 5 #ifndef CC_RASTER_RASTER_SOURCE_H_ |
| 6 #define CC_RASTER_RASTER_SOURCE_H_ | 6 #define CC_RASTER_RASTER_SOURCE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // crbug.com/691076. | 49 // crbug.com/691076. |
| 50 ImageIdFlatSet images_to_skip; | 50 ImageIdFlatSet images_to_skip; |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 static scoped_refptr<RasterSource> CreateFromRecordingSource( | 53 static scoped_refptr<RasterSource> CreateFromRecordingSource( |
| 54 const RecordingSource* other, | 54 const RecordingSource* other, |
| 55 bool can_use_lcd_text); | 55 bool can_use_lcd_text); |
| 56 | 56 |
| 57 // TODO(trchen): Deprecated. | 57 // TODO(trchen): Deprecated. |
| 58 void PlaybackToCanvas(SkCanvas* canvas, | 58 void PlaybackToCanvas(SkCanvas* canvas, |
| 59 const gfx::ColorSpace& canvas_color_space, | 59 const gfx::ColorSpace& target_color_space, |
| 60 const gfx::Rect& canvas_bitmap_rect, | 60 const gfx::Rect& canvas_bitmap_rect, |
| 61 const gfx::Rect& canvas_playback_rect, | 61 const gfx::Rect& canvas_playback_rect, |
| 62 float contents_scale, | 62 float contents_scale, |
| 63 const PlaybackSettings& settings) const; | 63 const PlaybackSettings& settings) const; |
| 64 | 64 |
| 65 // Raster this RasterSource into the given canvas. Canvas states such as | 65 // Raster this RasterSource into the given canvas. Canvas states such as |
| 66 // CTM and clip region will be respected. This function will replace pixels | 66 // CTM and clip region will be respected. This function will replace pixels |
| 67 // in the clip region without blending. It is assumed that existing pixels | 67 // in the clip region without blending. It is assumed that existing pixels |
| 68 // may be uninitialized and will be cleared before playback. | 68 // may be uninitialized and will be cleared before playback. |
| 69 // | 69 // |
| 70 // Virtual for testing. | 70 // Virtual for testing. |
| 71 // | 71 // |
| 72 // Note that this should only be called after the image decode controller has | 72 // Note that this should only be called after the image decode controller has |
| 73 // been set, which happens during commit. | 73 // been set, which happens during commit. |
| 74 virtual void PlaybackToCanvas(SkCanvas* canvas, | 74 virtual void PlaybackToCanvas(SkCanvas* canvas, |
| 75 const gfx::ColorSpace& canvas_color_space, | 75 const gfx::ColorSpace& target_color_space, |
| 76 const PlaybackSettings& settings) const; | 76 const PlaybackSettings& settings) const; |
| 77 | 77 |
| 78 // Returns whether the given rect at given scale is of solid color in | 78 // Returns whether the given rect at given scale is of solid color in |
| 79 // this raster source, as well as the solid color value. | 79 // this raster source, as well as the solid color value. |
| 80 bool PerformSolidColorAnalysis(const gfx::Rect& content_rect, | 80 bool PerformSolidColorAnalysis(const gfx::Rect& content_rect, |
| 81 float contents_scale, | 81 float contents_scale, |
| 82 SkColor* color) const; | 82 SkColor* color) const; |
| 83 | 83 |
| 84 // Returns true iff the whole raster source is of solid color. | 84 // Returns true iff the whole raster source is of solid color. |
| 85 bool IsSolidColor() const; | 85 bool IsSolidColor() const; |
| 86 | 86 |
| 87 // Returns the color of the raster source if it is solid color. The results | 87 // Returns the color of the raster source if it is solid color. The results |
| 88 // are unspecified if IsSolidColor returns false. | 88 // are unspecified if IsSolidColor returns false. |
| 89 SkColor GetSolidColor() const; | 89 SkColor GetSolidColor() const; |
| 90 | 90 |
| 91 // Returns the size of this raster source. | 91 // Returns the size of this raster source. |
| 92 gfx::Size GetSize() const; | 92 gfx::Size GetSize() const; |
| 93 | 93 |
| 94 // Populate the given list with all images that may overlap the given | 94 // Populate the given list with all images that may overlap the given |
| 95 // rect in layer space. The returned draw images' matrices are modified as if | 95 // rect in layer space. The returned draw images' matrices are modified as if |
| 96 // they were being using during raster at scale |raster_scale|. | 96 // they were being using during raster at scale |raster_scale|. |
| 97 void GetDiscardableImagesInRect(const gfx::Rect& layer_rect, | 97 void GetDiscardableImagesInRect(const gfx::Rect& layer_rect, |
| 98 float contents_scale, | 98 float contents_scale, |
| 99 const gfx::ColorSpace& target_color_space, |
| 99 std::vector<DrawImage>* images) const; | 100 std::vector<DrawImage>* images) const; |
| 100 | 101 |
| 101 // Return true iff this raster source can raster the given rect in layer | 102 // Return true iff this raster source can raster the given rect in layer |
| 102 // space. | 103 // space. |
| 103 bool CoversRect(const gfx::Rect& layer_rect) const; | 104 bool CoversRect(const gfx::Rect& layer_rect) const; |
| 104 | 105 |
| 105 // Returns true if this raster source has anything to rasterize. | 106 // Returns true if this raster source has anything to rasterize. |
| 106 virtual bool HasRecordings() const; | 107 virtual bool HasRecordings() const; |
| 107 | 108 |
| 108 // Valid rectangle in which everything is recorded and can be rastered from. | 109 // Valid rectangle in which everything is recorded and can be rastered from. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 const gfx::Size size_; | 149 const gfx::Size size_; |
| 149 const bool clear_canvas_with_debug_color_; | 150 const bool clear_canvas_with_debug_color_; |
| 150 const int slow_down_raster_scale_factor_for_debug_; | 151 const int slow_down_raster_scale_factor_for_debug_; |
| 151 | 152 |
| 152 // In practice, this is only set once before raster begins, so it's ok with | 153 // In practice, this is only set once before raster begins, so it's ok with |
| 153 // respect to threading. | 154 // respect to threading. |
| 154 ImageDecodeCache* image_decode_cache_; | 155 ImageDecodeCache* image_decode_cache_; |
| 155 | 156 |
| 156 private: | 157 private: |
| 157 void RasterCommon(SkCanvas* canvas, | 158 void RasterCommon(SkCanvas* canvas, |
| 158 const gfx::ColorSpace& canvas_color_space, | |
| 159 SkPicture::AbortCallback* callback) const; | 159 SkPicture::AbortCallback* callback) const; |
| 160 | 160 |
| 161 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; | 161 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; |
| 162 | 162 |
| 163 DISALLOW_COPY_AND_ASSIGN(RasterSource); | 163 DISALLOW_COPY_AND_ASSIGN(RasterSource); |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 } // namespace cc | 166 } // namespace cc |
| 167 | 167 |
| 168 #endif // CC_RASTER_RASTER_SOURCE_H_ | 168 #endif // CC_RASTER_RASTER_SOURCE_H_ |
| OLD | NEW |