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

Unified 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: Add TODO's for other planned tests 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/compositor/layer/crushed_sprite_layer.h
diff --git a/chrome/browser/android/compositor/layer/crushed_sprite_layer.h b/chrome/browser/android/compositor/layer/crushed_sprite_layer.h
new file mode 100644
index 0000000000000000000000000000000000000000..89e60ce1b0f6dde740d9f3d5792f317cd03966c5
--- /dev/null
+++ b/chrome/browser/android/compositor/layer/crushed_sprite_layer.h
@@ -0,0 +1,62 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CRUSHED_SPRITE_LAYER_H_
+#define CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CRUSHED_SPRITE_LAYER_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/android/compositor/layer/layer.h"
+
+namespace cc {
+class UIResourceLayer;
+}
+
+namespace ui {
+class CrushedSpriteResource;
+class ResourceManager;
+}
+
+namespace chrome {
+namespace android {
+
+// A layer which manages drawing frames from a CrushedSpriteResource into an
+// SkCanvas backed by an SkBitmap. The final SkBitmap is passed to a
+// UIResourceLayer for display.
+class CrushedSpriteLayer : public Layer {
+ public:
+ static scoped_refptr<CrushedSpriteLayer> Create(
+ ui::ResourceManager* resource_manager);
+
+ // Sets the CrushedSpriteResource to draw from.
+ void SetCrushedSpriteResource(
+ scoped_refptr<ui::CrushedSpriteResource> resource);
+
+ // Draws the rectangles for |sprite_frame| on top of the previous frame and
+ // sends to layer_ for display.
+ void DrawSpriteFrame(int sprite_frame);
+
+ // Layer overrides.
+ scoped_refptr<cc::Layer> layer() override;
+
+ protected:
+ explicit CrushedSpriteLayer(ui::ResourceManager* resource_manager);
+ ~CrushedSpriteLayer() override;
+
+ private:
+ // Draws the rectangles for |frame| to |canvas|.
+ void DrawRectanglesForFrame(int frame, SkCanvas* canvas);
+
+ ui::ResourceManager* resource_manager_;
+ scoped_refptr<cc::UIResourceLayer> layer_;
+ 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.
+ int previous_frame_;
+ SkBitmap previous_frame_bitmap_;
+
+ DISALLOW_COPY_AND_ASSIGN(CrushedSpriteLayer);
+};
+
+} // namespace android
+} // namespace chrome
+
+#endif // CHROME_BROWSER_ANDROID_COMPOSITOR_LAYER_CRUSHED_SPRITE_LAYER_H_

Powered by Google App Engine
This is Rietveld 408576698