summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-07-21 16:17:55 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-07-21 16:17:53 -0400
commit9a56b267cd4a2430eedfb5ced3273d5ab399b7b9 (patch)
tree55fb92f24788fd90dae0fd9d5e53164d73bd18d9
parent736c63be3449c34678cd4f875b0f41105bb827c7 (diff)
downloadefl-9a56b267cd4a2430eedfb5ced3273d5ab399b7b9.tar.gz
evas sw x11: formatting
-rw-r--r--src/modules/evas/engines/software_x11/evas_engine.c56
-rw-r--r--src/modules/evas/engines/software_x11/evas_x_egl.c137
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_buffer.c413
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_color.c329
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_dri_image.c310
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_image.c15
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_main.c1
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_outbuf.c1034
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_swapbuf.c174
-rw-r--r--src/modules/evas/engines/software_x11/evas_xlib_swapper.c175
10 files changed, 1317 insertions, 1327 deletions
diff --git a/src/modules/evas/engines/software_x11/evas_engine.c b/src/modules/evas/engines/software_x11/evas_engine.c
index 29ece83cb5..81631c96b9 100644
--- a/src/modules/evas/engines/software_x11/evas_engine.c
+++ b/src/modules/evas/engines/software_x11/evas_engine.c
@@ -24,8 +24,8 @@
#include <Ecore.h>
#include <Eina.h>
-Evas_Native_Tbm_Surface_Image_Set_Call glsym__evas_native_tbm_surface_image_set = NULL;
-Evas_Native_Tbm_Surface_Stride_Get_Call glsym__evas_native_tbm_surface_stride_get = NULL;
+Evas_Native_Tbm_Surface_Image_Set_Call glsym__evas_native_tbm_surface_image_set = NULL;
+Evas_Native_Tbm_Surface_Stride_Get_Call glsym__evas_native_tbm_surface_stride_get = NULL;
int _evas_engine_soft_x11_log_dom = -1;
/* function tables - filled in later (func and parent func) */
@@ -37,9 +37,10 @@ typedef struct _Render_Engine Render_Engine;
struct _Render_Engine
{
Render_Engine_Software_Generic generic;
- Eina_Bool (*outbuf_alpha_get)(Outbuf *ob);
+ Eina_Bool (*outbuf_alpha_get)(Outbuf *ob);
- struct {
+ struct
+ {
void *disp;
void *config;
void *surface;
@@ -47,9 +48,9 @@ struct _Render_Engine
};
/* prototypes we will use here */
-static void *_best_visual_get(int backend, void *connection, int screen);
+static void *_best_visual_get(int backend, void *connection, int screen);
static unsigned int _best_colormap_get(int backend, void *connection, int screen);
-static int _best_depth_get(int backend, void *connection, int screen);
+static int _best_depth_get(int backend, void *connection, int screen);
static Eina_List *_outbufs = NULL;
@@ -129,7 +130,7 @@ _output_xlib_setup(int w, int h, int rot, Display *disp, Drawable draw,
return re;
- on_error:
+on_error:
if (ob) evas_software_xlib_outbuf_free(ob);
free(re);
return NULL;
@@ -175,7 +176,7 @@ _output_swapbuf_setup(int w, int h, int rot, Display *disp, Drawable draw,
goto on_error;
return re;
- on_error:
+on_error:
if (ob) evas_software_xlib_swapbuf_free(ob);
free(re);
return NULL;
@@ -220,7 +221,7 @@ _symbols(void)
if (done) return;
#define LINK2GENERIC(sym) \
- glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
+ glsym_##sym = dlsym(RTLD_DEFAULT, #sym);
// Get function pointer to native_common that is now provided through the link of SW_Generic.
LINK2GENERIC(_evas_native_tbm_surface_image_set);
@@ -264,7 +265,7 @@ eng_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h)
Evas_Engine_Info_Software_X11 *info = in;
Render_Engine *re = NULL;
static int try_swapbuf = -1;
- char* s;
+ char *s;
if (info->info.backend != EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB)
return NULL;
@@ -304,7 +305,7 @@ eng_setup(void *engine EINA_UNUSED, void *in, unsigned int w, unsigned int h)
re->outbuf_alpha_get = evas_software_xlib_outbuf_alpha_get;
}
- _outbufs = eina_list_append(_outbufs, re->generic.ob);
+ _outbufs = eina_list_append(_outbufs, re->generic.ob);
return re;
}
@@ -363,7 +364,7 @@ eng_update(void *engine EINA_UNUSED, void *data, void *in, unsigned int w, unsig
evas_render_engine_software_generic_update(&re->generic, ob, w, h);
}
- _outbufs = eina_list_append(_outbufs, re->generic.ob);
+ _outbufs = eina_list_append(_outbufs, re->generic.ob);
return 1;
}
@@ -389,7 +390,7 @@ eng_canvas_alpha_get(void *engine)
re = (Render_Engine *)engine;
return (re->generic.ob->priv.destination_alpha) ||
- (re->outbuf_alpha_get(re->generic.ob));
+ (re->outbuf_alpha_get(re->generic.ob));
}
static void
@@ -398,10 +399,10 @@ _native_evasgl_free(void *image)
RGBA_Image *im = image;
Native *n = im->native.data;
- im->native.data = NULL;
- im->native.func.bind = NULL;
+ im->native.data = NULL;
+ im->native.func.bind = NULL;
im->native.func.unbind = NULL;
- im->native.func.free = NULL;
+ im->native.func.free = NULL;
//im->image.data = NULL;
free(n);
}
@@ -414,10 +415,12 @@ eng_image_native_init(void *engine EINA_UNUSED, Evas_Native_Surface_Type type)
#ifdef GL_GLES
case EVAS_NATIVE_SURFACE_TBM:
return _evas_native_tbm_init();
+
#endif
case EVAS_NATIVE_SURFACE_X11:
case EVAS_NATIVE_SURFACE_EVASGL:
return 1;
+
default:
ERR("Native surface type %d not supported!", type);
return 0;
@@ -433,10 +436,12 @@ eng_image_native_shutdown(void *engine EINA_UNUSED, Evas_Native_Surface_Type typ
case EVAS_NATIVE_SURFACE_TBM:
_evas_native_tbm_shutdown();
return;
+
#endif
case EVAS_NATIVE_SURFACE_X11:
case EVAS_NATIVE_SURFACE_OPENGL:
return;
+
default:
ERR("Native surface type %d not supported!", type);
return;
@@ -496,8 +501,8 @@ eng_image_native_set(void *engine, void *image, void *native)
{
stride = glsym__evas_native_tbm_surface_stride_get(re->generic.ob, ns);
ie2 = evas_cache_image_copied_data(evas_common_image_cache_get(),
- stride, ie->h, NULL, ie->flags.alpha,
- EVAS_COLORSPACE_ARGB8888);
+ stride, ie->h, NULL, ie->flags.alpha,
+ EVAS_COLORSPACE_ARGB8888);
}
else
ie2 = evas_cache_image_data(evas_common_image_cache_get(),
@@ -515,15 +520,15 @@ eng_image_native_set(void *engine, void *image, void *native)
evas_cache2_image_close(ie);
else
#endif
- evas_cache_image_drop(ie);
+ evas_cache_image_drop(ie);
ie = ie2;
if (ns->type == EVAS_NATIVE_SURFACE_X11)
{
RGBA_Image *ret_im = NULL;
ret_im = evas_xlib_image_dri_native_set(re->generic.ob, ie, ns);
- if (!ret_im)
- ret_im = evas_xlib_image_native_set(re->generic.ob, ie, ns);
+ if (!ret_im)
+ ret_im = evas_xlib_image_native_set(re->generic.ob, ie, ns);
return ret_im;
}
else if (ns->type == EVAS_NATIVE_SURFACE_TBM)
@@ -537,7 +542,7 @@ eng_image_native_set(void *engine, void *image, void *native)
if (n)
{
n->ns_data.evasgl.surface = ns->data.evasgl.surface;
- im = (RGBA_Image *) ie;
+ im = (RGBA_Image *)ie;
n->ns.type = EVAS_NATIVE_SURFACE_EVASGL;
n->ns.version = EVAS_NATIVE_SURFACE_VERSION;
n->ns.data.evasgl.surface = ns->data.evasgl.surface;
@@ -562,7 +567,6 @@ eng_image_native_get(void *engine EINA_UNUSED, void *image)
return &(n->ns);
}
-
/* module advertising code */
static int
module_open(Evas_Module *em)
@@ -572,7 +576,7 @@ module_open(Evas_Module *em)
/* get whatever engine module we inherit from */
if (!_evas_module_engine_inherit(&pfunc, "software_generic")) return 0;
- _evas_engine_soft_x11_log_dom =
+ _evas_engine_soft_x11_log_dom =
eina_log_domain_register("evas-software_x11", EVAS_DEFAULT_LOG_COLOR);
if (_evas_engine_soft_x11_log_dom < 0)
@@ -617,8 +621,8 @@ static Evas_Module_Api evas_modapi =
{
EVAS_MODULE_API_VERSION, "software_x11", "none",
{
- module_open,
- module_close
+ module_open,
+ module_close
}
};
diff --git a/src/modules/evas/engines/software_x11/evas_x_egl.c b/src/modules/evas/engines/software_x11/evas_x_egl.c
index 95b4e2419e..9b2cde3ac9 100644
--- a/src/modules/evas/engines/software_x11/evas_x_egl.c
+++ b/src/modules/evas/engines/software_x11/evas_x_egl.c
@@ -9,7 +9,7 @@
#include "evas_macros.h"
#ifdef HAVE_DLSYM
-# include <dlfcn.h> /* dlopen,dlclose,etc */
+# include <dlfcn.h> /* dlopen,dlclose,etc */
#else
# undef BUILD_ENGINE_SOFTWARE_XLIB
#endif
@@ -17,19 +17,19 @@
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
#include "evas_x_egl.h"
-#define EGL_SURFACE_TYPE 0x3033
-#define EGL_WINDOW_BIT 0x0004
-#define EGL_RENDERABLE_TYPE 0x3040
-#define EGL_ALPHA_SIZE 0x3021
-#define EGL_BLUE_SIZE 0x3022
-#define EGL_GREEN_SIZE 0x3023
-#define EGL_RED_SIZE 0x3024
-#define EGL_DEPTH_SIZE 0x3025
-#define EGL_STENCIL_SIZE 0x3026
-#define EGL_SURFACE_TYPE 0x3033
-#define EGL_NONE 0x3038
-#define EGL_FALSE 0
-#define EGL_TRUE 1
+#define EGL_SURFACE_TYPE 0x3033
+#define EGL_WINDOW_BIT 0x0004
+#define EGL_RENDERABLE_TYPE 0x3040
+#define EGL_ALPHA_SIZE 0x3021
+#define EGL_BLUE_SIZE 0x3022
+#define EGL_GREEN_SIZE 0x3023
+#define EGL_RED_SIZE 0x3024
+#define EGL_DEPTH_SIZE 0x3025
+#define EGL_STENCIL_SIZE 0x3026
+#define EGL_SURFACE_TYPE 0x3033
+#define EGL_NONE 0x3038
+#define EGL_FALSE 0
+#define EGL_TRUE 1
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
@@ -56,22 +56,23 @@
static int egl_found = -1;
static void *egl_lib = NULL;
-static struct {
- void * (*GetProcAddress) (const char *name);
- void * (*GetDisplay) (void *d);
- unsigned int (*Initialize) (void *ed, int *vmaj, int *vmin);
- unsigned int (*Terminate) (void *ed);
- const char * (*QueryString) (void *ed, int name);
- unsigned int (*ChooseConfig) (void *ed, int *attr, void **configs, int config_size, int *num_config);
- unsigned int (*GetConfigAttrib) (void *ed, void *config, int attr, int *val);
- unsigned int (*QuerySurface) (void *ed, void *surf, int attr, int *val);
- void * (*CreateWindowSurface) (void *ed, void *config, Window win, int *attr);
- unsigned int (*DestroySurface) (void *ed, void *surf);
- unsigned int (*SwapBuffers) (void *ed, void *surf);
- unsigned int (*SwapInterval) (void *ed, int interval);
-
- unsigned int (*LockSurface) (void *ed, void *surf, int *attr);
- unsigned int (*UnlockSurface) (void *ed, void *surf);
+static struct
+{
+ void * (*GetProcAddress)(const char *name);
+ void * (*GetDisplay)(void *d);
+ unsigned int (*Initialize)(void *ed, int *vmaj, int *vmin);
+ unsigned int (*Terminate)(void *ed);
+ const char * (*QueryString)(void *ed, int name);
+ unsigned int (*ChooseConfig)(void *ed, int *attr, void **configs, int config_size, int *num_config);
+ unsigned int (*GetConfigAttrib)(void *ed, void *config, int attr, int *val);
+ unsigned int (*QuerySurface)(void *ed, void *surf, int attr, int *val);
+ void * (*CreateWindowSurface)(void *ed, void *config, Window win, int *attr);
+ unsigned int (*DestroySurface)(void *ed, void *surf);
+ unsigned int (*SwapBuffers)(void *ed, void *surf);
+ unsigned int (*SwapInterval)(void *ed, int interval);
+
+ unsigned int (*LockSurface)(void *ed, void *surf, int *attr);
+ unsigned int (*UnlockSurface)(void *ed, void *surf);
} egl;
static int
@@ -86,31 +87,32 @@ _egl_find(void)
}
if (!(egl.GetProcAddress = dlsym(egl_lib, "eglGetProcAddress"))) goto err;
-#define SYM(x, y) if (!(egl.x = egl.GetProcAddress(y))) goto err
+#define SYM(x, y) if (!(egl.x = egl.GetProcAddress(y))) \
+ goto err
// core syms used
- SYM(GetDisplay , "eglGetDisplay");
- SYM(Initialize, "eglInitialize");
- SYM(Terminate, "eglTerminate");
- SYM(QueryString, "eglQueryString");
- SYM(ChooseConfig, "eglChooseConfig");
- SYM(UnlockSurface, "eglGetConfigAttrib");
- SYM(QuerySurface, "eglQuerySurface");
+ SYM(GetDisplay, "eglGetDisplay");
+ SYM(Initialize, "eglInitialize");
+ SYM(Terminate, "eglTerminate");
+ SYM(QueryString, "eglQueryString");
+ SYM(ChooseConfig, "eglChooseConfig");
+ SYM(UnlockSurface, "eglGetConfigAttrib");
+ SYM(QuerySurface, "eglQuerySurface");
SYM(CreateWindowSurface, "eglCreateWindowSurface");
- SYM(DestroySurface, "eglDestroySurface");
- SYM(SwapBuffers, "eglSwapBuffers");
- SYM(SwapInterval, "eglSwapInterval");
+ SYM(DestroySurface, "eglDestroySurface");
+ SYM(SwapBuffers, "eglSwapBuffers");
+ SYM(SwapInterval, "eglSwapInterval");
#undef SYM
#define SYM(x, y) egl.x = egl.GetProcAddress(y)
-// extns
+// extns
SYM(LockSurface, "eglLockSurface");
if (!egl.LockSurface) SYM(LockSurface, "eglLockSurfaceKHR");
SYM(UnlockSurface, "eglUnlockSurface");
if (!egl.UnlockSurface) SYM(UnlockSurface, "eglUnlockSurfaceKHR");
-
+
if (!egl.LockSurface) goto err;
if (!egl.UnlockSurface) goto err;
-
+
egl_found = 1;
return 1;
err:
@@ -118,6 +120,7 @@ err:
egl_lib = NULL;
return 0;
}
+
#endif
void *
@@ -163,7 +166,7 @@ _egl_x_disp_choose_config(void *ed)
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
int config_attrs[40], n = 0, num_config = 0;
void *eglconfig = NULL;
-
+
if (!_egl_find()) return NULL;
config_attrs[n++] = EGL_SURFACE_TYPE;
config_attrs[n++] = EGL_WINDOW_BIT;
@@ -183,9 +186,9 @@ _egl_x_disp_choose_config(void *ed)
config_attrs[n++] = EGL_LOCK_SURFACE_BIT_KHR;
config_attrs[n++] = EGL_MATCH_FORMAT_KHR;
config_attrs[n++] = EGL_FORMAT_RGBA_8888_KHR;
-
+
config_attrs[n++] = EGL_NONE;
-
+
if (!egl.ChooseConfig(ed, config_attrs, &eglconfig, 1, &num_config))
return NULL;
return eglconfig;
@@ -202,6 +205,7 @@ _egl_x_win_surf_new(void *ed, Window win, void *config)
if (!_egl_find()) return NULL;
return egl.CreateWindowSurface(ed, config, win, NULL);
}
+
#endif
void
@@ -222,17 +226,17 @@ _egl_x_surf_map(void *ed, void *surf, int *stride)
#ifdef BUILD_ENGINE_SOFTWARE_XLIB
int config_attrs[40], n = 0;
void *ptr = NULL;
- int pitch = 0, origin = 0;
+ int pitch = 0, origin = 0;
int r_offset = 0, g_offset = 0, b_offset = 0;
-
+
if (!_egl_find()) return NULL;
-
+
config_attrs[n++] = EGL_MAP_PRESERVE_PIXELS_KHR;
config_attrs[n++] = EGL_TRUE;
config_attrs[n++] = EGL_LOCK_USAGE_HINT_KHR;
config_attrs[n++] = EGL_READ_SURFACE_BIT_KHR | EGL_WRITE_SURFACE_BIT_KHR;
config_attrs[n++] = EGL_NONE;
-
+
if (!egl.LockSurface(ed, surf, config_attrs)) return NULL;
if (!egl.QuerySurface(ed, surf, EGL_BITMAP_POINTER_KHR, (int *)&ptr)) goto err;
if (!egl.QuerySurface(ed, surf, EGL_BITMAP_PITCH_KHR, &pitch)) goto err;
@@ -240,7 +244,7 @@ _egl_x_surf_map(void *ed, void *surf, int *stride)
if (!egl.QuerySurface(ed, surf, EGL_BITMAP_PIXEL_RED_OFFSET_KHR, &r_offset)) goto err;
if (!egl.QuerySurface(ed, surf, EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR, &g_offset)) goto err;
if (!egl.QuerySurface(ed, surf, EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR, &b_offset)) goto err;
-
+
if (!ptr) goto err;
if (pitch <= 0) goto err;
// must be top-left to bottom-right ordered
@@ -294,20 +298,21 @@ evas_software_egl_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
int grayscale, int max_colors, Pixmap mask,
int shape_dither, int destination_alpha)
{
- (void) w;
- (void) h;
- (void) rot;
- (void) depth;
- (void) draw;
- (void) cmap;
- (void) x_depth;
- (void) grayscale;
- (void) max_colors;
- (void) mask;
- (void) shape_dither;
- (void) destination_alpha;
- (void) disp;
- (void) vis;
+ (void)w;
+ (void)h;
+ (void)rot;
+ (void)depth;
+ (void)draw;
+ (void)cmap;
+ (void)x_depth;
+ (void)grayscale;
+ (void)max_colors;
+ (void)mask;
+ (void)shape_dither;
+ (void)destination_alpha;
+ (void)disp;
+ (void)vis;
return NULL;
}
+
#endif
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_buffer.c b/src/modules/evas/engines/software_x11/evas_xlib_buffer.c
index b88571d8a1..d4b082540a 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_buffer.c
+++ b/src/modules/evas/engines/software_x11/evas_xlib_buffer.c
@@ -18,43 +18,43 @@ evas_software_xlib_x_write_mask_line(Outbuf *buf, X_Output_Buffer *xob, DATA32 *
w -= 7;
if (buf->priv.x11.xlib.bit_swap)
{
- for (x = 0; x < w; x += 8)
- {
- *dst_ptr =
- ((A_VAL(&(src_ptr[0])) >> 7) << 7) |
- ((A_VAL(&(src_ptr[1])) >> 7) << 6) |
- ((A_VAL(&(src_ptr[2])) >> 7) << 5) |
- ((A_VAL(&(src_ptr[3])) >> 7) << 4) |
- ((A_VAL(&(src_ptr[4])) >> 7) << 3) |
- ((A_VAL(&(src_ptr[5])) >> 7) << 2) |
- ((A_VAL(&(src_ptr[6])) >> 7) << 1) |
- ((A_VAL(&(src_ptr[7])) >> 7) << 0);
- src_ptr += 8;
- dst_ptr++;
- }
+ for (x = 0; x < w; x += 8)
+ {
+ *dst_ptr =
+ ((A_VAL(&(src_ptr[0])) >> 7) << 7) |
+ ((A_VAL(&(src_ptr[1])) >> 7) << 6) |
+ ((A_VAL(&(src_ptr[2])) >> 7) << 5) |
+ ((A_VAL(&(src_ptr[3])) >> 7) << 4) |
+ ((A_VAL(&(src_ptr[4])) >> 7) << 3) |
+ ((A_VAL(&(src_ptr[5])) >> 7) << 2) |
+ ((A_VAL(&(src_ptr[6])) >> 7) << 1) |
+ ((A_VAL(&(src_ptr[7])) >> 7) << 0);
+ src_ptr += 8;
+ dst_ptr++;
+ }
}
else
{
- for (x = 0; x < w; x += 8)
- {
- *dst_ptr =
- ((A_VAL(&(src_ptr[0])) >> 7) << 0) |
- ((A_VAL(&(src_ptr[1])) >> 7) << 1) |
- ((A_VAL(&(src_ptr[2])) >> 7) << 2) |
- ((A_VAL(&(src_ptr[3])) >> 7) << 3) |
- ((A_VAL(&(src_ptr[4])) >> 7) << 4) |
- ((A_VAL(&(src_ptr[5])) >> 7) << 5) |
- ((A_VAL(&(src_ptr[6])) >> 7) << 6) |
- ((A_VAL(&(src_ptr[7])) >> 7) << 7);
- src_ptr += 8;
- dst_ptr++;
- }
+ for (x = 0; x < w; x += 8)
+ {
+ *dst_ptr =
+ ((A_VAL(&(src_ptr[0])) >> 7) << 0) |
+ ((A_VAL(&(src_ptr[1])) >> 7) << 1) |
+ ((A_VAL(&(src_ptr[2])) >> 7) << 2) |
+ ((A_VAL(&(src_ptr[3])) >> 7) << 3) |
+ ((A_VAL(&(src_ptr[4])) >> 7) << 4) |
+ ((A_VAL(&(src_ptr[5])) >> 7) << 5) |
+ ((A_VAL(&(src_ptr[6])) >> 7) << 6) |
+ ((A_VAL(&(src_ptr[7])) >> 7) << 7);
+ src_ptr += 8;
+ dst_ptr++;
+ }
}
w += 7;
- for (; x < w; x ++)
+ for (; x < w; x++)
{
- XPutPixel(xob->xim, x, y, A_VAL(src_ptr) >> 7);
- src_ptr++;
+ XPutPixel(xob->xim, x, y, A_VAL(src_ptr) >> 7);
+ src_ptr++;
}
}
@@ -72,49 +72,49 @@ evas_software_xlib_x_write_mask_line_rev(Outbuf *buf, X_Output_Buffer *xob, DATA
w -= 7;
if (buf->priv.x11.xlib.bit_swap)
{
- for (x = 0; x < w; x += 8)
- {
- *dst_ptr =
- ((A_VAL(&(src_ptr[ 0])) >> 7) << 7) |
- ((A_VAL(&(src_ptr[-1])) >> 7) << 6) |
- ((A_VAL(&(src_ptr[-2])) >> 7) << 5) |
- ((A_VAL(&(src_ptr[-3])) >> 7) << 4) |
- ((A_VAL(&(src_ptr[-4])) >> 7) << 3) |
- ((A_VAL(&(src_ptr[-5])) >> 7) << 2) |
- ((A_VAL(&(src_ptr[-6])) >> 7) << 1) |
- ((A_VAL(&(src_ptr[-7])) >> 7) << 0);
- src_ptr -= 8;
- dst_ptr++;
- }
+ for (x = 0; x < w; x += 8)
+ {
+ *dst_ptr =
+ ((A_VAL(&(src_ptr[ 0])) >> 7) << 7) |
+ ((A_VAL(&(src_ptr[-1])) >> 7) << 6) |
+ ((A_VAL(&(src_ptr[-2])) >> 7) << 5) |
+ ((A_VAL(&(src_ptr[-3])) >> 7) << 4) |
+ ((A_VAL(&(src_ptr[-4])) >> 7) << 3) |
+ ((A_VAL(&(src_ptr[-5])) >> 7) << 2) |
+ ((A_VAL(&(src_ptr[-6])) >> 7) << 1) |
+ ((A_VAL(&(src_ptr[-7])) >> 7) << 0);
+ src_ptr -= 8;
+ dst_ptr++;
+ }
}
else
{
- for (x = 0; x < w; x += 8)
- {
- *dst_ptr =
- ((A_VAL(&(src_ptr[ 0])) >> 7) << 0) |
- ((A_VAL(&(src_ptr[-1])) >> 7) << 1) |
- ((A_VAL(&(src_ptr[-2])) >> 7) << 2) |
- ((A_VAL(&(src_ptr[-3])) >> 7) << 3) |
- ((A_VAL(&(src_ptr[-4])) >> 7) << 4) |
- ((A_VAL(&(src_ptr[-5])) >> 7) << 5) |
- ((A_VAL(&(src_ptr[-6])) >> 7) << 6) |
- ((A_VAL(&(src_ptr[-7])) >> 7) << 7);
- src_ptr -= 8;
- dst_ptr++;
- }
+ for (x = 0; x < w; x += 8)
+ {
+ *dst_ptr =
+ ((A_VAL(&(src_ptr[ 0])) >> 7) << 0) |
+ ((A_VAL(&(src_ptr[-1])) >> 7) << 1) |
+ ((A_VAL(&(src_ptr[-2])) >> 7) << 2) |
+ ((A_VAL(&(src_ptr[-3])) >> 7) << 3) |
+ ((A_VAL(&(src_ptr[-4])) >> 7) << 4) |
+ ((A_VAL(&(src_ptr[-5])) >> 7) << 5) |
+ ((A_VAL(&(src_ptr[-6])) >> 7) << 6) |
+ ((A_VAL(&(src_ptr[-7])) >> 7) << 7);
+ src_ptr -= 8;
+ dst_ptr++;
+ }
}
w += 7;
- for (; x < w; x ++)
+ for (; x < w; x++)
{
- XPutPixel(xob->xim, x, y, A_VAL(src_ptr) >> 7);
- src_ptr--;
+ XPutPixel(xob->xim, x, y, A_VAL(src_ptr) >> 7);
+ src_ptr--;
}
}
void
-evas_software_xlib_x_write_mask_line_vert(Outbuf *buf, X_Output_Buffer *xob,
- DATA32 *src,
+evas_software_xlib_x_write_mask_line_vert(Outbuf *buf, X_Output_Buffer *xob,
+ DATA32 *src,
int h, int ym, int w)
{
int y;
@@ -128,49 +128,49 @@ evas_software_xlib_x_write_mask_line_vert(Outbuf *buf, X_Output_Buffer *xob,
h -= 7;
if (buf->priv.x11.xlib.bit_swap)
{
- for (y = 0; y < h; y += 8)
- {
- *dst_ptr =
- ((A_VAL(&(src_ptr[0 * w])) >> 7) << 7) |
- ((A_VAL(&(src_ptr[1 * w])) >> 7) << 6) |
- ((A_VAL(&(src_ptr[2 * w])) >> 7) << 5) |
- ((A_VAL(&(src_ptr[3 * w])) >> 7) << 4) |
- ((A_VAL(&(src_ptr[4 * w])) >> 7) << 3) |
- ((A_VAL(&(src_ptr[5 * w])) >> 7) << 2) |
- ((A_VAL(&(src_ptr[6 * w])) >> 7) << 1) |
- ((A_VAL(&(src_ptr[7 * w])) >> 7) << 0);
- src_ptr += 8 * w;
- dst_ptr++;
- }
+ for (y = 0; y < h; y += 8)
+ {
+ *dst_ptr =
+ ((A_VAL(&(src_ptr[0 * w])) >> 7) << 7) |
+ ((A_VAL(&(src_ptr[1 * w])) >> 7) << 6) |
+ ((A_VAL(&(src_ptr[2 * w])) >> 7) << 5) |
+ ((A_VAL(&(src_ptr[3 * w])) >> 7) << 4) |
+ ((A_VAL(&(src_ptr[4 * w])) >> 7) << 3) |
+ ((A_VAL(&(src_ptr[5 * w])) >> 7) << 2) |
+ ((A_VAL(&(src_ptr[6 * w])) >> 7) << 1) |
+ ((A_VAL(&(src_ptr[7 * w])) >> 7) << 0);
+ src_ptr += 8 * w;
+ dst_ptr++;
+ }
}
else
{
- for (y = 0; y < h; y += 8)
- {
- *dst_ptr =
- ((A_VAL(&(src_ptr[0 * w])) >> 7) << 0) |
- ((A_VAL(&(src_ptr[1 * w])) >> 7) << 1) |
- ((A_VAL(&(src_ptr[2 * w])) >> 7) << 2) |
- ((A_VAL(&(src_ptr[3 * w])) >> 7) << 3) |
- ((A_VAL(&(src_ptr[4 * w])) >> 7) << 4) |
- ((A_VAL(&(src_ptr[5 * w])) >> 7) << 5) |
- ((A_VAL(&(src_ptr[6 * w])) >> 7) << 6) |
- ((A_VAL(&(src_ptr[7 * w])) >> 7) << 7);
- src_ptr += 8 * w;
- dst_ptr++;
- }
+ for (y = 0; y < h; y += 8)
+ {
+ *dst_ptr =
+ ((A_VAL(&(src_ptr[0 * w])) >> 7) << 0) |
+ ((A_VAL(&(src_ptr[1 * w])) >> 7) << 1) |
+ ((A_VAL(&(src_ptr[2 * w])) >> 7) << 2) |
+ ((A_VAL(&(src_ptr[3 * w])) >> 7) << 3) |
+ ((A_VAL(&(src_ptr[4 * w])) >> 7) << 4) |
+ ((A_VAL(&(src_ptr[5 * w])) >> 7) << 5) |
+ ((A_VAL(&(src_ptr[6 * w])) >> 7) << 6) |
+ ((A_VAL(&(src_ptr[7 * w])) >> 7) << 7);
+ src_ptr += 8 * w;
+ dst_ptr++;
+ }
}
h += 7;
- for (; y < h; y ++)
+ for (; y < h; y++)
{
- XPutPixel(xob->xim, y, ym, A_VAL(src_ptr) >> 7);
- src_ptr += w;
+ XPutPixel(xob->xim, y, ym, A_VAL(src_ptr) >> 7);
+ src_ptr += w;
}
}
void
-evas_software_xlib_x_write_mask_line_vert_rev(Outbuf *buf, X_Output_Buffer *xob,
- DATA32 *src,
+evas_software_xlib_x_write_mask_line_vert_rev(Outbuf *buf, X_Output_Buffer *xob,
+ DATA32 *src,
int h, int ym, int w)
{
int y;
@@ -184,43 +184,43 @@ evas_software_xlib_x_write_mask_line_vert_rev(Outbuf *buf, X_Output_Buffer *xob,
h -= 7;
if (buf->priv.x11.xlib.bit_swap)
{
- for (y = 0; y < h; y += 8)
- {
- *dst_ptr =
- ((A_VAL(&(src_ptr[ 0 * w])) >> 7) << 7) |
- ((A_VAL(&(src_ptr[-1 * w])) >> 7) << 6) |
- ((A_VAL(&(src_ptr[-2 * w])) >> 7) << 5) |
- ((A_VAL(&(src_ptr[-3 * w])) >> 7) << 4) |
- ((A_VAL(&(src_ptr[-4 * w])) >> 7) << 3) |
- ((A_VAL(&(src_ptr[-5 * w])) >> 7) << 2) |
- ((A_VAL(&(src_ptr[-6 * w])) >> 7) << 1) |
- ((A_VAL(&(src_ptr[-7 * w])) >> 7) << 0);
- src_ptr -= 8 * w;
- dst_ptr++;
- }
+ for (y = 0; y < h; y += 8)
+ {
+ *dst_ptr =
+ ((A_VAL(&(src_ptr[ 0 * w])) >> 7) << 7) |
+ ((A_VAL(&(src_ptr[-1 * w])) >> 7) << 6) |
+ ((A_VAL(&(src_ptr[-2 * w])) >> 7) << 5) |
+ ((A_VAL(&(src_ptr[-3 * w])) >> 7) << 4) |
+ ((A_VAL(&(src_ptr[-4 * w])) >> 7) << 3) |
+ ((A_VAL(&(src_ptr[-5 * w])) >> 7) << 2) |
+ ((A_VAL(&(src_ptr[-6 * w])) >> 7) << 1) |
+ ((A_VAL(&(src_ptr[-7 * w])) >> 7) << 0);
+ src_ptr -= 8 * w;
+ dst_ptr++;
+ }
}
else
{
- for (y = 0; y < h; y += 8)
- {
- *dst_ptr =
- ((A_VAL(&(src_ptr[ 0 * w])) >> 7) << 0) |
- ((A_VAL(&(src_ptr[-1 * w])) >> 7) << 1) |
- ((A_VAL(&(src_ptr[-2 * w])) >> 7) << 2) |
- ((A_VAL(&(src_ptr[-3 * w])) >> 7) << 3) |
- ((A_VAL(&(src_ptr[-4 * w])) >> 7) << 4) |
- ((A_VAL(&(src_ptr[-5 * w])) >> 7) << 5) |
- ((A_VAL(&(src_ptr[-6 * w])) >> 7) << 6) |
- ((A_VAL(&(src_ptr[-7 * w])) >> 7) << 7);
- src_ptr -= 8 * w;
- dst_ptr++;
- }
+ for (y = 0; y < h; y += 8)
+ {
+ *dst_ptr =
+ ((A_VAL(&(src_ptr[ 0 * w])) >> 7) << 0) |
+ ((A_VAL(&(src_ptr[-1 * w])) >> 7) << 1) |
+ ((A_VAL(&(src_ptr[-2 * w])) >> 7) << 2) |
+ ((A_VAL(&(src_ptr[-3 * w])) >> 7) << 3) |
+ ((A_VAL(&(src_ptr[-4 * w])) >> 7) << 4) |
+ ((A_VAL(&(src_ptr[-5 * w])) >> 7) << 5) |
+ ((A_VAL(&(src_ptr[-6 * w])) >> 7) << 6) |
+ ((A_VAL(&(src_ptr[-7 * w])) >> 7) << 7);
+ src_ptr -= 8 * w;
+ dst_ptr++;
+ }
}
h += 7;
- for (; y < h; y ++)
+ for (; y < h; y++)
{
- XPutPixel(xob->xim, y, ym, A_VAL(src_ptr) >> 7);
- src_ptr -= w;
+ XPutPixel(xob->xim, y, ym, A_VAL(src_ptr) >> 7);
+ src_ptr -= w;
}
}
@@ -229,24 +229,24 @@ evas_software_xlib_x_can_do_shm(Display *d)
{
static Display *cached_d = NULL;
static int cached_result = 0;
-
+
if (d == cached_d) return cached_result;
cached_d = d;
if (XShmQueryExtension(d))
{
- X_Output_Buffer *xob;
-
- xob = evas_software_xlib_x_output_buffer_new
- (d, DefaultVisual(d, DefaultScreen(d)),
- DefaultDepth(d, DefaultScreen(d)), 16, 16, 2, NULL);
- if (!xob)
- {
- cached_result = 0;
- return 0;
- }
- evas_software_xlib_x_output_buffer_unref(xob, 1);
- cached_result = 1;
- return 1;
+ X_Output_Buffer *xob;
+
+ xob = evas_software_xlib_x_output_buffer_new
+ (d, DefaultVisual(d, DefaultScreen(d)),
+ DefaultDepth(d, DefaultScreen(d)), 16, 16, 2, NULL);
+ if (!xob)
+ {
+ cached_result = 0;
+ return 0;
+ }
+ evas_software_xlib_x_output_buffer_unref(xob, 1);
+ cached_result = 1;
+ return 1;
}
cached_result = 0;
return 0;
@@ -279,26 +279,26 @@ evas_software_xlib_x_output_buffer_new(Display *d, Visual *v, int depth, int w,
if (try_shm > 0)
{
- xob->shm_info = malloc(sizeof(XShmSegmentInfo));
- if (xob->shm_info)
- {
- xob->xim = XShmCreateImage(d, v, depth, ZPixmap, NULL,
- xob->shm_info, w, h);
- if (xob->xim)
- {
- xob->shm_info->shmid = shmget(IPC_PRIVATE,
- xob->xim->bytes_per_line *
- xob->xim->height,
- IPC_CREAT | 0600);
- if (xob->shm_info->shmid >= 0)
- {
- xob->shm_info->readOnly = False;
- xob->shm_info->shmaddr = xob->xim->data =
- shmat(xob->shm_info->shmid, 0, 0);
- if (xob->shm_info->shmaddr != ((void *)-1))
- {
- XErrorHandler ph;
-
+ xob->shm_info = malloc(sizeof(XShmSegmentInfo));
+ if (xob->shm_info)
+ {
+ xob->xim = XShmCreateImage(d, v, depth, ZPixmap, NULL,
+ xob->shm_info, w, h);
+ if (xob->xim)
+ {
+ xob->shm_info->shmid = shmget(IPC_PRIVATE,
+ xob->xim->bytes_per_line *
+ xob->xim->height,
+ IPC_CREAT | 0600);
+ if (xob->shm_info->shmid >= 0)
+ {
+ xob->shm_info->readOnly = False;
+ xob->shm_info->shmaddr = xob->xim->data =
+ shmat(xob->shm_info->shmid, 0, 0);
+ if (xob->shm_info->shmaddr != ((void *)-1))
+ {
+ XErrorHandler ph;
+
if (try_shm == 2) // only needed during testing
{
XSync(d, False);
@@ -307,38 +307,38 @@ evas_software_xlib_x_output_buffer_new(Display *d, Visual *v, int depth, int w,
x_output_tmp_x_err);
}
#if defined(LIBXEXT_VERSION_LOW)
- /* workaround for libXext of lower then 1.1.1 */
- if (evas_common_frameq_enabled())
- XLockDisplay(d);
+ /* workaround for libXext of lower then 1.1.1 */
+ if (evas_common_frameq_enabled())
+ XLockDisplay(d);
#endif
- XShmAttach(d, xob->shm_info);
+ XShmAttach(d, xob->shm_info);
#if defined(LIBXEXT_VERSION_LOW)
- /* workaround for libXext of lower then 1.1.1 */
- if (evas_common_frameq_enabled())
- XUnlockDisplay(d);
+ /* workaround for libXext of lower then 1.1.1 */
+ if (evas_common_frameq_enabled())
+ XUnlockDisplay(d);
#endif
if (try_shm == 2) // only needed during testing
{
- XSync(d, False);
+ XSync(d, False);
XSetErrorHandler((XErrorHandler)ph);
}
if (!_x_err)
{
- xob->bpl = xob->xim->bytes_per_line;
- xob->psize = xob->bpl * xob->h;
- return xob;
- }
- }
- shmdt(xob->shm_info->shmaddr);
- shmctl(xob->shm_info->shmid, IPC_RMID, 0);
- }
- if (xob->xim) XDestroyImage(xob->xim);
- xob->xim = NULL;
- }
- if (xob->shm_info) free(xob->shm_info);
- xob->shm_info = NULL;
- }
+ xob->bpl = xob->xim->bytes_per_line;
+ xob->psize = xob->bpl * xob->h;
+ return xob;
+ }
+ }
+ shmdt(xob->shm_info->shmaddr);
+ shmctl(xob->shm_info->shmid, IPC_RMID, 0);
+ }
+ if (xob->xim) XDestroyImage(xob->xim);
+ xob->xim = NULL;
+ }
+ if (xob->shm_info) free(xob->shm_info);
+ xob->shm_info = NULL;
+ }
}
if (try_shm > 1)
@@ -350,21 +350,21 @@ evas_software_xlib_x_output_buffer_new(Display *d, Visual *v, int depth, int w,
xob->xim = XCreateImage(d, v, depth, ZPixmap, 0, data, w, h, 32, 0);
if (!xob->xim)
{
- free(xob);
- return NULL;
+ free(xob);
+ return NULL;
}
xob->data = data;
if (!xob->xim->data)
{
- xob->xim->data = malloc(xob->xim->bytes_per_line * xob->xim->height);
- if (!xob->xim->data)
- {
- XDestroyImage(xob->xim);
- free(xob);
- return NULL;
- }
+ xob->xim->data = malloc(xob->xim->bytes_per_line * xob->xim->height);
+ if (!xob->xim->data)
+ {
+ XDestroyImage(xob->xim);
+ free(xob);
+ return NULL;
+ }
}
xob->bpl = xob->xim->bytes_per_line;
xob->psize = xob->bpl * xob->h;
@@ -390,17 +390,17 @@ evas_software_xlib_x_output_buffer_unref(X_Output_Buffer *xob, int psync)
return;
if (xob->shm_info)
{
- if (psync) XSync(xob->display, False);
- XShmDetach(xob->display, xob->shm_info);
- XDestroyImage(xob->xim);
- shmdt(xob->shm_info->shmaddr);
- shmctl(xob->shm_info->shmid, IPC_RMID, 0);
- free(xob->shm_info);
+ if (psync) XSync(xob->display, False);
+ XShmDetach(xob->display, xob->shm_info);
+ XDestroyImage(xob->xim);
+ shmdt(xob->shm_info->shmaddr);
+ shmctl(xob->shm_info->shmid, IPC_RMID, 0);
+ free(xob->shm_info);
}
else
{
- if (xob->data) xob->xim->data = NULL;
- XDestroyImage(xob->xim);
+ if (xob->data) xob->xim->data = NULL;
+ XDestroyImage(xob->xim);
}
free(xob);
}
@@ -410,14 +410,14 @@ evas_software_xlib_x_output_buffer_paste(X_Output_Buffer *xob, Drawable d, GC gc
{
if (xob->shm_info)
{
- XShmPutImage(xob->display, d, gc, xob->xim, 0, 0, x, y,
- xob->w, xob->h, False);
- if (psync) XSync(xob->display, False);
+ XShmPutImage(xob->display, d, gc, xob->xim, 0, 0, x, y,
+ xob->w, xob->h, False);
+ if (psync) XSync(xob->display, False);
}
else
{
- XPutImage(xob->display, d, gc, xob->xim, 0, 0, x, y,
- xob->w, xob->h);
+ XPutImage(xob->display, d, gc, xob->xim, 0, 0, x, y,
+ xob->w, xob->h);
}
}
@@ -445,3 +445,4 @@ evas_software_xlib_x_output_buffer_bit_order(X_Output_Buffer *xob)
{
return xob->xim->bitmap_bit_order;
}
+
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_color.c b/src/modules/evas/engines/software_x11/evas_xlib_color.c
index 87e1453614..4070c48418 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_color.c
+++ b/src/modules/evas/engines/software_x11/evas_xlib_color.c
@@ -14,27 +14,27 @@ struct _Convert_Pal_Priv
Visual *vis;
};
-typedef DATA8 * (*X_Func_Alloc_Colors) (Display *d, Colormap cmap, Visual *v);
+typedef DATA8 * (*X_Func_Alloc_Colors)(Display *d, Colormap cmap, Visual *v);
static X_Func_Alloc_Colors x_color_alloc[PAL_MODE_LAST + 1];
-static int x_color_count[PAL_MODE_LAST + 1];
-static Eina_List *palettes = NULL;
-
-static DATA8 * x_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_gray(int ng, Display *d, Colormap cmap, Visual *v);
-
-static DATA8 * x_color_alloc_rgb_332(Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_rgb_666(Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_rgb_232(Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_rgb_222(Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_rgb_221(Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_rgb_121(Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_rgb_111(Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_gray_256(Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_gray_64(Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_gray_16(Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_gray_4(Display *d, Colormap cmap, Visual *v);
-static DATA8 * x_color_alloc_mono(Display *d, Colormap cmap, Visual *v);
+static int x_color_count[PAL_MODE_LAST + 1];
+static Eina_List *palettes = NULL;
+
+static DATA8 *x_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_gray(int ng, Display *d, Colormap cmap, Visual *v);
+
+static DATA8 *x_color_alloc_rgb_332(Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_rgb_666(Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_rgb_232(Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_rgb_222(Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_rgb_221(Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_rgb_121(Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_rgb_111(Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_gray_256(Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_gray_64(Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_gray_16(Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_gray_4(Display *d, Colormap cmap, Visual *v);
+static DATA8 *x_color_alloc_mono(Display *d, Colormap cmap, Visual *v);
static DATA8 *
x_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v)
@@ -43,7 +43,8 @@ x_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v)
DATA8 *color_lut;
int sig_mask = 0, delt = 0;
- for (i = 0; i < v->bits_per_rgb; i++) sig_mask |= (0x1 << i);
+ for (i = 0; i < v->bits_per_rgb; i++)
+ sig_mask |= (0x1 << i);
sig_mask <<= (16 - v->bits_per_rgb);
i = 0;
color_lut = malloc((nr) * (ng) * (nb));
@@ -51,69 +52,69 @@ x_color_alloc_rgb(int nr, int ng, int nb, Display *d, Colormap cmap, Visual *v)
delt = 0x0101 * 3;
for (r = 0; r < (nr); r++)
{
- for (g = 0; g < (ng); g++)
- {
- for (b = 0; b < (nb); b++)
- {
- XColor xcl;
- XColor xcl_in;
- int val;
- Status ret;
- int dr, dg, db;
+ for (g = 0; g < (ng); g++)
+ {
+ for (b = 0; b < (nb); b++)
+ {
+ XColor xcl;
+ XColor xcl_in;
+ int val;
+ Status ret;
+ int dr, dg, db;
val = (int)(((r * 255) / ((nr) - 1)));
- val = (val << 8) | val;
- xcl.red = (unsigned short)(val);
- val = (int)(((g * 255) / ((ng) - 1)));
- val = (val << 8) | val;
- xcl.green = (unsigned short)(val);
- val = (int)(((b * 255) / ((nb) - 1)));
- val = (val << 8) | val;
- xcl.blue = (unsigned short)(val);
+ val = (val << 8) | val;
+ xcl.red = (unsigned short)(val);
+ val = (int)(((g * 255) / ((ng) - 1)));
+ val = (val << 8) | val;
+ xcl.green = (unsigned short)(val);
+ val = (int)(((b * 255) / ((nb) - 1)));
+ val = (val << 8) | val;
+ xcl.blue = (unsigned short)(val);
xcl.pixel = 0;
xcl.flags = 0;
xcl.pad = 0;
- xcl_in = xcl;
- ret = XAllocColor(d, cmap, &xcl);
- dr = (int)xcl_in.red - (int)xcl.red;
- if (dr < 0) dr = -dr;
- dg = (int)xcl_in.green - (int)xcl.green;
- if (dg < 0) dg = -dg;
- db = (int)xcl_in.blue - (int)xcl.blue;
- if (db < 0) db = -db;
-/*
- printf("ASK [%i]: %04x %04x %04x = %04x %04x %04x | dif = %04x / %04x\n",
- ret,
- xcl_in.red, xcl_in.green, xcl_in.blue,
- xcl.red, xcl.green, xcl.blue,
- (dr + dg +db), delt);
- */
- if ((ret == 0) ||
- ((dr + dg + db) > delt)
+ xcl_in = xcl;
+ ret = XAllocColor(d, cmap, &xcl);
+ dr = (int)xcl_in.red - (int)xcl.red;
+ if (dr < 0) dr = -dr;
+ dg = (int)xcl_in.green - (int)xcl.green;
+ if (dg < 0) dg = -dg;
+ db = (int)xcl_in.blue - (int)xcl.blue;
+ if (db < 0) db = -db;
/*
- ||
- ((xcl_in.red & sig_mask) != (xcl.red & sig_mask)) ||
- ((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) ||
- ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask))
+ printf("ASK [%i]: %04x %04x %04x = %04x %04x %04x | dif = %04x / %04x\n",
+ ret,
+ xcl_in.red, xcl_in.green, xcl_in.blue,
+ xcl.red, xcl.green, xcl.blue,
+ (dr + dg +db), delt);
*/
- )
- {
- unsigned long pixels[256];
- int j;
-
- if (i > 0)
- {
- for (j = 0; j < i; j++)
- pixels[j] = (unsigned long) color_lut[j];
- XFreeColors(d, cmap, pixels, i, 0);
- }
- free(color_lut);
- return NULL;
- }
- color_lut[i] = xcl.pixel;
- i++;
- }
- }
+ if ((ret == 0) ||
+ ((dr + dg + db) > delt)
+/*
+||
+ ((xcl_in.red & sig_mask) != (xcl.red & sig_mask)) ||
+ ((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) ||
+ ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask))
+*/
+ )
+ {
+ unsigned long pixels[256];
+ int j;
+
+ if (i > 0)
+ {
+ for (j = 0; j < i; j++)
+ pixels[j] = (unsigned long)color_lut[j];
+ XFreeColors(d, cmap, pixels, i, 0);
+ }
+ free(color_lut);
+ return NULL;
+ }
+ color_lut[i] = xcl.pixel;
+ i++;
+ }
+ }
}
return color_lut;
}
@@ -125,47 +126,48 @@ x_color_alloc_gray(int ng, Display *d, Colormap cmap, Visual *v)
DATA8 *color_lut;
int sig_mask = 0;
- for (i = 0; i < v->bits_per_rgb; i++) sig_mask |= (0x1 << i);
+ for (i = 0; i < v->bits_per_rgb; i++)
+ sig_mask |= (0x1 << i);
sig_mask <<= (16 - v->bits_per_rgb);
i = 0;
color_lut = malloc(ng);
if (!color_lut) return NULL;
for (g = 0; g < (ng); g++)
{
- XColor xcl;
- XColor xcl_in;
- int val;
- Status ret;
-
- val = (int)(((g * 255) / ((ng) - 1)));
- val = (val << 8) | val;
- xcl.red = (unsigned short)(val);
- xcl.green = (unsigned short)(val);
- xcl.blue = (unsigned short)(val);
+ XColor xcl;
+ XColor xcl_in;
+ int val;
+ Status ret;
+
+ val = (int)(((g * 255) / ((ng) - 1)));
+ val = (val << 8) | val;
+ xcl.red = (unsigned short)(val);
+ xcl.green = (unsigned short)(val);
+ xcl.blue = (unsigned short)(val);
xcl.pixel = 0;
xcl.flags = 0;
xcl.pad = 0;
- xcl_in = xcl;
- ret = XAllocColor(d, cmap, &xcl);
- if ((ret == 0) ||
- ((xcl_in.red & sig_mask) != (xcl.red & sig_mask)) ||
- ((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) ||
- ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask)))
- {
- unsigned long pixels[256];
- int j;
-
- if (i > 0)
- {
- for (j = 0; j < i; j++)
- pixels[j] = (unsigned long) color_lut[j];
- XFreeColors(d, cmap, pixels, i, 0);
- }
- free(color_lut);
- return NULL;
- }
- color_lut[i] = xcl.pixel;
- i++;
+ xcl_in = xcl;
+ ret = XAllocColor(d, cmap, &xcl);
+ if ((ret == 0) ||
+ ((xcl_in.red & sig_mask) != (xcl.red & sig_mask)) ||
+ ((xcl_in.green & sig_mask) != (xcl.green & sig_mask)) ||
+ ((xcl_in.blue & sig_mask) != (xcl.blue & sig_mask)))
+ {
+ unsigned long pixels[256];
+ int j;
+
+ if (i > 0)
+ {
+ for (j = 0; j < i; j++)
+ pixels[j] = (unsigned long)color_lut[j];
+ XFreeColors(d, cmap, pixels, i, 0);
+ }
+ free(color_lut);
+ return NULL;
+ }
+ color_lut[i] = xcl.pixel;
+ i++;
}
return color_lut;
}
@@ -248,83 +250,83 @@ evas_software_xlib_x_color_init(void)
static int initialised = 0;
if (initialised) return;
- x_color_alloc[PAL_MODE_NONE] = NULL;
- x_color_count[PAL_MODE_NONE] = 0;
+ x_color_alloc[PAL_MODE_NONE] = NULL;
+ x_color_count[PAL_MODE_NONE] = 0;
- x_color_alloc[PAL_MODE_MONO] = x_color_alloc_mono;
- x_color_count[PAL_MODE_MONO] = 2;
+ x_color_alloc[PAL_MODE_MONO] = x_color_alloc_mono;
+ x_color_count[PAL_MODE_MONO] = 2;
- x_color_alloc[PAL_MODE_GRAY4] = x_color_alloc_gray_4;
- x_color_count[PAL_MODE_GRAY4] = 4;
+ x_color_alloc[PAL_MODE_GRAY4] = x_color_alloc_gray_4;
+ x_color_count[PAL_MODE_GRAY4] = 4;
- x_color_alloc[PAL_MODE_GRAY16] = x_color_alloc_gray_16;
- x_color_count[PAL_MODE_GRAY16] = 16;
+ x_color_alloc[PAL_MODE_GRAY16] = x_color_alloc_gray_16;
+ x_color_count[PAL_MODE_GRAY16] = 16;
- x_color_alloc[PAL_MODE_GRAY64] = x_color_alloc_gray_64;
- x_color_count[PAL_MODE_GRAY64] = 64;
+ x_color_alloc[PAL_MODE_GRAY64] = x_color_alloc_gray_64;
+ x_color_count[PAL_MODE_GRAY64] = 64;
x_color_alloc[PAL_MODE_GRAY256] = x_color_alloc_gray_256;
x_color_count[PAL_MODE_GRAY256] = 256;
- x_color_alloc[PAL_MODE_RGB111] = x_color_alloc_rgb_111;
- x_color_count[PAL_MODE_RGB111] = 2 * 2 * 2;
+ x_color_alloc[PAL_MODE_RGB111] = x_color_alloc_rgb_111;
+ x_color_count[PAL_MODE_RGB111] = 2 * 2 * 2;
- x_color_alloc[PAL_MODE_RGB121] = x_color_alloc_rgb_121;
- x_color_count[PAL_MODE_RGB121] = 2 * 4 * 2;
+ x_color_alloc[PAL_MODE_RGB121] = x_color_alloc_rgb_121;
+ x_color_count[PAL_MODE_RGB121] = 2 * 4 * 2;
- x_color_alloc[PAL_MODE_RGB221] = x_color_alloc_rgb_221;
- x_color_count[PAL_MODE_RGB221] = 4 * 4 * 2;
+ x_color_alloc[PAL_MODE_RGB221] = x_color_alloc_rgb_221;
+ x_color_count[PAL_MODE_RGB221] = 4 * 4 * 2;
- x_color_alloc[PAL_MODE_RGB222] = x_color_alloc_rgb_222;
- x_color_count[PAL_MODE_RGB222] = 4 * 4 * 4;
+ x_color_alloc[PAL_MODE_RGB222] = x_color_alloc_rgb_222;
+ x_color_count[PAL_MODE_RGB222] = 4 * 4 * 4;
- x_color_alloc[PAL_MODE_RGB232] = x_color_alloc_rgb_232;
- x_color_count[PAL_MODE_RGB232] = 4 * 8 * 4;
+ x_color_alloc[PAL_MODE_RGB232] = x_color_alloc_rgb_232;
+ x_color_count[PAL_MODE_RGB232] = 4 * 8 * 4;
- x_color_alloc[PAL_MODE_RGB666] = x_color_alloc_rgb_666;
- x_color_count[PAL_MODE_RGB666] = 6 * 6 * 6;
+ x_color_alloc[PAL_MODE_RGB666] = x_color_alloc_rgb_666;
+ x_color_count[PAL_MODE_RGB666] = 6 * 6 * 6;
- x_color_alloc[PAL_MODE_RGB332] = x_color_alloc_rgb_332;
- x_color_count[PAL_MODE_RGB332] = 8 * 8 * 4;
+ x_color_alloc[PAL_MODE_RGB332] = x_color_alloc_rgb_332;
+ x_color_count[PAL_MODE_RGB332] = 8 * 8 * 4;
- x_color_alloc[PAL_MODE_LAST] = NULL;
- x_color_count[PAL_MODE_LAST] = 0;
+ x_color_alloc[PAL_MODE_LAST] = NULL;
+ x_color_count[PAL_MODE_LAST] = 0;
initialised = 1;
}
Convert_Pal *
-evas_software_xlib_x_color_allocate(Display *disp,
- Colormap cmap,
- Visual *vis,
+evas_software_xlib_x_color_allocate(Display *disp,
+ Colormap cmap,
+ Visual *vis,
Convert_Pal_Mode colors)
{
Convert_Pal_Priv *palpriv;
- Convert_Pal *pal;
- Convert_Pal_Mode c;
- Eina_List *l;
+ Convert_Pal *pal;
+ Convert_Pal_Mode c;
+ Eina_List *l;
/* printf("ALLOC cmap=%i vis=%p\n", cmap, vis);*/
EINA_LIST_FOREACH(palettes, l, pal)
{
- palpriv = pal->data;
- if ((disp == palpriv->disp) &&
- (vis == palpriv->vis) &&
- (cmap == palpriv->cmap))
- {
- pal->references++;
- return pal;
- }
+ palpriv = pal->data;
+ if ((disp == palpriv->disp) &&
+ (vis == palpriv->vis) &&
+ (cmap == palpriv->cmap))
+ {
+ pal->references++;
+ return pal;
+ }
}
pal = calloc(1, sizeof(struct _Convert_Pal));
if (!pal) return NULL;
for (c = colors; c > PAL_MODE_NONE; c--)
{
- if (x_color_alloc[c])
- {
+ if (x_color_alloc[c])
+ {
/* printf("TRY PAL %i\n", c);*/
- pal->lookup = (x_color_alloc[c])(disp, cmap, vis);
- if (pal->lookup) break;
- }
+ pal->lookup = (x_color_alloc[c])(disp, cmap, vis);
+ if (pal->lookup) break;
+ }
}
pal->references = 1;
pal->colors = c;
@@ -333,9 +335,9 @@ evas_software_xlib_x_color_allocate(Display *disp,
pal->data = palpriv;
if (!palpriv)
{
- if (pal->lookup) free(pal->lookup);
- free(pal);
- return NULL;
+ if (pal->lookup) free(pal->lookup);
+ free(pal);
+ return NULL;
}
palpriv->disp = disp;
palpriv->vis = vis;
@@ -352,9 +354,9 @@ evas_software_xlib_x_color_allocate(Display *disp,
}
void
-evas_software_xlib_x_color_deallocate(Display *disp,
- Colormap cmap,
- Visual *vis EINA_UNUSED,
+evas_software_xlib_x_color_deallocate(Display *disp,
+ Colormap cmap,
+ Visual *vis EINA_UNUSED,
Convert_Pal *pal)
{
unsigned long pixels[256];
@@ -364,12 +366,13 @@ evas_software_xlib_x_color_deallocate(Display *disp,
if (pal->references > 0) return;
if (pal->lookup)
{
- for(j = 0; j < pal->count; j++)
- pixels[j] = (unsigned long) pal->lookup[j];
- XFreeColors(disp, cmap, pixels, pal->count, 0);
- free(pal->lookup);
+ for (j = 0; j < pal->count; j++)
+ pixels[j] = (unsigned long)pal->lookup[j];
+ XFreeColors(disp, cmap, pixels, pal->count, 0);
+ free(pal->lookup);
}
free(pal->data);
palettes = eina_list_remove(palettes, pal);
free(pal);
}
+
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c b/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c
index 3069eb0150..bf3c7ff82f 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c
+++ b/src/modules/evas/engines/software_x11/evas_xlib_dri_image.c
@@ -6,39 +6,37 @@
#include "evas_xlib_dri_image.h"
#include "../software_generic/evas_native_common.h"
-# include <dlfcn.h> /* dlopen,dlclose,etc */
+# include <dlfcn.h> /* dlopen,dlclose,etc */
# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
-
static Eina_Bool tried = EINA_FALSE;
////////////////////////////////////
//libdrm.so.2
static void *drm_lib = NULL;
typedef unsigned int drm_magic_t;
-static int (*sym_drmGetMagic) (int fd, drm_magic_t *magic) = NULL;
+static int (*sym_drmGetMagic)(int fd, drm_magic_t *magic) = NULL;
////////////////////////////////////
// libtbm.so.1
-#define TBM_DEVICE_CPU 1
-#define TBM_OPTION_READ (1 << 0)
-#define TBM_OPTION_WRITE (1 << 1)
+#define TBM_DEVICE_CPU 1
+#define TBM_OPTION_READ (1 << 0)
+#define TBM_OPTION_WRITE (1 << 1)
static void *lib_tbm = NULL;
-
-static tbm_bo (*sym_tbm_bo_import) (tbm_bufmgr bufmgr, unsigned int key) = NULL;
-static tbm_bo_handle (*sym_tbm_bo_map) (tbm_bo bo, int device, int opt) = NULL;
-static int (*sym_tbm_bo_unmap) (tbm_bo bo) = NULL;
-static void (*sym_tbm_bo_unref) (tbm_bo bo) = NULL;
-static tbm_bufmgr (*sym_tbm_bufmgr_init) (int fd) = NULL;
-static void (*sym_tbm_bufmgr_deinit) (tbm_bufmgr bufmgr) = NULL;
+static tbm_bo (*sym_tbm_bo_import)(tbm_bufmgr bufmgr, unsigned int key) = NULL;
+static tbm_bo_handle (*sym_tbm_bo_map)(tbm_bo bo, int device, int opt) = NULL;
+static int (*sym_tbm_bo_unmap)(tbm_bo bo) = NULL;
+static void (*sym_tbm_bo_unref)(tbm_bo bo) = NULL;
+static tbm_bufmgr (*sym_tbm_bufmgr_init)(int fd) = NULL;
+static void (*sym_tbm_bufmgr_deinit)(tbm_bufmgr bufmgr) = NULL;
// legacy compatibility
-static void *(*sym_drm_slp_bo_map) (tbm_bo bo, int device, int opt) = NULL;
-static int (*sym_drm_slp_bo_unmap) (tbm_bo bo, int device) = NULL;
-static tbm_bufmgr (*sym_drm_slp_bufmgr_init) (int fd, void *arg) = NULL;
+static void *(*sym_drm_slp_bo_map)(tbm_bo bo, int device, int opt) = NULL;
+static int (*sym_drm_slp_bo_unmap)(tbm_bo bo, int device) = NULL;
+static tbm_bufmgr (*sym_drm_slp_bufmgr_init)(int fd, void *arg) = NULL;
////////////////////////////////////
// libdri2.so.0
@@ -47,23 +45,22 @@ static void *dri_lib = NULL;
typedef unsigned long long CD64;
-static DRI2Buffer *(*sym_DRI2GetBuffers) (Display *display, XID drawable, int *width, int *height, unsigned int *attachments, int count, int *outCount) = NULL;
-static Bool (*sym_DRI2QueryExtension) (Display *display, int *eventBase, int *errorBase) = NULL;
-static Bool (*sym_DRI2QueryVersion) (Display *display, int *major, int *minor) = NULL;
-static Bool (*sym_DRI2Connect) (Display *display, XID window, char **driverName, char **deviceName) = NULL;
-static Bool (*sym_DRI2Authenticate) (Display *display, XID window, unsigned int magic) = NULL;
-static void (*sym_DRI2CreateDrawable) (Display *display, XID drawable) = NULL;
-static void (*sym_DRI2DestroyDrawable) (Display *display, XID handle) = NULL;
+static DRI2Buffer *(*sym_DRI2GetBuffers)(Display * display, XID drawable, int *width, int *height, unsigned int *attachments, int count, int *outCount) = NULL;
+static Bool (*sym_DRI2QueryExtension)(Display *display, int *eventBase, int *errorBase) = NULL;
+static Bool (*sym_DRI2QueryVersion)(Display *display, int *major, int *minor) = NULL;
+static Bool (*sym_DRI2Connect)(Display *display, XID window, char **driverName, char **deviceName) = NULL;
+static Bool (*sym_DRI2Authenticate)(Display *display, XID window, unsigned int magic) = NULL;
+static void (*sym_DRI2CreateDrawable)(Display *display, XID drawable) = NULL;
+static void (*sym_DRI2DestroyDrawable)(Display *display, XID handle) = NULL;
////////////////////////////////////
// libXfixes.so.3
static void *xfixes_lib = NULL;
-static Bool (*sym_XFixesQueryExtension) (Display *display, int *event_base_return, int *error_base_return) = NULL;
-static Status (*sym_XFixesQueryVersion) (Display *display, int *major_version_return, int *minor_version_return) = NULL;
-static XID (*sym_XFixesCreateRegion) (Display *display, XRectangle *rectangles, int nrectangles) = NULL;
-static void (*sym_XFixesDestroyRegion) (Display *dpy, XID region) = NULL;
-
+static Bool (*sym_XFixesQueryExtension)(Display *display, int *event_base_return, int *error_base_return) = NULL;
+static Status (*sym_XFixesQueryVersion)(Display *display, int *major_version_return, int *minor_version_return) = NULL;
+static XID (*sym_XFixesCreateRegion)(Display *display, XRectangle *rectangles, int nrectangles) = NULL;
+static void (*sym_XFixesDestroyRegion)(Display *dpy, XID region) = NULL;
static int inits = 0;
static int xfixes_ev_base = 0, xfixes_err_base = 0;
@@ -88,54 +85,54 @@ _drm_init(Display *disp, int scr)
tried = EINA_TRUE;
drm_lib = dlopen("libdrm.so.2", RTLD_NOW | RTLD_LOCAL);
if (!drm_lib)
- {
+ {
ERR("Can't load libdrm.so.2");
goto err;
- }
+ }
slp_mode = EINA_FALSE;
lib_tbm = dlopen("libtbm.so.1", RTLD_NOW | RTLD_LOCAL);
if (!lib_tbm)
- {
+ {
ERR("Can't load libtbm.so.1");
lib_tbm = dlopen("libdrm_slp.so.1", RTLD_NOW | RTLD_LOCAL);
if (lib_tbm) slp_mode = EINA_TRUE;
else goto err;
- }
+ }
dri_lib = dlopen("libdri2.so.0", RTLD_NOW | RTLD_LOCAL);
if (!dri_lib)
- {
+ {
ERR("Can't load libdri2.so.0");
goto err;
- }
+ }
xfixes_lib = dlopen("libXfixes.so.3", RTLD_NOW | RTLD_LOCAL);
if (!xfixes_lib)
- {
+ {
ERR("Can't load libXfixes.so.3");
goto err;
- }
+ }
-#define SYM(l, x) \
- do { sym_ ## x = dlsym(l, #x); \
- if (!sym_ ## x) { \
- ERR("Can't load symbol "#x); \
- goto err; \
- } \
- } while (0)
+#define SYM(l, x) \
+ do { sym_ ## x = dlsym(l, #x); \
+ if (!sym_ ## x) { \
+ ERR("Can't load symbol " #x); \
+ goto err; \
+ } \
+ } while (0)
SYM(drm_lib, drmGetMagic);
if (!slp_mode)
- {
+ {
SYM(lib_tbm, tbm_bo_import);
SYM(lib_tbm, tbm_bo_map);
SYM(lib_tbm, tbm_bo_unmap);
SYM(lib_tbm, tbm_bo_unref);
SYM(lib_tbm, tbm_bufmgr_init);
SYM(lib_tbm, tbm_bufmgr_deinit);
- }
+ }
else
- {
+ {
// Looking up the legacy DRM SLP symbols. I don't believe this will
// ever happen, this code is here "just in case".
sym_tbm_bo_import = dlsym(lib_tbm, "drm_slp_bo_import");
@@ -146,11 +143,11 @@ _drm_init(Display *disp, int scr)
sym_tbm_bufmgr_deinit = dlsym(lib_tbm, "drm_slp_bufmgr_destroy");
if (!sym_tbm_bo_import || !sym_drm_slp_bo_map || !sym_drm_slp_bo_unmap ||
!sym_tbm_bo_unref || !sym_drm_slp_bufmgr_init || !sym_tbm_bufmgr_deinit)
- {
+ {
ERR("Can't load symbols from libdrm_slp.so.1");
goto err;
- }
- }
+ }
+ }
SYM(dri_lib, DRI2GetBuffers);
SYM(dri_lib, DRI2QueryExtension);
@@ -165,34 +162,34 @@ _drm_init(Display *disp, int scr)
SYM(xfixes_lib, XFixesCreateRegion);
SYM(xfixes_lib, XFixesDestroyRegion);
if (!sym_XFixesQueryExtension(disp, &xfixes_ev_base, &xfixes_err_base))
- {
+ {
if (exim_debug) ERR("XFixes extension not in xserver");
goto err;
- }
+ }
sym_XFixesQueryVersion(disp, &xfixes_major, &xfixes_minor);
-
if (!sym_DRI2QueryExtension(disp, &dri2_ev_base, &dri2_err_base))
- {
+ {
if (exim_debug) ERR("DRI2 extension not in xserver");
goto err;
- }
+ }
if (!sym_DRI2QueryVersion(disp, &dri2_major, &dri2_minor))
- {
+ {
if (exim_debug) ERR("DRI2 query version failed");
goto err;
- }
+ }
if (dri2_minor < 99)
- {
- if (exim_debug) ERR("Not supported by DRI2 version(%i.%i)",
- dri2_major, dri2_minor);
+ {
+ if (exim_debug)
+ ERR("Not supported by DRI2 version(%i.%i)",
+ dri2_major, dri2_minor);
goto err;
- }
+ }
if (!sym_DRI2Connect(disp, RootWindow(disp, scr), &drv_name, &dev_name))
- {
+ {
if (exim_debug) ERR("DRI2 connect failed on screen %i", scr);
goto err;
- }
+ }
if (!dev_name)
{
if (exim_debug) ERR("DRI2 connect - cannot find dev name");
@@ -200,73 +197,73 @@ _drm_init(Display *disp, int scr)
}
drm_fd = open(dev_name, O_RDWR);
if (drm_fd < 0)
- {
+ {
if (exim_debug) ERR("DRM FD open of '%s' failed", dev_name);
goto err;
- }
+ }
if (sym_drmGetMagic(drm_fd, &magic))
- {
+ {
if (exim_debug) ERR("DRM get magic failed");
goto err;
- }
+ }
if (!sym_DRI2Authenticate(disp, RootWindow(disp, scr),
- (unsigned int)magic))
- {
+ (unsigned int)magic))
+ {
if (exim_debug) ERR("DRI2 authenticate failed with magic 0x%x on screen %i", (unsigned int)magic, scr);
goto err;
- }
+ }
if (!slp_mode)
- bufmgr = sym_tbm_bufmgr_init(drm_fd);
+ bufmgr = sym_tbm_bufmgr_init(drm_fd);
else
- bufmgr = sym_drm_slp_bufmgr_init(drm_fd, NULL);
+ bufmgr = sym_drm_slp_bufmgr_init(drm_fd, NULL);
if (!bufmgr)
- {
+ {
if (exim_debug) ERR("DRM bufmgr init failed");
goto err;
- }
+ }
if (drv_name)
- {
+ {
XFree(drv_name);
- }
+ }
if (dev_name)
- {
+ {
XFree(dev_name);
- }
+ }
return EINA_TRUE;
- err:
+err:
if (drm_fd >= 0)
- {
+ {
close(drm_fd);
drm_fd = -1;
- }
+ }
if (drm_lib)
- {
+ {
dlclose(drm_lib);
drm_lib = NULL;
- }
+ }
if (lib_tbm)
- {
+ {
dlclose(lib_tbm);
lib_tbm = NULL;
- }
+ }
if (dri_lib)
- {
+ {
dlclose(dri_lib);
dri_lib = NULL;
- }
+ }
if (xfixes_lib)
- {
+ {
dlclose(xfixes_lib);
xfixes_lib = NULL;
- }
+ }
if (drv_name)
- {
+ {
XFree(drv_name);
- }
+ }
if (dev_name)
- {
+ {
XFree(dev_name);
- }
+ }
return EINA_FALSE;
}
@@ -274,10 +271,10 @@ static void
_drm_shutdown(void)
{
if (bufmgr)
- {
+ {
sym_tbm_bufmgr_deinit(bufmgr);
bufmgr = NULL;
- }
+ }
if (drm_fd >= 0) close(drm_fd);
tried = EINA_FALSE;
drm_fd = -1;
@@ -308,30 +305,30 @@ evas_xlib_image_dri_init(Evas_DRI_Image *exim,
{
exim->dis = display;
if (inits <= 0)
- {
- if(!_drm_init(display, 0)) return EINA_FALSE;
- }
+ {
+ if (!_drm_init(display, 0)) return EINA_FALSE;
+ }
inits++;
- if(!_drm_setup(display, exim))
- {
+ if (!_drm_setup(display, exim))
+ {
inits--;
if (inits == 0) _drm_shutdown();
free(exim);
return EINA_FALSE;
- }
+ }
- if(getenv("EVAS_NO_DRI2_CACHE"))
- {
+ if (getenv("EVAS_NO_DRI2_CACHE"))
+ {
use_cache = EINA_FALSE;
- }
+ }
return EINA_TRUE;
}
Eina_Bool
evas_xlib_image_dri_used()
{
- if(inits > 0) return EINA_TRUE;
+ if (inits > 0) return EINA_TRUE;
return EINA_FALSE;
}
@@ -339,9 +336,9 @@ void
evas_xlib_image_buffer_unmap(Evas_DRI_Image *exim)
{
if (!slp_mode)
- sym_tbm_bo_unmap(exim->buf_bo);
+ sym_tbm_bo_unmap(exim->buf_bo);
else
- sym_drm_slp_bo_unmap(exim->buf_bo, TBM_DEVICE_CPU);
+ sym_drm_slp_bo_unmap(exim->buf_bo, TBM_DEVICE_CPU);
if (exim_debug) DBG("Unmap buffer name %i\n", exim->buf->name);
free(exim->buf);
exim->buf = NULL;
@@ -355,33 +352,33 @@ _evas_xlib_image_cache_import(Evas_DRI_Image *exim)
exim->buf_bo = NULL;
flags = (DRI2BufferFlags *)(&(exim->buf->flags));
if (!flags->data.is_reused)
- {
+ {
if (exim_debug) DBG("Buffer cache not reused - clear cache\n");
if (exim->buf_cache)
- {
+ {
sym_tbm_bo_unref(exim->buf_cache->buf_bo);
free(exim->buf_cache);
- }
- }
+ }
+ }
else
- {
+ {
if (exim->buf_cache && exim->buf_cache->name == exim->buf->name)
- {
+ {
if (exim_debug) DBG("Cached buf name %i found\n", exim->buf_cache->name);
exim->buf_bo = exim->buf_cache->buf_bo;
- }
+ }
else
- {
+ {
if (exim->buf_cache)
- {
+ {
sym_tbm_bo_unref(exim->buf_cache->buf_bo);
free(exim->buf_cache);
- }
- }
- }
+ }
+ }
+ }
if (!exim->buf_bo)
- {
+ {
exim->buf_bo = sym_tbm_bo_import(bufmgr, exim->buf->name);
if (!exim->buf_bo) return EINA_FALSE;
// cache the buf entry
@@ -390,7 +387,7 @@ _evas_xlib_image_cache_import(Evas_DRI_Image *exim)
exim->buf_cache->name = exim->buf->name;
exim->buf_cache->buf_bo = exim->buf_bo;
if (exim_debug) DBG("Buffer cache added name %i\n", exim->buf_cache->name);
- }
+ }
return EINA_TRUE;
}
@@ -419,13 +416,13 @@ evas_xlib_image_get_buffers(RGBA_Image *im)
Evas_DRI_Image *exim;
if (im->native.data)
- n = im->native.data;
+ n = im->native.data;
if (!n) return EINA_FALSE;
exim = n->ns_data.x11.exim;
d = n->ns_data.x11.display;
- if(!exim) return EINA_FALSE;
+ if (!exim) return EINA_FALSE;
unsigned int attach = DRI2BufferFrontLeft;
int num;
@@ -440,58 +437,57 @@ evas_xlib_image_get_buffers(RGBA_Image *im)
if (!exim->buf->name) return _evas_xlib_image_x_free(d);
if (use_cache)
- {
+ {
if (!_evas_xlib_image_cache_import(exim)) return _evas_xlib_image_x_free(d);
- }
+ }
else
- {
+ {
if (!_evas_xlib_image_no_cache_import(exim)) return _evas_xlib_image_x_free(d);
- }
+ }
if (!slp_mode)
- {
- bo_handle = sym_tbm_bo_map(exim->buf_bo, TBM_DEVICE_CPU, TBM_OPTION_READ |TBM_OPTION_WRITE);
+ {
+ bo_handle = sym_tbm_bo_map(exim->buf_bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
if (bo_handle.ptr == NULL) return _evas_xlib_image_x_free(d);
exim->buf_data = bo_handle.ptr;
- }
+ }
else
- {
+ {
exim->buf_data = sym_drm_slp_bo_map(exim->buf_bo, TBM_DEVICE_CPU, TBM_OPTION_READ | TBM_OPTION_WRITE);
- }
+ }
if (!exim->buf_data)
- {
+ {
ERR("Buffer map name %i failed", exim->buf->name);
return _evas_xlib_image_x_free(d);
- }
+ }
XUngrabServer(d);
XSync(d, 0);
im->image.data = exim->buf_data;
- im->cache_entry.w = exim->buf->pitch/4;
+ im->cache_entry.w = exim->buf->pitch / 4;
evas_xlib_image_buffer_unmap(exim);
return EINA_TRUE;
}
-
void
evas_xlib_image_dri_free(Evas_DRI_Image *exim)
{
- if(use_cache)
- {
+ if (use_cache)
+ {
if (exim->buf_cache)
- {
+ {
if (exim_debug) DBG("Cached buf name %i freed\n", exim->buf_cache->name);
sym_tbm_bo_unref(exim->buf_cache->buf_bo);
free(exim->buf_cache);
- }
- }
+ }
+ }
else
- {
- if(exim->buf_bo) sym_tbm_bo_unref(exim->buf_bo);
- }
+ {
+ if (exim->buf_bo) sym_tbm_bo_unref(exim->buf_bo);
+ }
_drm_cleanup(exim);
free(exim);
@@ -506,7 +502,7 @@ evas_xlib_image_dri_new(int w, int h, Visual *vis, int depth)
exim = calloc(1, sizeof(Evas_DRI_Image));
if (!exim)
- return NULL;
+ return NULL;
exim->w = w;
exim->h = h;
@@ -522,12 +518,12 @@ _native_bind_cb(void *image, int x EINA_UNUSED, int y EINA_UNUSED, int w EINA_UN
Native *n = im->native.data;
if ((n) && (n->ns.type == EVAS_NATIVE_SURFACE_X11))
- {
+ {
if (evas_xlib_image_get_buffers(im))
- {
+ {
evas_common_image_colorspace_dirty(im);
- }
- }
+ }
+ }
}
static void
@@ -537,17 +533,17 @@ _native_free_cb(void *image)
Native *n = im->native.data;
if (!n) return;
if (n->ns_data.x11.exim)
- {
+ {
evas_xlib_image_dri_free(n->ns_data.x11.exim);
n->ns_data.x11.exim = NULL;
- }
+ }
n->ns_data.x11.visual = NULL;
n->ns_data.x11.display = NULL;
- im->native.data = NULL;
- im->native.func.bind = NULL;
- im->native.func.free = NULL;
- im->image.data = NULL;
+ im->native.data = NULL;
+ im->native.func.bind = NULL;
+ im->native.func.free = NULL;
+ im->image.data = NULL;
free(n);
}
@@ -555,9 +551,9 @@ void *
evas_xlib_image_dri_native_set(void *data, void *image, void *native)
{
Display *d = NULL;
- Visual *vis = NULL;
- Pixmap pm = 0;
- Native *n = NULL;
+ Visual *vis = NULL;
+ Pixmap pm = 0;
+ Native *n = NULL;
RGBA_Image *im = image;
int w, h;
Evas_DRI_Image *exim;
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_image.c b/src/modules/evas/engines/software_x11/evas_xlib_image.c
index c8f5eca614..ee1ebfc02d 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_image.c
+++ b/src/modules/evas/engines/software_x11/evas_xlib_image.c
@@ -57,11 +57,11 @@ _native_free_cb(void *image)
}
n->ns_data.x11.visual = NULL;
- im->native.data = NULL;
- im->native.func.bind = NULL;
+ im->native.data = NULL;
+ im->native.func.bind = NULL;
im->native.func.unbind = NULL;
- im->native.func.free = NULL;
- im->image.data = NULL;
+ im->native.func.free = NULL;
+ im->image.data = NULL;
free(n);
}
@@ -70,10 +70,10 @@ evas_xlib_image_native_set(void *data EINA_UNUSED, void *image, void *native)
{
RGBA_Image *im = image;
Evas_Native_Surface *ns = native;
- Native *n = NULL;
+ Native *n = NULL;
Ecore_X_Image *exim = NULL;
- Visual *vis = NULL;
- Pixmap pm = 0;
+ Visual *vis = NULL;
+ Pixmap pm = 0;
int w, h, depth;
if ((ns) && (ns->type == EVAS_NATIVE_SURFACE_X11))
@@ -109,3 +109,4 @@ evas_xlib_image_native_set(void *data EINA_UNUSED, void *image, void *native)
}
return im;
}
+
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_main.c b/src/modules/evas/engines/software_x11/evas_xlib_main.c
index dea33dbf32..82e9870d75 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_main.c
+++ b/src/modules/evas/engines/software_x11/evas_xlib_main.c
@@ -5,3 +5,4 @@ void
evas_software_xlib_x_init(void)
{
}
+
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c b/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c
index 76ac0ca16a..e52b6093d8 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c
+++ b/src/modules/evas/engines/software_x11/evas_xlib_outbuf.c
@@ -14,7 +14,7 @@
#include "evas_xlib_buffer.h"
#include "evas_xlib_color.h"
-typedef struct _Outbuf_Region Outbuf_Region;
+typedef struct _Outbuf_Region Outbuf_Region;
struct _Outbuf_Region
{
@@ -33,7 +33,7 @@ static int shmmemlimit = 0;
static const unsigned int shmcountlimit = 32;
static Eina_Spinlock shmpool_lock;
-#define SHMPOOL_LOCK() eina_spinlock_take(&shmpool_lock)
+#define SHMPOOL_LOCK() eina_spinlock_take(&shmpool_lock)
#define SHMPOOL_UNLOCK() eina_spinlock_release(&shmpool_lock)
static X_Output_Buffer *
@@ -49,9 +49,9 @@ _find_xob(Display *d, Visual *v, int depth, int w, int h, int shm, void *data)
return evas_software_xlib_x_output_buffer_new(d, v, depth, w, h, shm, data);
if (depth > 1)
{
- bpp = depth / 8;
- if (bpp == 3) bpp = 4;
- lbytes = (((w * bpp) + 3) / 4) * 4;
+ bpp = depth / 8;
+ if (bpp == 3) bpp = 4;
+ lbytes = (((w * bpp) + 3) / 4) * 4;
}
else
lbytes = ((w + 63) / 64) * 8;
@@ -59,37 +59,37 @@ _find_xob(Display *d, Visual *v, int depth, int w, int h, int shm, void *data)
SHMPOOL_LOCK();
EINA_LIST_FOREACH(shmpool, l, xob2)
{
- int szdif;
-
- if ((xob2->xim->depth != depth) || (xob2->visual != v) ||
- (xob2->display != d) || (xob2->w != w))
- continue;
- szdif = xob2->psize - sz;
- if (szdif < 0) continue;
- if (szdif == 0)
- {
- xob = xob2;
- xl = l;
- goto have_xob;
- }
- if (szdif < fitness)
- {
- fitness = szdif;
- xob = xob2;
- xl = l;
- }
+ int szdif;
+
+ if ((xob2->xim->depth != depth) || (xob2->visual != v) ||
+ (xob2->display != d) || (xob2->w != w))
+ continue;
+ szdif = xob2->psize - sz;
+ if (szdif < 0) continue;
+ if (szdif == 0)
+ {
+ xob = xob2;
+ xl = l;
+ goto have_xob;
+ }
+ if (szdif < fitness)
+ {
+ fitness = szdif;
+ xob = xob2;
+ xl = l;
+ }
}
if (
- (fitness > (400 * 400)) ||
- (!xob)
- )
+ (fitness > (400 * 400)) ||
+ (!xob)
+ )
{
SHMPOOL_UNLOCK();
xob = evas_software_xlib_x_output_buffer_new(d, v, depth, w, h, shm, data);
return xob;
}
-
- have_xob:
+
+have_xob:
shmpool = eina_list_remove_list(shmpool, xl);
xob->w = w;
xob->h = h;
@@ -108,24 +108,24 @@ _unfind_xob(X_Output_Buffer *xob, int psync)
if (xob->shm_info)
{
SHMPOOL_LOCK();
- shmpool = eina_list_prepend(shmpool, xob);
- shmsize += xob->psize * xob->xim->depth / 8;
- while ((shmsize > (shmmemlimit)) ||
- (eina_list_count(shmpool) > shmcountlimit))
- {
- Eina_List *xl;
-
- xl = eina_list_last(shmpool);
- if (!xl)
- {
- shmsize = 0;
- break;
- }
- xob = xl->data;
+ shmpool = eina_list_prepend(shmpool, xob);
+ shmsize += xob->psize * xob->xim->depth / 8;
+ while ((shmsize > (shmmemlimit)) ||
+ (eina_list_count(shmpool) > shmcountlimit))
+ {
+ Eina_List *xl;
+
+ xl = eina_list_last(shmpool);
+ if (!xl)
+ {
+ shmsize = 0;
+ break;
+ }
+ xob = xl->data;
shmpool = eina_list_remove_list(shmpool, xl);
shmsize -= xob->psize * xob->xim->depth / 8;
- evas_software_xlib_x_output_buffer_unref(xob, psync);
- }
+ evas_software_xlib_x_output_buffer_unref(xob, psync);
+ }
SHMPOOL_UNLOCK();
}
else
@@ -142,11 +142,11 @@ _clear_xob(int psync)
SHMPOOL_LOCK();
while (shmpool)
{
- X_Output_Buffer *xob;
+ X_Output_Buffer *xob;
- xob = shmpool->data;
- shmpool = eina_list_remove_list(shmpool, shmpool);
- evas_software_xlib_x_output_buffer_unref(xob, psync);
+ xob = shmpool->data;
+ shmpool = eina_list_remove_list(shmpool, shmpool);
+ evas_software_xlib_x_output_buffer_unref(xob, psync);
}
shmsize = 0;
SHMPOOL_UNLOCK();
@@ -171,37 +171,37 @@ evas_software_xlib_outbuf_free(Outbuf *buf)
eina_spinlock_take(&(buf->priv.lock));
while (buf->priv.pending_writes)
{
- RGBA_Image *im;
- Outbuf_Region *obr;
+ RGBA_Image *im;
+ Outbuf_Region *obr;
- im = buf->priv.pending_writes->data;
- buf->priv.pending_writes = eina_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
- obr = im->extended_info;
+ im = buf->priv.pending_writes->data;
+ buf->priv.pending_writes = eina_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
+ obr = im->extended_info;
#ifdef EVAS_CSERVE2
- if (evas_cserve2_use_get())
- {
- evas_cache2_image_close(&im->cache_entry);
- }
- else
+ if (evas_cserve2_use_get())
+ {
+ evas_cache2_image_close(&im->cache_entry);
+ }
+ else
#endif
- evas_cache_image_drop(&im->cache_entry);
- if (obr->xob) _unfind_xob(obr->xob, 0);
- if (obr->mxob) _unfind_xob(obr->mxob, 0);
- free(obr);
+ evas_cache_image_drop(&im->cache_entry);
+ if (obr->xob) _unfind_xob(obr->xob, 0);
+ if (obr->mxob) _unfind_xob(obr->mxob, 0);
+ free(obr);
}
eina_spinlock_release(&(buf->priv.lock));
evas_software_xlib_outbuf_idle_flush(buf);
evas_software_xlib_outbuf_flush(buf, NULL, NULL, EVAS_RENDER_MODE_UNDEF);
if (buf->priv.x11.xlib.gc)
- XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc);
+ XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc);
if (buf->priv.x11.xlib.gcm)
- XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gcm);
+ XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gcm);
if (buf->priv.pal)
- evas_software_xlib_x_color_deallocate(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.cmap,
- buf->priv.x11.xlib.vis, buf->priv.pal);
+ evas_software_xlib_x_color_deallocate(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.cmap,
+ buf->priv.x11.xlib.vis, buf->priv.pal);
/* safe because no effect on the default colormap */
- XFreeColormap (buf->priv.x11.xlib.disp, buf->priv.x11.xlib.cmap);
+ XFreeColormap(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.cmap);
eina_array_flush(&buf->priv.onebuf_regions);
eina_spinlock_free(&(buf->priv.lock));
@@ -216,11 +216,11 @@ evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
int grayscale, int max_colors, Pixmap mask,
int shape_dither, int destination_alpha)
{
- Outbuf *buf;
+ Outbuf *buf;
buf = calloc(1, sizeof(Outbuf));
if (!buf)
- return NULL;
+ return NULL;
if (x_depth < 15) rot = 0;
@@ -239,136 +239,136 @@ evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
eina_array_step_set(&buf->priv.onebuf_regions, sizeof (Eina_Array), 8);
- {
- Gfx_Func_Convert conv_func;
- X_Output_Buffer *xob;
+ {
+ Gfx_Func_Convert conv_func;
+ X_Output_Buffer *xob;
buf->priv.x11.xlib.shm = evas_software_xlib_x_can_do_shm(buf->priv.x11.xlib.disp);
xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
- buf->priv.x11.xlib.vis,
- buf->priv.x11.xlib.depth,
- 1, 1, buf->priv.x11.xlib.shm, NULL);
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
+ 1, 1, buf->priv.x11.xlib.shm, NULL);
conv_func = NULL;
if (xob)
- {
+ {
#ifdef WORDS_BIGENDIAN
- if (evas_software_xlib_x_output_buffer_byte_order(xob) == LSBFirst)
- buf->priv.x11.xlib.swap = 1;
- if (evas_software_xlib_x_output_buffer_bit_order(xob) == MSBFirst)
- buf->priv.x11.xlib.bit_swap = 1;
+ if (evas_software_xlib_x_output_buffer_byte_order(xob) == LSBFirst)
+ buf->priv.x11.xlib.swap = 1;
+ if (evas_software_xlib_x_output_buffer_bit_order(xob) == MSBFirst)
+ buf->priv.x11.xlib.bit_swap = 1;
#else
- if (evas_software_xlib_x_output_buffer_byte_order(xob) == MSBFirst)
- buf->priv.x11.xlib.swap = 1;
- if (evas_software_xlib_x_output_buffer_bit_order(xob) == MSBFirst)
- buf->priv.x11.xlib.bit_swap = 1;
+ if (evas_software_xlib_x_output_buffer_byte_order(xob) == MSBFirst)
+ buf->priv.x11.xlib.swap = 1;
+ if (evas_software_xlib_x_output_buffer_bit_order(xob) == MSBFirst)
+ buf->priv.x11.xlib.bit_swap = 1;
#endif
- if (((vis->class == TrueColor) || (vis->class == DirectColor)) &&
- (x_depth > 8))
- {
- buf->priv.mask.r = (DATA32) vis->red_mask;
- buf->priv.mask.g = (DATA32) vis->green_mask;
- buf->priv.mask.b = (DATA32) vis->blue_mask;
- if (buf->priv.x11.xlib.swap)
- {
- SWAP32(buf->priv.mask.r);
- SWAP32(buf->priv.mask.g);
- SWAP32(buf->priv.mask.b);
- }
- }
- else if ((vis->class == PseudoColor) ||
- (vis->class == StaticColor) ||
- (vis->class == GrayScale) ||
- (vis->class == StaticGray) ||
- (x_depth <= 8))
- {
- Convert_Pal_Mode pm = PAL_MODE_RGB332;
-
- if ((vis->class == GrayScale) || (vis->class == StaticGray))
- grayscale = 1;
- if (grayscale)
- {
- if (max_colors >= 256)
- pm = PAL_MODE_GRAY256;
- else if (max_colors >= 64)
- pm = PAL_MODE_GRAY64;
- else if (max_colors >= 16)
- pm = PAL_MODE_GRAY16;
- else if (max_colors >= 4)
- pm = PAL_MODE_GRAY4;
- else
- pm = PAL_MODE_MONO;
- }
- else
- {
- if (max_colors >= 256)
- pm = PAL_MODE_RGB332;
- else if (max_colors >= 216)
- pm = PAL_MODE_RGB666;
- else if (max_colors >= 128)
- pm = PAL_MODE_RGB232;
- else if (max_colors >= 64)
- pm = PAL_MODE_RGB222;
- else if (max_colors >= 32)
- pm = PAL_MODE_RGB221;
- else if (max_colors >= 16)
- pm = PAL_MODE_RGB121;
- else if (max_colors >= 8)
- pm = PAL_MODE_RGB111;
- else if (max_colors >= 4)
- pm = PAL_MODE_GRAY4;
- else
- pm = PAL_MODE_MONO;
- }
- /* FIXME: only alloc once per display+cmap */
- buf->priv.pal = evas_software_xlib_x_color_allocate(disp, cmap, vis,
- pm);
+ if (((vis->class == TrueColor) || (vis->class == DirectColor)) &&
+ (x_depth > 8))
+ {
+ buf->priv.mask.r = (DATA32)vis->red_mask;
+ buf->priv.mask.g = (DATA32)vis->green_mask;
+ buf->priv.mask.b = (DATA32)vis->blue_mask;
+ if (buf->priv.x11.xlib.swap)
+ {
+ SWAP32(buf->priv.mask.r);
+ SWAP32(buf->priv.mask.g);
+ SWAP32(buf->priv.mask.b);
+ }
+ }
+ else if ((vis->class == PseudoColor) ||
+ (vis->class == StaticColor) ||
+ (vis->class == GrayScale) ||
+ (vis->class == StaticGray) ||
+ (x_depth <= 8))
+ {
+ Convert_Pal_Mode pm = PAL_MODE_RGB332;
+
+ if ((vis->class == GrayScale) || (vis->class == StaticGray))
+ grayscale = 1;
+ if (grayscale)
+ {
+ if (max_colors >= 256)
+ pm = PAL_MODE_GRAY256;
+ else if (max_colors >= 64)
+ pm = PAL_MODE_GRAY64;
+ else if (max_colors >= 16)
+ pm = PAL_MODE_GRAY16;
+ else if (max_colors >= 4)
+ pm = PAL_MODE_GRAY4;
+ else
+ pm = PAL_MODE_MONO;
+ }
+ else
+ {
+ if (max_colors >= 256)
+ pm = PAL_MODE_RGB332;
+ else if (max_colors >= 216)
+ pm = PAL_MODE_RGB666;
+ else if (max_colors >= 128)
+ pm = PAL_MODE_RGB232;
+ else if (max_colors >= 64)
+ pm = PAL_MODE_RGB222;
+ else if (max_colors >= 32)
+ pm = PAL_MODE_RGB221;
+ else if (max_colors >= 16)
+ pm = PAL_MODE_RGB121;
+ else if (max_colors >= 8)
+ pm = PAL_MODE_RGB111;
+ else if (max_colors >= 4)
+ pm = PAL_MODE_GRAY4;
+ else
+ pm = PAL_MODE_MONO;
+ }
+ /* FIXME: only alloc once per display+cmap */
+ buf->priv.pal = evas_software_xlib_x_color_allocate(disp, cmap, vis,
+ pm);
if (!buf->priv.pal)
{
if (xob) evas_software_xlib_x_output_buffer_unref(xob, 1);
free(buf);
return NULL;
}
- }
- if (buf->priv.pal)
- {
- if (buf->rot == 0 || buf->rot == 180)
- conv_func = evas_common_convert_func_get(0, buf->w, buf->h,
- evas_software_xlib_x_output_buffer_depth
- (xob), buf->priv.mask.r,
- buf->priv.mask.g,
- buf->priv.mask.b,
- buf->priv.pal->colors,
- buf->rot);
- else if (buf->rot == 90 || buf->rot == 270)
- conv_func = evas_common_convert_func_get(0, buf->h, buf->w,
- evas_software_xlib_x_output_buffer_depth
- (xob), buf->priv.mask.r,
- buf->priv.mask.g,
- buf->priv.mask.b,
- buf->priv.pal->colors,
- buf->rot);
- }
- else
- {
- if (buf->rot == 0 || buf->rot == 180)
- conv_func = evas_common_convert_func_get(0, buf->w, buf->h,
- evas_software_xlib_x_output_buffer_depth
- (xob), buf->priv.mask.r,
- buf->priv.mask.g,
- buf->priv.mask.b, PAL_MODE_NONE,
- buf->rot);
- else if (buf->rot == 90 || buf->rot == 270)
- conv_func = evas_common_convert_func_get(0, buf->h, buf->w,
- evas_software_xlib_x_output_buffer_depth
- (xob), buf->priv.mask.r,
- buf->priv.mask.g,
- buf->priv.mask.b, PAL_MODE_NONE,
- buf->rot);
- }
+ }
+ if (buf->priv.pal)
+ {
+ if (buf->rot == 0 || buf->rot == 180)
+ conv_func = evas_common_convert_func_get(0, buf->w, buf->h,
+ evas_software_xlib_x_output_buffer_depth
+ (xob), buf->priv.mask.r,
+ buf->priv.mask.g,
+ buf->priv.mask.b,
+ buf->priv.pal->colors,
+ buf->rot);
+ else if (buf->rot == 90 || buf->rot == 270)
+ conv_func = evas_common_convert_func_get(0, buf->h, buf->w,
+ evas_software_xlib_x_output_buffer_depth
+ (xob), buf->priv.mask.r,
+ buf->priv.mask.g,
+ buf->priv.mask.b,
+ buf->priv.pal->colors,
+ buf->rot);
+ }
+ else
+ {
+ if (buf->rot == 0 || buf->rot == 180)
+ conv_func = evas_common_convert_func_get(0, buf->w, buf->h,
+ evas_software_xlib_x_output_buffer_depth
+ (xob), buf->priv.mask.r,
+ buf->priv.mask.g,
+ buf->priv.mask.b, PAL_MODE_NONE,
+ buf->rot);
+ else if (buf->rot == 90 || buf->rot == 270)
+ conv_func = evas_common_convert_func_get(0, buf->h, buf->w,
+ evas_software_xlib_x_output_buffer_depth
+ (xob), buf->priv.mask.r,
+ buf->priv.mask.g,
+ buf->priv.mask.b, PAL_MODE_NONE,
+ buf->rot);
+ }
buf->priv.x11.xlib.imdepth = evas_software_xlib_x_output_buffer_depth(xob);
evas_software_xlib_x_output_buffer_unref(xob, 1);
- if (!conv_func)
- {
+ if (!conv_func)
+ {
ERR("At depth: %i, RGB format mask: %08x %08x %08x, "
"Palette mode: %i. "
"Not supported by compiled in converters!",
@@ -377,8 +377,8 @@ evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
buf->priv.mask.g,
buf->priv.mask.b,
buf->priv.pal ? (int)buf->priv.pal->colors : -1);
- }
- }
+ }
+ }
evas_software_xlib_outbuf_drawable_set(buf, draw);
evas_software_xlib_outbuf_mask_set(buf, mask);
}
@@ -392,18 +392,18 @@ evas_software_xlib_outbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
void *
evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w, int h, int *cx, int *cy, int *cw, int *ch)
{
- RGBA_Image *im;
- Outbuf_Region *obr;
- int bpl = 0;
- int use_shm = 1;
- int alpha;
+ RGBA_Image *im;
+ Outbuf_Region *obr;
+ int bpl = 0;
+ int use_shm = 1;
+ int alpha;
eina_spinlock_take(&(buf->priv.lock));
if ((buf->onebuf) && (buf->priv.x11.xlib.shm))
{
- Eina_Rectangle *rect;
+ Eina_Rectangle *rect;
- RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h);
+ RECTS_CLIP_TO_RECT(x, y, w, h, 0, 0, buf->w, buf->h);
rect = eina_rectangle_new(x, y, w, h);
if (!rect)
@@ -414,53 +414,53 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
if ((eina_array_push(&buf->priv.onebuf_regions, rect)) &&
(buf->priv.onebuf))
- {
- *cx = x;
- *cy = y;
- *cw = w;
- *ch = h;
- if (!buf->priv.synced)
- {
- XSync(buf->priv.x11.xlib.disp, False);
- buf->priv.synced = 1;
- }
+ {
+ *cx = x;
+ *cy = y;
+ *cw = w;
+ *ch = h;
+ if (!buf->priv.synced)
+ {
+ XSync(buf->priv.x11.xlib.disp, False);
+ buf->priv.synced = 1;
+ }
eina_spinlock_release(&(buf->priv.lock));
- return buf->priv.onebuf;
- }
+ return buf->priv.onebuf;
+ }
if (rect) eina_rectangle_free(rect);
- obr = calloc(1, sizeof(Outbuf_Region));
+ obr = calloc(1, sizeof(Outbuf_Region));
if (!obr)
{
eina_spinlock_release(&(buf->priv.lock));
return NULL;
}
- obr->x = 0;
- obr->y = 0;
- obr->w = buf->w;
- obr->h = buf->h;
- *cx = x;
- *cy = y;
- *cw = w;
- *ch = h;
+ obr->x = 0;
+ obr->y = 0;
+ obr->w = buf->w;
+ obr->h = buf->h;
+ *cx = x;
+ *cy = y;
+ *cw = w;
+ *ch = h;
alpha = ((buf->priv.x11.xlib.mask) || (buf->priv.destination_alpha));
- use_shm = buf->priv.x11.xlib.shm;
- if ((buf->rot == 0) &&
+ use_shm = buf->priv.x11.xlib.shm;
+ if ((buf->rot == 0) &&
(buf->priv.x11.xlib.imdepth == 32) &&
- (buf->priv.mask.r == 0xff0000) &&
- (buf->priv.mask.g == 0x00ff00) &&
- (buf->priv.mask.b == 0x0000ff))
- {
- obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
- buf->priv.x11.xlib.vis,
- buf->priv.x11.xlib.depth,
- buf->w, buf->h,
- use_shm,
- NULL);
+ (buf->priv.mask.r == 0xff0000) &&
+ (buf->priv.mask.g == 0x00ff00) &&
+ (buf->priv.mask.b == 0x0000ff))
+ {
+ obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
+ buf->w, buf->h,
+ use_shm,
+ NULL);
if (!obr->xob)
{
free(obr);
@@ -471,16 +471,16 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
if (evas_cserve2_use_get())
{
im = (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(),
- buf->w, buf->h,
- (DATA32 *) evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
- alpha, EVAS_COLORSPACE_ARGB8888);
+ buf->w, buf->h,
+ (DATA32 *)evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
+ alpha, EVAS_COLORSPACE_ARGB8888);
}
else
#endif
- im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
- buf->w, buf->h,
- (DATA32 *) evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
- alpha, EVAS_COLORSPACE_ARGB8888);
+ im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
+ buf->w, buf->h,
+ (DATA32 *)evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
+ alpha, EVAS_COLORSPACE_ARGB8888);
if (!im)
{
evas_software_xlib_x_output_buffer_unref(obr->xob, 0);
@@ -490,21 +490,21 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
}
im->extended_info = obr;
if (buf->priv.x11.xlib.mask)
- obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
- buf->priv.x11.xlib.vis,
- 1,
- buf->w, buf->h,
- use_shm,
- NULL);
- }
- else
- {
+ obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ 1,
+ buf->w, buf->h,
+ use_shm,
+ NULL);
+ }
+ else
+ {
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
im = (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get());
else
#endif
- im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
+ im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
if (!im)
{
free(obr);
@@ -517,9 +517,9 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
evas_cache2_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
else
#endif
- evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
- im->extended_info = obr;
- if ((buf->rot == 0) || (buf->rot == 180))
+ evas_cache_image_surface_alloc(&im->cache_entry, buf->w, buf->h);
+ im->extended_info = obr;
+ if ((buf->rot == 0) || (buf->rot == 180))
{
obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
buf->priv.x11.xlib.vis,
@@ -536,19 +536,19 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
}
else
#endif
- evas_cache_image_drop(&im->cache_entry);
+ evas_cache_image_drop(&im->cache_entry);
free(obr);
eina_spinlock_release(&(buf->priv.lock));
return NULL;
}
if (buf->priv.x11.xlib.mask)
- obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
- buf->priv.x11.xlib.vis,
- 1, buf->w, buf->h,
- use_shm,
- NULL);
+ obr->mxob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ 1, buf->w, buf->h,
+ use_shm,
+ NULL);
}
- else if ((buf->rot == 90) || (buf->rot == 270))
+ else if ((buf->rot == 90) || (buf->rot == 270))
{
obr->xob = evas_software_xlib_x_output_buffer_new(buf->priv.x11.xlib.disp,
buf->priv.x11.xlib.vis,
@@ -565,7 +565,7 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
}
else
#endif
- evas_cache_image_drop(&im->cache_entry);
+ evas_cache_image_drop(&im->cache_entry);
free(obr);
eina_spinlock_release(&(buf->priv.lock));
return NULL;
@@ -577,9 +577,9 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
use_shm,
NULL);
}
- }
- /* FIXME: We should be able to remove this memset, but somewhere in the process
- we copy too much to the destination surface and some area are not cleaned before copy. */
+ }
+ /* FIXME: We should be able to remove this memset, but somewhere in the process
+ we copy too much to the destination surface and some area are not cleaned before copy. */
if ((alpha) && (im->image.data))
{
/* FIXME: faster memset! */
@@ -588,7 +588,7 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
buf->priv.onebuf = im;
eina_spinlock_release(&(buf->priv.lock));
- return im;
+ return im;
}
obr = calloc(1, sizeof(Outbuf_Region));
@@ -621,12 +621,12 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
(buf->priv.mask.g == 0x00ff00) &&
(buf->priv.mask.b == 0x0000ff))
{
- obr->xob = _find_xob(buf->priv.x11.xlib.disp,
- buf->priv.x11.xlib.vis,
- buf->priv.x11.xlib.depth,
- w, h,
- use_shm,
- NULL);
+ obr->xob = _find_xob(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ buf->priv.x11.xlib.depth,
+ w, h,
+ use_shm,
+ NULL);
if (!obr->xob)
{
free(obr);
@@ -637,14 +637,14 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
if (evas_cserve2_use_get())
im = (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(),
w, h,
- (DATA32 *) evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
+ (DATA32 *)evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
alpha, EVAS_COLORSPACE_ARGB8888);
else
#endif
- im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
- w, h,
- (DATA32 *) evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
- alpha, EVAS_COLORSPACE_ARGB8888);
+ im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
+ w, h,
+ (DATA32 *)evas_software_xlib_x_output_buffer_data(obr->xob, &bpl),
+ alpha, EVAS_COLORSPACE_ARGB8888);
if (!im)
{
_unfind_xob(obr->xob, 0);
@@ -652,13 +652,13 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
eina_spinlock_release(&(buf->priv.lock));
return NULL;
}
- im->extended_info = obr;
- if (buf->priv.x11.xlib.mask)
- obr->mxob = _find_xob(buf->priv.x11.xlib.disp,
- buf->priv.x11.xlib.vis,
- 1, w, h,
- use_shm,
- NULL);
+ im->extended_info = obr;
+ if (buf->priv.x11.xlib.mask)
+ obr->mxob = _find_xob(buf->priv.x11.xlib.disp,
+ buf->priv.x11.xlib.vis,
+ 1, w, h,
+ use_shm,
+ NULL);
}
else
{
@@ -667,7 +667,7 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
im = (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get());
else
#endif
- im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
+ im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
if (!im)
{
free(obr);
@@ -682,9 +682,9 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
evas_cache2_image_surface_alloc(&im->cache_entry, w, h);
else
#endif
- evas_cache_image_surface_alloc(&im->cache_entry, w, h);
- im->extended_info = obr;
- if ((buf->rot == 0) || (buf->rot == 180))
+ evas_cache_image_surface_alloc(&im->cache_entry, w, h);
+ im->extended_info = obr;
+ if ((buf->rot == 0) || (buf->rot == 180))
{
obr->xob = _find_xob(buf->priv.x11.xlib.disp,
buf->priv.x11.xlib.vis,
@@ -701,7 +701,7 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
}
else
#endif
- evas_cache_image_drop(&im->cache_entry);
+ evas_cache_image_drop(&im->cache_entry);
free(obr);
eina_spinlock_release(&(buf->priv.lock));
return NULL;
@@ -713,7 +713,7 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
use_shm,
NULL);
}
- else if ((buf->rot == 90) || (buf->rot == 270))
+ else if ((buf->rot == 90) || (buf->rot == 270))
{
obr->xob = _find_xob(buf->priv.x11.xlib.disp,
buf->priv.x11.xlib.vis,
@@ -730,7 +730,7 @@ evas_software_xlib_outbuf_new_region_for_update(Outbuf *buf, int x, int y, int w
}
else
#endif
- evas_cache_image_drop(&im->cache_entry);
+ evas_cache_image_drop(&im->cache_entry);
free(obr);
eina_spinlock_release(&(buf->priv.lock));
return NULL;
@@ -776,97 +776,97 @@ evas_software_xlib_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_U
Eina_Rectangle *rect;
Eina_Array_Iterator it;
unsigned int i;
- Region tmpr;
+ Region tmpr;
- im = buf->priv.onebuf;
- obr = im->extended_info;
- tmpr = XCreateRegion();
+ im = buf->priv.onebuf;
+ obr = im->extended_info;
+ tmpr = XCreateRegion();
EINA_ARRAY_ITER_NEXT(&buf->priv.onebuf_regions, i, rect, it)
- {
- XRectangle xr;
-
- if (buf->rot == 0)
- {
- xr.x = rect->x;
- xr.y = rect->y;
- xr.width = rect->w;
- xr.height = rect->h;
- }
- else if (buf->rot == 90)
- {
- xr.x = rect->y;
- xr.y = buf->w - rect->x - rect->w;
- xr.width = rect->h;
- xr.height = rect->w;
- }
- else if (buf->rot == 180)
- {
- xr.x = buf->w - rect->x - rect->w;
- xr.y = buf->h - rect->y - rect->h;
- xr.width = rect->w;
- xr.height = rect->h;
- }
- else if (buf->rot == 270)
- {
- xr.x = buf->h - rect->y - rect->h;
- xr.y = rect->x;
- xr.width = rect->h;
- xr.height = rect->w;
- }
- XUnionRectWithRegion(&xr, tmpr, tmpr);
- if (buf->priv.debug)
- evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
- xr.x, xr.y, xr.width, xr.height);
- eina_rectangle_free(rect);
- }
+ {
+ XRectangle xr;
+
+ if (buf->rot == 0)
+ {
+ xr.x = rect->x;
+ xr.y = rect->y;
+ xr.width = rect->w;
+ xr.height = rect->h;
+ }
+ else if (buf->rot == 90)
+ {
+ xr.x = rect->y;
+ xr.y = buf->w - rect->x - rect->w;
+ xr.width = rect->h;
+ xr.height = rect->w;
+ }
+ else if (buf->rot == 180)
+ {
+ xr.x = buf->w - rect->x - rect->w;
+ xr.y = buf->h - rect->y - rect->h;
+ xr.width = rect->w;
+ xr.height = rect->h;
+ }
+ else if (buf->rot == 270)
+ {
+ xr.x = buf->h - rect->y - rect->h;
+ xr.y = rect->x;
+ xr.width = rect->h;
+ xr.height = rect->w;
+ }
+ XUnionRectWithRegion(&xr, tmpr, tmpr);
+ if (buf->priv.debug)
+ evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
+ xr.x, xr.y, xr.width, xr.height);
+ eina_rectangle_free(rect);
+ }
eina_array_clean(&buf->priv.onebuf_regions);
- XSetRegion(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc, tmpr);
+ XSetRegion(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc, tmpr);
if (obr->xob)
{
evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
buf->priv.x11.xlib.gc,
0, 0, 0);
}
- if (obr->mxob)
- {
- XSetRegion(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gcm, tmpr);
- evas_software_xlib_x_output_buffer_paste(obr->mxob,
+ if (obr->mxob)
+ {
+ XSetRegion(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gcm, tmpr);
+ evas_software_xlib_x_output_buffer_paste(obr->mxob,
buf->priv.x11.xlib.mask,
buf->priv.x11.xlib.gcm,
0, 0, 0);
- }
- XDestroyRegion(tmpr);
- buf->priv.synced = 0;
+ }
+ XDestroyRegion(tmpr);
+ buf->priv.synced = 0;
}
else
{
#if 1
XSync(buf->priv.x11.xlib.disp, False);
- EINA_LIST_FOREACH(buf->priv.pending_writes, l, im)
- {
- obr = im->extended_info;
- if (buf->priv.debug)
- evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
- obr->x, obr->y, obr->w, obr->h);
+ EINA_LIST_FOREACH(buf->priv.pending_writes, l, im)
+ {
+ obr = im->extended_info;
+ if (buf->priv.debug)
+ evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
+ obr->x, obr->y, obr->w, obr->h);
if (obr->xob)
{
evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
buf->priv.x11.xlib.gc,
obr->x, obr->y, 0);
}
- if (obr->mxob)
- evas_software_xlib_x_output_buffer_paste(obr->mxob,
- buf->priv.x11.xlib.mask,
- buf->priv.x11.xlib.gcm,
- obr->x, obr->y, 0);
- }
- while (buf->priv.prev_pending_writes)
- {
- im = buf->priv.prev_pending_writes->data;
- buf->priv.prev_pending_writes =
- eina_list_remove_list(buf->priv.prev_pending_writes,
- buf->priv.prev_pending_writes);
- obr = im->extended_info;
+ if (obr->mxob)
+ evas_software_xlib_x_output_buffer_paste(obr->mxob,
+ buf->priv.x11.xlib.mask,
+ buf->priv.x11.xlib.gcm,
+ obr->x, obr->y, 0);
+ }
+ while (buf->priv.prev_pending_writes)
+ {
+ im = buf->priv.prev_pending_writes->data;
+ buf->priv.prev_pending_writes =
+ eina_list_remove_list(buf->priv.prev_pending_writes,
+ buf->priv.prev_pending_writes);
+ obr = im->extended_info;
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
{
@@ -874,43 +874,43 @@ evas_software_xlib_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_U
}
else
#endif
- evas_cache_image_drop(&im->cache_entry);
- if (obr->xob) _unfind_xob(obr->xob, 0);
- if (obr->mxob) _unfind_xob(obr->mxob, 0);
- free(obr);
- }
- buf->priv.prev_pending_writes = buf->priv.pending_writes;
- buf->priv.pending_writes = NULL;
- XFlush(buf->priv.x11.xlib.disp);
+ evas_cache_image_drop(&im->cache_entry);
+ if (obr->xob) _unfind_xob(obr->xob, 0);
+ if (obr->mxob) _unfind_xob(obr->mxob, 0);
+ free(obr);
+ }
+ buf->priv.prev_pending_writes = buf->priv.pending_writes;
+ buf->priv.pending_writes = NULL;
+ XFlush(buf->priv.x11.xlib.disp);
#else
- /* XX async push - disable */
- /*
- EINA_LIST_FOREACH(buf->priv.pending_writes, l, im)
- {
- obr = im->extended_info;
- if (buf->priv.debug)
- evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
- obr->x, obr->y, obr->w, obr->h);
- evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
- buf->priv.x11.xlib.gc,
- obr->x, obr->y, 0);
- if (obr->mxob)
- evas_software_xlib_x_output_buffer_paste(obr->mxob,
- buf->priv.x11.xlib.mask,
- buf->priv.x11.xlib.gcm,
- obr->x, obr->y, 0);
- }
- */
- XSync(buf->priv.x11.xlib.disp, False);
-
- while (buf->priv.pending_writes)
- {
- RGBA_Image *im;
- Outbuf_Region *obr;
-
- im = eina_list_data_get(buf->priv.pending_writes);
- buf->priv.pending_writes = eina_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
- obr = im->extended_info;
+ /* XX async push - disable */
+ /*
+ EINA_LIST_FOREACH(buf->priv.pending_writes, l, im)
+ {
+ obr = im->extended_info;
+ if (buf->priv.debug)
+ evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
+ obr->x, obr->y, obr->w, obr->h);
+ evas_software_xlib_x_output_buffer_paste(obr->xob, buf->priv.x11.xlib.win,
+ buf->priv.x11.xlib.gc,
+ obr->x, obr->y, 0);
+ if (obr->mxob)
+ evas_software_xlib_x_output_buffer_paste(obr->mxob,
+ buf->priv.x11.xlib.mask,
+ buf->priv.x11.xlib.gcm,
+ obr->x, obr->y, 0);
+ }
+ */
+ XSync(buf->priv.x11.xlib.disp, False);
+
+ while (buf->priv.pending_writes)
+ {
+ RGBA_Image *im;
+ Outbuf_Region *obr;
+
+ im = eina_list_data_get(buf->priv.pending_writes);
+ buf->priv.pending_writes = eina_list_remove_list(buf->priv.pending_writes, buf->priv.pending_writes);
+ obr = im->extended_info;
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
{
@@ -918,10 +918,10 @@ evas_software_xlib_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_U
}
else
#endif
- evas_cache_image_drop(&im->cache_entry);
- if (obr->xob) _unfind_xob(obr->xob, 0);
- if (obr->mxob) _unfind_xob(obr->mxob, 0);
- free(obr);
+ evas_cache_image_drop(&im->cache_entry);
+ if (obr->xob) _unfind_xob(obr->xob, 0);
+ if (obr->mxob) _unfind_xob(obr->mxob, 0);
+ free(obr);
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
{
@@ -929,8 +929,8 @@ evas_software_xlib_outbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_U
}
else
#endif
- evas_cache_image_drop(&im->cache_entry);
- }
+ evas_cache_image_drop(&im->cache_entry);
+ }
#endif
}
eina_spinlock_release(&(buf->priv.lock));
@@ -944,11 +944,11 @@ evas_software_xlib_outbuf_idle_flush(Outbuf *buf)
if (buf->priv.onebuf)
{
RGBA_Image *im;
- Outbuf_Region *obr;
+ Outbuf_Region *obr;
- im = buf->priv.onebuf;
- buf->priv.onebuf = NULL;
- obr = im->extended_info;
+ im = buf->priv.onebuf;
+ buf->priv.onebuf = NULL;
+ obr = im->extended_info;
if (obr->xob)
{
SHMPOOL_LOCK();
@@ -961,7 +961,7 @@ evas_software_xlib_outbuf_idle_flush(Outbuf *buf)
evas_software_xlib_x_output_buffer_unref(obr->mxob, 0);
SHMPOOL_UNLOCK();
}
- free(obr);
+ free(obr);
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
{
@@ -969,21 +969,21 @@ evas_software_xlib_outbuf_idle_flush(Outbuf *buf)
}
else
#endif
- evas_cache_image_drop(&im->cache_entry);
+ evas_cache_image_drop(&im->cache_entry);
}
else
{
- if (buf->priv.prev_pending_writes) XSync(buf->priv.x11.xlib.disp, False);
- while (buf->priv.prev_pending_writes)
- {
- RGBA_Image *im;
- Outbuf_Region *obr;
-
- im = buf->priv.prev_pending_writes->data;
- buf->priv.prev_pending_writes =
- eina_list_remove_list(buf->priv.prev_pending_writes,
- buf->priv.prev_pending_writes);
- obr = im->extended_info;
+ if (buf->priv.prev_pending_writes) XSync(buf->priv.x11.xlib.disp, False);
+ while (buf->priv.prev_pending_writes)
+ {
+ RGBA_Image *im;
+ Outbuf_Region *obr;
+
+ im = buf->priv.prev_pending_writes->data;
+ buf->priv.prev_pending_writes =
+ eina_list_remove_list(buf->priv.prev_pending_writes,
+ buf->priv.prev_pending_writes);
+ obr = im->extended_info;
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
{
@@ -991,12 +991,12 @@ evas_software_xlib_outbuf_idle_flush(Outbuf *buf)
}
else
#endif
- evas_cache_image_drop(&im->cache_entry);
- if (obr->xob) _unfind_xob(obr->xob, 0);
- if (obr->mxob) _unfind_xob(obr->mxob, 0);
- free(obr);
- }
- _clear_xob(0);
+ evas_cache_image_drop(&im->cache_entry);
+ if (obr->xob) _unfind_xob(obr->xob, 0);
+ if (obr->mxob) _unfind_xob(obr->mxob, 0);
+ free(obr);
+ }
+ _clear_xob(0);
}
eina_spinlock_release(&(buf->priv.lock));
}
@@ -1004,43 +1004,43 @@ evas_software_xlib_outbuf_idle_flush(Outbuf *buf)
void
evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, int x, int y, int w, int h)
{
- Gfx_Func_Convert conv_func = NULL;
- Outbuf_Region *obr;
- DATA32 *src_data;
- unsigned char *data;
- int bpl = 0, yy;
+ Gfx_Func_Convert conv_func = NULL;
+ Outbuf_Region *obr;
+ DATA32 *src_data;
+ unsigned char *data;
+ int bpl = 0, yy;
eina_spinlock_take(&(buf->priv.lock));
obr = update->extended_info;
if (buf->priv.pal)
{
- if ((buf->rot == 0) || (buf->rot == 180))
- conv_func = evas_common_convert_func_get(0, w, h,
- evas_software_xlib_x_output_buffer_depth
- (obr->xob), buf->priv.mask.r,
- buf->priv.mask.g, buf->priv.mask.b,
- buf->priv.pal->colors, buf->rot);
- else if ((buf->rot == 90) || (buf->rot == 270))
- conv_func = evas_common_convert_func_get(0, h, w,
- evas_software_xlib_x_output_buffer_depth
- (obr->xob), buf->priv.mask.r,
- buf->priv.mask.g, buf->priv.mask.b,
- buf->priv.pal->colors, buf->rot);
+ if ((buf->rot == 0) || (buf->rot == 180))
+ conv_func = evas_common_convert_func_get(0, w, h,
+ evas_software_xlib_x_output_buffer_depth
+ (obr->xob), buf->priv.mask.r,
+ buf->priv.mask.g, buf->priv.mask.b,
+ buf->priv.pal->colors, buf->rot);
+ else if ((buf->rot == 90) || (buf->rot == 270))
+ conv_func = evas_common_convert_func_get(0, h, w,
+ evas_software_xlib_x_output_buffer_depth
+ (obr->xob), buf->priv.mask.r,
+ buf->priv.mask.g, buf->priv.mask.b,
+ buf->priv.pal->colors, buf->rot);
}
else
{
- if ((buf->rot == 0) || (buf->rot == 180))
- conv_func = evas_common_convert_func_get(0, w, h,
- evas_software_xlib_x_output_buffer_depth
- (obr->xob), buf->priv.mask.r,
- buf->priv.mask.g, buf->priv.mask.b,
- PAL_MODE_NONE, buf->rot);
- else if ((buf->rot == 90) || (buf->rot == 270))
- conv_func = evas_common_convert_func_get(0, h, w,
- evas_software_xlib_x_output_buffer_depth
- (obr->xob), buf->priv.mask.r,
- buf->priv.mask.g, buf->priv.mask.b,
- PAL_MODE_NONE, buf->rot);
+ if ((buf->rot == 0) || (buf->rot == 180))
+ conv_func = evas_common_convert_func_get(0, w, h,
+ evas_software_xlib_x_output_buffer_depth
+ (obr->xob), buf->priv.mask.r,
+ buf->priv.mask.g, buf->priv.mask.b,
+ PAL_MODE_NONE, buf->rot);
+ else if ((buf->rot == 90) || (buf->rot == 270))
+ conv_func = evas_common_convert_func_get(0, h, w,
+ evas_software_xlib_x_output_buffer_depth
+ (obr->xob), buf->priv.mask.r,
+ buf->priv.mask.g, buf->priv.mask.b,
+ PAL_MODE_NONE, buf->rot);
}
if (!conv_func)
{
@@ -1067,44 +1067,44 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
}
if (buf->rot == 0)
{
- obr->x = x;
- obr->y = y;
+ obr->x = x;
+ obr->y = y;
}
else if (buf->rot == 90)
{
- obr->x = y;
- obr->y = buf->w - x - w;
+ obr->x = y;
+ obr->y = buf->w - x - w;
}
else if (buf->rot == 180)
{
- obr->x = buf->w - x - w;
- obr->y = buf->h - y - h;
+ obr->x = buf->w - x - w;
+ obr->y = buf->h - y - h;
}
else if (buf->rot == 270)
{
- obr->x = buf->h - y - h;
- obr->y = x;
+ obr->x = buf->h - y - h;
+ obr->y = x;
}
if ((buf->rot == 0) || (buf->rot == 180))
{
- obr->w = w;
- obr->h = h;
+ obr->w = w;
+ obr->h = h;
}
else if ((buf->rot == 90) || (buf->rot == 270))
{
- obr->w = h;
- obr->h = w;
+ obr->w = h;
+ obr->h = w;
}
if (buf->onebuf)
{
src_data += x + (y * update->cache_entry.w);
- data += (bpl * obr->y) +
- (obr->x * (evas_software_xlib_x_output_buffer_depth(obr->xob) / 8));
+ data += (bpl * obr->y) +
+ (obr->x * (evas_software_xlib_x_output_buffer_depth(obr->xob) / 8));
}
if (buf->priv.pal)
{
- if (data != (unsigned char *)src_data)
- conv_func(src_data, data, update->cache_entry.w - w,
+ if (data != (unsigned char *)src_data)
+ conv_func(src_data, data, update->cache_entry.w - w,
bpl - obr->w, obr->w, obr->h, x, y,
buf->priv.pal->lookup);
}
@@ -1113,7 +1113,7 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
int pixelb = evas_software_xlib_x_output_buffer_depth(obr->xob) / 8;
int run;
int dstjump;
-
+
if (pixelb == 3)
{
run = obr->w * pixelb;
@@ -1129,8 +1129,8 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
run = obr->w;
dstjump = bpl - run;
}
- if (data != (unsigned char *)src_data)
- conv_func(src_data, data, update->cache_entry.w - w, dstjump,
+ if (data != (unsigned char *)src_data)
+ conv_func(src_data, data, update->cache_entry.w - w, dstjump,
obr->w, obr->h, x, y, NULL);
}
#if 1
@@ -1138,8 +1138,8 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
/* XX async push */
if (!((buf->priv.onebuf) && eina_array_count(&buf->priv.onebuf_regions)))
{
- if (buf->priv.debug)
- evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
+ if (buf->priv.debug)
+ evas_software_xlib_outbuf_debug_show(buf, buf->priv.x11.xlib.win,
obr->x, obr->y, obr->w, obr->h);
if (obr->xob)
{
@@ -1162,10 +1162,10 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
{
for (yy = 0; yy < obr->h; yy++)
evas_software_xlib_x_write_mask_line_vert(buf, obr->mxob,
- src_data + yy,
+ src_data + yy,
h, // h
obr->h - yy - 1, // ym
- w); // w
+ w); // w
}
else if (buf->rot == 180)
{
@@ -1173,7 +1173,7 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
{
evas_software_xlib_x_write_mask_line_rev(buf, obr->mxob,
src_data +
- (yy * obr->w),
+ (yy * obr->w),
obr->w, obr->h - yy - 1);
}
}
@@ -1184,16 +1184,16 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
src_data + yy,
h, // h
yy, // ym
- w); // w
+ w); // w
}
#if 1
#else
- /* XX async push */
- if (!((buf->priv.onebuf) && eina_array_count(&buf->priv.onebuf_regions)))
- evas_software_xlib_x_output_buffer_paste(obr->mxob,
- buf->priv.x11.xlib.mask,
- buf->priv.x11.xlib.gcm,
- obr->x, obr->y, 0);
+ /* XX async push */
+ if (!((buf->priv.onebuf) && eina_array_count(&buf->priv.onebuf_regions)))
+ evas_software_xlib_x_output_buffer_paste(obr->mxob,
+ buf->priv.x11.xlib.mask,
+ buf->priv.x11.xlib.gcm,
+ obr->x, obr->y, 0);
#endif
}
#if 1
@@ -1204,8 +1204,8 @@ evas_software_xlib_outbuf_push_updated_region(Outbuf *buf, RGBA_Image *update, i
}
void
-evas_software_xlib_outbuf_reconfigure(Outbuf * buf, int w, int h, int rot,
- Outbuf_Depth depth)
+evas_software_xlib_outbuf_reconfigure(Outbuf *buf, int w, int h, int rot,
+ Outbuf_Depth depth)
{
if ((w == buf->w) &&
(h == buf->h) &&
@@ -1222,54 +1222,54 @@ evas_software_xlib_outbuf_reconfigure(Outbuf * buf, int w, int h, int rot,
}
int
-evas_software_xlib_outbuf_get_width(Outbuf * buf)
+evas_software_xlib_outbuf_get_width(Outbuf *buf)
{
return buf->w;
}
int
-evas_software_xlib_outbuf_get_height(Outbuf * buf)
+evas_software_xlib_outbuf_get_height(Outbuf *buf)
{
return buf->h;
}
Outbuf_Depth
-evas_software_xlib_outbuf_get_depth(Outbuf * buf)
+evas_software_xlib_outbuf_get_depth(Outbuf *buf)
{
return buf->depth;
}
int
-evas_software_xlib_outbuf_get_rot(Outbuf * buf)
+evas_software_xlib_outbuf_get_rot(Outbuf *buf)
{
return buf->rot;
}
void
-evas_software_xlib_outbuf_drawable_set(Outbuf * buf, Drawable draw)
+evas_software_xlib_outbuf_drawable_set(Outbuf *buf, Drawable draw)
{
- XGCValues gcv;
+ XGCValues gcv;
if (buf->priv.x11.xlib.win == draw) return;
if (buf->priv.x11.xlib.gc)
{
- XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc);
- buf->priv.x11.xlib.gc = NULL;
+ XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc);
+ buf->priv.x11.xlib.gc = NULL;
}
buf->priv.x11.xlib.win = draw;
buf->priv.x11.xlib.gc = XCreateGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.win, 0, &gcv);
}
void
-evas_software_xlib_outbuf_mask_set(Outbuf * buf, Pixmap mask)
+evas_software_xlib_outbuf_mask_set(Outbuf *buf, Pixmap mask)
{
- XGCValues gcv;
+ XGCValues gcv;
if (buf->priv.x11.xlib.mask == mask) return;
if (buf->priv.x11.xlib.gcm)
{
- XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gcm);
- buf->priv.x11.xlib.gcm = NULL;
+ XFreeGC(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gcm);
+ buf->priv.x11.xlib.gcm = NULL;
}
buf->priv.x11.xlib.mask = mask;
if (buf->priv.x11.xlib.mask)
@@ -1277,41 +1277,41 @@ evas_software_xlib_outbuf_mask_set(Outbuf * buf, Pixmap mask)
}
void
-evas_software_xlib_outbuf_debug_set(Outbuf * buf, int debug)
+evas_software_xlib_outbuf_debug_set(Outbuf *buf, int debug)
{
buf->priv.debug = debug;
}
void
-evas_software_xlib_outbuf_debug_show(Outbuf * buf, Drawable draw, int x, int y, int w,
- int h)
+evas_software_xlib_outbuf_debug_show(Outbuf *buf, Drawable draw, int x, int y, int w,
+ int h)
{
- int i;
- int screen_num = 0;
-
- {
- int wx, wy;
- unsigned int ww, wh, bd, dp;
- Window wdum, root;
- XWindowAttributes wattr;
-
- XGetGeometry(buf->priv.x11.xlib.disp, draw, &root, &wx, &wy, &ww, &wh, &bd, &dp);
- XGetGeometry(buf->priv.x11.xlib.disp, root, &wdum, &wx, &wy, &ww, &wh, &bd, &dp);
- XGetWindowAttributes(buf->priv.x11.xlib.disp, root, &wattr);
- screen_num = XScreenNumberOfScreen(wattr.screen);
- }
+ int i;
+ int screen_num = 0;
+
+ {
+ int wx, wy;
+ unsigned int ww, wh, bd, dp;
+ Window wdum, root;
+ XWindowAttributes wattr;
+
+ XGetGeometry(buf->priv.x11.xlib.disp, draw, &root, &wx, &wy, &ww, &wh, &bd, &dp);
+ XGetGeometry(buf->priv.x11.xlib.disp, root, &wdum, &wx, &wy, &ww, &wh, &bd, &dp);
+ XGetWindowAttributes(buf->priv.x11.xlib.disp, root, &wattr);
+ screen_num = XScreenNumberOfScreen(wattr.screen);
+ }
for (i = 0; i < 20; i++)
{
- XSetForeground(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc,
- BlackPixel(buf->priv.x11.xlib.disp, screen_num));
- XFillRectangle(buf->priv.x11.xlib.disp, draw, buf->priv.x11.xlib.gc, x, y, w, h);
- XSync(buf->priv.x11.xlib.disp, False);
- XSync(buf->priv.x11.xlib.disp, False);
- XSetForeground(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc,
- WhitePixel(buf->priv.x11.xlib.disp, screen_num));
- XFillRectangle(buf->priv.x11.xlib.disp, draw, buf->priv.x11.xlib.gc, x, y, w, h);
- XSync(buf->priv.x11.xlib.disp, False);
- XSync(buf->priv.x11.xlib.disp, False);
+ XSetForeground(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc,
+ BlackPixel(buf->priv.x11.xlib.disp, screen_num));
+ XFillRectangle(buf->priv.x11.xlib.disp, draw, buf->priv.x11.xlib.gc, x, y, w, h);
+ XSync(buf->priv.x11.xlib.disp, False);
+ XSync(buf->priv.x11.xlib.disp, False);
+ XSetForeground(buf->priv.x11.xlib.disp, buf->priv.x11.xlib.gc,
+ WhitePixel(buf->priv.x11.xlib.disp, screen_num));
+ XFillRectangle(buf->priv.x11.xlib.disp, draw, buf->priv.x11.xlib.gc, x, y, w, h);
+ XSync(buf->priv.x11.xlib.disp, False);
+ XSync(buf->priv.x11.xlib.disp, False);
}
}
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.c b/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.c
index 0b74421b8e..e22cb89127 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.c
+++ b/src/modules/evas/engines/software_x11/evas_xlib_swapbuf.c
@@ -15,15 +15,15 @@
#include "evas_xlib_color.h"
#include "evas_xlib_swapper.h"
-typedef struct _Outbuf_Region Outbuf_Region;
+typedef struct _Outbuf_Region Outbuf_Region;
struct _Outbuf_Region
{
- RGBA_Image *im;
- int x;
- int y;
- int w;
- int h;
+ RGBA_Image *im;
+ int x;
+ int y;
+ int w;
+ int h;
};
void
@@ -38,8 +38,8 @@ evas_software_xlib_swapbuf_free(Outbuf *buf)
evas_software_xlib_swapbuf_idle_flush(buf);
if (buf->priv.pal)
evas_software_xlib_x_color_deallocate
- (buf->priv.x11.xlib.disp, buf->priv.x11.xlib.cmap,
- buf->priv.x11.xlib.vis, buf->priv.pal);
+ (buf->priv.x11.xlib.disp, buf->priv.x11.xlib.cmap,
+ buf->priv.x11.xlib.vis, buf->priv.pal);
evas_xlib_swapper_free(buf->priv.swapper);
eina_array_flush(&buf->priv.onebuf_regions);
free(buf);
@@ -47,21 +47,21 @@ evas_software_xlib_swapbuf_free(Outbuf *buf)
Outbuf *
evas_software_xlib_swapbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
- Display *disp, Drawable draw, Visual *vis,
- Colormap cmap, int x_depth,
- int grayscale, int max_colors,
- Pixmap mask EINA_UNUSED,
- int shape_dither, int destination_alpha)
+ Display *disp, Drawable draw, Visual *vis,
+ Colormap cmap, int x_depth,
+ int grayscale, int max_colors,
+ Pixmap mask EINA_UNUSED,
+ int shape_dither, int destination_alpha)
{
- Outbuf *buf;
- Gfx_Func_Convert conv_func = NULL;
- int d;
-
+ Outbuf *buf;
+ Gfx_Func_Convert conv_func = NULL;
+ int d;
+
buf = calloc(1, sizeof(Outbuf));
if (!buf) return NULL;
if (x_depth < 15) rot = 0;
-
+
buf->onebuf = 1;
buf->w = w;
buf->h = h;
@@ -92,9 +92,9 @@ evas_software_xlib_swapbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
free(buf);
return NULL;
}
-
+
eina_array_step_set(&buf->priv.onebuf_regions, sizeof (Eina_Array), 8);
-
+
#ifdef WORDS_BIGENDIAN
if (evas_xlib_swapper_byte_order_get(buf->priv.swapper) == LSBFirst)
buf->priv.x11.xlib.swap = 1;
@@ -109,9 +109,9 @@ evas_software_xlib_swapbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
if (((vis->class == TrueColor) || (vis->class == DirectColor)) &&
(x_depth > 8))
{
- buf->priv.mask.r = (DATA32) vis->red_mask;
- buf->priv.mask.g = (DATA32) vis->green_mask;
- buf->priv.mask.b = (DATA32) vis->blue_mask;
+ buf->priv.mask.r = (DATA32)vis->red_mask;
+ buf->priv.mask.g = (DATA32)vis->green_mask;
+ buf->priv.mask.b = (DATA32)vis->blue_mask;
if (buf->priv.x11.xlib.swap)
{
SWAP32(buf->priv.mask.r);
@@ -124,32 +124,42 @@ evas_software_xlib_swapbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
(x_depth <= 8))
{
Convert_Pal_Mode pm = PAL_MODE_RGB332;
-
+
if ((vis->class == GrayScale) || (vis->class == StaticGray))
grayscale = 1;
if (grayscale)
{
if (max_colors >= 256) pm = PAL_MODE_GRAY256;
- else if (max_colors >= 64) pm = PAL_MODE_GRAY64;
- else if (max_colors >= 16) pm = PAL_MODE_GRAY16;
- else if (max_colors >= 4) pm = PAL_MODE_GRAY4;
+ else if (max_colors >= 64)
+ pm = PAL_MODE_GRAY64;
+ else if (max_colors >= 16)
+ pm = PAL_MODE_GRAY16;
+ else if (max_colors >= 4)
+ pm = PAL_MODE_GRAY4;
else pm = PAL_MODE_MONO;
}
else
{
if (max_colors >= 256) pm = PAL_MODE_RGB332;
- else if (max_colors >= 216) pm = PAL_MODE_RGB666;
- else if (max_colors >= 128) pm = PAL_MODE_RGB232;
- else if (max_colors >= 64) pm = PAL_MODE_RGB222;
- else if (max_colors >= 32) pm = PAL_MODE_RGB221;
- else if (max_colors >= 16) pm = PAL_MODE_RGB121;
- else if (max_colors >= 8) pm = PAL_MODE_RGB111;
- else if (max_colors >= 4) pm = PAL_MODE_GRAY4;
+ else if (max_colors >= 216)
+ pm = PAL_MODE_RGB666;
+ else if (max_colors >= 128)
+ pm = PAL_MODE_RGB232;
+ else if (max_colors >= 64)
+ pm = PAL_MODE_RGB222;
+ else if (max_colors >= 32)
+ pm = PAL_MODE_RGB221;
+ else if (max_colors >= 16)
+ pm = PAL_MODE_RGB121;
+ else if (max_colors >= 8)
+ pm = PAL_MODE_RGB111;
+ else if (max_colors >= 4)
+ pm = PAL_MODE_GRAY4;
else pm = PAL_MODE_MONO;
}
/* FIXME: only alloc once per display+cmap */
buf->priv.pal = evas_software_xlib_x_color_allocate
- (disp, cmap, vis, pm);
+ (disp, cmap, vis, pm);
if (!buf->priv.pal)
{
evas_xlib_swapper_free(buf->priv.swapper);
@@ -160,7 +170,6 @@ evas_software_xlib_swapbuf_setup_x(int w, int h, int rot, Outbuf_Depth depth,
d = evas_xlib_swapper_depth_get(buf->priv.swapper);
if (buf->priv.pal)
{
-
if (buf->rot == 0 || buf->rot == 180)
conv_func = evas_common_convert_func_get(0, buf->w, buf->h, d,
buf->priv.mask.r,
@@ -232,21 +241,21 @@ evas_software_xlib_swapbuf_new_region_for_update(Outbuf *buf, int x, int y, int
d = evas_xlib_swapper_depth_get(buf->priv.swapper);
bpp = d / 8;
- data = evas_xlib_swapper_buffer_map(buf->priv.swapper, &bpl,
+ data = evas_xlib_swapper_buffer_map(buf->priv.swapper, &bpl,
&(ww), &(hh));
- // To take stride into account, we do use bpl as the real image width, but return the real useful one.
+ // To take stride into account, we do use bpl as the real image width, but return the real useful one.
#ifdef EVAS_CSERVE2
if (evas_cserve2_use_get())
im = (RGBA_Image *)evas_cache2_image_data(evas_common_image_cache2_get(),
- bpl/bpp, hh, data,
+ bpl / bpp, hh, data,
buf->priv.destination_alpha,
EVAS_COLORSPACE_ARGB8888);
else
#endif
- im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
- bpl/bpp, hh, data,
- buf->priv.destination_alpha,
- EVAS_COLORSPACE_ARGB8888);
+ im = (RGBA_Image *)evas_cache_image_data(evas_common_image_cache_get(),
+ bpl / bpp, hh, data,
+ buf->priv.destination_alpha,
+ EVAS_COLORSPACE_ARGB8888);
buf->priv.onebuf = im;
if (!im) return NULL;
}
@@ -258,11 +267,11 @@ evas_software_xlib_swapbuf_new_region_for_update(Outbuf *buf, int x, int y, int
evas_cache2_image_close(&im->cache_entry);
else
#endif
- evas_cache_image_drop(&im->cache_entry);
+ evas_cache_image_drop(&im->cache_entry);
eina_rectangle_free(rect);
return NULL;
}
-
+
// the clip region of the onebuf to render
*cx = x;
*cy = y;
@@ -272,9 +281,9 @@ evas_software_xlib_swapbuf_new_region_for_update(Outbuf *buf, int x, int y, int
}
else
{
- RGBA_Image *im;
+ RGBA_Image *im;
Eina_Rectangle *rect;
-
+
rect = eina_rectangle_new(x, y, w, h);
if (!rect) return NULL;
#ifdef EVAS_CSERVE2
@@ -282,7 +291,7 @@ evas_software_xlib_swapbuf_new_region_for_update(Outbuf *buf, int x, int y, int
im = (RGBA_Image *)evas_cache2_image_empty(evas_common_image_cache2_get());
else
#endif
- im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
+ im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
if (!im)
{
eina_rectangle_free(rect);
@@ -294,10 +303,10 @@ evas_software_xlib_swapbuf_new_region_for_update(Outbuf *buf, int x, int y, int
evas_cache2_image_surface_alloc(&im->cache_entry, w, h);
else
#endif
- evas_cache_image_surface_alloc(&im->cache_entry, w, h);
+ evas_cache_image_surface_alloc(&im->cache_entry, w, h);
im->extended_info = rect;
buf->priv.pending_writes = eina_list_append(buf->priv.pending_writes, im);
-
+
// the region is the update image
*cx = 0;
*cy = 0;
@@ -330,10 +339,10 @@ evas_software_xlib_swapbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_
if (n == 0) return;
result = alloca(n * sizeof(Eina_Rectangle));
EINA_ARRAY_ITER_NEXT(&buf->priv.onebuf_regions, i, rect, it)
- {
- result[i] = *rect;
- eina_rectangle_free(rect);
- }
+ {
+ result[i] = *rect;
+ eina_rectangle_free(rect);
+ }
evas_xlib_swapper_buffer_unmap(buf->priv.swapper);
evas_xlib_swapper_swap(buf->priv.swapper, result, n);
eina_array_clean(&buf->priv.onebuf_regions);
@@ -346,7 +355,7 @@ evas_software_xlib_swapbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_
evas_cache2_image_close(&im->cache_entry);
else
#endif
- evas_cache_image_drop(&im->cache_entry);
+ evas_cache_image_drop(&im->cache_entry);
}
}
else
@@ -354,7 +363,7 @@ evas_software_xlib_swapbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_
RGBA_Image *im;
Eina_Rectangle *result;
unsigned int n, i = 0;
-
+
n = eina_list_count(buf->priv.pending_writes);
if (n == 0) return;
result = alloca(n * sizeof(Eina_Rectangle));
@@ -362,7 +371,7 @@ evas_software_xlib_swapbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_
{
Eina_Rectangle *rect = im->extended_info;
int x, y, w, h;
-
+
x = rect->x; y = rect->y; w = rect->w; h = rect->h;
if (buf->rot == 0)
{
@@ -400,7 +409,7 @@ evas_software_xlib_swapbuf_flush(Outbuf *buf, Tilebuf_Rect *surface_damage EINA_
evas_cache2_image_close(&im->cache_entry);
else
#endif
- evas_cache_image_drop(&im->cache_entry);
+ evas_cache_image_drop(&im->cache_entry);
i++;
}
evas_xlib_swapper_buffer_unmap(buf->priv.swapper);
@@ -430,36 +439,36 @@ evas_software_xlib_swapbuf_push_updated_region(Outbuf *buf, RGBA_Image *update,
if (bpp <= 0) return;
if (buf->priv.pal)
{
- if ((buf->rot == 0) || (buf->rot == 180))
- conv_func = evas_common_convert_func_get(0, w, h, d,
+ if ((buf->rot == 0) || (buf->rot == 180))
+ conv_func = evas_common_convert_func_get(0, w, h, d,
buf->priv.mask.r,
- buf->priv.mask.g,
+ buf->priv.mask.g,
buf->priv.mask.b,
- buf->priv.pal->colors,
+ buf->priv.pal->colors,
buf->rot);
- else if ((buf->rot == 90) || (buf->rot == 270))
- conv_func = evas_common_convert_func_get(0, h, w, d,
- buf->priv.mask.r,
- buf->priv.mask.g,
+ else if ((buf->rot == 90) || (buf->rot == 270))
+ conv_func = evas_common_convert_func_get(0, h, w, d,
+ buf->priv.mask.r,
+ buf->priv.mask.g,
buf->priv.mask.b,
- buf->priv.pal->colors,
+ buf->priv.pal->colors,
buf->rot);
}
else
{
- if ((buf->rot == 0) || (buf->rot == 180))
- conv_func = evas_common_convert_func_get(0, w, h, d,
- buf->priv.mask.r,
- buf->priv.mask.g,
+ if ((buf->rot == 0) || (buf->rot == 180))
+ conv_func = evas_common_convert_func_get(0, w, h, d,
+ buf->priv.mask.r,
+ buf->priv.mask.g,
buf->priv.mask.b,
- PAL_MODE_NONE,
+ PAL_MODE_NONE,
buf->rot);
- else if ((buf->rot == 90) || (buf->rot == 270))
- conv_func = evas_common_convert_func_get(0, h, w, d,
- buf->priv.mask.r,
- buf->priv.mask.g,
+ else if ((buf->rot == 90) || (buf->rot == 270))
+ conv_func = evas_common_convert_func_get(0, h, w, d,
+ buf->priv.mask.r,
+ buf->priv.mask.g,
buf->priv.mask.b,
- PAL_MODE_NONE,
+ PAL_MODE_NONE,
buf->rot);
}
if (!conv_func) return;
@@ -497,7 +506,7 @@ evas_software_xlib_swapbuf_push_updated_region(Outbuf *buf, RGBA_Image *update,
if (!src_data) return;
if ((buf->rot == 0) || (buf->rot == 180))
{
- dst_data = evas_xlib_swapper_buffer_map(buf->priv.swapper, &bpl,
+ dst_data = evas_xlib_swapper_buffer_map(buf->priv.swapper, &bpl,
&(ww), &(hh));
if (!dst_data) return;
if (buf->rot == 0)
@@ -517,7 +526,7 @@ evas_software_xlib_swapbuf_push_updated_region(Outbuf *buf, RGBA_Image *update,
}
else
{
- dst_data = evas_xlib_swapper_buffer_map(buf->priv.swapper, &bpl,
+ dst_data = evas_xlib_swapper_buffer_map(buf->priv.swapper, &bpl,
&(ww), &(hh));
if (!dst_data) return;
if (buf->rot == 90)
@@ -541,14 +550,14 @@ evas_software_xlib_swapbuf_push_updated_region(Outbuf *buf, RGBA_Image *update,
wid = bpl / bpp;
dst_data += (bpl * r.y) + (r.x * bpp);
if (buf->priv.pal)
- conv_func(src_data, dst_data,
+ conv_func(src_data, dst_data,
update->cache_entry.w - w,
wid - r.w,
r.w, r.h,
x + rx, y + ry,
buf->priv.pal->lookup);
else
- conv_func(src_data, dst_data,
+ conv_func(src_data, dst_data,
update->cache_entry.w - w,
wid - r.w,
r.w, r.h,
@@ -582,7 +591,7 @@ evas_software_xlib_swapbuf_reconfigure(Outbuf *buf, int w, int h, int rot,
}
int
-evas_software_xlib_swapbuf_get_rot(Outbuf * buf)
+evas_software_xlib_swapbuf_get_rot(Outbuf *buf)
{
return buf->rot;
}
@@ -601,3 +610,4 @@ evas_software_xlib_swapbuf_buffer_state_get(Outbuf *buf)
mode = evas_xlib_swapper_buffer_state_get(buf->priv.swapper);
return mode;
}
+
diff --git a/src/modules/evas/engines/software_x11/evas_xlib_swapper.c b/src/modules/evas/engines/software_x11/evas_xlib_swapper.c
index 6749f8c113..35a3e40f25 100644
--- a/src/modules/evas/engines/software_x11/evas_xlib_swapper.c
+++ b/src/modules/evas/engines/software_x11/evas_xlib_swapper.c
@@ -7,7 +7,7 @@
#include "evas_xlib_swapper.h"
#ifdef HAVE_DLSYM
-# include <dlfcn.h> /* dlopen,dlclose,etc */
+# include <dlfcn.h> /* dlopen,dlclose,etc */
# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
@@ -16,12 +16,12 @@
// X(shm)image emulation of multiple buffers + swapping /////////////////////
typedef struct
{
- XImage *xim;
- XShmSegmentInfo shm_info;
- void *data;
- int w, h, bpl;
- Eina_Bool shm : 1;
- Eina_Bool valid : 1;
+ XImage *xim;
+ XShmSegmentInfo shm_info;
+ void *data;
+ int w, h, bpl;
+ Eina_Bool shm : 1;
+ Eina_Bool valid : 1;
} Buffer;
struct _X_Swapper
@@ -33,7 +33,7 @@ struct _X_Swapper
Buffer buf[3];
int w, h, depth;
int buf_cur, buf_num;
- Eina_Bool mapped: 1;
+ Eina_Bool mapped : 1;
};
static Eina_Bool _x_err = EINA_FALSE;
@@ -64,7 +64,7 @@ _buf_new(X_Swapper *swp, Buffer *buf)
{
buf->shm_info.readOnly = False;
buf->shm_info.shmaddr = buf->data = buf->xim->data =
- shmat(buf->shm_info.shmid, 0, 0);
+ shmat(buf->shm_info.shmid, 0, 0);
if (buf->shm_info.shmaddr != ((void *)-1))
{
XErrorHandler ph;
@@ -146,7 +146,7 @@ _buf_put(X_Swapper *swp, Buffer *buf, Eina_Rectangle *rects, int nrects)
if (!buf->xim) return;
tmpr = XCreateRegion();
- if ((rects)/* && 0*/) // set to 0 to test buffer stuff
+ if ((rects) /* && 0*/) // set to 0 to test buffer stuff
{
for (i = 0; i < nrects; i++)
{
@@ -273,8 +273,10 @@ evas_xlib_swapper_buffer_state_get(X_Swapper *swp)
if (count == swp->buf_num)
{
if (count == 1) return MODE_COPY;
- else if (count == 2) return MODE_DOUBLE;
- else if (count == 3) return MODE_TRIPLE;
+ else if (count == 2)
+ return MODE_DOUBLE;
+ else if (count == 3)
+ return MODE_TRIPLE;
}
return MODE_FULL;
}
@@ -299,7 +301,6 @@ evas_xlib_swapper_bit_order_get(X_Swapper *swp)
#else
-
// DRM/DRI buffer swapping+access (driver specific) /////////////////////
static Eina_Bool tried = EINA_FALSE;
@@ -308,39 +309,38 @@ static Eina_Bool tried = EINA_FALSE;
static void *drm_lib = NULL;
typedef unsigned int drm_magic_t;
-static int (*sym_drmGetMagic) (int fd, drm_magic_t *magic) = NULL;
+static int (*sym_drmGetMagic)(int fd, drm_magic_t *magic) = NULL;
////////////////////////////////////
// libtbm.so.1
-#define TBM_DEVICE_CPU 1
-#define TBM_OPTION_READ (1 << 0)
-#define TBM_OPTION_WRITE (1 << 1)
+#define TBM_DEVICE_CPU 1
+#define TBM_OPTION_READ (1 << 0)
+#define TBM_OPTION_WRITE (1 << 1)
static void *tbm_lib = NULL;
typedef struct _tbm_bufmgr *tbm_bufmgr;
-typedef struct _tbm_bo *tbm_bo;
+typedef struct _tbm_bo *tbm_bo;
typedef union _tbm_bo_handle
{
- void *ptr;
+ void *ptr;
int32_t s32;
uint32_t u32;
int64_t s64;
uint64_t u64;
} tbm_bo_handle;
-
-static tbm_bo (*sym_tbm_bo_import) (tbm_bufmgr bufmgr, unsigned int key) = NULL;
-static tbm_bo_handle (*sym_tbm_bo_map) (tbm_bo bo, int device, int opt) = NULL;
-static int (*sym_tbm_bo_unmap) (tbm_bo bo) = NULL;
-static void (*sym_tbm_bo_unref) (tbm_bo bo) = NULL;
-static tbm_bufmgr (*sym_tbm_bufmgr_init) (int fd) = NULL;
-static void (*sym_tbm_bufmgr_deinit) (tbm_bufmgr bufmgr) = NULL;
+static tbm_bo (*sym_tbm_bo_import)(tbm_bufmgr bufmgr, unsigned int key) = NULL;
+static tbm_bo_handle (*sym_tbm_bo_map)(tbm_bo bo, int device, int opt) = NULL;
+static int (*sym_tbm_bo_unmap)(tbm_bo bo) = NULL;
+static void (*sym_tbm_bo_unref)(tbm_bo bo) = NULL;
+static tbm_bufmgr (*sym_tbm_bufmgr_init)(int fd) = NULL;
+static void (*sym_tbm_bufmgr_deinit)(tbm_bufmgr bufmgr) = NULL;
// legacy compatibility
-static void *(*sym_drm_slp_bo_map) (tbm_bo bo, int device, int opt) = NULL;
-static int (*sym_drm_slp_bo_unmap) (tbm_bo bo, int device) = NULL;
-static tbm_bufmgr (*sym_drm_slp_bufmgr_init) (int fd, void *arg) = NULL;
+static void *(*sym_drm_slp_bo_map)(tbm_bo bo, int device, int opt) = NULL;
+static int (*sym_drm_slp_bo_unmap)(tbm_bo bo, int device) = NULL;
+static tbm_bufmgr (*sym_drm_slp_bufmgr_init)(int fd, void *arg) = NULL;
////////////////////////////////////
// libdri2.so.0
@@ -366,34 +366,34 @@ typedef union
{
unsigned int flags;
struct
- {
- unsigned int type:1;
- unsigned int is_framebuffer:1;
- unsigned int is_mapped:1;
- unsigned int is_reused:1;
- unsigned int idx_reuse:3;
- }
+ {
+ unsigned int type : 1;
+ unsigned int is_framebuffer : 1;
+ unsigned int is_mapped : 1;
+ unsigned int is_reused : 1;
+ unsigned int idx_reuse : 3;
+ }
data;
} DRI2BufferFlags;
-static DRI2Buffer *(*sym_DRI2GetBuffers) (Display *display, XID drawable, int *width, int *height, unsigned int *attachments, int count, int *outCount) = NULL;
-static Bool (*sym_DRI2QueryExtension) (Display *display, int *eventBase, int *errorBase) = NULL;
-static Bool (*sym_DRI2QueryVersion) (Display *display, int *major, int *minor) = NULL;
-static Bool (*sym_DRI2Connect) (Display *display, XID window, char **driverName, char **deviceName) = NULL;
-static Bool (*sym_DRI2Authenticate) (Display *display, XID window, unsigned int magic) = NULL;
-static void (*sym_DRI2CreateDrawable) (Display *display, XID drawable) = NULL;
-static void (*sym_DRI2SwapBuffersWithRegion) (Display *display, XID drawable, XID region, CD64 *count) = NULL;
-static void (*sym_DRI2SwapBuffers) (Display *display, XID drawable, CD64 target_msc, CD64 divisor, CD64 remainder, CD64 *count) = NULL;
-static void (*sym_DRI2DestroyDrawable) (Display *display, XID handle) = NULL;
+static DRI2Buffer *(*sym_DRI2GetBuffers)(Display * display, XID drawable, int *width, int *height, unsigned int *attachments, int count, int *outCount) = NULL;
+static Bool (*sym_DRI2QueryExtension)(Display *display, int *eventBase, int *errorBase) = NULL;
+static Bool (*sym_DRI2QueryVersion)(Display *display, int *major, int *minor) = NULL;
+static Bool (*sym_DRI2Connect)(Display *display, XID window, char **driverName, char **deviceName) = NULL;
+static Bool (*sym_DRI2Authenticate)(Display *display, XID window, unsigned int magic) = NULL;
+static void (*sym_DRI2CreateDrawable)(Display *display, XID drawable) = NULL;
+static void (*sym_DRI2SwapBuffersWithRegion)(Display *display, XID drawable, XID region, CD64 *count) = NULL;
+static void (*sym_DRI2SwapBuffers)(Display *display, XID drawable, CD64 target_msc, CD64 divisor, CD64 remainder, CD64 *count) = NULL;
+static void (*sym_DRI2DestroyDrawable)(Display *display, XID handle) = NULL;
////////////////////////////////////
// libXfixes.so.3
static void *xfixes_lib = NULL;
-static Bool (*sym_XFixesQueryExtension) (Display *display, int *event_base_return, int *error_base_return) = NULL;
-static Status (*sym_XFixesQueryVersion) (Display *display, int *major_version_return, int *minor_version_return) = NULL;
-static XID (*sym_XFixesCreateRegion) (Display *display, XRectangle *rectangles, int nrectangles) = NULL;
-static void (*sym_XFixesDestroyRegion) (Display *dpy, XID region) = NULL;
+static Bool (*sym_XFixesQueryExtension)(Display *display, int *event_base_return, int *error_base_return) = NULL;
+static Status (*sym_XFixesQueryVersion)(Display *display, int *major_version_return, int *minor_version_return) = NULL;
+static XID (*sym_XFixesCreateRegion)(Display *display, XRectangle *rectangles, int nrectangles) = NULL;
+static void (*sym_XFixesDestroyRegion)(Display *dpy, XID region) = NULL;
////////////////////////////////////////////////////////////////////////////
#define MAX_BO_CACHE 4
@@ -416,7 +416,7 @@ struct _X_Swapper
int buf_w, buf_h;
Eina_List *buf_cache;
int last_count;
- Eina_Bool mapped: 1;
+ Eina_Bool mapped : 1;
};
static int inits = 0;
@@ -472,13 +472,13 @@ _drm_init(Display *disp, int scr)
goto err;
}
-#define SYM(l, x) \
- do { sym_ ## x = dlsym(l, #x); \
- if (!sym_ ## x) { \
- if (swap_debug) ERR("Can't load symbol "#x); \
- goto err; \
- } \
- } while (0)
+#define SYM(l, x) \
+ do { sym_ ## x = dlsym(l, #x); \
+ if (!sym_ ## x) { \
+ if (swap_debug) ERR("Can't load symbol " #x); \
+ goto err; \
+ } \
+ } while (0)
SYM(drm_lib, drmGetMagic);
@@ -543,8 +543,9 @@ _drm_init(Display *disp, int scr)
}
if (dri2_minor < 99)
{
- if (swap_debug) ERR("Not supported by DRI2 version(%i.%i)",
- dri2_major, dri2_minor);
+ if (swap_debug)
+ ERR("Not supported by DRI2 version(%i.%i)",
+ dri2_major, dri2_minor);
goto err;
}
if (!sym_DRI2Connect(disp, RootWindow(disp, scr), &drv_name, &dev_name))
@@ -569,7 +570,7 @@ _drm_init(Display *disp, int scr)
if (swap_debug) ERR("DRI2 authenticate failed with magic 0x%x on screen %i", (unsigned int)magic, scr);
goto err;
}
-
+
if (!slp_mode)
bufmgr = sym_tbm_bufmgr_init(drm_fd);
else
@@ -680,8 +681,8 @@ evas_xlib_swapper_new(Display *disp, Drawable draw, Visual *vis,
free(swp);
return NULL;
}
- if (swp->depth == 24)
- { // need to adjust to 32bpp?? have to check
+ if (swp->depth == 24) // need to adjust to 32bpp?? have to check
+ {
swp->depth = 32;
}
if (swap_debug) printf("Swapper allocated OK\n");
@@ -868,10 +869,14 @@ evas_xlib_swapper_buffer_state_get(X_Swapper *swp)
}
if (swap_debug) printf("Swap state idx_reuse = %i (0=FULL, 1=COPY, 2=DOUBLE, 3=TRIPLE, 4=QUAD)\n", flags->data.idx_reuse);
if (flags->data.idx_reuse == 0) return MODE_FULL;
- else if (flags->data.idx_reuse == 1) return MODE_COPY;
- else if (flags->data.idx_reuse == 2) return MODE_DOUBLE;
- else if (flags->data.idx_reuse == 3) return MODE_TRIPLE;
- else if (flags->data.idx_reuse == 4) return MODE_QUADRUPLE;
+ else if (flags->data.idx_reuse == 1)
+ return MODE_COPY;
+ else if (flags->data.idx_reuse == 2)
+ return MODE_DOUBLE;
+ else if (flags->data.idx_reuse == 3)
+ return MODE_TRIPLE;
+ else if (flags->data.idx_reuse == 4)
+ return MODE_QUADRUPLE;
return MODE_FULL;
}
@@ -897,43 +902,6 @@ evas_xlib_swapper_bit_order_get(X_Swapper *swp EINA_UNUSED)
#else
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
X_Swapper *
evas_xlib_swapper_new(Display *disp EINA_UNUSED, Drawable draw EINA_UNUSED,
Visual *vis EINA_UNUSED, int depth EINA_UNUSED,
@@ -986,4 +954,5 @@ evas_xlib_swapper_bit_order_get(X_Swapper *swp EINA_UNUSED)
{
return 0;
}
+
#endif