diff options
Diffstat (limited to 'libs/hwui/OpenGLRenderer.h')
-rw-r--r-- | libs/hwui/OpenGLRenderer.h | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 12363360b65f..8a541fcf3a81 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -19,8 +19,32 @@ #include <SkXfermode.h> +#include <utils/RefBase.h> + +#include "Rect.h" + namespace android { +class Snapshot: public LightRefBase<Snapshot> { +public: + Snapshot() { } + + Snapshot(const sp<Snapshot> s): clipRect(s->clipRect), flags(0), previous(s) { } + + enum Flags { + kFlagClipSet = 0x1, + }; + + // Clipping rectangle at the time of this snapshot + Rect clipRect; + + // Dirty flags + int flags; + + // Previous snapshot in the frames stack + sp<Snapshot> previous; +}; // struct Snapshot + class OpenGLRenderer { public: OpenGLRenderer(); @@ -29,12 +53,32 @@ public: void setViewport(int width, int height); void prepare(); + int getSaveCount() const; + int save(int flags); + void restore(); + void restoreToCount(int saveCount); + + bool clipRect(float left, float top, float right, float bottom); + void drawColor(int color, SkXfermode::Mode mode); private: + int saveSnapshot(); + bool restoreSnapshot(); + + void setScissorFromClip(); + + // Dimensions of the drawing surface + int mWidth, mHeight; + // Matrix used for ortho projection in shaders float mOrthoMatrix[16]; -}; + + // Number of saved states + int mSaveCount; + // Current state + sp<Snapshot> mSnapshot; +}; // class OpenGLRenderer }; // namespace android |