bring gl engine vaguely back up to snuff.
SVN revision: 27363
This commit is contained in:
parent
647edd2a27
commit
6635bab903
|
@ -42,24 +42,25 @@ struct _Evas_GL_Context
|
|||
{
|
||||
int w, h;
|
||||
|
||||
char dither : 1;
|
||||
char blend : 1;
|
||||
unsigned char dither : 1;
|
||||
unsigned char blend : 1;
|
||||
unsigned char blend_alpha : 1;
|
||||
unsigned char r, g, b, a;
|
||||
|
||||
struct {
|
||||
char size : 1;
|
||||
char dither : 1;
|
||||
char blend : 1;
|
||||
char color : 1;
|
||||
char texture : 1;
|
||||
char clip : 1;
|
||||
char buf : 1;
|
||||
char other : 1;
|
||||
unsigned char size : 1;
|
||||
unsigned char dither : 1;
|
||||
unsigned char blend : 1;
|
||||
unsigned char color : 1;
|
||||
unsigned char texture : 1;
|
||||
unsigned char clip : 1;
|
||||
unsigned char buf : 1;
|
||||
unsigned char other : 1;
|
||||
} change;
|
||||
|
||||
struct {
|
||||
char active : 1;
|
||||
int x, y, w, h;
|
||||
unsigned char active : 1;
|
||||
int x, y, w, h;
|
||||
} clip;
|
||||
|
||||
struct {
|
||||
|
@ -74,7 +75,7 @@ struct _Evas_GL_Context
|
|||
|
||||
Evas_GL_Texture *texture;
|
||||
GLuint font_texture;
|
||||
char font_texture_rectangle : 1;
|
||||
unsigned char font_texture_rectangle : 1;
|
||||
|
||||
int max_texture_depth;
|
||||
int max_texture_size;
|
||||
|
@ -96,12 +97,12 @@ struct _Evas_GL_Texture
|
|||
|
||||
GLuint texture;
|
||||
|
||||
char smooth : 1;
|
||||
char changed : 1;
|
||||
char have_mipmaps : 1;
|
||||
char rectangle : 1;
|
||||
char not_power_of_two : 1;
|
||||
char opt : 1;
|
||||
unsigned char smooth : 1;
|
||||
unsigned char changed : 1;
|
||||
unsigned char have_mipmaps : 1;
|
||||
unsigned char rectangle : 1;
|
||||
unsigned char not_power_of_two : 1;
|
||||
unsigned char opt : 1;
|
||||
|
||||
int references;
|
||||
};
|
||||
|
@ -114,8 +115,8 @@ struct _Evas_GL_Image
|
|||
RGBA_Image_Loadopts load_opts;
|
||||
int putcount;
|
||||
int references;
|
||||
char dirty : 1;
|
||||
char cached : 1;
|
||||
unsigned char dirty : 1;
|
||||
unsigned char cached : 1;
|
||||
};
|
||||
|
||||
struct _Evas_GL_Polygon
|
||||
|
@ -153,7 +154,7 @@ struct _Evas_GL_Font_Texture_Pool
|
|||
int w, h;
|
||||
GLuint texture;
|
||||
int references;
|
||||
char rectangle : 1;
|
||||
unsigned char rectangle : 1;
|
||||
Evas_List *allocations;
|
||||
};
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ evas_gl_common_context_use(Evas_GL_Context *gc)
|
|||
// this causes at least nvidia's drivers to go into pathological pain when
|
||||
// changing textures a lot (doing video). so we wont do anything with this
|
||||
// for now, but it does work.
|
||||
gc->ext.arb_texture_non_power_of_two = 0; printf("DISABLE GL_ARB_texture_non_power_of_two\n");
|
||||
// gc->ext.nv_texture_rectangle = 0; printf("DISABLE GL_NV_texture_rectangle\n");
|
||||
// gc->ext.arb_texture_non_power_of_two = 0; printf("DISABLE GL_ARB_texture_non_power_of_two\n");
|
||||
gc->ext.nv_texture_rectangle = 0; printf("DISABLE GL_NV_texture_rectangle\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -127,9 +127,27 @@ evas_gl_common_context_color_set(Evas_GL_Context *gc, int r, int g, int b, int a
|
|||
void
|
||||
evas_gl_common_context_blend_set(Evas_GL_Context *gc, int blend)
|
||||
{
|
||||
if (((blend) && (gc->blend)) || ((!blend) && (!gc->blend))) return;
|
||||
gc->change.blend = 1;
|
||||
gc->blend = blend;
|
||||
if (blend == 1)
|
||||
{
|
||||
if (gc->blend) return;
|
||||
gc->change.blend = 1;
|
||||
gc->blend = 1;
|
||||
gc->blend_alpha = 0;
|
||||
}
|
||||
else if (blend == 2)
|
||||
{
|
||||
if (gc->blend_alpha) return;
|
||||
gc->change.blend = 1;
|
||||
gc->blend = 0;
|
||||
gc->blend_alpha = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((!gc->blend) && (!gc->blend_alpha)) return;
|
||||
gc->change.blend = 1;
|
||||
gc->blend = 0;
|
||||
gc->blend_alpha = 0;
|
||||
}
|
||||
if (_evas_gl_common_context == gc) _evas_gl_common_blend_set(gc);
|
||||
}
|
||||
|
||||
|
@ -267,7 +285,12 @@ static void
|
|||
_evas_gl_common_blend_set(Evas_GL_Context *gc)
|
||||
{
|
||||
if (!gc->change.blend) return;
|
||||
if (gc->blend)
|
||||
if (gc->blend_alpha)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
else if (gc->blend)
|
||||
{
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -350,7 +373,7 @@ _evas_gl_common_texture_set(Evas_GL_Context *gc)
|
|||
{
|
||||
if (gc->texture->smooth)
|
||||
{
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 8);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 16);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
if (gc->texture->have_mipmaps)
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
|
||||
|
|
|
@ -181,9 +181,14 @@ evas_gl_font_texture_draw(Evas_GL_Context *gc, void *surface, RGBA_Draw_Context
|
|||
int r, g, b, a;
|
||||
|
||||
a = (dc->col.col >> 24) & 0xff;
|
||||
if (a == 0) return;
|
||||
r = (dc->col.col >> 16) & 0xff;
|
||||
g = (dc->col.col >> 8 ) & 0xff;
|
||||
b = (dc->col.col ) & 0xff;
|
||||
/* have to un-premul the color - as we are using blend mode 2 (non-premul blend) */
|
||||
r = (r * 255) / a;
|
||||
g = (g * 255) / a;
|
||||
b = (b * 255) / a;
|
||||
evas_gl_common_context_color_set(gc, r, g, b, a);
|
||||
if (dc->clip.use)
|
||||
evas_gl_common_context_clip_set(gc, 1,
|
||||
|
@ -192,7 +197,7 @@ evas_gl_font_texture_draw(Evas_GL_Context *gc, void *surface, RGBA_Draw_Context
|
|||
else
|
||||
evas_gl_common_context_clip_set(gc, 0,
|
||||
0, 0, 0, 0);
|
||||
evas_gl_common_context_blend_set(gc, 1);
|
||||
evas_gl_common_context_blend_set(gc, 2);
|
||||
evas_gl_common_context_read_buf_set(gc, GL_BACK);
|
||||
evas_gl_common_context_write_buf_set(gc, GL_BACK);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue