| 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 <memory> | 10 #include <memory> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 static scoped_refptr<RasterSource> CreateFromRecordingSource( | 46 static scoped_refptr<RasterSource> CreateFromRecordingSource( |
| 47 const RecordingSource* other, | 47 const RecordingSource* other, |
| 48 bool can_use_lcd_text); | 48 bool can_use_lcd_text); |
| 49 | 49 |
| 50 // TODO(trchen): Deprecated. | 50 // TODO(trchen): Deprecated. |
| 51 void PlaybackToCanvas(SkCanvas* canvas, | 51 void PlaybackToCanvas(SkCanvas* canvas, |
| 52 const gfx::Rect& canvas_bitmap_rect, | 52 const gfx::Rect& canvas_bitmap_rect, |
| 53 const gfx::Rect& canvas_playback_rect, | 53 const gfx::Rect& canvas_playback_rect, |
| 54 const gfx::SizeF& raster_scales, | 54 float contents_scale, |
| 55 const PlaybackSettings& settings) const; | 55 const PlaybackSettings& settings) const; |
| 56 | 56 |
| 57 // Raster this RasterSource into the given canvas. Canvas states such as | 57 // Raster this RasterSource into the given canvas. Canvas states such as |
| 58 // CTM and clip region will be respected. This function will replace pixels | 58 // CTM and clip region will be respected. This function will replace pixels |
| 59 // in the clip region without blending. It is assumed that existing pixels | 59 // in the clip region without blending. It is assumed that existing pixels |
| 60 // may be uninitialized and will be cleared before playback. | 60 // may be uninitialized and will be cleared before playback. |
| 61 // | 61 // |
| 62 // Virtual for testing. | 62 // Virtual for testing. |
| 63 // | 63 // |
| 64 // Note that this should only be called after the image decode controller has | 64 // Note that this should only be called after the image decode controller has |
| 65 // been set, which happens during commit. | 65 // been set, which happens during commit. |
| 66 virtual void PlaybackToCanvas(SkCanvas* canvas, | 66 virtual void PlaybackToCanvas(SkCanvas* canvas, |
| 67 const PlaybackSettings& settings) const; | 67 const PlaybackSettings& settings) const; |
| 68 | 68 |
| 69 // Returns whether the given rect at given scale is of solid color in | 69 // Returns whether the given rect at given scale is of solid color in |
| 70 // this raster source, as well as the solid color value. | 70 // this raster source, as well as the solid color value. |
| 71 bool PerformSolidColorAnalysis(const gfx::Rect& content_rect, | 71 bool PerformSolidColorAnalysis(const gfx::Rect& content_rect, |
| 72 const gfx::SizeF& raster_scales, | 72 float contents_scale, |
| 73 SkColor* color) const; | 73 SkColor* color) const; |
| 74 | 74 |
| 75 // Returns true iff the whole raster source is of solid color. | 75 // Returns true iff the whole raster source is of solid color. |
| 76 bool IsSolidColor() const; | 76 bool IsSolidColor() const; |
| 77 | 77 |
| 78 // Returns the color of the raster source if it is solid color. The results | 78 // Returns the color of the raster source if it is solid color. The results |
| 79 // are unspecified if IsSolidColor returns false. | 79 // are unspecified if IsSolidColor returns false. |
| 80 SkColor GetSolidColor() const; | 80 SkColor GetSolidColor() const; |
| 81 | 81 |
| 82 // Returns the size of this raster source. | 82 // Returns the size of this raster source. |
| 83 gfx::Size GetSize() const; | 83 gfx::Size GetSize() const; |
| 84 | 84 |
| 85 // Returns whether or not there was a color space implied by the raster source | 85 // Returns whether or not there was a color space implied by the raster source |
| 86 // when it was created. If this returns true then no color correction is | 86 // when it was created. If this returns true then no color correction is |
| 87 // to be applied at rasterization time, and the result of rasterization is to | 87 // to be applied at rasterization time, and the result of rasterization is to |
| 88 // be interpreted as being in this color space. If this returns falce, then | 88 // be interpreted as being in this color space. If this returns falce, then |
| 89 // then a destination color space must be specified at raster time. | 89 // then a destination color space must be specified at raster time. |
| 90 bool HasImpliedColorSpace() const; | 90 bool HasImpliedColorSpace() const; |
| 91 const gfx::ColorSpace& GetImpliedColorSpace() const; | 91 const gfx::ColorSpace& GetImpliedColorSpace() const; |
| 92 | 92 |
| 93 // Populate the given list with all images that may overlap the given | 93 // Populate the given list with all images that may overlap the given |
| 94 // rect in layer space. The returned draw images' matrices are modified as if | 94 // rect in layer space. The returned draw images' matrices are modified as if |
| 95 // they were being using during raster at scale |raster_scale|. | 95 // they were being using during raster at scale |raster_scale|. |
| 96 void GetDiscardableImagesInRect(const gfx::Rect& layer_rect, | 96 void GetDiscardableImagesInRect(const gfx::Rect& layer_rect, |
| 97 const gfx::SizeF& raster_scales, | 97 float contents_scale, |
| 98 std::vector<DrawImage>* images) const; | 98 std::vector<DrawImage>* images) const; |
| 99 | 99 |
| 100 // Return true iff this raster source can raster the given rect in layer | 100 // Return true iff this raster source can raster the given rect in layer |
| 101 // space. | 101 // space. |
| 102 bool CoversRect(const gfx::Rect& layer_rect) const; | 102 bool CoversRect(const gfx::Rect& layer_rect) const; |
| 103 | 103 |
| 104 // Returns true if this raster source has anything to rasterize. | 104 // Returns true if this raster source has anything to rasterize. |
| 105 virtual bool HasRecordings() const; | 105 virtual bool HasRecordings() const; |
| 106 | 106 |
| 107 // Valid rectangle in which everything is recorded and can be rastered from. | 107 // Valid rectangle in which everything is recorded and can be rastered from. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 void RasterCommon(SkCanvas* canvas, SkPicture::AbortCallback* callback) const; | 154 void RasterCommon(SkCanvas* canvas, SkPicture::AbortCallback* callback) const; |
| 155 | 155 |
| 156 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; | 156 void PrepareForPlaybackToCanvas(SkCanvas* canvas) const; |
| 157 | 157 |
| 158 DISALLOW_COPY_AND_ASSIGN(RasterSource); | 158 DISALLOW_COPY_AND_ASSIGN(RasterSource); |
| 159 }; | 159 }; |
| 160 | 160 |
| 161 } // namespace cc | 161 } // namespace cc |
| 162 | 162 |
| 163 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ | 163 #endif // CC_PLAYBACK_RASTER_SOURCE_H_ |
| OLD | NEW |