summaryrefslogtreecommitdiffstats
path: root/libs/surfaceflinger/LayerBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/surfaceflinger/LayerBase.cpp')
-rw-r--r--libs/surfaceflinger/LayerBase.cpp37
1 files changed, 22 insertions, 15 deletions
diff --git a/libs/surfaceflinger/LayerBase.cpp b/libs/surfaceflinger/LayerBase.cpp
index 17c9f42..af353e2 100644
--- a/libs/surfaceflinger/LayerBase.cpp
+++ b/libs/surfaceflinger/LayerBase.cpp
@@ -30,7 +30,7 @@
#include "DisplayHardware/DisplayHardware.h"
-// We don't honor the premultipliad alpha flags, which means that
+// We don't honor the premultiplied alpha flags, which means that
// premultiplied surface may be composed using a non-premultiplied
// equation. We do this because it may be a lot faster on some hardware
// The correct value is HONOR_PREMULTIPLIED_ALPHA = 1
@@ -256,7 +256,7 @@ void LayerBase::validateVisibility(const Transform& planeTransform)
// see if we can/should use 2D h/w with the new configuration
mCanUseCopyBit = false;
- copybit_t* copybit = mFlinger->getBlitEngine();
+ copybit_device_t* copybit = mFlinger->getBlitEngine();
if (copybit) {
const int step = copybit->get(copybit, COPYBIT_ROTATION_STEP_DEG);
const int scaleBits = copybit->get(copybit, COPYBIT_SCALING_FRAC_BITS);
@@ -413,7 +413,7 @@ void LayerBase::drawWithOpenGL(const Region& clip,
// premultiplied alpha.
// If the texture doesn't have an alpha channel we can
- // use REPLACE and switch to non premultiplied-alpha
+ // use REPLACE and switch to non premultiplied alpha
// blending (SRCA/ONE_MINUS_SRCA).
GLenum env, src;
@@ -431,11 +431,11 @@ void LayerBase::drawWithOpenGL(const Region& clip,
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, env);
} else {
glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
+ glColor4x(0x10000, 0x10000, 0x10000, 0x10000);
if (needsBlending()) {
GLenum src = mPremultipliedAlpha ? GL_ONE : GL_SRC_ALPHA;
glEnable(GL_BLEND);
glBlendFunc(src, GL_ONE_MINUS_SRC_ALPHA);
- glColor4x(0x10000, 0x10000, 0x10000, 0x10000);
} else {
glDisable(GL_BLEND);
}
@@ -463,7 +463,7 @@ void LayerBase::drawWithOpenGL(const Region& clip,
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
if (!(mFlags & DisplayHardware::NPOT_EXTENSION)) {
- // find the smalest power-of-two that will accomodate our surface
+ // find the smallest power-of-two that will accommodate our surface
GLuint tw = 1 << (31 - clz(t.width));
GLuint th = 1 << (31 - clz(t.height));
if (tw < t.width) tw <<= 1;
@@ -556,7 +556,7 @@ void LayerBase::loadTexture(const Region& dirty,
GLuint texture_w = tw;
GLuint texture_h = th;
if (!(flags & DisplayHardware::NPOT_EXTENSION)) {
- // find the smalest power-of-two that will accomodate our surface
+ // find the smallest power-of-two that will accommodate our surface
texture_w = 1 << (31 - clz(t.width));
texture_h = 1 << (31 - clz(t.height));
if (texture_w < t.width) texture_w <<= 1;
@@ -582,6 +582,8 @@ void LayerBase::loadTexture(const Region& dirty,
glTexImage2D(GL_DIRECT_TEXTURE_2D_QUALCOMM, 0,
GL_RGBA, tw, th, 0,
GL_RGBA, GL_UNSIGNED_BYTE, t.data);
+ } else if (t.format == GGL_PIXEL_FORMAT_BGRA_8888) {
+ // TODO: add GL_BGRA extension
} else {
// oops, we don't handle this format, try the regular path
goto regular;
@@ -592,7 +594,7 @@ void LayerBase::loadTexture(const Region& dirty,
regular:
Rect bounds(dirty.bounds());
GLvoid* data = 0;
- if (texture_w!=textureWidth || texture_w!=textureHeight) {
+ if (texture_w!=textureWidth || texture_h!=textureHeight) {
// texture size changed, we need to create a new one
if (!textureWidth || !textureHeight) {
@@ -606,31 +608,36 @@ regular:
bounds.set(Rect(tw, th));
}
}
-
+
if (t.format == GGL_PIXEL_FORMAT_RGB_565) {
glTexImage2D(GL_TEXTURE_2D, 0,
- GL_RGB, tw, th, 0,
+ GL_RGB, texture_w, texture_h, 0,
GL_RGB, GL_UNSIGNED_SHORT_5_6_5, data);
} else if (t.format == GGL_PIXEL_FORMAT_RGBA_4444) {
glTexImage2D(GL_TEXTURE_2D, 0,
- GL_RGBA, tw, th, 0,
+ GL_RGBA, texture_w, texture_h, 0,
GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, data);
} else if (t.format == GGL_PIXEL_FORMAT_RGBA_8888) {
glTexImage2D(GL_TEXTURE_2D, 0,
- GL_RGBA, tw, th, 0,
+ GL_RGBA, texture_w, texture_h, 0,
GL_RGBA, GL_UNSIGNED_BYTE, data);
} else if ( t.format == GGL_PIXEL_FORMAT_YCbCr_422_SP ||
t.format == GGL_PIXEL_FORMAT_YCbCr_420_SP) {
// just show the Y plane of YUV buffers
data = t.data;
glTexImage2D(GL_TEXTURE_2D, 0,
- GL_LUMINANCE, tw, th, 0,
+ GL_LUMINANCE, texture_w, texture_h, 0,
GL_LUMINANCE, GL_UNSIGNED_BYTE, data);
+ } else {
+ // oops, we don't handle this format!
+ LOGE("layer %p, texture=%d, using format %d, which is not "
+ "supported by the GL", this, textureName, t.format);
+ textureName = -1;
}
- textureWidth = tw;
- textureHeight = th;
+ textureWidth = texture_w;
+ textureHeight = texture_h;
}
- if (!data) {
+ if (!data && textureName>=0) {
if (t.format == GGL_PIXEL_FORMAT_RGB_565) {
glTexSubImage2D(GL_TEXTURE_2D, 0,
0, bounds.top, t.width, bounds.height(),