Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: chrome/browser/android/compositor/layer/crushed_sprite_layer.h

Issue 1337703002: [Contextual Search] Add support for crushed sprites and animate the search provider icon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes from last dtrainor@ review Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/browser/android/compositor/layer/layer.h"
11
12 namespace cc {
13 class UIResourceLayer;
14 }
15
16 namespace ui {
17 class CrushedSpriteResource;
18 class ResourceManager;
19 }
20
21 namespace chrome {
22 namespace android {
23
24 // A layer which manages drawing frames from a CrushedSpriteResource into an
25 // SkCanvas backed by an SkBitmap. The final SkBitmap is passed to a
26 // UIResourceLayer for display.
27 class CrushedSpriteLayer : public Layer {
28 public:
29 static scoped_refptr<CrushedSpriteLayer> Create(
30 ui::ResourceManager* resource_manager);
31
32 // Draws the rectangles for |sprite_frame| on top of the previous frame and
33 // sends to layer_ for display.
34 void DrawSpriteFrame(scoped_refptr<ui::CrushedSpriteResource> resource,
35 int sprite_frame);
36
37 // Layer overrides.
38 scoped_refptr<cc::Layer> layer() override;
39
40 protected:
41 explicit CrushedSpriteLayer(ui::ResourceManager* resource_manager);
42 ~CrushedSpriteLayer() override;
43
44 private:
45 // Draws the rectangles for |frame| to |canvas|.
46 void DrawRectanglesForFrame(
47 scoped_refptr<ui::CrushedSpriteResource> resource,
48 int frame,
49 skia::RefPtr<SkCanvas> canvas);
50
51 ui::ResourceManager* resource_manager_;
52 scoped_refptr<cc::UIResourceLayer> layer_;
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698