OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_BITMAP_CONTENT_LAYER_UPDATER_H_ | |
6 #define CC_BITMAP_CONTENT_LAYER_UPDATER_H_ | |
7 | |
8 #include "cc/base/cc_export.h" | |
9 #include "cc/content_layer_updater.h" | |
10 | |
11 class SkCanvas; | |
12 | |
13 namespace cc { | |
14 | |
15 class LayerPainter; | |
16 | |
17 // This class rasterizes the content_rect into a skia bitmap canvas. It then | |
18 // updates textures by copying from the canvas into the texture, using | |
19 // MapSubImage if possible. | |
20 class CC_EXPORT BitmapContentLayerUpdater : public ContentLayerUpdater { | |
21 public: | |
22 class Resource : public LayerUpdater::Resource { | |
23 public: | |
24 Resource(BitmapContentLayerUpdater* updater, | |
25 scoped_ptr<PrioritizedResource> resource); | |
26 virtual ~Resource(); | |
27 | |
28 virtual void Update(ResourceUpdateQueue* queue, | |
29 gfx::Rect source_rect, | |
30 gfx::Vector2d dest_offset, | |
31 bool partial_update, | |
32 RenderingStats* stats) OVERRIDE; | |
33 | |
34 private: | |
35 BitmapContentLayerUpdater* updater_; | |
36 | |
37 DISALLOW_COPY_AND_ASSIGN(Resource); | |
38 }; | |
39 | |
40 static scoped_refptr<BitmapContentLayerUpdater> Create( | |
41 scoped_ptr<LayerPainter> painter); | |
42 | |
43 virtual scoped_ptr<LayerUpdater::Resource> CreateResource( | |
44 PrioritizedResourceManager* manager) OVERRIDE; | |
45 virtual void PrepareToUpdate(gfx::Rect content_rect, | |
46 gfx::Size tile_size, | |
47 float contents_width_scale, | |
48 float contents_height_scale, | |
49 gfx::Rect* resulting_opaque_rect, | |
50 RenderingStats* stats) OVERRIDE; | |
51 void UpdateTexture(ResourceUpdateQueue* queue, | |
52 PrioritizedResource* resource, | |
53 gfx::Rect source_rect, | |
54 gfx::Vector2d dest_offset, | |
55 bool partial_update); | |
56 | |
57 virtual void SetOpaque(bool opaque) OVERRIDE; | |
58 | |
59 protected: | |
60 explicit BitmapContentLayerUpdater(scoped_ptr<LayerPainter> painter); | |
61 virtual ~BitmapContentLayerUpdater(); | |
62 | |
63 scoped_ptr<SkCanvas> canvas_; | |
64 gfx::Size canvas_size_; | |
65 bool opaque_; | |
66 | |
67 DISALLOW_COPY_AND_ASSIGN(BitmapContentLayerUpdater); | |
68 }; | |
69 | |
70 } // namespace cc | |
71 | |
72 #endif // CC_BITMAP_CONTENT_LAYER_UPDATER_H_ | |
OLD | NEW |