summaryrefslogtreecommitdiff
path: root/libs/input/SpriteController.h
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2020-06-02 01:01:26 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-06-02 01:01:26 +0000
commitb538f65845b13705cd119dfe77617b91aed112f0 (patch)
tree397b18a6bba64f4d9c4d4744aca03de6c34c380d /libs/input/SpriteController.h
parent3182d32da327f5c029325cffcc98a273a841b042 (diff)
parent38a831c1e32e1dec31be273a3ad079d36ee52f3f (diff)
Merge "Isolate SpriteIcon into its own file." am: 38a831c1e3
Original change: undetermined Change-Id: I136cf55c2fd1346dacb0774d8fb53383b2ae1202
Diffstat (limited to 'libs/input/SpriteController.h')
-rw-r--r--libs/input/SpriteController.h38
1 files changed, 2 insertions, 36 deletions
diff --git a/libs/input/SpriteController.h b/libs/input/SpriteController.h
index 79a904f5fe65..137b5646feae 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 @@ struct SpriteTransformationMatrix {
};
/*
- * 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 @@ private:
* 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),