mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
2008-10-30 Emmanuele Bassi <ebassi@linux.intel.com>
Bug 1210 - Add CoglColor API * clutter/cogl/cogl-color.h: * clutter/cogl/cogl.h.in: * clutter/cogl/common/Makefile.am: * clutter/cogl/common/cogl-color.c: * clutter/cogl/gl/Makefile.am: * clutter/cogl/gl/cogl.c: * clutter/cogl/gles/Makefile.am: * clutter/cogl/gles/cogl-texture.c: * clutter/cogl/gles/cogl.c: Add a new color-type, to be used by COGL. CoglColor is optimized to allow the minimum amount of conversions possible for both GL and GLES implementations. * clutter/clutter-actor.c: * clutter/clutter-clone-texture.c: * clutter/clutter-entry.c: * clutter/clutter-main.c: * clutter/clutter-rectangle.c: * clutter/clutter-stage.c: * clutter/clutter-texture.c: Use CoglColor when needed. * clutter/pango/pangoclutter-render.c: Use CoglColor when needed. * doc/reference/cogl/cogl-docs.sgml: * doc/reference/cogl/cogl-sections.txt: Update the documentation. * tests/test-cogl-offscreen.c: * tests/test-cogl-primitives.c: * tests/test-cogl-tex-convert.c: * tests/test-cogl-tex-foreign.c: * tests/test-cogl-tex-getset.c: * tests/test-cogl-tex-polygon.c: * tests/test-cogl-tex-tile.c: * tests/test-paint-wrapper.c: Update the tests. * README: Update release notes.
This commit is contained in:
parent
71a0be6fff
commit
d1f6dbaa79
223
cogl-color.h
Normal file
223
cogl-color.h
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
#ifndef __COGL_COLOR_H__
|
||||||
|
#define __COGL_COLOR_H__
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <cogl/cogl-fixed.h>
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
typedef struct _CoglColor CoglColor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CoglColor:
|
||||||
|
*
|
||||||
|
* A structure for holding a color definition. The contents of
|
||||||
|
* the CoglColor structure are private and should never by accessed
|
||||||
|
* directly.
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
struct _CoglColor
|
||||||
|
{
|
||||||
|
/*< private >*/
|
||||||
|
CoglFixed red;
|
||||||
|
CoglFixed green;
|
||||||
|
CoglFixed blue;
|
||||||
|
|
||||||
|
CoglFixed alpha;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_set_from_4ub:
|
||||||
|
* @dest: return location for a #CoglColor
|
||||||
|
* @red: value of the red channel, between 0 and 255
|
||||||
|
* @green: value of the green channel, between 0 and 255
|
||||||
|
* @blue: value of the blue channel, between 0 and 255
|
||||||
|
* @alpha: value of the alpha channel, between 0 and 255
|
||||||
|
*
|
||||||
|
* Sets the values of the passed channel into a #CoglColor.
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
void cogl_color_set_from_4ub (CoglColor *dest,
|
||||||
|
guint8 red,
|
||||||
|
guint8 green,
|
||||||
|
guint8 blue,
|
||||||
|
guint8 alpha);
|
||||||
|
/**
|
||||||
|
* cogl_color_set_from_4ub:
|
||||||
|
* @dest: return location for a #CoglColor
|
||||||
|
* @red: value of the red channel, between 0 and 1
|
||||||
|
* @green: value of the green channel, between 0 and 1
|
||||||
|
* @blue: value of the blue channel, between 0 and 1
|
||||||
|
* @alpha: value of the alpha channel, between 0 and 1
|
||||||
|
*
|
||||||
|
* Sets the values of the passed channel into a #CoglColor.
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
void cogl_color_set_from_4d (CoglColor *dest,
|
||||||
|
gdouble red,
|
||||||
|
gdouble green,
|
||||||
|
gdouble blue,
|
||||||
|
gdouble alpha);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_red_byte:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the red channel of @color as a byte value
|
||||||
|
* between 0 and 255
|
||||||
|
*
|
||||||
|
* Return value: the red channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
unsigned char cogl_color_get_red_byte (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_green_byte:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the green channel of @color as a byte value
|
||||||
|
* between 0 and 255
|
||||||
|
*
|
||||||
|
* Return value: the green channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
unsigned char cogl_color_get_green_byte (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_blue_byte:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the blue channel of @color as a byte value
|
||||||
|
* between 0 and 255
|
||||||
|
*
|
||||||
|
* Return value: the blue channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
unsigned char cogl_color_get_blue_byte (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_alpha_byte:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the alpha channel of @color as a byte value
|
||||||
|
* between 0 and 255
|
||||||
|
*
|
||||||
|
* Return value: the alpha channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
unsigned char cogl_color_get_alpha_byte (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_red_float:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the red channel of @color as a floating point
|
||||||
|
* value between 0.0 and 1.0
|
||||||
|
*
|
||||||
|
* Return value: the red channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
float cogl_color_get_red_float (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_green_float:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the green channel of @color as a floating point
|
||||||
|
* value between 0.0 and 1.0
|
||||||
|
*
|
||||||
|
* Return value: the green channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
float cogl_color_get_green_float (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_blue_float:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the blue channel of @color as a floating point
|
||||||
|
* value between 0.0 and 1.0
|
||||||
|
*
|
||||||
|
* Return value: the blue channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
float cogl_color_get_blue_float (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_alpha_float:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the alpha channel of @color as a floating point
|
||||||
|
* value between 0.0 and 1.0
|
||||||
|
*
|
||||||
|
* Return value: the alpha channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
float cogl_color_get_alpha_float (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_red:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the red channel of @color as a fixed point
|
||||||
|
* value between 0 and %COGL_FIXED_1.
|
||||||
|
*
|
||||||
|
* Return value: the red channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
CoglFixed cogl_color_get_red (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_green:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the green channel of @color as a fixed point
|
||||||
|
* value between 0 and %COGL_FIXED_1.
|
||||||
|
*
|
||||||
|
* Return value: the green channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
CoglFixed cogl_color_get_green (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_blue:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the blue channel of @color as a fixed point
|
||||||
|
* value between 0 and %COGL_FIXED_1.
|
||||||
|
*
|
||||||
|
* Return value: the blue channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
CoglFixed cogl_color_get_blue (const CoglColor *color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_color_get_alpha:
|
||||||
|
* @color: a #CoglColor
|
||||||
|
*
|
||||||
|
* Retrieves the alpha channel of @color as a fixed point
|
||||||
|
* value between 0 and %COGL_FIXED_1.
|
||||||
|
*
|
||||||
|
* Return value: the alpha channel of the passed color
|
||||||
|
*
|
||||||
|
* Since: 1.0
|
||||||
|
*/
|
||||||
|
CoglFixed cogl_color_get_alpha (const CoglColor *color);
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif /* __COGL_COLOR_H__ */
|
13
cogl.h.in
13
cogl.h.in
@ -43,12 +43,11 @@
|
|||||||
#define __COGL_H__
|
#define __COGL_H__
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <clutter/clutter-color.h>
|
|
||||||
#include <clutter/clutter-feature.h>
|
#include <clutter/clutter-feature.h>
|
||||||
#include <clutter/clutter-types.h>
|
|
||||||
|
|
||||||
#include <cogl/cogl-defines-@CLUTTER_COGL@.h>
|
#include <cogl/cogl-defines-@CLUTTER_COGL@.h>
|
||||||
#include <cogl/cogl-fixed.h>
|
#include <cogl/cogl-fixed.h>
|
||||||
|
#include <cogl/cogl-color.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@ -212,7 +211,7 @@ struct _CoglTextureVertex
|
|||||||
{
|
{
|
||||||
CoglFixed x, y, z;
|
CoglFixed x, y, z;
|
||||||
CoglFixed tx, ty;
|
CoglFixed tx, ty;
|
||||||
ClutterColor color;
|
CoglColor color;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct _CoglTextureVertex CoglTextureVertex;
|
typedef struct _CoglTextureVertex CoglTextureVertex;
|
||||||
@ -618,7 +617,7 @@ void cogl_alpha_func (COGLenum func,
|
|||||||
* with @fog_color. Fogging will remain enabled until the next call to
|
* with @fog_color. Fogging will remain enabled until the next call to
|
||||||
* cogl_paint_init().
|
* cogl_paint_init().
|
||||||
*/
|
*/
|
||||||
void cogl_fog_set (const ClutterColor *fog_color,
|
void cogl_fog_set (const CoglColor *fog_color,
|
||||||
CoglFixed density,
|
CoglFixed density,
|
||||||
CoglFixed z_near,
|
CoglFixed z_near,
|
||||||
CoglFixed z_far);
|
CoglFixed z_far);
|
||||||
@ -630,7 +629,7 @@ void cogl_fog_set (const ClutterColor *fog_color,
|
|||||||
* Clears the color buffer to @color. The depth buffer and stencil
|
* Clears the color buffer to @color. The depth buffer and stencil
|
||||||
* buffers are also cleared and fogging and lighting are disabled.
|
* buffers are also cleared and fogging and lighting are disabled.
|
||||||
*/
|
*/
|
||||||
void cogl_paint_init (const ClutterColor *color);
|
void cogl_paint_init (const CoglColor *color);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SECTION:cogl-texture
|
* SECTION:cogl-texture
|
||||||
@ -1019,12 +1018,12 @@ void cogl_texture_polygon (CoglHandle handle,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* cogl_color:
|
* cogl_color:
|
||||||
* @color: new current @ClutterColor.
|
* @color: new current @CoglColor.
|
||||||
*
|
*
|
||||||
* Changes the color of cogl's current paint, which is used for filling and stroking
|
* Changes the color of cogl's current paint, which is used for filling and stroking
|
||||||
* primitives.
|
* primitives.
|
||||||
*/
|
*/
|
||||||
void cogl_color (const ClutterColor *color);
|
void cogl_color (const CoglColor *color);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,4 +26,5 @@ libclutter_cogl_common_la_SOURCES = \
|
|||||||
cogl-bitmap-pixbuf.c \
|
cogl-bitmap-pixbuf.c \
|
||||||
cogl-clip-stack.h \
|
cogl-clip-stack.h \
|
||||||
cogl-clip-stack.c \
|
cogl-clip-stack.c \
|
||||||
cogl-fixed.c
|
cogl-fixed.c \
|
||||||
|
cogl-color.c
|
||||||
|
107
common/cogl-color.c
Normal file
107
common/cogl-color.c
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "cogl-color.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
cogl_color_set_from_4ub (CoglColor *dest,
|
||||||
|
guint8 red,
|
||||||
|
guint8 green,
|
||||||
|
guint8 blue,
|
||||||
|
guint8 alpha)
|
||||||
|
{
|
||||||
|
g_return_if_fail (dest != NULL);
|
||||||
|
|
||||||
|
dest->red = COGL_FIXED_FROM_FLOAT ((float) red / 0xff * 1.0);
|
||||||
|
dest->green = COGL_FIXED_FROM_FLOAT ((float) green / 0xff * 1.0);
|
||||||
|
dest->blue = COGL_FIXED_FROM_FLOAT ((float) blue / 0xff * 1.0);
|
||||||
|
dest->alpha = COGL_FIXED_FROM_FLOAT ((float) alpha / 0xff * 1.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cogl_color_set_from_4d (CoglColor *dest,
|
||||||
|
gdouble red,
|
||||||
|
gdouble green,
|
||||||
|
gdouble blue,
|
||||||
|
gdouble alpha)
|
||||||
|
{
|
||||||
|
g_return_if_fail (dest != NULL);
|
||||||
|
|
||||||
|
dest->red = COGL_FIXED_FROM_FLOAT (CLAMP (red, 0.0, 1.0));
|
||||||
|
dest->green = COGL_FIXED_FROM_FLOAT (CLAMP (green, 0.0, 1.0));
|
||||||
|
dest->blue = COGL_FIXED_FROM_FLOAT (CLAMP (blue, 0.0, 1.0));
|
||||||
|
dest->alpha = COGL_FIXED_FROM_FLOAT (CLAMP (alpha, 0.0, 1.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char
|
||||||
|
cogl_color_get_red_byte (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_INT (color->red * 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
cogl_color_get_red_float (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_FLOAT (color->red);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoglFixed
|
||||||
|
cogl_color_get_red (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return color->red;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char
|
||||||
|
cogl_color_get_green_byte (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_INT (color->green * 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
cogl_color_get_green_float (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_FLOAT (color->green);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoglFixed
|
||||||
|
cogl_color_get_green (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return color->green;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char
|
||||||
|
cogl_color_get_blue_byte (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_INT (color->blue * 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
cogl_color_get_blue_float (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_FLOAT (color->blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoglFixed
|
||||||
|
cogl_color_get_blue (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return color->blue;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned char
|
||||||
|
cogl_color_get_alpha_byte (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_INT (color->alpha * 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
cogl_color_get_alpha_float (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return COGL_FIXED_TO_FLOAT (color->alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
CoglFixed
|
||||||
|
cogl_color_get_alpha (const CoglColor *color)
|
||||||
|
{
|
||||||
|
return color->alpha;
|
||||||
|
}
|
@ -59,6 +59,7 @@
|
|||||||
<xi:include href="xml/cogl-shaders.xml"/>
|
<xi:include href="xml/cogl-shaders.xml"/>
|
||||||
<xi:include href="xml/cogl-offscreen.xml"/>
|
<xi:include href="xml/cogl-offscreen.xml"/>
|
||||||
<xi:include href="xml/cogl-fixed.xml"/>
|
<xi:include href="xml/cogl-fixed.xml"/>
|
||||||
|
<xi:include href="xml/cogl-color.xml"/>
|
||||||
|
|
||||||
</chapter>
|
</chapter>
|
||||||
|
|
||||||
|
@ -231,3 +231,29 @@ cogl_double_to_fixed
|
|||||||
cogl_double_to_int
|
cogl_double_to_int
|
||||||
cogl_double_to_unit
|
cogl_double_to_unit
|
||||||
</SECTION>
|
</SECTION>
|
||||||
|
|
||||||
|
<SECTION>
|
||||||
|
<FILE>cogl-color</FILE>
|
||||||
|
<TITLE>Color Type</TITLE>
|
||||||
|
CoglColor
|
||||||
|
cogl_color_set_from_4ub
|
||||||
|
cogl_color_set_from_4d
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
|
cogl_color_get_red
|
||||||
|
cogl_color_get_green
|
||||||
|
cogl_color_get_blue
|
||||||
|
cogl_color_get_alpha
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
|
cogl_color_get_red_byte
|
||||||
|
cogl_color_get_green_byte
|
||||||
|
cogl_color_get_blue_byte
|
||||||
|
cogl_color_get_alpha_byte
|
||||||
|
|
||||||
|
<SUBSECTION>
|
||||||
|
cogl_color_get_red_float
|
||||||
|
cogl_color_get_green_float
|
||||||
|
cogl_color_get_blue_float
|
||||||
|
cogl_color_get_alpha_float
|
||||||
|
</SECTION>
|
||||||
|
@ -2,6 +2,7 @@ libclutterincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
|
|||||||
libclutterinclude_HEADERS = \
|
libclutterinclude_HEADERS = \
|
||||||
$(top_builddir)/clutter/cogl/cogl.h \
|
$(top_builddir)/clutter/cogl/cogl.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
||||||
|
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-fixed.h
|
$(top_builddir)/clutter/cogl/cogl-fixed.h
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
@ -23,6 +24,7 @@ noinst_LTLIBRARIES = libclutter-cogl.la
|
|||||||
libclutter_cogl_la_SOURCES = \
|
libclutter_cogl_la_SOURCES = \
|
||||||
$(top_builddir)/clutter/cogl/cogl.h \
|
$(top_builddir)/clutter/cogl/cogl.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
$(top_builddir)/clutter/cogl/cogl-defines-gl.h \
|
||||||
|
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
||||||
cogl-internal.h \
|
cogl-internal.h \
|
||||||
cogl-texture.h \
|
cogl-texture.h \
|
||||||
|
32
gl/cogl.c
32
gl/cogl.c
@ -169,12 +169,12 @@ cogl_check_extension (const gchar *name, const gchar *ext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_paint_init (const ClutterColor *color)
|
cogl_paint_init (const CoglColor *color)
|
||||||
{
|
{
|
||||||
GE( glClearColor (((float) color->red / 0xff * 1.0),
|
GE( glClearColor (cogl_color_get_red_float (color),
|
||||||
((float) color->green / 0xff * 1.0),
|
cogl_color_get_green_float (color),
|
||||||
((float) color->blue / 0xff * 1.0),
|
cogl_color_get_blue_float (color),
|
||||||
0.0) );
|
0.0) );
|
||||||
|
|
||||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
glDisable (GL_LIGHTING);
|
glDisable (GL_LIGHTING);
|
||||||
@ -380,17 +380,17 @@ cogl_enable_backface_culling (gboolean setting)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_color (const ClutterColor *color)
|
cogl_color (const CoglColor *color)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
|
|
||||||
glColor4ub (color->red,
|
glColor4f (cogl_color_get_red_float (color),
|
||||||
color->green,
|
cogl_color_get_green_float (color),
|
||||||
color->blue,
|
cogl_color_get_blue_float (color),
|
||||||
color->alpha);
|
cogl_color_get_alpha_float (color));
|
||||||
|
|
||||||
/* Store alpha for proper blending enables */
|
/* Store alpha for proper blending enables */
|
||||||
ctx->color_alpha = color->alpha;
|
ctx->color_alpha = cogl_color_get_alpha_byte (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1242,17 +1242,17 @@ cogl_get_bitmasks (gint *red, gint *green, gint *blue, gint *alpha)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_fog_set (const ClutterColor *fog_color,
|
cogl_fog_set (const CoglColor *fog_color,
|
||||||
CoglFixed density,
|
CoglFixed density,
|
||||||
CoglFixed start,
|
CoglFixed start,
|
||||||
CoglFixed stop)
|
CoglFixed stop)
|
||||||
{
|
{
|
||||||
GLfloat fogColor[4];
|
GLfloat fogColor[4];
|
||||||
|
|
||||||
fogColor[0] = ((float) fog_color->red / 0xff * 1.0);
|
fogColor[0] = cogl_color_get_red_float (fog_color);
|
||||||
fogColor[1] = ((float) fog_color->green / 0xff * 1.0);
|
fogColor[1] = cogl_color_get_green_float (fog_color);
|
||||||
fogColor[2] = ((float) fog_color->blue / 0xff * 1.0);
|
fogColor[2] = cogl_color_get_blue_float (fog_color);
|
||||||
fogColor[3] = ((float) fog_color->alpha / 0xff * 1.0);
|
fogColor[3] = cogl_color_get_alpha_float (fog_color);
|
||||||
|
|
||||||
glEnable (GL_FOG);
|
glEnable (GL_FOG);
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ libclutterincludedir = $(includedir)/clutter-@CLUTTER_API_VERSION@/cogl
|
|||||||
libclutterinclude_HEADERS = \
|
libclutterinclude_HEADERS = \
|
||||||
$(top_builddir)/clutter/cogl/cogl.h \
|
$(top_builddir)/clutter/cogl/cogl.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-defines-gles.h \
|
$(top_builddir)/clutter/cogl/cogl-defines-gles.h \
|
||||||
|
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-fixed.h
|
$(top_builddir)/clutter/cogl/cogl-fixed.h
|
||||||
|
|
||||||
INCLUDES = \
|
INCLUDES = \
|
||||||
@ -23,6 +24,7 @@ noinst_LTLIBRARIES = libclutter-cogl.la
|
|||||||
libclutter_cogl_la_SOURCES = \
|
libclutter_cogl_la_SOURCES = \
|
||||||
$(top_builddir)/clutter/cogl/cogl.h \
|
$(top_builddir)/clutter/cogl/cogl.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-defines-gles.h \
|
$(top_builddir)/clutter/cogl/cogl-defines-gles.h \
|
||||||
|
$(top_builddir)/clutter/cogl/cogl-color.h \
|
||||||
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
$(top_builddir)/clutter/cogl/cogl-fixed.h \
|
||||||
cogl-internal.h \
|
cogl-internal.h \
|
||||||
cogl-texture.h \
|
cogl-texture.h \
|
||||||
|
@ -336,10 +336,10 @@ _cogl_texture_upload_to_gl (CoglTexture *tex)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_cogl_texture_draw_and_read (CoglTexture *tex,
|
_cogl_texture_draw_and_read (CoglTexture *tex,
|
||||||
CoglBitmap *target_bmp,
|
CoglBitmap *target_bmp,
|
||||||
ClutterColor *back_color,
|
CoglColor *back_color,
|
||||||
GLint *viewport)
|
GLint *viewport)
|
||||||
{
|
{
|
||||||
gint bpp;
|
gint bpp;
|
||||||
CoglFixed rx1, ry1;
|
CoglFixed rx1, ry1;
|
||||||
@ -460,15 +460,17 @@ _cogl_texture_download_from_gl (CoglTexture *tex,
|
|||||||
GLuint target_gl_format,
|
GLuint target_gl_format,
|
||||||
GLuint target_gl_type)
|
GLuint target_gl_type)
|
||||||
{
|
{
|
||||||
gint bpp;
|
gint bpp;
|
||||||
GLint viewport[4];
|
GLint viewport[4];
|
||||||
ClutterColor cwhite = {0xFF, 0xFF, 0xFF, 0xFF};
|
CoglColor cwhite;
|
||||||
CoglBitmap alpha_bmp;
|
CoglBitmap alpha_bmp;
|
||||||
COGLenum old_src_factor;
|
COGLenum old_src_factor;
|
||||||
COGLenum old_dst_factor;
|
COGLenum old_dst_factor;
|
||||||
|
|
||||||
_COGL_GET_CONTEXT (ctx, FALSE);
|
_COGL_GET_CONTEXT (ctx, FALSE);
|
||||||
|
|
||||||
|
cogl_color_set_from_4ub (&cwhite, 0xff, 0xff, 0xff, 0xff);
|
||||||
|
|
||||||
bpp = _cogl_get_format_bpp (COGL_PIXEL_FORMAT_RGBA_8888);
|
bpp = _cogl_get_format_bpp (COGL_PIXEL_FORMAT_RGBA_8888);
|
||||||
|
|
||||||
/* Viewport needs to have some size and be inside the window for this */
|
/* Viewport needs to have some size and be inside the window for this */
|
||||||
|
32
gles/cogl.c
32
gles/cogl.c
@ -86,16 +86,16 @@ cogl_check_extension (const gchar *name, const gchar *ext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_paint_init (const ClutterColor *color)
|
cogl_paint_init (const CoglColor *color)
|
||||||
{
|
{
|
||||||
#if COGL_DEBUG
|
#if COGL_DEBUG
|
||||||
fprintf(stderr, "\n ============== Paint Start ================ \n");
|
fprintf(stderr, "\n ============== Paint Start ================ \n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
cogl_wrap_glClearColorx ((color->red << 16) / 0xff,
|
cogl_wrap_glClearColorx (cogl_color_get_red (color),
|
||||||
(color->green << 16) / 0xff,
|
cogl_color_get_green (color),
|
||||||
(color->blue << 16) / 0xff,
|
cogl_color_get_blue (color),
|
||||||
0xff);
|
0);
|
||||||
|
|
||||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
cogl_wrap_glDisable (GL_LIGHTING);
|
cogl_wrap_glDisable (GL_LIGHTING);
|
||||||
@ -291,7 +291,7 @@ cogl_enable_backface_culling (gboolean setting)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_color (const ClutterColor *color)
|
cogl_color (const CoglColor *color)
|
||||||
{
|
{
|
||||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||||
|
|
||||||
@ -315,14 +315,14 @@ cogl_color (const ClutterColor *color)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
/* conversion can cause issues with picking on some gles implementations */
|
/* conversion can cause issues with picking on some gles implementations */
|
||||||
GE( cogl_wrap_glColor4x ((color->red << 16) / 0xff,
|
GE( cogl_wrap_glColor4x (cogl_color_get_red (color),
|
||||||
(color->green << 16) / 0xff,
|
cogl_color_get_green (color),
|
||||||
(color->blue << 16) / 0xff,
|
cogl_color_get_blue (color),
|
||||||
(color->alpha << 16) / 0xff));
|
cogl_color_get_alpha (color)) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Store alpha for proper blending enables */
|
/* Store alpha for proper blending enables */
|
||||||
ctx->color_alpha = color->alpha;
|
ctx->color_alpha = cogl_color_get_alpha_byte (color);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -898,17 +898,17 @@ cogl_get_bitmasks (gint *red, gint *green, gint *blue, gint *alpha)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cogl_fog_set (const ClutterColor *fog_color,
|
cogl_fog_set (const CoglColor *fog_color,
|
||||||
CoglFixed density,
|
CoglFixed density,
|
||||||
CoglFixed z_near,
|
CoglFixed z_near,
|
||||||
CoglFixed z_far)
|
CoglFixed z_far)
|
||||||
{
|
{
|
||||||
GLfixed fogColor[4];
|
GLfixed fogColor[4];
|
||||||
|
|
||||||
fogColor[0] = (fog_color->red << 16) / 0xff;
|
fogColor[0] = cogl_color_get_red (fog_color);
|
||||||
fogColor[1] = (fog_color->green << 16) / 0xff;
|
fogColor[1] = cogl_color_get_green (fog_color);
|
||||||
fogColor[2] = (fog_color->blue << 16) / 0xff;
|
fogColor[2] = cogl_color_get_blue (fog_color);
|
||||||
fogColor[3] = (fog_color->alpha << 16) / 0xff;
|
fogColor[3] = cogl_color_get_alpha (fog_color);
|
||||||
|
|
||||||
cogl_wrap_glEnable (GL_FOG);
|
cogl_wrap_glEnable (GL_FOG);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user