Skip to content

Commit

Permalink
egl: Add support for BGRA_8888 format
Browse files Browse the repository at this point in the history
* Select with BOARD_USE_BGRA_8888 flag

Change-Id: I79a5a9edfef9c264eeeb9807797d03208f9bdbd7
  • Loading branch information
Alberto96 authored and intervigilium committed Jun 30, 2014
1 parent 974ff06 commit f2b2273
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions opengl/libs/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ ifneq ($(MAX_EGL_CACHE_SIZE),)
LOCAL_CFLAGS += -DMAX_EGL_CACHE_SIZE=$(MAX_EGL_CACHE_SIZE)
endif

ifeq ($(BOARD_USE_BGRA_8888),true)
LOCAL_CFLAGS += -DUSE_BGRA_8888=1
endif

LOCAL_REQUIRED_MODULES := $(egl.cfg_config_module)
egl.cfg_config_module :=

Expand Down
8 changes: 8 additions & 0 deletions opengl/libs/EGL/eglApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,13 +450,21 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
}
#else
// by default, just pick RGBA_8888
#ifdef USE_BGRA_8888
EGLine format = HAL_PIXEL_FORMAT_BGRA_8888;
#else
EGLint format = HAL_PIXEL_FORMAT_RGBA_8888;
#endif

EGLint a = 0;
cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_ALPHA_SIZE, &a);
if (a > 0) {
// alpha-channel requested, there's really only one suitable format
#ifdef USE_BGRA_8888
format = HAL_PIXEL_FORMAT_BGRA_8888;
#else
format = HAL_PIXEL_FORMAT_RGBA_8888;
#endif
} else {
EGLint r, g, b;
r = g = b = 0;
Expand Down

0 comments on commit f2b2273

Please sign in to comment.