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

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: Small changes from reviews Created 5 years, 1 month 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 "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
30 // Loads the resource, calculates the sprite frame to display based on
31 // |completion_percentage|, draws the rectangles for the frame on top
32 // of the previous frame and sends to layer_ for display.
33 void DrawSpriteFrame(ui::ResourceManager* resource_manager,
34 int bitmap_res_id,
35 int metadata_res_id,
36 float completion_percentage);
37
38 // Layer overrides.
39 scoped_refptr<cc::Layer> layer() override;
40
41 protected:
42 CrushedSpriteLayer();
43 ~CrushedSpriteLayer() override;
44
45 private:
46 // Draws the rectangles for |frame| to |canvas|.
47 void DrawRectanglesForFrame(ui::CrushedSpriteResource* resource,
48 int frame,
49 skia::RefPtr<SkCanvas> canvas);
50
51 scoped_refptr<cc::UIResourceLayer> layer_;
52 int frame_count_;
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