Isolate SpriteIcon into its own file.
This is to isolate differences between internal master and AOSP so that
the open source intern can work on a relatively new project.
It also isolates a divergent piece of code into SpriteIcon.cpp.
Bug: None
Test: Pointer icons in ApiDemos still work.
Change-Id: I1bf8f23411ad7170de2497d6fee0f70b015e9b5f
Merged-In: I1bf8f23411ad7170de2497d6fee0f70b015e9b5f
diff --git a/libs/input/SpriteController.h b/libs/input/SpriteController.h
index 79a904f..137b564 100644
--- a/libs/input/SpriteController.h
+++ b/libs/input/SpriteController.h
@@ -22,7 +22,7 @@
#include <gui/SurfaceComposerClient.h>
-#include <SkBitmap.h>
+#include "SpriteIcon.h"
namespace android {
@@ -52,40 +52,6 @@
};
/*
- * Icon that a sprite displays, including its hotspot.
- */
-struct SpriteIcon {
- inline SpriteIcon() : style(0), hotSpotX(0), hotSpotY(0) { }
- inline SpriteIcon(const SkBitmap& bitmap, int32_t style, float hotSpotX, float hotSpotY) :
- bitmap(bitmap), style(style), hotSpotX(hotSpotX), hotSpotY(hotSpotY) { }
-
- SkBitmap bitmap;
- int32_t style;
- float hotSpotX;
- float hotSpotY;
-
- inline SpriteIcon copy() const {
- SkBitmap bitmapCopy;
- if (bitmapCopy.tryAllocPixels(bitmap.info().makeColorType(kN32_SkColorType))) {
- bitmap.readPixels(bitmapCopy.info(), bitmapCopy.getPixels(), bitmapCopy.rowBytes(),
- 0, 0);
- }
- return SpriteIcon(bitmapCopy, style, hotSpotX, hotSpotY);
- }
-
- inline void reset() {
- bitmap.reset();
- style = 0;
- hotSpotX = 0;
- hotSpotY = 0;
- }
-
- inline bool isValid() const {
- return !bitmap.isNull() && !bitmap.empty();
- }
-};
-
-/*
* A sprite is a simple graphical object that is displayed on-screen above other layers.
* The basic sprite class is an interface.
* The implementation is provided by the sprite controller.
@@ -183,7 +149,7 @@
* This structure is designed so that it can be copied during updates so that
* surfaces can be resized and redrawn without blocking the client by holding a lock
* on the sprites for a long time.
- * Note that the SkBitmap holds a reference to a shared (and immutable) pixel ref. */
+ * Note that the SpriteIcon holds a reference to a shared (and immutable) bitmap. */
struct SpriteState {
inline SpriteState() :
dirty(0), visible(false),