| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_SKPICTURE_CONTENT_LAYER_UPDATER_H_ | 5 #ifndef CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_ |
| 6 #define CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_ | 6 #define CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_ |
| 7 | 7 |
| 8 #include "cc/resources/content_layer_updater.h" | 8 #include "cc/resources/content_layer_updater.h" |
| 9 #include "third_party/skia/include/core/SkPicture.h" | 9 #include "third_party/skia/include/core/SkPicture.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 public: | 23 public: |
| 24 class Resource : public LayerUpdater::Resource { | 24 class Resource : public LayerUpdater::Resource { |
| 25 public: | 25 public: |
| 26 Resource(SkPictureContentLayerUpdater* updater, | 26 Resource(SkPictureContentLayerUpdater* updater, |
| 27 scoped_ptr<PrioritizedResource> texture); | 27 scoped_ptr<PrioritizedResource> texture); |
| 28 virtual ~Resource(); | 28 virtual ~Resource(); |
| 29 | 29 |
| 30 virtual void Update(ResourceUpdateQueue* queue, | 30 virtual void Update(ResourceUpdateQueue* queue, |
| 31 gfx::Rect source_rect, | 31 gfx::Rect source_rect, |
| 32 gfx::Vector2d dest_offset, | 32 gfx::Vector2d dest_offset, |
| 33 bool partial_update, | 33 bool partial_update) OVERRIDE; |
| 34 RenderingStats* stats) OVERRIDE; | |
| 35 | 34 |
| 36 private: | 35 private: |
| 37 SkPictureContentLayerUpdater* updater_; | 36 SkPictureContentLayerUpdater* updater_; |
| 38 | 37 |
| 39 DISALLOW_COPY_AND_ASSIGN(Resource); | 38 DISALLOW_COPY_AND_ASSIGN(Resource); |
| 40 }; | 39 }; |
| 41 | 40 |
| 42 static scoped_refptr<SkPictureContentLayerUpdater> Create( | 41 static scoped_refptr<SkPictureContentLayerUpdater> Create( |
| 43 scoped_ptr<LayerPainter> painter); | 42 scoped_ptr<LayerPainter> painter, |
| 43 RenderingStatsInstrumentation* stats_instrumentation); |
| 44 | 44 |
| 45 virtual scoped_ptr<LayerUpdater::Resource> CreateResource( | 45 virtual scoped_ptr<LayerUpdater::Resource> CreateResource( |
| 46 PrioritizedResourceManager* manager) OVERRIDE; | 46 PrioritizedResourceManager* manager) OVERRIDE; |
| 47 virtual void SetOpaque(bool opaque) OVERRIDE; | 47 virtual void SetOpaque(bool opaque) OVERRIDE; |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 explicit SkPictureContentLayerUpdater(scoped_ptr<LayerPainter> painter); | 50 SkPictureContentLayerUpdater( |
| 51 scoped_ptr<LayerPainter> painter, |
| 52 RenderingStatsInstrumentation* stats_instrumentation); |
| 51 virtual ~SkPictureContentLayerUpdater(); | 53 virtual ~SkPictureContentLayerUpdater(); |
| 52 | 54 |
| 53 virtual void PrepareToUpdate(gfx::Rect content_rect, | 55 virtual void PrepareToUpdate(gfx::Rect content_rect, |
| 54 gfx::Size tile_size, | 56 gfx::Size tile_size, |
| 55 float contents_width_scale, | 57 float contents_width_scale, |
| 56 float contents_height_scale, | 58 float contents_height_scale, |
| 57 gfx::Rect* resulting_opaque_rect, | 59 gfx::Rect* resulting_opaque_rect) OVERRIDE; |
| 58 RenderingStats* stats) OVERRIDE; | |
| 59 void DrawPicture(SkCanvas* canvas); | 60 void DrawPicture(SkCanvas* canvas); |
| 60 void UpdateTexture(ResourceUpdateQueue* queue, | 61 void UpdateTexture(ResourceUpdateQueue* queue, |
| 61 PrioritizedResource* texture, | 62 PrioritizedResource* texture, |
| 62 gfx::Rect source_rect, | 63 gfx::Rect source_rect, |
| 63 gfx::Vector2d dest_offset, | 64 gfx::Vector2d dest_offset, |
| 64 bool partial_update); | 65 bool partial_update); |
| 65 | 66 |
| 66 bool layer_is_opaque() const { return layer_is_opaque_; } | 67 bool layer_is_opaque() const { return layer_is_opaque_; } |
| 67 | 68 |
| 68 private: | 69 private: |
| 69 // Recording canvas. | 70 // Recording canvas. |
| 70 SkPicture picture_; | 71 SkPicture picture_; |
| 71 // True when it is known that all output pixels will be opaque. | 72 // True when it is known that all output pixels will be opaque. |
| 72 bool layer_is_opaque_; | 73 bool layer_is_opaque_; |
| 73 | 74 |
| 74 DISALLOW_COPY_AND_ASSIGN(SkPictureContentLayerUpdater); | 75 DISALLOW_COPY_AND_ASSIGN(SkPictureContentLayerUpdater); |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 } // namespace cc | 78 } // namespace cc |
| 78 | 79 |
| 79 #endif // CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_ | 80 #endif // CC_RESOURCES_SKPICTURE_CONTENT_LAYER_UPDATER_H_ |
| OLD | NEW |