OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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 CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CRUSHED_SPRITE_LAYER_H_ | |
6 #define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CRUSHED_SPRITE_LAYER_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "chrome/browser/android/compositor/layer/layer.h" | |
10 | |
11 namespace cc { | |
12 class UIResourceLayer; | |
13 } | |
14 | |
15 namespace ui { | |
16 class CrushedSpriteResource; | |
17 class ResourceManager; | |
18 } | |
19 | |
20 namespace chrome { | |
21 namespace android { | |
22 | |
23 // A layer which manages drawing frames from a CrushedSpriteResource into an | |
24 // SkCanvas backed by an SkBitmap. The final SkBitmap is passed to a | |
25 // UIResourceLayer for display. | |
26 class CrushedSpriteLayer : public Layer { | |
27 public: | |
28 static scoped_refptr<CrushedSpriteLayer> Create( | |
29 ui::ResourceManager* resource_manager); | |
30 | |
31 // Sets the CrushedSpriteResource to draw from. | |
32 void SetCrushedSpriteResource( | |
33 scoped_refptr<ui::CrushedSpriteResource> resource); | |
34 | |
35 // Draws the rectangles for |sprite_frame| on top of the previous frame and | |
36 // sends to layer_ for display. | |
37 void DrawSpriteFrame(int sprite_frame); | |
38 | |
39 // Layer overrides. | |
40 scoped_refptr<cc::Layer> layer() override; | |
41 | |
42 protected: | |
43 explicit CrushedSpriteLayer(ui::ResourceManager* resource_manager); | |
44 ~CrushedSpriteLayer() override; | |
45 | |
46 private: | |
47 // Draws the rectangles for |frame| to |canvas|. | |
48 void DrawRectanglesForFrame(int frame, SkCanvas* canvas); | |
49 | |
50 ui::ResourceManager* resource_manager_; | |
51 scoped_refptr<cc::UIResourceLayer> layer_; | |
52 scoped_refptr<ui::CrushedSpriteResource> resource_; | |
David Trainor- moved to gerrit
2015/10/15 21:04:57
I think nobody else holds onto resources. We set
Theresa
2015/10/24 00:06:45
Done.
| |
53 int previous_frame_; | |
54 SkBitmap previous_frame_bitmap_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(CrushedSpriteLayer); | |
57 }; | |
58 | |
59 } // namespace android | |
60 } // namespace chrome | |
61 | |
62 #endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CRUSHED_SPRITE_LAYER_H_ | |
OLD | NEW |