diff options
Diffstat (limited to 'libs/hwui/OpenGLRenderer.h')
| -rw-r--r-- | libs/hwui/OpenGLRenderer.h | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 8a541fc..595768c 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -17,24 +17,36 @@ #ifndef ANDROID_OPENGL_RENDERER_H #define ANDROID_OPENGL_RENDERER_H +#include <SkMatrix.h> #include <SkXfermode.h> #include <utils/RefBase.h> +#include "Matrix.h" #include "Rect.h" namespace android { +/////////////////////////////////////////////////////////////////////////////// +// Support +/////////////////////////////////////////////////////////////////////////////// + class Snapshot: public LightRefBase<Snapshot> { public: - Snapshot() { } + Snapshot() { + } - Snapshot(const sp<Snapshot> s): clipRect(s->clipRect), flags(0), previous(s) { } + Snapshot(const sp<Snapshot> s): transform(s->transform), clipRect(s->clipRect), + flags(0), previous(s) { + } enum Flags { kFlagClipSet = 0x1, }; + // Local transformations + mat4 transform; + // Clipping rectangle at the time of this snapshot Rect clipRect; @@ -45,6 +57,10 @@ public: sp<Snapshot> previous; }; // struct Snapshot +/////////////////////////////////////////////////////////////////////////////// +// Renderer +/////////////////////////////////////////////////////////////////////////////// + class OpenGLRenderer { public: OpenGLRenderer(); @@ -58,6 +74,14 @@ public: void restore(); void restoreToCount(int saveCount); + void translate(float dx, float dy); + void rotate(float degrees); + void scale(float sx, float sy); + + void setMatrix(SkMatrix* matrix); + void getMatrix(SkMatrix* matrix); + void concatMatrix(SkMatrix* matrix); + bool clipRect(float left, float top, float right, float bottom); void drawColor(int color, SkXfermode::Mode mode); @@ -76,6 +100,8 @@ private: // Number of saved states int mSaveCount; + // Base state + Snapshot mFirstSnapshot; // Current state sp<Snapshot> mSnapshot; }; // class OpenGLRenderer |
