summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chih-Chung Chang <chihchung@google.com> 2010-01-22 16:30:39 -0800
committer Chih-Chung Chang <chihchung@google.com> 2010-01-22 16:30:39 -0800
commitac127dc31bd071ed522f5cd48a910065756c8ded (patch)
treecfeba59fe0f2680256e38fb95a906e8b3ca5680b
parent7c45147f3537bc777a04545a6f0bc70550df5269 (diff)
Add support for 180/270 degrees rotation.
-rw-r--r--include/ui/ISurface.h5
-rw-r--r--libs/surfaceflinger/LayerBase.cpp19
2 files changed, 18 insertions, 6 deletions
diff --git a/include/ui/ISurface.h b/include/ui/ISurface.h
index b37a8ace6b2c..c7f181c7e56c 100644
--- a/include/ui/ISurface.h
+++ b/include/ui/ISurface.h
@@ -55,8 +55,11 @@ public:
class BufferHeap {
public:
enum {
- /* rotate source image 90 degrees */
+ /* rotate source image */
+ ROT_0 = 0,
ROT_90 = HAL_TRANSFORM_ROT_90,
+ ROT_180 = HAL_TRANSFORM_ROT_180,
+ ROT_270 = HAL_TRANSFORM_ROT_270,
};
BufferHeap();
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp
index 17db6f457397..4d7bef8da704 100644
--- a/libs/surfaceflinger/LayerBase.cpp
+++ b/libs/surfaceflinger/LayerBase.cpp
@@ -444,12 +444,21 @@ void LayerBase::drawWithOpenGL(const Region& clip, const Texture& texture) const
glLoadIdentity();
// the texture's source is rotated
- if (texture.transform == HAL_TRANSFORM_ROT_90) {
- // TODO: handle the other orientations
- glTranslatef(0, 1, 0);
- glRotatef(-90, 0, 0, 1);
+ switch (texture.transform) {
+ case HAL_TRANSFORM_ROT_90:
+ glTranslatef(0, 1, 0);
+ glRotatef(-90, 0, 0, 1);
+ break;
+ case HAL_TRANSFORM_ROT_180:
+ glTranslatef(1, 1, 0);
+ glRotatef(-180, 0, 0, 1);
+ break;
+ case HAL_TRANSFORM_ROT_270:
+ glTranslatef(1, 0, 0);
+ glRotatef(-270, 0, 0, 1);
+ break;
}
-
+
if (texture.NPOTAdjust) {
glScalef(texture.wScale, texture.hScale, 1.0f);
}