--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -177,19 +177,16 @@ CPPSRCS += $(STATIC_CPPSRCS)
EXTRA_DSO_LIBS += $(STATIC_EXTRA_DSO_LIBS)
REQUIRES += $(STATIC_REQUIRES)
EXTRA_LIBS += $(STATIC_EXTRA_LIBS)
endif
ifeq ($(OS_ARCH),WINNT)
OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool)
OS_LIBS += $(call EXPAND_LIBNAME,usp10 msimg32)
-ifdef MOZ_ENABLE_GLITZ
-OS_LIBS += $(call EXPAND_LIBNAME,opengl32)
-endif
RCINCLUDE = splash.rc
ifndef GNU_CC
RCFLAGS += -DMOZ_PHOENIX -I$(srcdir)
else
RCFLAGS += -DMOZ_PHOENIX --include-dir $(srcdir)
endif
ifdef BUILD_STATIC_LIBS
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -495,17 +495,16 @@ TK_CFLAGS = @TK_CFLAGS@
TK_LIBS = @TK_LIBS@
MOZ_TOOLKIT_REGISTRY_CFLAGS = \
$(TK_CFLAGS)
CAIRO_FT_CFLAGS = @CAIRO_FT_CFLAGS@
MOZ_ENABLE_CAIRO_FT = @MOZ_ENABLE_CAIRO_FT@
-MOZ_ENABLE_GLITZ = @MOZ_ENABLE_GLITZ@
MOZ_ENABLE_GTK2 = @MOZ_ENABLE_GTK2@
MOZ_ENABLE_QT = @MOZ_ENABLE_QT@
MOZ_ENABLE_PHOTON = @MOZ_ENABLE_PHOTON@
MOZ_ENABLE_COCOA = @MOZ_ENABLE_COCOA@
MOZ_ENABLE_XREMOTE = @MOZ_ENABLE_XREMOTE@
MOZ_GTK2_CFLAGS = @MOZ_GTK2_CFLAGS@
MOZ_GTK2_LIBS = @MOZ_GTK2_LIBS@
--- a/configure.in
+++ b/configure.in
@@ -115,17 +115,16 @@ NSS_VERSION=3
dnl Set the minimum version of toolkit libs used by mozilla
dnl ========================================================
GLIB_VERSION=1.2.0
LIBIDL_VERSION=0.6.3
PERL_VERSION=5.006
LIBART_VERSION=2.3.4
CAIRO_VERSION=1.6.0
-GLITZ_VERSION=0.4.0
PANGO_VERSION=1.10.0
GTK2_VERSION=2.10.0
MAKE_VERSION=3.78
WINDRES_VERSION=2.14.90
W32API_VERSION=3.8
GNOMEVFS_VERSION=2.0
GNOMEUI_VERSION=2.2.0
GCONF_VERSION=1.2.1
@@ -4309,26 +4308,16 @@ MOZ_ARG_ENABLE_BOOL(system-hunspell,
SYSTEM_HUNSPELL=1 )
if test -n "$SYSTEM_HUNSPELL"; then
PKG_CHECK_MODULES(MOZ_HUNSPELL, hunspell)
fi
AC_SUBST(SYSTEM_HUNSPELL)
-dnl check whether to enable glitz
-dnl ========================================================
-MOZ_ARG_ENABLE_BOOL(glitz,
-[ --enable-glitz Enable Glitz for use with Cairo],
- MOZ_ENABLE_GLITZ=1,
- MOZ_ENABLE_GLITZ= )
-if test "$MOZ_ENABLE_GLITZ"; then
- AC_DEFINE(MOZ_ENABLE_GLITZ)
-fi
-
dnl ========================================================
dnl Java SDK support
dnl ========================================================
JAVA_INCLUDE_PATH=
MOZ_ARG_WITH_STRING(java-include-path,
[ --with-java-include-path=dir Location of Java SDK headers],
JAVA_INCLUDE_PATH=$withval)
@@ -4910,17 +4899,16 @@ fi
AC_SUBST(GTK_CONFIG)
AC_SUBST(TK_CFLAGS)
AC_SUBST(TK_LIBS)
AC_SUBST(MOZ_ENABLE_GTK2)
AC_SUBST(MOZ_ENABLE_PHOTON)
AC_SUBST(MOZ_ENABLE_COCOA)
-AC_SUBST(MOZ_ENABLE_GLITZ)
AC_SUBST(MOZ_ENABLE_QT)
AC_SUBST(MOZ_ENABLE_XREMOTE)
AC_SUBST(MOZ_GTK2_CFLAGS)
AC_SUBST(MOZ_GTK2_LIBS)
AC_SUBST(MOZ_QT_CFLAGS)
AC_SUBST(MOZ_QT_LIBS)
AC_SUBST(MOC)
@@ -7446,19 +7434,16 @@ if test "$MOZ_TREE_CAIRO"; then
if test "$MOZ_WIDGET_TOOLKIT" = "os2"; then
OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
PDF_SURFACE_FEATURE="#define CAIRO_HAS_PDF_SURFACE 1"
MOZ_ENABLE_CAIRO_FT=1
CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
CAIRO_FT_LIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
fi
- if test "$MOZ_ENABLE_GLITZ"; then
- GLITZ_SURFACE_FEATURE="#define CAIRO_HAS_GLITZ_SURFACE 1"
- fi
if test "$MOZ_WIDGET_TOOLKIT" = "beos"; then
PKG_CHECK_MODULES(CAIRO_FT, fontconfig freetype2)
BEOS_SURFACE_FEATURE="#define CAIRO_HAS_BEOS_SURFACE 1"
FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
MOZ_ENABLE_CAIRO_FT=1
fi
AC_SUBST(MOZ_ENABLE_CAIRO_FT)
AC_SUBST(CAIRO_FT_CFLAGS)
@@ -7477,45 +7462,31 @@ if test "$MOZ_TREE_CAIRO"; then
AC_SUBST(XLIB_SURFACE_FEATURE)
AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE)
AC_SUBST(QUARTZ_SURFACE_FEATURE)
AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE)
AC_SUBST(XCB_SURFACE_FEATURE)
AC_SUBST(WIN32_SURFACE_FEATURE)
AC_SUBST(OS2_SURFACE_FEATURE)
AC_SUBST(BEOS_SURFACE_FEATURE)
- AC_SUBST(GLITZ_SURFACE_FEATURE)
AC_SUBST(DIRECTFB_SURFACE_FEATURE)
AC_SUBST(FT_FONT_FEATURE)
AC_SUBST(WIN32_FONT_FEATURE)
AC_SUBST(QUARTZ_FONT_FEATURE)
AC_SUBST(PNG_FUNCTIONS_FEATURE)
AC_SUBST(QPAINTER_SURFACE_FEATURE)
if test "$_WIN32_MSVC"; then
MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/mozcairo.lib $(DEPTH)/gfx/cairo/libpixman/src/mozlibpixman.lib'
- if test "$MOZ_ENABLE_GLITZ"; then
- MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'$(DEPTH)/gfx/cairo/glitz/src/mozglitz.lib $(DEPTH)/gfx/cairo/glitz/src/wgl/mozglitzwgl.lib'
- fi
else
MOZ_CAIRO_LIBS='$(DEPTH)/gfx/cairo/cairo/src/$(LIB_PREFIX)mozcairo.$(LIB_SUFFIX) $(DEPTH)/gfx/cairo/libpixman/src/$(LIB_PREFIX)mozlibpixman.$(LIB_SUFFIX)'" $CAIRO_FT_LIBS"
if test "$MOZ_X11"; then
MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender -lfreetype -lfontconfig"
fi
-
- if test "$MOZ_ENABLE_GLITZ"; then
- MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src -lmozglitz'
- if test "$MOZ_X11"; then
- MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/glx -lmozglitzglx -lGL'
- fi
- if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
- MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS "'-L$(DEPTH)/gfx/cairo/glitz/src/wgl -lmozglitzwgl'
- fi
- fi
fi
CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h
mv -f $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig 2> /dev/null
else
PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION freetype2 fontconfig)
MOZ_CAIRO_CFLAGS=$CAIRO_CFLAGS
--- a/gfx/cairo/Makefile.in
+++ b/gfx/cairo/Makefile.in
@@ -39,16 +39,12 @@ DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = $(NULL)
-ifdef MOZ_ENABLE_GLITZ
-DIRS += glitz/src
-endif
-
DIRS += libpixman/src cairo/src
include $(topsrcdir)/config/rules.mk
--- a/gfx/cairo/cairo/src/Makefile.in
+++ b/gfx/cairo/cairo/src/Makefile.in
@@ -200,24 +200,16 @@ EXPORTS += cairo-xlib.h cairo-xlib-xrend
endif
ifdef MOZ_ENABLE_CAIRO_FT
CSRCS += cairo-ft-font.c cairo-type1-subset.c
EXPORTS += cairo-ft.h
OS_INCLUDES += $(CAIRO_FT_CFLAGS)
endif
-
-ifdef MOZ_ENABLE_GLITZ
-REQUIRES += glitz
-CSRCS += cairo-glitz-surface.c
-EXPORTS += cairo-glitz.h
-endif
-
-
LOCAL_INCLUDES += -I$(srcdir)
FORCE_STATIC_LIB = 1
# This library is used by other shared libs in a static build
FORCE_USE_PIC = 1
include $(topsrcdir)/config/rules.mk
--- a/gfx/cairo/cairo/src/cairo-features.h.in
+++ b/gfx/cairo/cairo/src/cairo-features.h.in
@@ -72,18 +72,16 @@
@XCB_SURFACE_FEATURE@
@WIN32_SURFACE_FEATURE@
@OS2_SURFACE_FEATURE@
@BEOS_SURFACE_FEATURE@
-@GLITZ_SURFACE_FEATURE@
-
@DIRECTFB_SURFACE_FEATURE@
@QPAINTER_SURFACE_FEATURE@
@FT_FONT_FEATURE@
@WIN32_FONT_FEATURE@
deleted file mode 100644
--- a/gfx/cairo/glitz-endian.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/glitz/src/glitzint.h Fri Oct 19 14:55:50 2007
-+++ b/glitz/src/glitzint.h Fri Oct 19 14:57:19 2007
-@@ -26,6 +26,8 @@
- #ifndef GLITZINT_H_INCLUDED
- #define GLITZINT_H_INCLUDED
-
-+#include "cairo-platform.h"
-+
- #ifdef _MSC_VER
- #define _USE_MATH_DEFINES
- #endif
deleted file mode 100644
--- a/gfx/cairo/glitz/AUTHORS
+++ /dev/null
@@ -1,2 +0,0 @@
-David Reveman <davidr@novell.com>
-Peter Nilsson <c99pnn@cs.umu.se>
deleted file mode 100644
--- a/gfx/cairo/glitz/COPYING
+++ /dev/null
@@ -1,22 +0,0 @@
-
-Copyright © 2004 David Reveman, Peter Nilsson
-
-Permission to use, copy, modify, distribute, and sell this software
-and its documentation for any purpose is hereby granted without
-fee, provided that the above copyright notice appear in all copies
-and that both that copyright notice and this permission notice
-appear in supporting documentation, and that the names of
-David Reveman and Peter Nilsson not be used in advertising or
-publicity pertaining to distribution of the software without
-specific, written prior permission. David Reveman and Peter Nilsson
-makes no representations about the suitability of this software for
-any purpose. It is provided "as is" without express or implied warranty.
-
-DAVID REVEMAN AND PETER NILSSON DISCLAIMS ALL WARRANTIES WITH
-REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DAVID REVEMAN AND
-PETER NILSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
-DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
-OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THIS SOFTWARE.
deleted file mode 100644
--- a/gfx/cairo/glitz/README
+++ /dev/null
@@ -1,21 +0,0 @@
-glitz - OpenGL image compositing library
-
-Glitz is an OpenGL image compositing library. Glitz provides
-Porter/Duff compositing of images and implicit mask generation for
-geometric primitives including trapezoids, triangles, and rectangles.
-
-The semantics of glitz are designed to precisely match the
-specification of the X Render extension. Glitz does not only implement
-X Render features like component alpha and image transformations, but
-also support for additional features like convolution filters and color
-gradients, which are not currently part of the X Render specification.
-
-The performance and capabilities of glitz are much dependent on
-graphics hardware. Glitz does not in any way handle software
-fall-backs when graphics hardware is insufficient. However, glitz
-will report if any requested operation cannot be carried out by
-graphics hardware, hence making a higher level software layer
-responsible for appropriate actions.
-
-David Reveman
-davidr@novell.com
deleted file mode 100644
--- a/gfx/cairo/glitz/src/Makefile.in
+++ /dev/null
@@ -1,96 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-# http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# The Original Code is mozilla.org code.
-#
-# The Initial Developer of the Original Code is
-# mozilla.org
-# Portions created by the Initial Developer are Copyright (C) 2005
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Vladimir Vukicevic <vladimir@pobox.com>
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either of the GNU General Public License Version 2 or later (the "GPL"),
-# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-DEPTH = ../../../..
-topsrcdir = @top_srcdir@
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-include $(DEPTH)/config/autoconf.mk
-
-VISIBILITY_FLAGS =
-
-MODULE = glitz
-LIBRARY_NAME = mozglitz
-LIBXUL_LIBRARY = 1
-
-REQUIRES = $(NULL)
-
-CSRCS = \
- glitz.c \
- glitz_buffer.c \
- glitz_compose.c \
- glitz_context.c \
- glitz_drawable.c \
- glitz_filter.c \
- glitz_format.c \
- glitz_framebuffer.c \
- glitz_geometry.c \
- glitz_operator.c \
- glitz_pixel.c \
- glitz_program.c \
- glitz_rect.c \
- glitz_region.c \
- glitz_status.c \
- glitz_surface.c \
- glitz_texture.c \
- glitz_trap.c \
- glitz_util.c \
- $(NULL)
-
-EXPORTS = glitz.h
-
-DIRS = $(NULL)
-
-ifdef MOZ_X11
-DIRS += glx
-endif
-
-ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
-DIRS += wgl
-endif
-
-ifneq (,$(filter $(MOZ_WIDGET_TOOLKIT),mac cocoa))
-DIRS += agl
-endif
-
-FORCE_STATIC_LIB = 1
-FORCE_USE_PIC = 1
-
-LOCAL_INCLUDES += -I$(srcdir) -I$(srcdir)/../../cairo/src
-
-include $(topsrcdir)/config/rules.mk
deleted file mode 100644
--- a/gfx/cairo/glitz/src/agl/glitz-agl.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef GLITZ_AGL_H_INCLUDED
-#define GLITZ_AGL_H_INCLUDED
-
-#include <glitz.h>
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-#include <Carbon/Carbon.h>
-
-
-/* glitz_agl_info.c */
-
-void
-glitz_agl_init (void);
-
-void
-glitz_agl_fini (void);
-
-
-/* glitz_agl_format.c */
-
-glitz_drawable_format_t *
-glitz_agl_find_window_format (unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count);
-
-glitz_drawable_format_t *
-glitz_agl_find_pbuffer_format (unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count);
-
-/* glitz_agl_drawable.c */
-
-glitz_drawable_t *
-glitz_agl_create_drawable_for_window (glitz_drawable_format_t *format,
- WindowRef window,
- unsigned int width,
- unsigned int height);
-
-glitz_drawable_t *
-glitz_agl_create_pbuffer_drawable (glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height);
-
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* GLITZ_AGL_H_INCLUDED */
deleted file mode 100644
--- a/gfx/cairo/glitz/src/agl/glitz-agl.man
+++ /dev/null
@@ -1,26 +0,0 @@
-.\"
-.\"
-.de TQ
-.br
-.ns
-.TP
-\\$1
-..
-.TH GLITZ-AGL 3 "Version 1.0"
-
-.SH NAME
-GLITZ-AGL \- AGL interface to glitz
-
-.SH SYNOPSIS
-.nf
-.B #include <glitz-agl.h>
-.fi
-.SH DESCRIPTION
-
-AGL interface to glitz.
-
-.SH AUTHOR
-David Reveman
-
-.SH "SEE ALSO"
-.BR GLITZ (3)
\ No newline at end of file
deleted file mode 100644
--- a/gfx/cairo/glitz/src/agl/glitz_agl_context.c
+++ /dev/null
@@ -1,522 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitz_aglint.h"
-
-extern glitz_gl_proc_address_list_t _glitz_agl_gl_proc_address;
-
-static CFBundleRef
-_glitz_agl_get_bundle (const char *name)
-{
- CFBundleRef bundle = 0;
- FSRefParam ref_param;
- char framework_name[256];
-
- framework_name[0] = strlen (name);
- strcpy (&framework_name[1], name);
-
- memset (&ref_param, 0, sizeof (ref_param));
-
- if (FindFolder (kSystemDomain,
- kFrameworksFolderType,
- kDontCreateFolder,
- &ref_param.ioVRefNum,
- &ref_param.ioDirID) == noErr) {
- FSRef ref;
-
- memset (&ref, 0, sizeof (ref));
-
- ref_param.ioNamePtr = (unsigned char *) framework_name;
- ref_param.newRef = &ref;
-
- if (PBMakeFSRefSync (&ref_param) == noErr) {
- CFURLRef url;
-
- url = CFURLCreateFromFSRef (kCFAllocatorDefault, &ref);
- if (url) {
- bundle = CFBundleCreate (kCFAllocatorDefault, url);
- CFRelease (url);
-
- if (!CFBundleLoadExecutable (bundle)) {
- CFRelease (bundle);
- return (CFBundleRef) 0;
- }
- }
- }
- }
-
- return bundle;
-}
-
-static void
-_glitz_agl_release_bundle (CFBundleRef bundle)
-{
- if (bundle) {
- CFBundleUnloadExecutable (bundle);
- CFRelease (bundle);
- }
-}
-
-static void
-_glitz_agl_notify_dummy (void *abstract_drawable,
- glitz_surface_t *surface) {}
-
-static glitz_function_pointer_t
-_glitz_agl_get_proc_address (const char *name, void *closure)
-{
- glitz_function_pointer_t address = NULL;
- CFBundleRef bundle = (CFBundleRef) closure;
- CFStringRef str;
-
- if (bundle) {
- str = CFStringCreateWithCString (kCFAllocatorDefault, name,
- kCFStringEncodingMacRoman);
-
- address = CFBundleGetFunctionPointerForName (bundle, str);
-
- CFRelease (str);
- }
-
- return address;
-}
-
-static glitz_context_t *
-_glitz_agl_create_context (void *abstract_drawable,
- glitz_drawable_format_t *format)
-{
- glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
- abstract_drawable;
- glitz_agl_thread_info_t *thread_info = drawable->thread_info;
- glitz_agl_context_t *context;
-
- context = malloc (sizeof (glitz_agl_context_t));
- if (!context)
- return NULL;
-
- context->context =
- aglCreateContext (thread_info->pixel_formats[format->id],
- thread_info->root_context);
-
- _glitz_context_init (&context->base, &drawable->base);
-
- context->pbuffer = 0;
-
- return (glitz_context_t *) context;
-}
-
-static void
-_glitz_agl_context_destroy (void *abstract_context)
-{
- glitz_agl_context_t *context = (glitz_agl_context_t *) abstract_context;
- glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
- context->base.drawable;
-
- if (drawable->thread_info->cctx == &context->base)
- {
- aglSetCurrentContext (NULL);
-
- drawable->thread_info->cctx = NULL;
- }
-
- aglDestroyContext (context->context);
-
- _glitz_context_fini (&context->base);
-
- free (context);
-}
-
-static void
-_glitz_agl_copy_context (void *abstract_src,
- void *abstract_dst,
- unsigned long mask)
-{
- glitz_agl_context_t *src = (glitz_agl_context_t *) abstract_src;
- glitz_agl_context_t *dst = (glitz_agl_context_t *) abstract_dst;
-
- aglCopyContext (src->context, dst->context, mask);
-}
-
-static void
-_glitz_agl_make_current (void *abstract_drawable,
- void *abstract_context)
-{
- glitz_agl_context_t *context = (glitz_agl_context_t *) abstract_context;
- glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
- abstract_drawable;
- int update = 0;
-
- if (drawable->base.width != drawable->width ||
- drawable->base.height != drawable->height)
- glitz_agl_drawable_update_size (drawable,
- drawable->base.width,
- drawable->base.height);
-
- if (aglGetCurrentContext () != context->context)
- {
- update = 1;
- }
- else
- {
- if (drawable->pbuffer)
- {
- AGLPbuffer pbuffer;
- GLint unused;
-
- aglGetPBuffer (context->context, &pbuffer,
- &unused, &unused, &unused);
-
- if (pbuffer != drawable->pbuffer)
- update = 1;
-
- }
- else if (drawable->drawable)
- {
- if (aglGetDrawable (context->context) != drawable->drawable)
- update = 1;
- }
- }
-
- if (update)
- {
- if (drawable->thread_info->cctx)
- {
- glitz_context_t *ctx = drawable->thread_info->cctx;
-
- if (ctx->lose_current)
- ctx->lose_current (ctx->closure);
- }
-
- if (drawable->pbuffer) {
- aglSetPBuffer (context->context, drawable->pbuffer, 0, 0,
- aglGetVirtualScreen (context->context));
- context->pbuffer = 1;
- }
- else
- {
- if (context->pbuffer) {
- aglSetDrawable (context->context, NULL);
- context->pbuffer = 0;
- }
- aglSetDrawable (context->context, drawable->drawable);
- }
-
- aglSetCurrentContext (context->context);
- }
-
- drawable->thread_info->cctx = &context->base;
-}
-
-static glitz_function_pointer_t
-_glitz_agl_context_get_proc_address (void *abstract_context,
- const char *name)
-{
- glitz_agl_context_t *context = (glitz_agl_context_t *) abstract_context;
- glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
- context->base.drawable;
- glitz_function_pointer_t func;
- CFBundleRef bundle;
-
- _glitz_agl_make_current (drawable, context);
-
- bundle = _glitz_agl_get_bundle ("OpenGL.framework");
-
- func = _glitz_agl_get_proc_address (name, (void *) bundle);
-
- _glitz_agl_release_bundle (bundle);
-
- return func;
-}
-
-glitz_agl_context_t *
-glitz_agl_context_get (glitz_agl_thread_info_t *thread_info,
- glitz_drawable_format_t *format)
-{
- glitz_agl_context_t *context;
- glitz_agl_context_t **contexts = thread_info->contexts;
- int index, n_contexts = thread_info->n_contexts;
-
- for (; n_contexts; n_contexts--, contexts++)
- if ((*contexts)->id == format->id)
- return *contexts;
-
- index = thread_info->n_contexts++;
-
- thread_info->contexts =
- realloc (thread_info->contexts,
- sizeof (glitz_agl_context_t *) * thread_info->n_contexts);
- if (!thread_info->contexts)
- return NULL;
-
- context = malloc (sizeof (glitz_agl_context_t));
- if (!context)
- return NULL;
-
- thread_info->contexts[index] = context;
-
- context->context =
- aglCreateContext (thread_info->pixel_formats[format->id],
- thread_info->root_context);
- if (!context->context) {
- free (context);
- return NULL;
- }
-
- context->id = format->id;
- context->pbuffer = 0;
-
- if (!thread_info->root_context)
- thread_info->root_context = context->context;
-
- context->backend.gl = &_glitz_agl_gl_proc_address;
-
- context->backend.create_pbuffer = glitz_agl_create_pbuffer;
- context->backend.destroy = glitz_agl_destroy;
- context->backend.push_current = glitz_agl_push_current;
- context->backend.pop_current = glitz_agl_pop_current;
- context->backend.attach_notify = _glitz_agl_notify_dummy;
- context->backend.detach_notify = _glitz_agl_notify_dummy;
- context->backend.swap_buffers = glitz_agl_swap_buffers;
- context->backend.copy_sub_buffer = glitz_agl_copy_sub_buffer;
-
- context->backend.create_context = _glitz_agl_create_context;
- context->backend.destroy_context = _glitz_agl_context_destroy;
- context->backend.copy_context = _glitz_agl_copy_context;
- context->backend.make_current = _glitz_agl_make_current;
- context->backend.get_proc_address = _glitz_agl_context_get_proc_address;
-
- context->backend.draw_buffer = _glitz_drawable_draw_buffer;
- context->backend.read_buffer = _glitz_drawable_read_buffer;
-
- context->backend.drawable_formats = NULL;
- context->backend.n_drawable_formats = 0;
-
- if (thread_info->n_formats)
- {
- int size;
-
- size = sizeof (glitz_int_drawable_format_t) * thread_info->n_formats;
- context->backend.drawable_formats = malloc (size);
- if (context->backend.drawable_formats)
- {
- memcpy (context->backend.drawable_formats, thread_info->formats,
- size);
- context->backend.n_drawable_formats = thread_info->n_formats;
- }
- }
-
- context->backend.texture_formats = NULL;
- context->backend.formats = NULL;
- context->backend.n_formats = 0;
-
- context->backend.program_map = &thread_info->program_map;
- context->backend.feature_mask = 0;
-
- context->initialized = 0;
-
- return context;
-}
-
-void
-glitz_agl_context_destroy (glitz_agl_thread_info_t *thread_info,
- glitz_agl_context_t *context)
-{
- if (context->backend.drawable_formats)
- free (context->backend.drawable_formats);
-
- if (context->backend.formats)
- free (context->backend.formats);
-
- if (context->backend.texture_formats)
- free (context->backend.texture_formats);
-
- aglDestroyContext (context->context);
-
- free (context);
-}
-
-static void
-_glitz_agl_context_initialize (glitz_agl_thread_info_t *thread_info,
- glitz_agl_context_t *context)
-{
- CFBundleRef bundle;
-
- bundle = _glitz_agl_get_bundle ("OpenGL.framework");
-
- glitz_backend_init (&context->backend,
- _glitz_agl_get_proc_address,
- (void *) bundle);
-
- _glitz_agl_release_bundle (bundle);
-
- glitz_initiate_state (&_glitz_agl_gl_proc_address);
-
- context->initialized = 1;
-}
-
-static void
-_glitz_agl_context_make_current (glitz_agl_drawable_t *drawable,
- glitz_bool_t finish)
-{
- if (finish)
- glFinish ();
-
- if (drawable->thread_info->cctx)
- {
- glitz_context_t *ctx = drawable->thread_info->cctx;
-
- if (ctx->lose_current)
- ctx->lose_current (ctx->closure);
-
- drawable->thread_info->cctx = NULL;
- }
-
- if (drawable->pbuffer) {
- aglSetPBuffer (drawable->context->context, drawable->pbuffer, 0, 0,
- aglGetVirtualScreen (drawable->context->context));
- drawable->context->pbuffer = 1;
- } else {
- if (drawable->context->pbuffer) {
- aglSetDrawable (drawable->context->context, NULL);
- drawable->context->pbuffer = 0;
- }
-
- aglSetDrawable (drawable->context->context, drawable->drawable);
- }
-
- aglSetCurrentContext (drawable->context->context);
-
- drawable->base.update_all = 1;
-
- if (!drawable->context->initialized)
- _glitz_agl_context_initialize (drawable->thread_info,
- drawable->context);
-}
-
-static void
-_glitz_agl_context_update (glitz_agl_drawable_t *drawable,
- glitz_constraint_t constraint)
-{
- AGLContext context;
-
- drawable->base.flushed = drawable->base.finished = 0;
-
- switch (constraint) {
- case GLITZ_NONE:
- break;
- case GLITZ_ANY_CONTEXT_CURRENT:
- context = aglGetCurrentContext ();
- if (context == (AGLContext) 0)
- _glitz_agl_context_make_current (drawable, 0);
- break;
- case GLITZ_CONTEXT_CURRENT:
- context = aglGetCurrentContext ();
- if (context != drawable->context->context)
- _glitz_agl_context_make_current (drawable, (context)? 1: 0);
- break;
- case GLITZ_DRAWABLE_CURRENT:
- if (drawable->base.width != drawable->width ||
- drawable->base.height != drawable->height)
- glitz_agl_drawable_update_size (drawable,
- drawable->base.width,
- drawable->base.height);
-
- context = aglGetCurrentContext ();
- if (context != drawable->context->context) {
- _glitz_agl_context_make_current (drawable, (context)? 1: 0);
- } else {
- if (drawable->pbuffer) {
- AGLPbuffer pbuffer;
- GLint unused;
-
- aglGetPBuffer (drawable->context->context, &pbuffer,
- &unused, &unused, &unused);
-
- if (pbuffer != drawable->pbuffer)
- _glitz_agl_context_make_current (drawable,
- (context)? 1: 0);
-
- } else if (drawable->drawable) {
- if (aglGetDrawable (drawable->context->context) !=
- drawable->drawable)
- _glitz_agl_context_make_current (drawable,
- (context)? 1: 0);
- }
- }
- break;
- }
-}
-
-glitz_bool_t
-glitz_agl_push_current (void *abstract_drawable,
- glitz_surface_t *surface,
- glitz_constraint_t constraint,
- glitz_bool_t *restore_state)
-{
- glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
- abstract_drawable;
- glitz_agl_context_info_t *context_info;
- int index;
-
- if (restore_state)
- *restore_state = 0;
-
- index = drawable->thread_info->context_stack_size++;
-
- context_info = &drawable->thread_info->context_stack[index];
- context_info->drawable = drawable;
- context_info->surface = surface;
- context_info->constraint = constraint;
-
- _glitz_agl_context_update (context_info->drawable, constraint);
-
- return 1;
-}
-
-glitz_surface_t *
-glitz_agl_pop_current (void *abstract_drawable)
-{
- glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
- abstract_drawable;
- glitz_agl_context_info_t *context_info = NULL;
- int index;
-
- drawable->thread_info->context_stack_size--;
- index = drawable->thread_info->context_stack_size - 1;
-
- context_info = &drawable->thread_info->context_stack[index];
-
- if (context_info->drawable)
- _glitz_agl_context_update (context_info->drawable,
- context_info->constraint);
-
- if (context_info->constraint == GLITZ_DRAWABLE_CURRENT)
- return context_info->surface;
-
- return NULL;
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/agl/glitz_agl_drawable.c
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitz_aglint.h"
-
-static glitz_agl_drawable_t *
-_glitz_agl_create_drawable (glitz_agl_thread_info_t *thread_info,
- glitz_agl_context_t *context,
- glitz_drawable_format_t *format,
- AGLDrawable agl_drawable,
- AGLPbuffer agl_pbuffer,
- unsigned int width,
- unsigned int height)
-{
- glitz_agl_drawable_t *drawable;
-
- drawable = (glitz_agl_drawable_t *) malloc (sizeof (glitz_agl_drawable_t));
- if (drawable == NULL)
- return NULL;
-
- drawable->thread_info = thread_info;
- drawable->context = context;
- drawable->drawable = agl_drawable;
- drawable->pbuffer = agl_pbuffer;
- drawable->width = width;
- drawable->height = height;
-
- _glitz_drawable_init (&drawable->base,
- &thread_info->formats[format->id],
- &context->backend,
- width, height);
-
- if (!context->initialized) {
- glitz_agl_push_current (drawable, NULL, GLITZ_CONTEXT_CURRENT, NULL);
- glitz_agl_pop_current (drawable);
- }
-
- if (width > context->backend.max_viewport_dims[0] ||
- height > context->backend.max_viewport_dims[1]) {
- free (drawable);
- return NULL;
- }
-
- thread_info->drawables++;
-
- return drawable;
-}
-
-glitz_bool_t
-glitz_agl_drawable_update_size (glitz_agl_drawable_t *drawable,
- int width,
- int height)
-{
- if (drawable->pbuffer)
- {
- glitz_agl_pbuffer_destroy (drawable->pbuffer);
- drawable->pbuffer =
- glitz_agl_pbuffer_create (drawable->thread_info,
- (int) width, (int) height);
- if (!drawable->pbuffer)
- return 0;
- }
-
- drawable->width = width;
- drawable->height = height;
-
- return 1;
-}
-
-static glitz_drawable_t *
-_glitz_agl_create_pbuffer_drawable (glitz_agl_thread_info_t *thread_info,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height)
-{
- glitz_agl_drawable_t *drawable;
- glitz_agl_context_t *context;
- AGLPbuffer pbuffer;
-
- context = glitz_agl_context_get (thread_info, format);
- if (!context)
- return NULL;
-
- pbuffer = glitz_agl_pbuffer_create (thread_info,
- (int) width, (int) height);
- if (!pbuffer)
- return NULL;
-
- drawable = _glitz_agl_create_drawable (thread_info, context, format,
- (AGLDrawable) 0, pbuffer,
- width, height);
- if (!drawable) {
- glitz_agl_pbuffer_destroy (pbuffer);
- return NULL;
- }
-
- return &drawable->base;
-}
-
-glitz_drawable_t *
-glitz_agl_create_pbuffer (void *abstract_templ,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height)
-{
- glitz_agl_drawable_t *templ = (glitz_agl_drawable_t *) abstract_templ;
-
- return _glitz_agl_create_pbuffer_drawable (templ->thread_info, format,
- width, height);
-}
-
-glitz_drawable_t *
-glitz_agl_create_drawable_for_window (glitz_drawable_format_t *format,
- WindowRef window,
- unsigned int width,
- unsigned int height)
-{
- glitz_agl_drawable_t *drawable;
- glitz_agl_thread_info_t *thread_info;
- glitz_agl_context_t *context;
- AGLDrawable agl_drawable;
-
- agl_drawable = (AGLDrawable) GetWindowPort (window);
- if (!agl_drawable)
- return NULL;
-
- thread_info = glitz_agl_thread_info_get ();
- if (!thread_info)
- return NULL;
-
- if (format->id >= thread_info->n_formats)
- return NULL;
-
- context = glitz_agl_context_get (thread_info, format);
- if (!context)
- return NULL;
-
- drawable = _glitz_agl_create_drawable (thread_info, context, format,
- agl_drawable, (AGLPbuffer) 0,
- width, height);
- if (!drawable)
- return NULL;
-
- return &drawable->base;
-}
-slim_hidden_def(glitz_agl_create_drawable_for_window);
-
-glitz_drawable_t *
-glitz_agl_create_pbuffer_drawable (glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height)
-{
- glitz_agl_thread_info_t *thread_info;
-
- thread_info = glitz_agl_thread_info_get ();
- if (!thread_info)
- return NULL;
-
- if (format->id >= thread_info->n_formats)
- return NULL;
-
- return _glitz_agl_create_pbuffer_drawable (thread_info, format,
- width, height);
-}
-slim_hidden_def(glitz_agl_create_pbuffer_drawable);
-
-void
-glitz_agl_destroy (void *abstract_drawable)
-{
- glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
- abstract_drawable;
-
- drawable->thread_info->drawables--;
- if (drawable->thread_info->drawables == 0) {
- /*
- * Last drawable? We have to destroy all fragment programs as this may
- * be our last chance to have a context current.
- */
- glitz_agl_push_current (abstract_drawable, NULL,
- GLITZ_CONTEXT_CURRENT, NULL);
- glitz_program_map_fini (drawable->base.backend->gl,
- &drawable->thread_info->program_map);
- glitz_program_map_init (&drawable->thread_info->program_map);
- glitz_agl_pop_current (abstract_drawable);
- }
-
- if (drawable->drawable || drawable->pbuffer) {
- AGLContext context = aglGetCurrentContext ();
-
- if (context == drawable->context->context) {
- if (drawable->pbuffer) {
- AGLPbuffer pbuffer;
- GLint unused;
-
- aglGetPBuffer (context, &pbuffer, &unused, &unused, &unused);
-
- if (pbuffer == drawable->pbuffer)
- aglSetCurrentContext (NULL);
- } else {
- if (aglGetDrawable (context) == drawable->drawable)
- aglSetCurrentContext (NULL);
- }
- }
-
- if (drawable->pbuffer)
- glitz_agl_pbuffer_destroy (drawable->pbuffer);
- }
-
- free (drawable);
-}
-
-glitz_bool_t
-glitz_agl_swap_buffers (void *abstract_drawable)
-{
- glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
- abstract_drawable;
-
- glitz_agl_push_current (abstract_drawable, NULL, GLITZ_DRAWABLE_CURRENT,
- NULL);
- aglSwapBuffers (drawable->context->context);
- glitz_agl_pop_current (abstract_drawable);
-
- return 1;
-}
-
-glitz_bool_t
-glitz_agl_copy_sub_buffer (void *abstract_drawable,
- int x,
- int y,
- int width,
- int height)
-{
- return 0;
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/agl/glitz_agl_extension.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitz_aglint.h"
-
-static glitz_extension_map agl_extensions[] = {
- { 0.0, "GL_APPLE_pixel_buffer", GLITZ_AGL_FEATURE_PBUFFER_MASK },
- { 0.0, "GL_ARB_multisample", GLITZ_AGL_FEATURE_MULTISAMPLE_MASK },
- { 0.0, "GL_ARB_texture_rectangle",
- GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
- { 0.0, "GL_EXT_texture_rectangle",
- GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
- { 0.0, "GL_NV_texture_rectangle",
- GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
- { 0.0, NULL, 0 }
-};
-
-glitz_status_t
-glitz_agl_query_extensions (glitz_agl_thread_info_t *thread_info)
-{
- GLint attrib[] = {
- AGL_RGBA,
- AGL_NO_RECOVERY,
- AGL_NONE
- };
- AGLPixelFormat pf;
- AGLContext context;
-
- thread_info->agl_feature_mask = 0;
-
- pf = aglChoosePixelFormat (NULL, 0, attrib);
- context = aglCreateContext (pf, NULL);
-
- if (context) {
- const char *gl_extensions_string;
-
- aglSetCurrentContext (context);
-
- gl_extensions_string = (const char *) glGetString (GL_EXTENSIONS);
-
- thread_info->agl_feature_mask =
- glitz_extensions_query (0.0,
- gl_extensions_string,
- agl_extensions);
-
- if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_MULTISAMPLE_MASK)
- {
- const char *vendor;
-
- vendor = glGetString (GL_VENDOR);
-
- if (vendor) {
-
- /* NVIDIA's driver seem to support multisample with pbuffers */
- if (!strncmp ("NVIDIA", vendor, 6))
- thread_info->agl_feature_mask |=
- GLITZ_AGL_FEATURE_PBUFFER_MULTISAMPLE_MASK;
- }
- }
-
- aglSetCurrentContext (NULL);
- aglDestroyContext (context);
- }
-
- aglDestroyPixelFormat (pf);
-
- return GLITZ_STATUS_SUCCESS;
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/agl/glitz_agl_format.c
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitz_aglint.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-static GLint _attribs[] = {
- AGL_RGBA,
- AGL_ALPHA_SIZE, 16,
- AGL_RED_SIZE, 16,
- AGL_NONE
-};
-
-static GLint _db_attribs[] = {
- AGL_RGBA,
- AGL_DOUBLEBUFFER,
- AGL_ALPHA_SIZE, 16,
- AGL_RED_SIZE, 16,
- AGL_NONE
-};
-
-static GLint _stencil_attribs[] = {
- AGL_RGBA,
- AGL_ALPHA_SIZE, 16,
- AGL_RED_SIZE, 16,
- AGL_DEPTH_SIZE, 8,
- AGL_STENCIL_SIZE, 8,
- AGL_NONE
-};
-
-static GLint _db_stencil_attribs[] = {
- AGL_RGBA,
- AGL_DOUBLEBUFFER,
- AGL_ALPHA_SIZE, 16,
- AGL_RED_SIZE, 16,
- AGL_STENCIL_SIZE, 8,
- AGL_NONE
-};
-
-static GLint _ms2_attribs[] = {
- AGL_RGBA,
- AGL_ALPHA_SIZE, 16,
- AGL_RED_SIZE, 16,
- AGL_STENCIL_SIZE, 8,
- AGL_SAMPLE_BUFFERS_ARB, 1,
- AGL_SAMPLES_ARB, 2,
- AGL_NONE
-};
-
-static GLint _db_ms2_attribs[] = {
- AGL_RGBA,
- AGL_DOUBLEBUFFER,
- AGL_ALPHA_SIZE, 16,
- AGL_RED_SIZE, 16,
- AGL_STENCIL_SIZE, 8,
- AGL_SAMPLE_BUFFERS_ARB, 1,
- AGL_SAMPLES_ARB, 2,
- AGL_NONE
-};
-
-static GLint _ms4_attribs[] = {
- AGL_RGBA,
- AGL_ALPHA_SIZE, 16,
- AGL_RED_SIZE, 16,
- AGL_STENCIL_SIZE, 8,
- AGL_SAMPLE_BUFFERS_ARB, 1,
- AGL_SAMPLES_ARB, 4,
- AGL_NONE
-};
-
-static GLint _db_ms4_attribs[] = {
- AGL_RGBA,
- AGL_DOUBLEBUFFER,
- AGL_ALPHA_SIZE, 16,
- AGL_RED_SIZE, 16,
- AGL_STENCIL_SIZE, 8,
- AGL_SAMPLE_BUFFERS_ARB, 1,
- AGL_SAMPLES_ARB, 4,
- AGL_NONE
-};
-
-static GLint _ms6_attribs[] = {
- AGL_RGBA,
- AGL_ALPHA_SIZE, 16,
- AGL_RED_SIZE, 16,
- AGL_STENCIL_SIZE, 8,
- AGL_SAMPLE_BUFFERS_ARB, 1,
- AGL_SAMPLES_ARB, 6,
- AGL_NONE
-};
-
-static GLint _db_ms6_attribs[] = {
- AGL_RGBA,
- AGL_DOUBLEBUFFER,
- AGL_ALPHA_SIZE, 16,
- AGL_RED_SIZE, 16,
- AGL_STENCIL_SIZE, 8,
- AGL_SAMPLE_BUFFERS_ARB, 1,
- AGL_SAMPLES_ARB, 6,
- AGL_NONE
-};
-
-static GLint *_attribs_list[] = {
- _attribs,
- _db_attribs,
- _stencil_attribs,
- _db_stencil_attribs,
- _ms2_attribs,
- _db_ms2_attribs,
- _ms4_attribs,
- _db_ms4_attribs,
- _ms6_attribs,
- _db_ms6_attribs
-};
-
-static int
-_glitz_agl_format_compare (const void *elem1,
- const void *elem2)
-{
- glitz_int_drawable_format_t *format[2];
- int i, score[2];
-
- format[0] = (glitz_int_drawable_format_t *) elem1;
- format[1] = (glitz_int_drawable_format_t *) elem2;
- i = score[0] = score[1] = 0;
-
- for (; i < 2; i++)
- {
- if (format[i]->d.color.red_size)
- {
- if (format[i]->d.color.red_size >= 8)
- score[i] += 5;
-
- score[i] += 10;
- }
-
- if (format[i]->d.color.alpha_size)
- {
- if (format[i]->d.color.alpha_size >= 8)
- score[i] += 5;
-
- score[i] += 10;
- }
-
- if (format[i]->d.stencil_size)
- score[i] += 5;
-
- if (format[i]->d.depth_size)
- score[i] += 5;
-
- if (format[i]->d.doublebuffer)
- score[i] += 10;
-
- if (format[i]->d.samples > 1)
- score[i] -= (20 - format[i]->d.samples);
-
- if (format[i]->types & GLITZ_DRAWABLE_TYPE_WINDOW_MASK)
- score[i] += 10;
-
- if (format[i]->types & GLITZ_DRAWABLE_TYPE_PBUFFER_MASK)
- score[i] += 10;
-
- if (format[i]->caveat)
- score[i] -= 1000;
- }
-
- return score[1] - score[0];
-}
-
-static void
-_glitz_agl_add_format (glitz_agl_thread_info_t *thread_info,
- glitz_int_drawable_format_t *format,
- AGLPixelFormat pixel_format)
-{
- if (!glitz_drawable_format_find (thread_info->formats,
- thread_info->n_formats,
- GLITZ_DRAWABLE_FORMAT_ALL_EXCEPT_ID_MASK,
- format, 0)) {
- int n = thread_info->n_formats;
-
- thread_info->formats =
- realloc (thread_info->formats,
- sizeof (glitz_int_drawable_format_t) * (n + 1));
- thread_info->pixel_formats =
- realloc (thread_info->pixel_formats,
- sizeof (AGLPixelFormat) * (n + 1));
-
- if (thread_info->formats && thread_info->pixel_formats) {
- thread_info->formats[n] = *(glitz_int_drawable_format_t*)format;
- thread_info->formats[n].d.id = n;
- thread_info->pixel_formats[n] = pixel_format;
- thread_info->n_formats++;
- }
- }
-}
-
-void
-glitz_agl_query_formats (glitz_agl_thread_info_t *thread_info)
-{
- glitz_int_drawable_format_t format;
- AGLPixelFormat pixel_format, *new_pfs;
- int n_attribs_list, i;
-
- format.types = GLITZ_DRAWABLE_TYPE_WINDOW_MASK;
- format.d.id = 0;
- format.color.fourcc = GLITZ_FOURCC_RGB;
-
- n_attribs_list = sizeof (_attribs_list) / sizeof (GLint *);
-
- for (i = 0; i < n_attribs_list; i++) {
- GLint value;
-
- pixel_format = aglChoosePixelFormat (NULL, 0, _attribs_list[i]);
-
- /* Stereo is not supported yet */
- if (!(aglDescribePixelFormat (pixel_format, AGL_STEREO, &value)) ||
- value) {
- aglDestroyPixelFormat (pixel_format);
- continue;
- }
-
- aglDescribePixelFormat (pixel_format, AGL_DOUBLEBUFFER, &value);
- format.d.doublebuffer = (value)? 1: 0;
-
- aglDescribePixelFormat (pixel_format, AGL_RED_SIZE, &value);
- format.d.color.red_size = (unsigned short) value;
- aglDescribePixelFormat (pixel_format, AGL_GREEN_SIZE, &value);
- format.d.color.green_size = (unsigned short) value;
- aglDescribePixelFormat (pixel_format, AGL_BLUE_SIZE, &value);
- format.d.color.blue_size = (unsigned short) value;
- aglDescribePixelFormat (pixel_format, AGL_ALPHA_SIZE, &value);
- format.d.color.alpha_size = (unsigned short) value;
- aglDescribePixelFormat (pixel_format, AGL_DEPTH_SIZE, &value);
- format.d.depth_size = (unsigned short) value;
- aglDescribePixelFormat (pixel_format, AGL_STENCIL_SIZE, &value);
- format.d.stencil_size = (unsigned short) value;
-
- if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_MULTISAMPLE_MASK)
- {
- aglDescribePixelFormat (pixel_format, AGL_SAMPLE_BUFFERS_ARB,
- &value);
- if (value) {
- aglDescribePixelFormat (pixel_format, AGL_SAMPLES_ARB, &value);
- format.d.samples = (unsigned short) (value > 1)? value: 1;
- } else
- format.d.samples = 1;
- } else
- format.d.samples = 1;
-
- if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_PBUFFER_MASK) {
- if (format.d.color.red_size && format.d.color.green_size &&
- format.d.color.blue_size && format.d.color.alpha_size &&
- format.d.doublebuffer == 0 && format.d.stencil_size == 0 &&
- format.d.depth_size == 0) {
-
- if (thread_info->agl_feature_mask &
- GLITZ_AGL_FEATURE_PBUFFER_MULTISAMPLE_MASK)
- format.types |= GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
- else if (format.d.samples == 1)
- format.types |= GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
- else
- format.types &= ~GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
- } else
- format.types &= ~GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
- } else
- format.types &= ~GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
-
- if (format.d.color.red_size ||
- format.d.color.green_size ||
- format.d.color.blue_size ||
- format.d.color.alpha_size)
- _glitz_agl_add_format (thread_info, &format, pixel_format);
- }
-
- if (!thread_info->n_formats)
- return;
-
- qsort (thread_info->formats, thread_info->n_formats,
- sizeof (glitz_int_drawable_format_t), _glitz_agl_format_compare);
-
- /*
- * Update AGLPixelFormat list so that it matches the sorted format list.
- */
- new_pfs = malloc (sizeof (AGLPixelFormat) * thread_info->n_formats);
- if (!new_pfs) {
- thread_info->n_formats = 0;
- return;
- }
-
- for (i = 0; i < thread_info->n_formats; i++) {
- new_pfs[i] = thread_info->pixel_formats[thread_info->formats[i].d.id];
- thread_info->formats[i].d.id = i;
- }
-
- free (thread_info->pixel_formats);
- thread_info->pixel_formats = new_pfs;
-}
-
-glitz_drawable_format_t *
-glitz_agl_find_window_format (unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count)
-{
- glitz_int_drawable_format_t itempl;
- glitz_agl_thread_info_t *thread_info =
- glitz_agl_thread_info_get ();
-
- glitz_drawable_format_copy (templ, &itempl.d, mask);
-
- itempl.types = GLITZ_DRAWABLE_TYPE_WINDOW_MASK;
- mask |= GLITZ_INT_FORMAT_WINDOW_MASK;
-
- return glitz_drawable_format_find (thread_info->formats,
- thread_info->n_formats,
- mask, &itempl, count);
-}
-slim_hidden_def(glitz_agl_find_window_format);
-
-
-glitz_drawable_format_t *
-glitz_agl_find_pbuffer_format (unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count)
-{
- glitz_int_drawable_format_t itempl;
- glitz_agl_thread_info_t *thread_info =
- glitz_agl_thread_info_get ();
-
- glitz_drawable_format_copy (templ, &itempl.d, mask);
-
- itempl.types = GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
- mask |= GLITZ_INT_FORMAT_PBUFFER_MASK;
-
- return glitz_drawable_format_find (thread_info->formats,
- thread_info->n_formats,
- mask, &itempl, count);
-}
-slim_hidden_def(glitz_agl_find_pbuffer_format);
-
deleted file mode 100644
--- a/gfx/cairo/glitz/src/agl/glitz_agl_info.c
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitz_aglint.h"
-
-#include <OpenGL/glext.h>
-
-glitz_gl_proc_address_list_t _glitz_agl_gl_proc_address = {
-
- /* core */
- (glitz_gl_enable_t) glEnable,
- (glitz_gl_disable_t) glDisable,
- (glitz_gl_get_error_t) glGetError,
- (glitz_gl_get_string_t) glGetString,
- (glitz_gl_enable_client_state_t) glEnableClientState,
- (glitz_gl_disable_client_state_t) glDisableClientState,
- (glitz_gl_vertex_pointer_t) glVertexPointer,
- (glitz_gl_tex_coord_pointer_t) glTexCoordPointer,
- (glitz_gl_draw_arrays_t) glDrawArrays,
- (glitz_gl_tex_env_f_t) glTexEnvf,
- (glitz_gl_tex_env_fv_t) glTexEnvfv,
- (glitz_gl_tex_gen_i_t) glTexGeni,
- (glitz_gl_tex_gen_fv_t) glTexGenfv,
- (glitz_gl_color_4us_t) glColor4us,
- (glitz_gl_color_4f_t) glColor4f,
- (glitz_gl_scissor_t) glScissor,
- (glitz_gl_blend_func_t) glBlendFunc,
- (glitz_gl_clear_t) glClear,
- (glitz_gl_clear_color_t) glClearColor,
- (glitz_gl_clear_stencil_t) glClearStencil,
- (glitz_gl_stencil_func_t) glStencilFunc,
- (glitz_gl_stencil_op_t) glStencilOp,
- (glitz_gl_push_attrib_t) glPushAttrib,
- (glitz_gl_pop_attrib_t) glPopAttrib,
- (glitz_gl_matrix_mode_t) glMatrixMode,
- (glitz_gl_push_matrix_t) glPushMatrix,
- (glitz_gl_pop_matrix_t) glPopMatrix,
- (glitz_gl_load_identity_t) glLoadIdentity,
- (glitz_gl_load_matrix_f_t) glLoadMatrixf,
- (glitz_gl_depth_range_t) glDepthRange,
- (glitz_gl_viewport_t) glViewport,
- (glitz_gl_raster_pos_2f_t) glRasterPos2f,
- (glitz_gl_bitmap_t) glBitmap,
- (glitz_gl_read_buffer_t) glReadBuffer,
- (glitz_gl_draw_buffer_t) glDrawBuffer,
- (glitz_gl_copy_pixels_t) glCopyPixels,
- (glitz_gl_flush_t) glFlush,
- (glitz_gl_finish_t) glFinish,
- (glitz_gl_pixel_store_i_t) glPixelStorei,
- (glitz_gl_ortho_t) glOrtho,
- (glitz_gl_scale_f_t) glScalef,
- (glitz_gl_translate_f_t) glTranslatef,
- (glitz_gl_hint_t) glHint,
- (glitz_gl_depth_mask_t) glDepthMask,
- (glitz_gl_polygon_mode_t) glPolygonMode,
- (glitz_gl_shade_model_t) glShadeModel,
- (glitz_gl_color_mask_t) glColorMask,
- (glitz_gl_read_pixels_t) glReadPixels,
- (glitz_gl_get_tex_image_t) glGetTexImage,
- (glitz_gl_tex_sub_image_2d_t) glTexSubImage2D,
- (glitz_gl_gen_textures_t) glGenTextures,
- (glitz_gl_delete_textures_t) glDeleteTextures,
- (glitz_gl_bind_texture_t) glBindTexture,
- (glitz_gl_tex_image_2d_t) glTexImage2D,
- (glitz_gl_tex_parameter_i_t) glTexParameteri,
- (glitz_gl_tex_parameter_fv_t) glTexParameterfv,
- (glitz_gl_get_tex_level_parameter_iv_t) glGetTexLevelParameteriv,
- (glitz_gl_copy_tex_sub_image_2d_t) glCopyTexSubImage2D,
- (glitz_gl_get_integer_v_t) glGetIntegerv,
-
- /* extensions */
- (glitz_gl_blend_color_t) 0,
- (glitz_gl_active_texture_t) 0,
- (glitz_gl_client_active_texture_t) 0,
- (glitz_gl_multi_draw_arrays_t) 0,
- (glitz_gl_gen_programs_t) 0,
- (glitz_gl_delete_programs_t) 0,
- (glitz_gl_program_string_t) 0,
- (glitz_gl_bind_program_t) 0,
- (glitz_gl_program_local_param_4fv_t) 0,
- (glitz_gl_get_program_iv_t) 0,
- (glitz_gl_gen_buffers_t) 0,
- (glitz_gl_delete_buffers_t) 0,
- (glitz_gl_bind_buffer_t) 0,
- (glitz_gl_buffer_data_t) 0,
- (glitz_gl_buffer_sub_data_t) 0,
- (glitz_gl_get_buffer_sub_data_t) 0,
- (glitz_gl_map_buffer_t) 0,
- (glitz_gl_unmap_buffer_t) 0,
- (glitz_gl_gen_framebuffers_t) 0,
- (glitz_gl_delete_framebuffers_t) 0,
- (glitz_gl_bind_framebuffer_t) 0,
- (glitz_gl_framebuffer_renderbuffer_t) 0,
- (glitz_gl_framebuffer_texture_2d_t) 0,
- (glitz_gl_check_framebuffer_status_t) 0,
- (glitz_gl_gen_renderbuffers_t) 0,
- (glitz_gl_delete_renderbuffers_t) 0,
- (glitz_gl_bind_renderbuffer_t) 0,
- (glitz_gl_renderbuffer_storage_t) 0,
- (glitz_gl_get_renderbuffer_parameter_iv_t) 0
-};
-
-static void
-glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info);
-
-static void
-glitz_agl_thread_info_fini (glitz_agl_thread_info_t *thread_info);
-
-#ifdef PTHREADS
-
-#include <pthread.h>
-#include <stdlib.h>
-
-/* thread safe */
-static int tsd_initialized = 0;
-static pthread_key_t info_tsd;
-
-static void
-glitz_agl_thread_info_destroy (glitz_agl_thread_info_t *thread_info)
-{
- pthread_setspecific (info_tsd, NULL);
-
- if (thread_info) {
- glitz_agl_thread_info_fini (thread_info);
- free (thread_info);
- }
-}
-
-static void
-_tsd_destroy (void *p)
-{
- if (p) {
- glitz_agl_thread_info_fini ((glitz_agl_thread_info_t *) p);
- free (p);
- }
-}
-
-glitz_agl_thread_info_t *
-glitz_agl_thread_info_get (void)
-{
- glitz_agl_thread_info_t *thread_info;
- void *p;
-
- if (!tsd_initialized) {
- pthread_key_create (&info_tsd, _tsd_destroy);
- tsd_initialized = 1;
- }
-
- p = pthread_getspecific (info_tsd);
-
- if (p == NULL) {
- thread_info = malloc (sizeof (glitz_agl_thread_info_t));
- glitz_agl_thread_info_init (thread_info);
-
- pthread_setspecific (info_tsd, thread_info);
- } else
- thread_info = (glitz_agl_thread_info_t *) p;
-
- return thread_info;
-}
-
-#else
-
-/* not thread safe */
-static glitz_agl_thread_info_t _thread_info = {
- 0,
- NULL,
- NULL,
- 0,
- NULL,
- 0,
- { 0 },
- 0,
- NULL,
- 0,
- NULL,
- { 0 }
-};
-
-static void
-glitz_agl_thread_info_destroy (glitz_agl_thread_info_t *thread_info)
-{
- if (thread_info)
- glitz_agl_thread_info_fini (thread_info);
-}
-
-glitz_agl_thread_info_t *
-glitz_agl_thread_info_get (void)
-{
- if (_thread_info.context_stack_size == 0)
- glitz_agl_thread_info_init (&_thread_info);
-
- return &_thread_info;
-}
-
-#endif
-
-static void
-glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info)
-{
- thread_info->formats = NULL;
- thread_info->pixel_formats = (AGLPixelFormat *) 0;
- thread_info->n_formats = 0;
- thread_info->contexts = NULL;
- thread_info->n_contexts = 0;
-
- thread_info->context_stack_size = 1;
- thread_info->context_stack->surface = NULL;
- thread_info->context_stack->constraint = GLITZ_NONE;
-
- thread_info->root_context = NULL;
-
- thread_info->agl_feature_mask = 0;
-
- thread_info->cctx = NULL;
-
- glitz_program_map_init (&thread_info->program_map);
-
- if (!glitz_agl_query_extensions (thread_info))
- glitz_agl_query_formats (thread_info);
-}
-
-static void
-glitz_agl_thread_info_fini (glitz_agl_thread_info_t *thread_info)
-{
- int i;
-
- for (i = 0; i < thread_info->n_contexts; i++)
- glitz_agl_context_destroy (thread_info, thread_info->contexts[i]);
-
- for (i = 0; i < thread_info->n_formats; i++)
- aglDestroyPixelFormat (thread_info->pixel_formats[i]);
-
- if (thread_info->formats)
- free (thread_info->formats);
-
- if (thread_info->pixel_formats)
- free (thread_info->pixel_formats);
-}
-
-void
-glitz_agl_init (void)
-{
- glitz_agl_thread_info_get ();
-}
-slim_hidden_def(glitz_agl_init);
-
-void
-glitz_agl_fini (void)
-{
- glitz_agl_thread_info_t *info = glitz_agl_thread_info_get ();
-
- glitz_agl_thread_info_destroy (info);
-}
-slim_hidden_def(glitz_agl_fini);
deleted file mode 100644
--- a/gfx/cairo/glitz/src/agl/glitz_agl_pbuffer.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../../config.h"
-#endif
-
-#include "glitz_aglint.h"
-
-AGLPbuffer
-glitz_agl_pbuffer_create (glitz_agl_thread_info_t *thread_info,
- int width,
- int height)
-{
- AGLPbuffer pbuffer;
- glitz_gl_enum_t target;
-
- if (!POWER_OF_TWO (width) || !POWER_OF_TWO (height)) {
- if (thread_info->agl_feature_mask &
- GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK)
- target = GLITZ_GL_TEXTURE_RECTANGLE;
- else
- return (AGLPbuffer) 0;
- } else
- target = GLITZ_GL_TEXTURE_2D;
-
- aglCreatePBuffer (width, height, target, GLITZ_GL_RGBA, 0, &pbuffer);
-
- return pbuffer;
-}
-
-void
-glitz_agl_pbuffer_destroy (AGLPbuffer pbuffer)
-{
- aglDestroyPBuffer (pbuffer);
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/agl/glitz_aglint.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef GLITZ_GLXINT_H_INCLUDED
-#define GLITZ_GLXINT_H_INCLUDED
-
-#include "glitz.h"
-#include "glitzint.h"
-
-#include "glitz-agl.h"
-
-#include <OpenGL/gl.h>
-#include <Carbon/Carbon.h>
-#include <AGL/agl.h>
-
-#define GLITZ_AGL_FEATURE_PBUFFER_MASK (1L << 0)
-#define GLITZ_AGL_FEATURE_MULTISAMPLE_MASK (1L << 1)
-#define GLITZ_AGL_FEATURE_PBUFFER_MULTISAMPLE_MASK (1L << 2)
-#define GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK (1L << 3)
-
-typedef struct _glitz_agl_drawable glitz_agl_drawable_t;
-
-typedef struct _glitz_agl_context_info_t {
- glitz_agl_drawable_t *drawable;
- glitz_surface_t *surface;
- glitz_constraint_t constraint;
-} glitz_agl_context_info_t;
-
-typedef struct _glitz_agl_context_t {
- glitz_context_t base;
- AGLContext context;
- glitz_format_id_t id;
- AGLPixelFormat pixel_format;
- glitz_bool_t pbuffer;
- glitz_backend_t backend;
- glitz_bool_t initialized;
-} glitz_agl_context_t;
-
-typedef struct _glitz_agl_thread_info_t {
- int drawables;
- glitz_int_drawable_format_t *formats;
- AGLPixelFormat *pixel_formats;
- int n_formats;
- glitz_agl_context_t **contexts;
- int n_contexts;
- glitz_agl_context_info_t context_stack[GLITZ_CONTEXT_STACK_SIZE];
- int context_stack_size;
- AGLContext root_context;
- unsigned long agl_feature_mask;
- glitz_context_t *cctx;
- glitz_program_map_t program_map;
-} glitz_agl_thread_info_t;
-
-struct _glitz_agl_drawable {
- glitz_drawable_t base;
-
- glitz_agl_thread_info_t *thread_info;
- glitz_agl_context_t *context;
- AGLDrawable drawable;
- AGLPbuffer pbuffer;
- WindowRef window;
- int width;
- int height;
-};
-
-extern glitz_status_t __internal_linkage
-glitz_agl_query_extensions (glitz_agl_thread_info_t *thread_info);
-
-extern glitz_agl_thread_info_t __internal_linkage *
-glitz_agl_thread_info_get (void);
-
-extern glitz_agl_context_t __internal_linkage *
-glitz_agl_context_get (glitz_agl_thread_info_t *thread_info,
- glitz_drawable_format_t *format);
-
-extern void __internal_linkage
-glitz_agl_context_destroy (glitz_agl_thread_info_t *thread_info,
- glitz_agl_context_t *context);
-
-extern void __internal_linkage
-glitz_agl_query_formats (glitz_agl_thread_info_t *thread_info);
-
-extern AGLPbuffer __internal_linkage
-glitz_agl_pbuffer_create (glitz_agl_thread_info_t *thread_info,
- int width,
- int height);
-
-extern void __internal_linkage
-glitz_agl_pbuffer_destroy (AGLPbuffer pbuffer);
-
-extern glitz_drawable_t __internal_linkage *
-glitz_agl_create_pbuffer (void *abstract_templ,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height);
-
-extern glitz_bool_t __internal_linkage
-glitz_agl_push_current (void *abstract_drawable,
- glitz_surface_t *surface,
- glitz_constraint_t constraint,
- glitz_bool_t *restore_state);
-
-extern glitz_surface_t __internal_linkage *
-glitz_agl_pop_current (void *abstract_drawable);
-
-extern void __internal_linkage
-glitz_agl_destroy (void *abstract_drawable);
-
-extern glitz_bool_t __internal_linkage
-glitz_agl_swap_buffers (void *abstract_drawable);
-
-extern glitz_bool_t __internal_linkage
-glitz_agl_copy_sub_buffer (void *abstract_drawable,
- int x,
- int y,
- int width,
- int height);
-
-extern glitz_bool_t __internal_linkage
-glitz_agl_drawable_update_size (glitz_agl_drawable_t *drawable,
- int width,
- int height);
-
-/* Avoid unnecessary PLT entries. */
-
-slim_hidden_proto(glitz_agl_init)
-slim_hidden_proto(glitz_agl_fini)
-slim_hidden_proto(glitz_agl_find_drawable_format)
-slim_hidden_proto(glitz_agl_create_drawable_for_window)
-slim_hidden_proto(glitz_agl_create_pbuffer_drawable)
-slim_hidden_proto(glitz_agl_drawable_update_size)
-
-#endif /* GLITZ_GLXINT_H_INCLUDED */
deleted file mode 100644
--- a/gfx/cairo/glitz/src/egl/glitz-egl.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef GLITZ_EGL_H_INCLUDED
-#define GLITZ_EGL_H_INCLUDED
-
-#include <GL/gl.h>
-#include <GLES/egl.h>
-
-#include <glitz.h>
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-/* glitz_egl_info.c */
-
-void
-glitz_egl_init (const char *gl_library);
-
-void
-glitz_egl_fini (void);
-
-
-/* glitz_egl_config.c */
-
-glitz_drawable_format_t *
-glitz_egl_find_window_config (EGLDisplay egl_display,
- EGLScreenMESA egl_screen,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count);
-
-glitz_drawable_format_t *
-glitz_egl_find_pbuffer_config (EGLDisplay egl_display,
- EGLScreenMESA egl_screen,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count);
-
-
-/* glitz_egl_surface.c */
-
-glitz_drawable_t *
-glitz_egl_create_surface (EGLDisplay egl_display,
- EGLScreenMESA egl_screen,
- glitz_drawable_format_t *format,
- EGLSurface egl_surface,
- unsigned int width,
- unsigned int height);
-
-glitz_drawable_t *
-glitz_egl_create_pbuffer_surface (EGLDisplay egl_display,
- EGLScreenMESA egl_screen,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height);
-
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* GLITZ_EGL_H_INCLUDED */
deleted file mode 100644
--- a/gfx/cairo/glitz/src/egl/glitz-egl.man
+++ /dev/null
@@ -1,27 +0,0 @@
-.\"
-.\"
-.de TQ
-.br
-.ns
-.TP
-\\$1
-..
-.TH GLITZ-EGL 3 "Version 1.0"
-
-.SH NAME
-GLITZ-EGL \- EGL interface to glitz
-
-.SH SYNOPSIS
-.nf
-.B #include <glitz-egl.h>
-.fi
-.SH DESCRIPTION
-
-EGL interface to glitz.
-
-.SH AUTHOR
-David Reveman
-Jon Smirl
-
-.SH "SEE ALSO"
-.BR GLITZ (3)
deleted file mode 100644
--- a/gfx/cairo/glitz/src/egl/glitz_egl_config.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitz_eglint.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-static int
-_glitz_egl_format_compare (const void *elem1,
- const void *elem2)
-{
- glitz_int_drawable_format_t *format[2];
- int i, score[2];
-
- format[0] = (glitz_int_drawable_format_t *) elem1;
- format[1] = (glitz_int_drawable_format_t *) elem2;
- i = score[0] = score[1] = 0;
-
- for (; i < 2; i++)
- {
- if (format[i]->d.color.fourcc != GLITZ_FOURCC_RGB)
- score[i] -= 1000;
-
- if (format[i]->d.color.red_size)
- {
- if (format[i]->d.color.red_size >= 8)
- score[i] += 5;
-
- score[i] += 10;
- }
-
- if (format[i]->d.color.alpha_size)
- {
- if (format[i]->d.color.alpha_size >= 8)
- score[i] += 5;
-
- score[i] += 10;
- }
-
- if (format[i]->d.stencil_size)
- score[i] += 5;
-
- if (format[i]->d.depth_size)
- score[i] += 5;
-
- if (format[i]->d.doublebuffer)
- score[i] += 10;
-
- if (format[i]->d.samples > 1)
- score[i] -= (20 - format[i]->d.samples);
-
- if (format[i]->types & GLITZ_DRAWABLE_TYPE_WINDOW_MASK)
- score[i] += 10;
-
- if (format[i]->types & GLITZ_DRAWABLE_TYPE_PBUFFER_MASK)
- score[i] += 10;
-
- if (format[i]->caveat)
- score[i] -= 1000;
- }
-
- return score[1] - score[0];
-}
-
-static void
-_glitz_add_format (glitz_egl_screen_info_t *screen_info,
- glitz_int_drawable_format_t *format)
-{
- int n = screen_info->n_formats;
-
- screen_info->formats =
- realloc (screen_info->formats,
- sizeof (glitz_int_drawable_format_t) * (n + 1));
- if (screen_info->formats)
- {
- screen_info->formats[n] = *format;
- screen_info->formats[n].d.id = n;
- screen_info->n_formats++;
- }
-}
-
-static void
-_glitz_egl_query_configs (glitz_egl_screen_info_t *screen_info)
-{
- glitz_int_drawable_format_t format;
- EGLDisplay egl_display;
- EGLConfig *egl_configs;
- int i, num_configs;
-
- egl_display = screen_info->display_info->egl_display;
-
- eglGetConfigs (egl_display, NULL, 0, &num_configs);
- egl_configs = malloc (sizeof (EGLConfig) * num_configs);
- if (!egl_configs)
- return;
-
- format.d.id = 0;
- format.d.color.fourcc = GLITZ_FOURCC_RGB;
- format.d.doublebuffer = 1;
-
- eglGetConfigs (egl_display, egl_configs, num_configs, &num_configs);
-
- for (i = 0; i < num_configs; i++)
- {
- int value;
-
- eglGetConfigAttrib (egl_display, egl_configs[i], EGL_SURFACE_TYPE,
- &value);
- if (!((value & EGL_WINDOW_BIT) || (value & EGL_PBUFFER_BIT)))
- continue;
-
- format.types = 0;
- if (value & EGL_WINDOW_BIT)
- format.types |= GLITZ_DRAWABLE_TYPE_WINDOW_MASK;
-
- if (value & EGL_PBUFFER_BIT)
- format.types |= GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
-
- eglGetConfigAttrib (egl_display, egl_configs[i], EGL_CONFIG_ID,
- &value);
- format.u.uval = value;
-
- eglGetConfigAttrib (egl_display, egl_configs[i], EGL_RED_SIZE, &value);
- format.d.color.red_size = (unsigned short) value;
- eglGetConfigAttrib (egl_display, egl_configs[i], EGL_GREEN_SIZE,
- &value);
- format.d.color.green_size = (unsigned short) value;
- eglGetConfigAttrib (egl_display, egl_configs[i], EGL_BLUE_SIZE,
- &value);
- format.d.color.blue_size = (unsigned short) value;
- eglGetConfigAttrib (egl_display, egl_configs[i], EGL_ALPHA_SIZE,
- &value);
- format.d.color.alpha_size = (unsigned short) value;
- eglGetConfigAttrib (egl_display, egl_configs[i], EGL_DEPTH_SIZE,
- &value);
- format.d.depth_size = (unsigned short) value;
- eglGetConfigAttrib (egl_display, egl_configs[i], EGL_STENCIL_SIZE,
- &value);
- format.d.stencil_size = (unsigned short) value;
- eglGetConfigAttrib (egl_display, egl_configs[i], EGL_CONFIG_CAVEAT,
- &value);
- format.caveat = (unsigned short) value;
-
- eglGetConfigAttrib (egl_display, egl_configs[i], EGL_SAMPLE_BUFFERS,
- &value);
- if (value)
- {
- eglGetConfigAttrib (egl_display, egl_configs[i], EGL_SAMPLES,
- &value);
- format.d.samples = (unsigned short) (value > 1)? value: 1;
- }
- else
- format.d.samples = 1;
-
- _glitz_add_format (screen_info, &format);
- }
-
- free (egl_configs);
-}
-
-void
-glitz_egl_query_configs (glitz_egl_screen_info_t *screen_info)
-{
- int i;
-
- _glitz_egl_query_configs (screen_info);
-
- if (!screen_info->n_formats)
- return;
-
- qsort (screen_info->formats, screen_info->n_formats,
- sizeof (glitz_int_drawable_format_t), _glitz_egl_format_compare);
-
- for (i = 0; i < screen_info->n_formats; i++)
- screen_info->formats[i].d.id = i;
-}
-
-glitz_drawable_format_t *
-glitz_egl_find_window_config (EGLDisplay egl_display,
- EGLScreenMESA egl_screen,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count)
-{
- glitz_int_drawable_format_t itempl;
- glitz_egl_screen_info_t *screen_info =
- glitz_egl_screen_info_get (egl_display, egl_screen);
-
- glitz_drawable_format_copy (templ, &itempl.d, mask);
-
- itempl.types = GLITZ_DRAWABLE_TYPE_WINDOW_MASK;
- mask |= GLITZ_INT_FORMAT_WINDOW_MASK;
-
- return glitz_drawable_format_find (screen_info->formats,
- screen_info->n_formats,
- mask, &itempl, count);
-}
-slim_hidden_def(glitz_egl_find_window_config);
-
-glitz_drawable_format_t *
-glitz_egl_find_pbuffer_config (EGLDisplay egl_display,
- EGLScreenMESA egl_screen,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count)
-{
- glitz_int_drawable_format_t itempl;
- glitz_egl_screen_info_t *screen_info =
- glitz_egl_screen_info_get (egl_display, egl_screen);
-
- glitz_drawable_format_copy (templ, &itempl.d, mask);
-
- itempl.types = GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
- mask |= GLITZ_INT_FORMAT_PBUFFER_MASK;
-
- return glitz_drawable_format_find (screen_info->formats,
- screen_info->n_formats,
- mask, &itempl, count);
-}
-slim_hidden_def(glitz_egl_find_pbuffer_config);
deleted file mode 100644
--- a/gfx/cairo/glitz/src/egl/glitz_egl_context.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitz_eglint.h"
-
-#include <stdlib.h>
-
-extern glitz_gl_proc_address_list_t _glitz_egl_gl_proc_address;
-
-static void
-_glitz_egl_context_create (glitz_egl_screen_info_t *screen_info,
- EGLConfig egl_config,
- EGLContext egl_share_list,
- glitz_egl_context_t *context)
-{
- context->id = egl_config;
- context->egl_context =
- eglCreateContext (screen_info->display_info->egl_display,
- egl_config, egl_share_list, NULL);
-}
-
-static glitz_context_t *
-_glitz_egl_create_context (void *abstract_drawable,
- glitz_drawable_format_t *format)
-{
- glitz_egl_surface_t *drawable = (glitz_egl_surface_t *) abstract_drawable;
- glitz_egl_screen_info_t *screen_info = drawable->screen_info;
- int format_id = screen_info->formats[format->id].u.uval;
- glitz_egl_context_t *context;
-
- context = malloc (sizeof (glitz_egl_context_t));
- if (!context)
- return NULL;
-
- _glitz_context_init (&context->base, &drawable->base);
-
- _glitz_egl_context_create (screen_info,
- format_id,
- screen_info->egl_root_context,
- context);
-
- return (glitz_context_t *) context;
-}
-
-static void
-_glitz_egl_context_destroy (void *abstract_context)
-{
- glitz_egl_context_t *context = (glitz_egl_context_t *) abstract_context;
- glitz_egl_surface_t *drawable = (glitz_egl_surface_t *)
- context->base.drawable;
-
- if (drawable->screen_info->display_info->thread_info->cctx ==
- &context->base)
- {
- eglMakeCurrent (drawable->screen_info->display_info->egl_display,
- EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-
- drawable->screen_info->display_info->thread_info->cctx = NULL;
- }
-
- eglDestroyContext (drawable->screen_info->display_info->egl_display,
- context->egl_context);
-
- _glitz_context_fini (&context->base);
-
- free (context);
-}
-
-static void
-_glitz_egl_copy_context (void *abstract_src,
- void *abstract_dst,
- unsigned long mask)
-{
- glitz_egl_context_t *src = (glitz_egl_context_t *) abstract_src;
- glitz_egl_context_t *dst = (glitz_egl_context_t *) abstract_dst;
- glitz_egl_surface_t *drawable = (glitz_egl_surface_t *)
- src->base.drawable;
-
- eglCopyContextMESA (drawable->screen_info->display_info->egl_display,
- src->egl_context, dst->egl_context, mask);
-}
-
-static void
-_glitz_egl_make_current (void *abstract_drawable,
- void *abstract_context)
-{
- glitz_egl_context_t *context = (glitz_egl_context_t *) abstract_context;
- glitz_egl_surface_t *drawable = (glitz_egl_surface_t *) abstract_drawable;
- glitz_egl_display_info_t *display_info =
- drawable->screen_info->display_info;
-
- if (drawable->base.width != drawable->width ||
- drawable->base.height != drawable->height)
- _glitz_egl_drawable_update_size (drawable,
- drawable->base.width,
- drawable->base.height);
-
- if ((eglGetCurrentContext () != context->egl_context) ||
- (eglGetCurrentSurface ( EGL_READ ) != drawable->egl_surface))
- {
- if (display_info->thread_info->cctx)
- {
- glitz_context_t *ctx = display_info->thread_info->cctx;
-
- if (ctx->lose_current)
- ctx->lose_current (ctx->closure);
- }
-
- eglMakeCurrent (display_info->egl_display, drawable->egl_surface,
- drawable->egl_surface, context->egl_context);
- }
-
- display_info->thread_info->cctx = &context->base;
-}
-
-static void
-_glitz_egl_notify_dummy (void *abstract_drawable,
- glitz_surface_t *surface) {}
-
-static glitz_function_pointer_t
-_glitz_egl_context_get_proc_address (void *abstract_context,
- const char *name)
-{
- glitz_egl_context_t *context = (glitz_egl_context_t *) abstract_context;
- glitz_egl_surface_t *drawable = (glitz_egl_surface_t *)
- context->base.drawable;
-
- _glitz_egl_make_current (drawable, context);
-
- return glitz_egl_get_proc_address (name, drawable->screen_info);
-}
-
-glitz_egl_context_t *
-glitz_egl_context_get (glitz_egl_screen_info_t *screen_info,
- glitz_drawable_format_t *format)
-{
- glitz_egl_context_t *context;
- glitz_egl_context_t **contexts = screen_info->contexts;
- int index, n_contexts = screen_info->n_contexts;
-
- for (; n_contexts; n_contexts--, contexts++)
- if ((*contexts)->id == screen_info->formats[format->id].u.uval)
- return *contexts;
-
- index = screen_info->n_contexts++;
-
- screen_info->contexts =
- realloc (screen_info->contexts,
- sizeof (glitz_egl_context_t *) * screen_info->n_contexts);
- if (!screen_info->contexts)
- return NULL;
-
- context = malloc (sizeof (glitz_egl_context_t));
- if (!context)
- return NULL;
-
- screen_info->contexts[index] = context;
-
- _glitz_egl_context_create (screen_info,
- screen_info->formats[format->id].u.uval,
- screen_info->egl_root_context,
- context);
-
- if (!screen_info->egl_root_context)
- screen_info->egl_root_context = context->egl_context;
-
- context->backend.gl = &_glitz_egl_gl_proc_address;
-
- context->backend.create_pbuffer = glitz_egl_create_pbuffer;
- context->backend.destroy = glitz_egl_destroy;
- context->backend.push_current = glitz_egl_push_current;
- context->backend.pop_current = glitz_egl_pop_current;
- context->backend.attach_notify = _glitz_egl_notify_dummy;
- context->backend.detach_notify = _glitz_egl_notify_dummy;
- context->backend.swap_buffers = glitz_egl_swap_buffers;
-
- context->backend.create_context = _glitz_egl_create_context;
- context->backend.destroy_context = _glitz_egl_context_destroy;
- context->backend.copy_context = _glitz_egl_copy_context;
- context->backend.make_current = _glitz_egl_make_current;
- context->backend.get_proc_address = _glitz_egl_context_get_proc_address;
-
- context->backend.draw_buffer = _glitz_drawable_draw_buffer;
- context->backend.read_buffer = _glitz_drawable_read_buffer;
-
- context->backend.drawable_formats = NULL;
- context->backend.n_drawable_formats = 0;
-
- if (screen_info->n_formats)
- {
- int size;
-
- size = sizeof (glitz_int_drawable_format_t) * screen_info->n_formats;
- context->backend.drawable_formats = malloc (size);
- if (context->backend.drawable_formats)
- {
- memcpy (context->backend.drawable_formats, screen_info->formats,
- size);
- context->backend.n_drawable_formats = screen_info->n_formats;
- }
- }
-
- context->backend.texture_formats = NULL;
- context->backend.formats = NULL;
- context->backend.n_formats = 0;
-
- context->backend.program_map = &screen_info->program_map;
- context->backend.feature_mask = 0;
-
- context->initialized = 0;
-
- return context;
-}
-
-void
-glitz_egl_context_destroy (glitz_egl_screen_info_t *screen_info,
- glitz_egl_context_t *context)
-{
- if (context->backend.drawable_formats)
- free (context->backend.drawable_formats);
-
- if (context->backend.formats)
- free (context->backend.formats);
-
- if (context->backend.texture_formats)
- free (context->backend.texture_formats);
-
- eglDestroyContext (screen_info->display_info->egl_display,
- context->egl_context);
- free (context);
-}
-
-static void
-_glitz_egl_context_initialize (glitz_egl_screen_info_t *screen_info,
- glitz_egl_context_t *context)
-{
- const char *version;
-
- glitz_backend_init (&context->backend,
- glitz_egl_get_proc_address,
- (void *) screen_info);
-
- glitz_initiate_state (&_glitz_egl_gl_proc_address);
-
- version = (const char *)
- context->backend.gl->get_string (GLITZ_GL_VERSION);
- if (version)
- {
- /* Having trouble with TexSubImage2D to NPOT GL_TEXTURE_2D textures
- when using nvidia's binary driver. Seems like a driver issue, but
- I'm not sure yet. Turning of NPOT GL_TEXTURE_2D textures until
- this have been solved. */
- if (strstr (version, "NVIDIA 61.11") ||
- strstr (version, "NVIDIA 66.29"))
- {
- context->backend.feature_mask &=
- ~GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK;
- }
- }
-
- context->initialized = 1;
-}
-
-static void
-_glitz_egl_context_make_current (glitz_egl_surface_t *drawable,
- glitz_bool_t finish)
-{
- glitz_egl_display_info_t *display_info =
- drawable->screen_info->display_info;
-
- if (finish)
- glFinish ();
-
- if (display_info->thread_info->cctx)
- {
- glitz_context_t *ctx = display_info->thread_info->cctx;
-
- if (ctx->lose_current)
- ctx->lose_current (ctx->closure);
-
- display_info->thread_info->cctx = NULL;
- }
-
- eglMakeCurrent (display_info->egl_display,
- drawable->egl_surface, drawable->egl_surface,
- drawable->context->egl_context);
-
- drawable->base.update_all = 1;
-
- if (!drawable->context->initialized)
- _glitz_egl_context_initialize (drawable->screen_info,
- drawable->context);
-}
-
-static void
-_glitz_egl_context_update (glitz_egl_surface_t *drawable,
- glitz_constraint_t constraint)
-{
- EGLContext egl_context;
-
- switch (constraint) {
- case GLITZ_NONE:
- break;
- case GLITZ_ANY_CONTEXT_CURRENT: {
- glitz_egl_display_info_t *dinfo = drawable->screen_info->display_info;
-
- if (dinfo->thread_info->cctx)
- {
- _glitz_egl_context_make_current (drawable, 0);
- }
- else
- {
- egl_context = eglGetCurrentContext ();
- if (egl_context == (EGLContext) 0)
- _glitz_egl_context_make_current (drawable, 0);
- }
- } break;
- case GLITZ_CONTEXT_CURRENT:
- egl_context = eglGetCurrentContext ();
- if (egl_context != drawable->context->egl_context)
- _glitz_egl_context_make_current (drawable, (egl_context)? 1: 0);
- break;
- case GLITZ_DRAWABLE_CURRENT:
- if (drawable->base.width != drawable->width ||
- drawable->base.height != drawable->height)
- _glitz_egl_drawable_update_size (drawable,
- drawable->base.width,
- drawable->base.height);
-
- egl_context = eglGetCurrentContext ();
- if ((egl_context != drawable->context->egl_context) ||
- (eglGetCurrentSurface ( 0 ) != drawable->egl_surface))
- _glitz_egl_context_make_current (drawable, (egl_context)? 1: 0);
- break;
- }
-}
-
-glitz_bool_t
-glitz_egl_push_current (void *abstract_drawable,
- glitz_surface_t *surface,
- glitz_constraint_t constraint)
-{
- glitz_egl_surface_t *drawable = (glitz_egl_surface_t *) abstract_drawable;
- glitz_egl_context_info_t *context_info;
- int index;
-
- index = drawable->screen_info->context_stack_size++;
-
- context_info = &drawable->screen_info->context_stack[index];
- context_info->drawable = drawable;
- context_info->surface = surface;
- context_info->constraint = constraint;
-
- _glitz_egl_context_update (context_info->drawable, constraint);
-
- return 1;
-}
-
-glitz_surface_t *
-glitz_egl_pop_current (void *abstract_drawable)
-{
- glitz_egl_surface_t *drawable = (glitz_egl_surface_t *) abstract_drawable;
- glitz_egl_context_info_t *context_info = NULL;
- int index;
-
- drawable->screen_info->context_stack_size--;
- index = drawable->screen_info->context_stack_size - 1;
-
- context_info = &drawable->screen_info->context_stack[index];
-
- if (context_info->drawable)
- _glitz_egl_context_update (context_info->drawable,
- context_info->constraint);
-
- if (context_info->constraint == GLITZ_DRAWABLE_CURRENT)
- return context_info->surface;
-
- return NULL;
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/egl/glitz_egl_extension.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitz_eglint.h"
-
-#if 0
-static glitz_extension_map egl_extensions[] = {
- { 0.0, "EGL_SGIX_fbconfig", GLITZ_EGL_FEATURE_FBCONFIG_MASK },
- { 0.0, "EGL_SGIX_pbuffer", GLITZ_EGL_FEATURE_PBUFFER_MASK },
- { 0.0, "EGL_SGI_make_current_read",
- GLITZ_EGL_FEATURE_MAKE_CURRENT_READ_MASK },
- { 0.0, "EGL_ARB_multisample", GLITZ_EGL_FEATURE_MULTISAMPLE_MASK },
- { 0.0, NULL, 0 }
-};
-#endif
-
-void
-glitz_egl_query_extensions (glitz_egl_screen_info_t *screen_info,
- glitz_gl_float_t egl_version)
-{
-#if 0
- const char *egl_extensions_string;
-
- egl_extensions_string =
- eglQueryExtensionsString (screen_info->display_info->display,
- screen_info->screen);
-
- screen_info->egl_feature_mask =
- glitz_extensions_query (egl_version,
- egl_extensions_string,
- egl_extensions);
-
- if (screen_info->egl_feature_mask & GLITZ_EGL_FEATURE_MULTISAMPLE_MASK) {
- const char *vendor;
-
- vendor = eglGetClientString (screen_info->display_info->display,
- EGL_VENDOR);
-
- if (vendor) {
-
- /* NVIDIA's driver seem to support multisample with pbuffers */
- if (!strncmp ("NVIDIA", vendor, 6))
- screen_info->egl_feature_mask |=
- GLITZ_EGL_FEATURE_PBUFFER_MULTISAMPLE_MASK;
- }
- }
-#endif
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/egl/glitz_egl_info.c
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitz_eglint.h"
-
-#include <pthread.h>
-#include <string.h>
-#include <dlfcn.h>
-
-glitz_gl_proc_address_list_t _glitz_egl_gl_proc_address = {
-
- /* core */
- (glitz_gl_enable_t) glEnable,
- (glitz_gl_disable_t) glDisable,
- (glitz_gl_get_error_t) glGetError,
- (glitz_gl_get_string_t) glGetString,
- (glitz_gl_enable_client_state_t) glEnableClientState,
- (glitz_gl_disable_client_state_t) glDisableClientState,
- (glitz_gl_vertex_pointer_t) glVertexPointer,
- (glitz_gl_tex_coord_pointer_t) glTexCoordPointer,
- (glitz_gl_draw_arrays_t) glDrawArrays,
- (glitz_gl_tex_env_f_t) glTexEnvf,
- (glitz_gl_tex_env_fv_t) glTexEnvfv,
- (glitz_gl_tex_gen_i_t) glTexGeni,
- (glitz_gl_tex_gen_fv_t) glTexGenfv,
- (glitz_gl_color_4us_t) glColor4us,
- (glitz_gl_color_4f_t) glColor4f,
- (glitz_gl_scissor_t) glScissor,
- (glitz_gl_blend_func_t) glBlendFunc,
- (glitz_gl_clear_t) glClear,
- (glitz_gl_clear_color_t) glClearColor,
- (glitz_gl_clear_stencil_t) glClearStencil,
- (glitz_gl_stencil_func_t) glStencilFunc,
- (glitz_gl_stencil_op_t) glStencilOp,
- (glitz_gl_push_attrib_t) glPushAttrib,
- (glitz_gl_pop_attrib_t) glPopAttrib,
- (glitz_gl_matrix_mode_t) glMatrixMode,
- (glitz_gl_push_matrix_t) glPushMatrix,
- (glitz_gl_pop_matrix_t) glPopMatrix,
- (glitz_gl_load_identity_t) glLoadIdentity,
- (glitz_gl_load_matrix_f_t) glLoadMatrixf,
- (glitz_gl_depth_range_t) glDepthRange,
- (glitz_gl_viewport_t) glViewport,
- (glitz_gl_raster_pos_2f_t) glRasterPos2f,
- (glitz_gl_bitmap_t) glBitmap,
- (glitz_gl_read_buffer_t) glReadBuffer,
- (glitz_gl_draw_buffer_t) glDrawBuffer,
- (glitz_gl_copy_pixels_t) glCopyPixels,
- (glitz_gl_flush_t) glFlush,
- (glitz_gl_finish_t) glFinish,
- (glitz_gl_pixel_store_i_t) glPixelStorei,
- (glitz_gl_ortho_t) glOrtho,
- (glitz_gl_scale_f_t) glScalef,
- (glitz_gl_translate_f_t) glTranslatef,
- (glitz_gl_hint_t) glHint,
- (glitz_gl_depth_mask_t) glDepthMask,
- (glitz_gl_polygon_mode_t) glPolygonMode,
- (glitz_gl_shade_model_t) glShadeModel,
- (glitz_gl_color_mask_t) glColorMask,
- (glitz_gl_read_pixels_t) glReadPixels,
- (glitz_gl_get_tex_image_t) glGetTexImage,
- (glitz_gl_tex_sub_image_2d_t) glTexSubImage2D,
- (glitz_gl_gen_textures_t) glGenTextures,
- (glitz_gl_delete_textures_t) glDeleteTextures,
- (glitz_gl_bind_texture_t) glBindTexture,
- (glitz_gl_tex_image_2d_t) glTexImage2D,
- (glitz_gl_tex_parameter_i_t) glTexParameteri,
- (glitz_gl_tex_parameter_fv_t) glTexParameterfv,
- (glitz_gl_get_tex_level_parameter_iv_t) glGetTexLevelParameteriv,
- (glitz_gl_copy_tex_sub_image_2d_t) glCopyTexSubImage2D,
- (glitz_gl_get_integer_v_t) glGetIntegerv,
-
- /* extensions */
- (glitz_gl_blend_color_t) 0,
- (glitz_gl_active_texture_t) 0,
- (glitz_gl_client_active_texture_t) 0,
- (glitz_gl_multi_draw_arrays_t) 0,
- (glitz_gl_gen_programs_t) 0,
- (glitz_gl_delete_programs_t) 0,
- (glitz_gl_program_string_t) 0,
- (glitz_gl_bind_program_t) 0,
- (glitz_gl_program_local_param_4fv_t) 0,
- (glitz_gl_get_program_iv_t) 0,
- (glitz_gl_gen_buffers_t) 0,
- (glitz_gl_delete_buffers_t) 0,
- (glitz_gl_bind_buffer_t) 0,
- (glitz_gl_buffer_data_t) 0,
- (glitz_gl_buffer_sub_data_t) 0,
- (glitz_gl_get_buffer_sub_data_t) 0,
- (glitz_gl_map_buffer_t) 0,
- (glitz_gl_unmap_buffer_t) 0,
- (glitz_gl_gen_framebuffers_t) 0,
- (glitz_gl_delete_framebuffers_t) 0,
- (glitz_gl_bind_framebuffer_t) 0,
- (glitz_gl_framebuffer_renderbuffer_t) 0,
- (glitz_gl_framebuffer_texture_2d_t) 0,
- (glitz_gl_check_framebuffer_status_t) 0,
- (glitz_gl_gen_renderbuffers_t) 0,
- (glitz_gl_delete_renderbuffers_t) 0,
- (glitz_gl_bind_renderbuffer_t) 0,
- (glitz_gl_renderbuffer_storage_t) 0,
- (glitz_gl_get_renderbuffer_parameter_iv_t) 0
-};
-
-glitz_function_pointer_t
-glitz_egl_get_proc_address (const char *name,
- void *closure)
-{
- glitz_egl_screen_info_t *screen_info = (glitz_egl_screen_info_t *) closure;
- glitz_egl_thread_info_t *info = screen_info->display_info->thread_info;
- glitz_function_pointer_t address = NULL;
-
- if (screen_info->egl_feature_mask &
- GLITZ_EGL_FEATURE_GET_PROC_ADDRESS_MASK)
- address = eglGetProcAddress ((char *) name);
-
- if (!address) {
- if (!info->dlhand)
- info->dlhand = dlopen (info->gl_library, RTLD_LAZY);
-
- if (info->dlhand) {
- dlerror ();
- address = (glitz_function_pointer_t) dlsym (info->dlhand, name);
- if (dlerror () != NULL)
- address = NULL;
- }
- }
-
- return address;
-}
-
-static void
-_glitz_egl_display_destroy (glitz_egl_display_info_t *display_info);
-
-static void
-_glitz_egl_screen_destroy (glitz_egl_screen_info_t *screen_info);
-
-static void
-_glitz_egl_thread_info_fini (glitz_egl_thread_info_t *thread_info)
-{
- int i;
-
- for (i = 0; i < thread_info->n_displays; i++)
- _glitz_egl_display_destroy (thread_info->displays[i]);
-
- free (thread_info->displays);
-
- thread_info->displays = NULL;
- thread_info->n_displays = 0;
-
- if (thread_info->gl_library) {
- free (thread_info->gl_library);
- thread_info->gl_library = NULL;
- }
-
- if (thread_info->dlhand) {
- dlclose (thread_info->dlhand);
- thread_info->dlhand = NULL;
- }
-
- thread_info->cctx = NULL;
-}
-
-#ifdef PTHREADS
-
-/* thread safe */
-static int tsd_initialized = 0;
-static pthread_key_t info_tsd;
-
-static void
-_glitz_egl_thread_info_init (glitz_egl_thread_info_t *thread_info)
-{
- thread_info->displays = NULL;
- thread_info->n_displays = 0;
- thread_info->gl_library = NULL;
- thread_info->dlhand = NULL;
- thread_info->cctx = NULL;
-}
-
-static void
-_glitz_egl_thread_info_destroy (glitz_egl_thread_info_t *thread_info)
-{
- pthread_setspecific (info_tsd, NULL);
-
- if (thread_info) {
- _glitz_egl_thread_info_fini (thread_info);
- free (thread_info);
- }
-}
-
-static void
-_tsd_destroy (void *p)
-{
- if (p) {
- _glitz_egl_thread_info_fini ((glitz_egl_thread_info_t *) p);
- free (p);
- }
-}
-
-static glitz_egl_thread_info_t *
-_glitz_egl_thread_info_get (const char *gl_library)
-{
- glitz_egl_thread_info_t *thread_info;
- void *p;
-
- if (!tsd_initialized) {
- pthread_key_create (&info_tsd, _tsd_destroy);
- tsd_initialized = 1;
- }
-
- p = pthread_getspecific (info_tsd);
-
- if (p == NULL) {
- thread_info = malloc (sizeof (glitz_egl_thread_info_t));
- _glitz_egl_thread_info_init (thread_info);
-
- pthread_setspecific (info_tsd, thread_info);
- } else
- thread_info = (glitz_egl_thread_info_t *) p;
-
- if (gl_library) {
- int len = strlen (gl_library);
-
- if (thread_info->gl_library) {
- free (thread_info->gl_library);
- thread_info->gl_library = NULL;
- }
-
- thread_info->gl_library = malloc (len + 1);
- if (thread_info->gl_library) {
- memcpy (thread_info->gl_library, gl_library, len);
- thread_info->gl_library[len] = '\0';
- }
- }
-
- return thread_info;
-}
-
-#else
-
-/* not thread safe */
-static glitz_egl_thread_info_t thread_info = {
- NULL,
- 0,
- NULL,
- NULL
-};
-
-static void
-_glitz_egl_thread_info_destroy (glitz_egl_thread_info_t *thread_info)
-{
- if (thread_info)
- _glitz_egl_thread_info_fini (thread_info);
-}
-
-static glitz_egl_thread_info_t *
-_glitz_egl_thread_info_get (const char *gl_library)
-{
- if (gl_library) {
- int len = strlen (gl_library);
-
- if (thread_info.gl_library) {
- free (thread_info.gl_library);
- thread_info.gl_library = NULL;
- }
-
- thread_info.gl_library = malloc (len + 1);
- if (thread_info.gl_library) {
- memcpy (thread_info.gl_library, gl_library, len);
- thread_info.gl_library[len] = '\0';
- }
- }
-
- return &thread_info;
-}
-
-#endif
-
-static glitz_egl_display_info_t *
-_glitz_egl_display_info_get (EGLDisplay egl_display)
-{
- glitz_egl_display_info_t *display_info;
- glitz_egl_thread_info_t *thread_info = _glitz_egl_thread_info_get (NULL);
- glitz_egl_display_info_t **displays = thread_info->displays;
- int index, n_displays = thread_info->n_displays;
-
- for (; n_displays; n_displays--, displays++)
- if ((*displays)->egl_display == egl_display)
- return *displays;
-
- index = thread_info->n_displays++;
-
- thread_info->displays =
- realloc (thread_info->displays,
- sizeof (glitz_egl_display_info_t *) *
- thread_info->n_displays);
-
- display_info = malloc (sizeof (glitz_egl_display_info_t));
- thread_info->displays[index] = display_info;
-
- display_info->thread_info = thread_info;
- display_info->egl_display = egl_display;
- display_info->screens = NULL;
- display_info->n_screens = 0;
-
- return display_info;
-}
-
-static void
-_glitz_egl_display_destroy (glitz_egl_display_info_t *display_info)
-{
- int i;
-
- for (i = 0; i < display_info->n_screens; i++)
- _glitz_egl_screen_destroy (display_info->screens[i]);
-
- if (display_info->screens)
- free (display_info->screens);
-
- free (display_info);
-}
-
-glitz_egl_screen_info_t *
-glitz_egl_screen_info_get (EGLDisplay display,
- EGLScreenMESA screen)
-{
- glitz_egl_screen_info_t *screen_info;
- glitz_egl_display_info_t *display_info =
- _glitz_egl_display_info_get (display);
- glitz_egl_screen_info_t **screens = display_info->screens;
- int index, n_screens = display_info->n_screens;
-
-#if 0
- int error_base, event_base;
-#endif
-
- for (; n_screens; n_screens--, screens++)
- if ((*screens)->screen == screen)
- return *screens;
-
- index = display_info->n_screens++;
-
- display_info->screens =
- realloc (display_info->screens,
- sizeof (glitz_egl_screen_info_t *) * display_info->n_screens);
-
- screen_info = malloc (sizeof (glitz_egl_screen_info_t));
- display_info->screens[index] = screen_info;
-
- screen_info->display_info = display_info;
- screen_info->screen = screen;
- screen_info->drawables = 0;
- screen_info->formats = NULL;
- screen_info->n_formats = 0;
-
- screen_info->contexts = NULL;
- screen_info->n_contexts = 0;
-
- glitz_program_map_init (&screen_info->program_map);
-
- screen_info->egl_root_context = (EGLContext) 0;
- screen_info->egl_feature_mask = 0;
-
-#if 0
- if (eglQueryExtension (display, &error_base, &event_base)) {
- int major, minor;
-
- if (eglQueryVersion (display, &major, &minor)) {
- screen_info->egl_version = major + minor / 10.0f;
- if (major > 1 || (major > 0 || minor >= 2)) {
- glitz_egl_query_extensions (screen_info,
- screen_info->egl_version);
- _glitz_egl_proc_address_lookup (screen_info);
- glitz_egl_query_formats (screen_info);
- }
- }
- }
-#endif
-
- glitz_egl_query_extensions (screen_info, screen_info->egl_version);
- glitz_egl_query_configs (screen_info);
-
- screen_info->context_stack_size = 1;
- screen_info->context_stack->drawable = NULL;
- screen_info->context_stack->surface = NULL;
- screen_info->context_stack->constraint = GLITZ_NONE;
-
- return screen_info;
-}
-
-static void
-_glitz_egl_screen_destroy (glitz_egl_screen_info_t *screen_info)
-{
- EGLDisplay egl_display = screen_info->display_info->egl_display;
- int i;
-
- if (screen_info->egl_root_context)
- eglMakeCurrent (egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
-
- for (i = 0; i < screen_info->n_contexts; i++)
- glitz_egl_context_destroy (screen_info, screen_info->contexts[i]);
-
- free (screen_info->contexts);
- free (screen_info->formats);
- free (screen_info);
-}
-
-void
-glitz_egl_init (const char *gl_library)
-{
- _glitz_egl_thread_info_get (gl_library);
-}
-slim_hidden_def(glitz_egl_init);
-
-void
-glitz_egl_fini (void)
-{
- glitz_egl_thread_info_t *info = _glitz_egl_thread_info_get (NULL);
-
- _glitz_egl_thread_info_destroy (info);
-}
-slim_hidden_def(glitz_egl_fini);
deleted file mode 100644
--- a/gfx/cairo/glitz/src/egl/glitz_egl_pbuffer.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitz_eglint.h"
-
-EGLSurface
-glitz_egl_pbuffer_create (glitz_egl_screen_info_t *screen_info,
- EGLConfig egl_config,
- int width,
- int height)
-{
- if (egl_config) {
- int attributes[9];
-
- attributes[0] = EGL_WIDTH;
- attributes[1] = width;
-
- attributes[2] = EGL_HEIGHT;
- attributes[3] = height;
-
-#if 0
- attributes[4] = EGL_LARGEST_PBUFFER;
- attributes[5] = 0;
-
- attributes[6] = EGL_PRESERVED_CONTENTS;
- attributes[7] = 1;
- attributes[8] = 0;
-#endif
-
- return
- eglCreatePbufferSurface (screen_info->display_info->egl_display,
- egl_config, attributes);
- } else
- return (EGLSurface) 0;
-}
-
-void
-glitz_egl_pbuffer_destroy (glitz_egl_screen_info_t *screen_info,
- EGLSurface egl_pbuffer)
-{
- eglDestroySurface (screen_info->display_info->egl_display,
- egl_pbuffer);
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/egl/glitz_egl_surface.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitz_eglint.h"
-
-static glitz_egl_surface_t *
-_glitz_egl_create_surface (glitz_egl_screen_info_t *screen_info,
- glitz_egl_context_t *context,
- glitz_drawable_format_t *format,
- EGLSurface egl_surface,
- int width,
- int height)
-{
- glitz_egl_surface_t *surface;
-
- surface = (glitz_egl_surface_t *) malloc (sizeof (glitz_egl_surface_t));
- if (surface == NULL)
- return NULL;
-
- surface->screen_info = screen_info;
- surface->context = context;
- surface->egl_surface = egl_surface;
- surface->width = width;
- surface->height = height;
-
- _glitz_drawable_init (&surface->base,
- &screen_info->formats[format->id],
- &context->backend,
- width, height);
-
- if (!context->initialized) {
- glitz_egl_push_current (surface, NULL, GLITZ_CONTEXT_CURRENT);
- glitz_egl_pop_current (surface);
- }
-
- if (width > context->backend.max_viewport_dims[0] ||
- height > context->backend.max_viewport_dims[1]) {
- free (surface);
- return NULL;
- }
-
- screen_info->drawables++;
-
- return surface;
-}
-
-glitz_bool_t
-_glitz_egl_drawable_update_size (glitz_egl_surface_t *drawable,
- int width,
- int height)
-{
- if (drawable->egl_surface)
- {
- glitz_egl_pbuffer_destroy (drawable->screen_info,
- drawable->egl_surface);
- drawable->egl_surface =
- glitz_egl_pbuffer_create (drawable->screen_info,
- drawable->context->egl_config,
- (int) width, (int) height);
- if (!drawable->egl_surface)
- return 0;
- }
-
- drawable->width = width;
- drawable->height = height;
-
- return 1;
-}
-
-static glitz_drawable_t *
-_glitz_egl_create_pbuffer_surface (glitz_egl_screen_info_t *screen_info,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height)
-{
- glitz_egl_surface_t *surface;
- glitz_egl_context_t *context;
- EGLSurface egl_pbuffer;
-
- context = glitz_egl_context_get (screen_info, format);
- if (!context)
- return NULL;
-
- egl_pbuffer = glitz_egl_pbuffer_create (screen_info, context->egl_config,
- (int) width, (int) height);
- if (!egl_pbuffer)
- return NULL;
-
- surface = _glitz_egl_create_surface (screen_info, context, format,
- egl_pbuffer,
- width, height);
- if (!surface)
- {
- glitz_egl_pbuffer_destroy (screen_info, egl_pbuffer);
- return NULL;
- }
-
- return &surface->base;
-}
-
-glitz_drawable_t *
-glitz_egl_create_pbuffer (void *abstract_templ,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height)
-{
- glitz_egl_surface_t *templ = (glitz_egl_surface_t *) abstract_templ;
-
- return _glitz_egl_create_pbuffer_surface (templ->screen_info, format,
- width, height);
-}
-
-glitz_drawable_t *
-glitz_egl_create_surface (EGLDisplay egl_display,
- EGLScreenMESA egl_screen,
- glitz_drawable_format_t *format,
- EGLSurface egl_surface,
- unsigned int width,
- unsigned int height)
-{
- glitz_egl_surface_t *surface;
- glitz_egl_screen_info_t *screen_info;
- glitz_egl_context_t *context;
- glitz_int_drawable_format_t *iformat;
-
- screen_info = glitz_egl_screen_info_get (egl_display, egl_screen);
- if (!screen_info)
- return NULL;
-
- if (format->id >= screen_info->n_formats)
- return NULL;
-
- iformat = &screen_info->formats[format->id];
- if (!(iformat->types & GLITZ_DRAWABLE_TYPE_WINDOW_MASK))
- return NULL;
-
- context = glitz_egl_context_get (screen_info, format);
- if (!context)
- return NULL;
-
- surface = _glitz_egl_create_surface (screen_info, context, format,
- egl_surface, width, height);
- if (!surface)
- return NULL;
-
- return &surface->base;
-}
-slim_hidden_def(glitz_egl_create_surface);
-
-glitz_drawable_t *
-glitz_egl_create_pbuffer_surface (EGLDisplay display,
- EGLScreenMESA screen,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height)
-{
- glitz_egl_screen_info_t *screen_info;
- glitz_int_drawable_format_t *iformat;
-
- screen_info = glitz_egl_screen_info_get (display, screen);
- if (!screen_info)
- return NULL;
-
- if (format->id >= screen_info->n_formats)
- return NULL;
-
- iformat = &screen_info->formats[format->id];
- if (!(iformat->types & GLITZ_DRAWABLE_TYPE_PBUFFER_MASK))
- return NULL;
-
- return _glitz_egl_create_pbuffer_surface (screen_info, format,
- width, height);
-}
-slim_hidden_def(glitz_egl_create_pbuffer_surface);
-
-void
-glitz_egl_destroy (void *abstract_drawable)
-{
- EGLint value;
- glitz_egl_surface_t *surface = (glitz_egl_surface_t *) abstract_drawable;
-
- surface->screen_info->drawables--;
- if (surface->screen_info->drawables == 0) {
- /*
- * Last drawable? We have to destroy all fragment programs as this may
- * be our last chance to have a context current.
- */
- glitz_egl_push_current (abstract_drawable, NULL,
- GLITZ_CONTEXT_CURRENT);
- glitz_program_map_fini (surface->base.backend->gl,
- &surface->screen_info->program_map);
- glitz_program_map_init (&surface->screen_info->program_map);
- glitz_egl_pop_current (abstract_drawable);
- }
-
- if (eglGetCurrentSurface (0) == surface->egl_surface)
- eglMakeCurrent (surface->screen_info->display_info->egl_display,
- EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
-
- eglQuerySurface (surface->screen_info->display_info->egl_display,
- surface->egl_surface,
- EGL_SURFACE_TYPE, &value);
- if (value == EGL_PBUFFER_BIT)
- glitz_egl_pbuffer_destroy (surface->screen_info, surface->egl_surface);
-
- free (surface);
-}
-
-glitz_bool_t
-glitz_egl_swap_buffers (void *abstract_drawable)
-{
- glitz_egl_surface_t *surface = (glitz_egl_surface_t *) abstract_drawable;
-
- eglSwapBuffers (surface->screen_info->display_info->egl_display,
- surface->egl_surface);
-
- return 1;
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/egl/glitz_eglint.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef GLITZ_EGLINT_H_INCLUDED
-#define GLITZ_EGLINT_H_INCLUDED
-
-#include "glitz.h"
-#include "glitzint.h"
-
-#include "glitz-egl.h"
-
-#define GLITZ_EGL_FEATURE_MAKE_CURRENT_READ_MASK (1L << 2)
-#define GLITZ_EGL_FEATURE_GET_PROC_ADDRESS_MASK (1L << 3)
-#define GLITZ_EGL_FEATURE_MULTISAMPLE_MASK (1L << 4)
-#define GLITZ_EGL_FEATURE_PBUFFER_MULTISAMPLE_MASK (1L << 5)
-
-typedef struct _glitz_egl_surface glitz_egl_surface_t;
-typedef struct _glitz_egl_screen_info_t glitz_egl_screen_info_t;
-typedef struct _glitz_egl_display_info_t glitz_egl_display_info_t;
-
-typedef struct _glitz_egl_thread_info_t {
- glitz_egl_display_info_t **displays;
- int n_displays;
- char *gl_library;
- void *dlhand;
- glitz_context_t *cctx;
-} glitz_egl_thread_info_t;
-
-struct _glitz_egl_display_info_t {
- glitz_egl_thread_info_t *thread_info;
- EGLDisplay egl_display;
- glitz_egl_screen_info_t **screens;
- int n_screens;
-};
-
-typedef struct _glitz_egl_context_info_t {
- glitz_egl_surface_t *drawable;
- glitz_surface_t *surface;
- glitz_constraint_t constraint;
-} glitz_egl_context_info_t;
-
-typedef struct _glitz_egl_context_t {
- glitz_context_t base;
- EGLContext egl_context;
- glitz_format_id_t id;
- EGLConfig egl_config;
- glitz_backend_t backend;
- glitz_bool_t initialized;
-} glitz_egl_context_t;
-
-struct _glitz_egl_screen_info_t {
- glitz_egl_display_info_t *display_info;
- int screen;
- int drawables;
- glitz_int_drawable_format_t *formats;
- int n_formats;
- glitz_egl_context_t **contexts;
- int n_contexts;
- glitz_egl_context_info_t context_stack[GLITZ_CONTEXT_STACK_SIZE];
- int context_stack_size;
- EGLContext egl_root_context;
- unsigned long egl_feature_mask;
- glitz_gl_float_t egl_version;
- glitz_program_map_t program_map;
-};
-
-struct _glitz_egl_surface {
- glitz_drawable_t base;
-
- glitz_egl_screen_info_t *screen_info;
- glitz_egl_context_t *context;
- EGLSurface egl_surface;
- int width;
- int height;
-};
-
-extern void __internal_linkage
-glitz_egl_query_extensions (glitz_egl_screen_info_t *screen_info,
- glitz_gl_float_t egl_version);
-
-extern glitz_egl_screen_info_t __internal_linkage *
-glitz_egl_screen_info_get (EGLDisplay egl_display,
- EGLScreenMESA egl_screen);
-
-extern glitz_function_pointer_t __internal_linkage
-glitz_egl_get_proc_address (const char *name,
- void *closure);
-
-extern glitz_egl_context_t __internal_linkage *
-glitz_egl_context_get (glitz_egl_screen_info_t *screen_info,
- glitz_drawable_format_t *format);
-
-extern void __internal_linkage
-glitz_egl_context_destroy (glitz_egl_screen_info_t *screen_info,
- glitz_egl_context_t *context);
-
-extern void __internal_linkage
-glitz_egl_query_configs (glitz_egl_screen_info_t *screen_info);
-
-extern glitz_bool_t __internal_linkage
-_glitz_egl_drawable_update_size (glitz_egl_surface_t *drawable,
- int width,
- int height);
-
-extern EGLSurface __internal_linkage
-glitz_egl_pbuffer_create (glitz_egl_screen_info_t *screen_info,
- EGLConfig egl_config,
- int width,
- int height);
-
-extern void __internal_linkage
-glitz_egl_pbuffer_destroy (glitz_egl_screen_info_t *screen_info,
- EGLSurface egl_pbuffer);
-
-extern glitz_drawable_t __internal_linkage *
-glitz_egl_create_pbuffer (void *abstract_templ,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height);
-
-extern glitz_bool_t __internal_linkage
-glitz_egl_push_current (void *abstract_drawable,
- glitz_surface_t *surface,
- glitz_constraint_t constraint);
-
-extern glitz_surface_t __internal_linkage *
-glitz_egl_pop_current (void *abstract_drawable);
-
-void
-glitz_egl_make_current (void *abstract_drawable,
- glitz_constraint_t constraint);
-
-extern glitz_status_t __internal_linkage
-glitz_egl_make_current_read (void *abstract_surface);
-
-extern void __internal_linkage
-glitz_egl_destroy (void *abstract_drawable);
-
-extern glitz_bool_t __internal_linkage
-glitz_egl_swap_buffers (void *abstract_drawable);
-
-/* Avoid unnecessary PLT entries. */
-
-slim_hidden_proto(glitz_egl_init)
-slim_hidden_proto(glitz_egl_fini)
-slim_hidden_proto(glitz_egl_find_window_config)
-slim_hidden_proto(glitz_egl_find_pbuffer_config)
-slim_hidden_proto(glitz_egl_create_surface)
-slim_hidden_proto(glitz_egl_create_pbuffer_surface)
-
-#endif /* GLITZ_EGLINT_H_INCLUDED */
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz.c
+++ /dev/null
@@ -1,663 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitzint.h"
-
-static glitz_gl_uint_t _texture_units[] = {
- GLITZ_GL_TEXTURE0,
- GLITZ_GL_TEXTURE1,
- GLITZ_GL_TEXTURE2
-};
-
-typedef struct _glitz_texture_unit_t {
- glitz_texture_t *texture;
- glitz_gl_uint_t unit;
- glitz_bool_t transform;
-} glitz_texture_unit_t;
-
-void
-glitz_composite (glitz_operator_t op,
- glitz_surface_t *src,
- glitz_surface_t *mask,
- glitz_surface_t *dst,
- int x_src,
- int y_src,
- int x_mask,
- int y_mask,
- int x_dst,
- int y_dst,
- int width,
- int height)
-{
- glitz_composite_op_t comp_op;
- int i, texture_nr = -1;
- glitz_texture_t *stexture, *mtexture;
- glitz_texture_unit_t textures[3];
- glitz_texture_parameters_t param;
- glitz_box_t bounds;
- glitz_bool_t no_border_clamp;
- unsigned long flags;
-
- GLITZ_GL_SURFACE (dst);
-
- bounds.x1 = MAX (x_dst, 0);
- bounds.y1 = MAX (y_dst, 0);
- bounds.x2 = x_dst + width;
- bounds.y2 = y_dst + height;
-
- if (bounds.x2 > dst->box.x2)
- bounds.x2 = dst->box.x2;
- if (bounds.y2 > dst->box.y2)
- bounds.y2 = dst->box.y2;
-
- if (bounds.x1 >= bounds.x2 || bounds.y1 >= bounds.y2)
- return;
-
- if (dst->geometry.buffer && (!dst->geometry.count))
- return;
-
- glitz_composite_op_init (&comp_op, op, src, mask, dst);
- if (comp_op.type == GLITZ_COMBINE_TYPE_NA)
- {
- glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
- return;
- }
-
- src = comp_op.src;
- mask = comp_op.mask;
-
- param.border_color.red = param.border_color.green =
- param.border_color.blue = param.border_color.alpha = 0;
-
- if (src)
- {
- stexture = glitz_surface_get_texture (src, 0);
- if (!stexture)
- return;
- } else
- stexture = NULL;
-
- if (mask)
- {
- mtexture = glitz_surface_get_texture (mask, 0);
- if (!mtexture)
- return;
- } else
- mtexture = NULL;
-
- if (!glitz_surface_push_current (dst, GLITZ_DRAWABLE_CURRENT))
- {
- glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
- glitz_surface_pop_current (dst);
- return;
- }
-
- no_border_clamp = !(dst->drawable->backend->feature_mask &
- GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK);
-
- if (mtexture)
- {
- textures[0].texture = mtexture;
- textures[0].unit = _texture_units[0];
- textures[0].transform = 0;
- texture_nr = 0;
-
- glitz_texture_bind (gl, mtexture);
-
- flags = mask->flags | GLITZ_SURFACE_FLAGS_GEN_COORDS_MASK;
- if (dst->geometry.attributes & GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK)
- {
- flags &= ~GLITZ_SURFACE_FLAG_GEN_S_COORDS_MASK;
-
- if (dst->geometry.u.v.mask.size == 2)
- flags &= ~GLITZ_SURFACE_FLAG_GEN_T_COORDS_MASK;
- }
-
- glitz_texture_set_tex_gen (gl,
- mtexture,
- &dst->geometry,
- x_dst - x_mask,
- y_dst - y_mask,
- flags,
- &dst->geometry.u.v.mask);
-
- if (mask->transform)
- {
- textures[0].transform = 1;
- gl->matrix_mode (GLITZ_GL_TEXTURE);
- gl->load_matrix_f (SURFACE_EYE_COORDS (mask)?
- mask->transform->m: mask->transform->t);
- gl->matrix_mode (GLITZ_GL_MODELVIEW);
-
- if (SURFACE_LINEAR_TRANSFORM_FILTER (mask))
- param.filter[0] = GLITZ_GL_LINEAR;
- else
- param.filter[0] = GLITZ_GL_NEAREST;
- }
- else
- {
- if ((dst->geometry.attributes &
- GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK) &&
- SURFACE_LINEAR_TRANSFORM_FILTER (mask))
- param.filter[0] = GLITZ_GL_LINEAR;
- else
- param.filter[0] = GLITZ_GL_NEAREST;
- }
-
- if (SURFACE_REPEAT (mask))
- {
- if (SURFACE_MIRRORED (mask))
- param.wrap[0] = GLITZ_GL_MIRRORED_REPEAT;
- else
- param.wrap[0] = GLITZ_GL_REPEAT;
- }
- else
- {
- if (no_border_clamp || SURFACE_PAD (mask))
- param.wrap[0] = GLITZ_GL_CLAMP_TO_EDGE;
- else
- param.wrap[0] = GLITZ_GL_CLAMP_TO_BORDER;
- }
-
- param.filter[1] = param.filter[0];
- param.wrap[1] = param.wrap[0];
-
- glitz_texture_ensure_parameters (gl, mtexture, ¶m);
- }
-
- if (stexture)
- {
- int last_texture_nr = comp_op.combine->texture_units - 1;
-
- while (texture_nr < last_texture_nr)
- {
- textures[++texture_nr].texture = stexture;
- textures[texture_nr].unit = _texture_units[texture_nr];
- textures[texture_nr].transform = 0;
- if (texture_nr > 0)
- {
- gl->active_texture (textures[texture_nr].unit);
- gl->client_active_texture (textures[texture_nr].unit);
- }
- glitz_texture_bind (gl, stexture);
- }
-
- flags = src->flags | GLITZ_SURFACE_FLAGS_GEN_COORDS_MASK;
- if (dst->geometry.attributes & GLITZ_VERTEX_ATTRIBUTE_SRC_COORD_MASK)
- {
- flags &= ~GLITZ_SURFACE_FLAG_GEN_S_COORDS_MASK;
-
- if (dst->geometry.u.v.src.size == 2)
- flags &= ~GLITZ_SURFACE_FLAG_GEN_T_COORDS_MASK;
- }
-
- glitz_texture_set_tex_gen (gl,
- stexture,
- &dst->geometry,
- x_dst - x_src,
- y_dst - y_src,
- flags,
- &dst->geometry.u.v.src);
-
- if (src->transform)
- {
- textures[texture_nr].transform = 1;
- gl->matrix_mode (GLITZ_GL_TEXTURE);
- gl->load_matrix_f (SURFACE_EYE_COORDS (src)?
- src->transform->m: src->transform->t);
- gl->matrix_mode (GLITZ_GL_MODELVIEW);
-
- if (SURFACE_LINEAR_TRANSFORM_FILTER (src))
- param.filter[0] = GLITZ_GL_LINEAR;
- else
- param.filter[0] = GLITZ_GL_NEAREST;
- }
- else
- {
- if ((dst->geometry.attributes &
- GLITZ_VERTEX_ATTRIBUTE_SRC_COORD_MASK) &&
- SURFACE_LINEAR_TRANSFORM_FILTER (src))
- param.filter[0] = GLITZ_GL_LINEAR;
- else
- param.filter[0] = GLITZ_GL_NEAREST;
- }
-
- if (SURFACE_REPEAT (src))
- {
- if (SURFACE_MIRRORED (src))
- param.wrap[0] = GLITZ_GL_MIRRORED_REPEAT;
- else
- param.wrap[0] = GLITZ_GL_REPEAT;
- }
- else
- {
- if (no_border_clamp || SURFACE_PAD (src))
- param.wrap[0] = GLITZ_GL_CLAMP_TO_EDGE;
- else
- param.wrap[0] = GLITZ_GL_CLAMP_TO_BORDER;
- }
-
- param.filter[1] = param.filter[0];
- param.wrap[1] = param.wrap[0];
-
- glitz_texture_ensure_parameters (gl, stexture, ¶m);
- }
-
- glitz_geometry_enable (gl, dst, &bounds);
-
- if (comp_op.per_component)
- {
- static unsigned short alpha_map[4][4] = {
- { 0, 0, 0, 1 },
- { 0, 0, 1, 0 },
- { 0, 1, 0, 0 },
- { 1, 0, 0, 0 }
- };
- static int damage[4] = {
- GLITZ_DAMAGE_TEXTURE_MASK | GLITZ_DAMAGE_SOLID_MASK,
- 0,
- 0,
- 0
- };
- glitz_color_t alpha = comp_op.alpha_mask;
- int component = 4;
- int cmask = 1;
-
- while (component--)
- {
- comp_op.alpha_mask.red = alpha_map[component][0] * alpha.red;
- comp_op.alpha_mask.green = alpha_map[component][1] * alpha.green;
- comp_op.alpha_mask.blue = alpha_map[component][2] * alpha.blue;
- comp_op.alpha_mask.alpha = alpha_map[component][3] * alpha.alpha;
-
- gl->color_mask ((cmask & 1) ,
- (cmask & 2) >> 1,
- (cmask & 4) >> 2,
- (cmask & 8) >> 3);
-
- glitz_composite_enable (&comp_op);
- glitz_geometry_draw_arrays (gl, dst,
- dst->geometry.type, &bounds,
- damage[component]);
- cmask <<= 1;
- }
-
- gl->color_mask (1, 1, 1, 1);
- }
- else
- {
- glitz_composite_enable (&comp_op);
- glitz_geometry_draw_arrays (gl, dst, dst->geometry.type, &bounds,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_SOLID_MASK);
- }
-
- glitz_composite_disable (&comp_op);
- glitz_geometry_disable (dst);
-
- for (i = texture_nr; i >= 0; i--)
- {
- glitz_texture_unbind (gl, textures[i].texture);
- if (textures[i].transform)
- {
- gl->matrix_mode (GLITZ_GL_TEXTURE);
- gl->load_identity ();
- gl->matrix_mode (GLITZ_GL_MODELVIEW);
- }
-
- if (i > 0)
- {
- gl->client_active_texture (textures[i - 1].unit);
- gl->active_texture (textures[i - 1].unit);
- }
- }
-
- glitz_surface_pop_current (dst);
-}
-
-void
-glitz_copy_area (glitz_surface_t *src,
- glitz_surface_t *dst,
- int x_src,
- int y_src,
- int width,
- int height,
- int x_dst,
- int y_dst)
-{
- glitz_status_t status;
- glitz_box_t bounds;
- int src_width = src->box.x2;
- int src_height = src->box.y2;
-
- GLITZ_GL_SURFACE (dst);
-
- if (x_src < 0)
- {
- bounds.x1 = x_dst - x_src;
- width += x_src;
- }
- else
- {
- bounds.x1 = x_dst;
- src_width -= x_src;
- }
-
- if (y_src < 0)
- {
- bounds.y1 = y_dst - y_src;
- height += y_src;
- }
- else
- {
- bounds.y1 = y_dst;
- src_height -= y_src;
- }
-
- if (width > src_width)
- bounds.x2 = bounds.x1 + src_width;
- else
- bounds.x2 = bounds.x1 + width;
-
- if (height > src_height)
- bounds.y2 = bounds.y1 + src_height;
- else
- bounds.y2 = bounds.y1 + height;
-
- if (bounds.x1 < 0)
- bounds.x1 = 0;
- if (bounds.y1 < 0)
- bounds.y1 = 0;
- if (bounds.x2 > dst->box.x2)
- bounds.x2 = dst->box.x2;
- if (bounds.y2 > dst->box.y2)
- bounds.y2 = dst->box.y2;
-
- if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
- return;
-
- status = GLITZ_STATUS_NOT_SUPPORTED;
- if ((!src->attached) ||
- (src->attached == dst->attached) ||
- (dst->box.x2 * dst->box.y2 >= src->box.x2 * src->box.y2))
- {
- if (glitz_surface_push_current (dst, GLITZ_DRAWABLE_CURRENT))
- {
- int target_height = dst->attached->height;
-
- if (src->attached == dst->attached)
- {
- glitz_box_t box, *clip = dst->clip;
- int n_clip = dst->n_clip;
-
- if (REGION_NOTEMPTY (&src->drawable_damage))
- {
- glitz_surface_push_current (src, GLITZ_DRAWABLE_CURRENT);
- glitz_surface_pop_current (src);
- }
-
- src->drawable->backend->read_buffer (src->drawable,
- src->buffer);
- dst->drawable->backend->draw_buffer (dst->drawable,
- dst->buffer);
-
- glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
-
- x_src += src->x;
- y_src += src->y;
-
- while (n_clip--)
- {
- box.x1 = clip->x1 + dst->x_clip;
- box.y1 = clip->y1 + dst->y_clip;
- box.x2 = clip->x2 + dst->x_clip;
- box.y2 = clip->y2 + dst->y_clip;
- if (bounds.x1 > box.x1)
- box.x1 = bounds.x1;
- if (bounds.y1 > box.y1)
- box.y1 = bounds.y1;
- if (bounds.x2 < box.x2)
- box.x2 = bounds.x2;
- if (bounds.y2 < box.y2)
- box.y2 = bounds.y2;
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- glitz_set_raster_pos (gl,
- dst->x + box.x1,
- target_height - (dst->y + box.y2));
-
- gl->scissor (dst->x + box.x1,
- target_height - (dst->y + box.y2),
- box.x2 - box.x1,
- box.y2 - box.y1);
-
- gl->copy_pixels (x_src + (box.x1 - x_dst),
- target_height -
- (y_src + (box.y2 - y_dst)),
- box.x2 - box.x1, box.y2 - box.y1,
- GLITZ_GL_COLOR);
-
- glitz_surface_damage (dst, &box,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_SOLID_MASK);
- }
-
- clip++;
- }
- }
- else
- {
- glitz_texture_t *texture;
-
- texture = glitz_surface_get_texture (src, 0);
- if (texture)
- {
- glitz_texture_parameters_t param;
- unsigned long mask;
-
- mask = GLITZ_SURFACE_FLAGS_GEN_COORDS_MASK;
-
- glitz_texture_bind (gl, texture);
-
- glitz_texture_set_tex_gen (gl, texture, NULL,
- x_dst - x_src,
- y_dst - y_src,
- mask,
- NULL);
-
- gl->tex_env_f (GLITZ_GL_TEXTURE_ENV,
- GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_REPLACE);
-
- gl->color_4us (0x0, 0x0, 0x0, 0xffff);
-
- param.filter[0] = param.filter[1] = GLITZ_GL_NEAREST;
- param.wrap[0] = param.wrap[1] = GLITZ_GL_CLAMP_TO_EDGE;
-
- glitz_texture_ensure_parameters (gl, texture, ¶m);
-
- glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
-
- if (dst->n_clip > 1)
- {
- glitz_float_t *data;
- void *ptr;
- int vertices = 0;
- glitz_box_t box, *clip = dst->clip;
- int n_clip = dst->n_clip;
-
- ptr = malloc (n_clip * 8 * sizeof (glitz_float_t));
- if (!ptr)
- {
- mask = GLITZ_STATUS_NO_MEMORY_MASK;
- glitz_surface_pop_current (dst);
- glitz_surface_status_add (dst, mask);
- return;
- }
-
- data = (glitz_float_t *) ptr;
-
- while (n_clip--)
- {
- box.x1 = clip->x1 + dst->x_clip;
- box.y1 = clip->y1 + dst->y_clip;
- box.x2 = clip->x2 + dst->x_clip;
- box.y2 = clip->y2 + dst->y_clip;
- if (bounds.x1 > box.x1)
- box.x1 = bounds.x1;
- if (bounds.y1 > box.y1)
- box.y1 = bounds.y1;
- if (bounds.x2 < box.x2)
- box.x2 = bounds.x2;
- if (bounds.y2 < box.y2)
- box.y2 = bounds.y2;
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- *data++ = (glitz_float_t) box.x1;
- *data++ = (glitz_float_t) box.y1;
- *data++ = (glitz_float_t) box.x2;
- *data++ = (glitz_float_t) box.y1;
- *data++ = (glitz_float_t) box.x2;
- *data++ = (glitz_float_t) box.y2;
- *data++ = (glitz_float_t) box.x1;
- *data++ = (glitz_float_t) box.y2;
-
- vertices += 4;
- glitz_surface_damage (dst, &box,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_SOLID_MASK);
- }
-
- clip++;
- }
-
- if (vertices)
- {
- gl->scissor (bounds.x1 + dst->x,
- (target_height - dst->y) - bounds.y2,
- bounds.x2 - bounds.x1,
- bounds.y2 - bounds.y1);
-
- gl->vertex_pointer (2, GLITZ_GL_FLOAT, 0, ptr);
- gl->draw_arrays (GLITZ_GL_QUADS, 0, vertices);
- }
-
- free (ptr);
- }
- else
- {
- glitz_geometry_enable_none (gl, dst, &bounds);
- glitz_geometry_draw_arrays (gl, dst,
- GLITZ_GEOMETRY_TYPE_NONE,
- &bounds,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_SOLID_MASK);
- }
-
- glitz_texture_unbind (gl, texture);
- }
- }
-
- status = GLITZ_STATUS_SUCCESS;
- }
-
- glitz_surface_pop_current (dst);
- }
-
- if (status)
- {
- if (glitz_surface_push_current (src, GLITZ_DRAWABLE_CURRENT))
- {
- glitz_texture_t *texture;
-
- src->drawable->backend->read_buffer (src->drawable, src->buffer);
-
- texture = glitz_surface_get_texture (dst, 1);
- if (texture)
- {
- glitz_box_t box, *clip = dst->clip;
- int n_clip = dst->n_clip;
-
- gl->disable (GLITZ_GL_SCISSOR_TEST);
-
- glitz_texture_bind (gl, texture);
-
- x_src += src->x;
- y_src += src->y;
-
- while (n_clip--)
- {
- box.x1 = clip->x1 + dst->x_clip;
- box.y1 = clip->y1 + dst->y_clip;
- box.x2 = clip->x2 + dst->x_clip;
- box.y2 = clip->y2 + dst->y_clip;
- if (bounds.x1 > box.x1)
- box.x1 = bounds.x1;
- if (bounds.y1 > box.y1)
- box.y1 = bounds.y1;
- if (bounds.x2 < box.x2)
- box.x2 = bounds.x2;
- if (bounds.y2 < box.y2)
- box.y2 = bounds.y2;
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- glitz_texture_copy_drawable (gl,
- texture,
- src->attached,
- x_src + (box.x1 - x_dst),
- y_src + (box.y1 - y_dst),
- box.x2 - box.x1,
- box.y2 - box.y1,
- box.x1,
- box.y1);
-
- glitz_surface_damage (dst, &box,
- GLITZ_DAMAGE_DRAWABLE_MASK |
- GLITZ_DAMAGE_SOLID_MASK);
- }
-
- clip++;
- }
-
- glitz_texture_unbind (gl, texture);
-
- gl->enable (GLITZ_GL_SCISSOR_TEST);
-
- status = GLITZ_STATUS_SUCCESS;
- }
- }
- glitz_surface_pop_current (src);
- }
-
- if (status)
- glitz_surface_status_add (dst, glitz_status_to_status_mask (status));
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz.h
+++ /dev/null
@@ -1,776 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifndef GLITZ_H_INCLUDED
-#define GLITZ_H_INCLUDED
-
-#define GLITZ_MAJOR 0
-#define GLITZ_MINOR 5
-#define GLITZ_REVISION 5
-
-#if defined(__cplusplus) || defined(c_plusplus)
-extern "C" {
-#endif
-
-typedef int glitz_bool_t;
-typedef short glitz_short_t;
-typedef int glitz_int_t;
-typedef float glitz_float_t;
-typedef double glitz_double_t;
-typedef int glitz_fixed16_16_t;
-
-typedef struct _glitz_drawable glitz_drawable_t;
-typedef struct _glitz_surface glitz_surface_t;
-
-typedef struct _glitz_rectangle_t {
- short x, y;
- unsigned short width, height;
-} glitz_rectangle_t;
-
-typedef struct _glitz_box_t {
- short x1, y1, x2, y2;
-} glitz_box_t;
-
-typedef struct _glitz_point_fixed_t {
- glitz_fixed16_16_t x;
- glitz_fixed16_16_t y;
-} glitz_point_fixed_t;
-
-typedef struct _glitz_line_fixed_t {
- glitz_point_fixed_t p1;
- glitz_point_fixed_t p2;
-} glitz_line_fixed_t;
-
-typedef struct _glitz_trapezoid_t {
- glitz_fixed16_16_t top, bottom;
- glitz_line_fixed_t left, right;
-} glitz_trapezoid_t;
-
-typedef struct _glitz_span_fixed_t {
- glitz_fixed16_16_t left, right, y;
-} glitz_span_fixed_t;
-
-typedef struct _glitz_trap_t {
- glitz_span_fixed_t top, bottom;
-} glitz_trap_t;
-
-typedef struct _glitz_transform_t {
- glitz_fixed16_16_t matrix[3][3];
-} glitz_transform_t;
-
-typedef struct {
- unsigned short red;
- unsigned short green;
- unsigned short blue;
- unsigned short alpha;
-} glitz_color_t;
-
-typedef enum {
- GLITZ_FILTER_NEAREST,
- GLITZ_FILTER_BILINEAR,
- GLITZ_FILTER_CONVOLUTION,
- GLITZ_FILTER_GAUSSIAN,
- GLITZ_FILTER_LINEAR_GRADIENT,
- GLITZ_FILTER_RADIAL_GRADIENT
-} glitz_filter_t;
-
-typedef enum {
- GLITZ_OPERATOR_CLEAR,
- GLITZ_OPERATOR_SRC,
- GLITZ_OPERATOR_DST,
- GLITZ_OPERATOR_OVER,
- GLITZ_OPERATOR_OVER_REVERSE,
- GLITZ_OPERATOR_IN,
- GLITZ_OPERATOR_IN_REVERSE,
- GLITZ_OPERATOR_OUT,
- GLITZ_OPERATOR_OUT_REVERSE,
- GLITZ_OPERATOR_ATOP,
- GLITZ_OPERATOR_ATOP_REVERSE,
- GLITZ_OPERATOR_XOR,
- GLITZ_OPERATOR_ADD
-} glitz_operator_t;
-
-#define GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK (1L << 0)
-#define GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK (1L << 1)
-#define GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK (1L << 2)
-#define GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK (1L << 3)
-#define GLITZ_FEATURE_MULTISAMPLE_MASK (1L << 4)
-#define GLITZ_FEATURE_MULTISAMPLE_FILTER_HINT_MASK (1L << 5)
-#define GLITZ_FEATURE_MULTITEXTURE_MASK (1L << 6)
-#define GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK (1L << 7)
-#define GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK (1L << 8)
-#define GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK (1L << 9)
-#define GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK (1L << 10)
-#define GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK (1L << 11)
-#define GLITZ_FEATURE_PER_COMPONENT_RENDERING_MASK (1L << 12)
-#define GLITZ_FEATURE_BLEND_COLOR_MASK (1L << 13)
-#define GLITZ_FEATURE_PACKED_PIXELS_MASK (1L << 14)
-#define GLITZ_FEATURE_MULTI_DRAW_ARRAYS_MASK (1L << 15)
-#define GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK (1L << 16)
-#define GLITZ_FEATURE_COPY_SUB_BUFFER_MASK (1L << 17)
-
-
-/* glitz_format.c */
-
-typedef enum {
- GLITZ_STANDARD_ARGB32,
- GLITZ_STANDARD_RGB24,
- GLITZ_STANDARD_A8,
- GLITZ_STANDARD_A1
-} glitz_format_name_t;
-
-#define GLITZ_FORMAT_ID_MASK (1L << 0)
-#define GLITZ_FORMAT_RED_SIZE_MASK (1L << 1)
-#define GLITZ_FORMAT_GREEN_SIZE_MASK (1L << 2)
-#define GLITZ_FORMAT_BLUE_SIZE_MASK (1L << 3)
-#define GLITZ_FORMAT_ALPHA_SIZE_MASK (1L << 4)
-
-typedef unsigned long glitz_format_id_t;
-
-typedef unsigned int glitz_fourcc_t;
-
-#define GLITZ_FORMAT_FOURCC_MASK (1L << 5)
-
-#define GLITZ_FOURCC(a, b, c, d) \
- ((a) | (b) << 8 | (c) << 16 | ((glitz_fourcc_t) (d)) << 24)
-
-#define GLITZ_FOURCC_RGB ((glitz_fourcc_t) 0x0)
-#define GLITZ_FOURCC_YV12 GLITZ_FOURCC ('Y', 'V', '1', '2')
-#define GLITZ_FOURCC_YUY2 GLITZ_FOURCC ('Y', 'U', 'Y', '2')
-
-typedef struct _glitz_color_format_t {
- glitz_fourcc_t fourcc;
- unsigned short red_size;
- unsigned short green_size;
- unsigned short blue_size;
- unsigned short alpha_size;
-} glitz_color_format_t;
-
-#define GLITZ_FORMAT_DEPTH_SIZE_MASK (1L << 6)
-#define GLITZ_FORMAT_STENCIL_SIZE_MASK (1L << 7)
-#define GLITZ_FORMAT_DOUBLEBUFFER_MASK (1L << 8)
-#define GLITZ_FORMAT_SAMPLES_MASK (1L << 9)
-
-typedef struct _glitz_drawable_format_t {
- glitz_format_id_t id;
- glitz_color_format_t color;
- unsigned short depth_size;
- unsigned short stencil_size;
- unsigned short samples;
- glitz_bool_t doublebuffer;
-} glitz_drawable_format_t;
-
-typedef struct _glitz_format_t {
- glitz_format_id_t id;
- glitz_color_format_t color;
-} glitz_format_t;
-
-glitz_format_t *
-glitz_find_standard_format (glitz_drawable_t *drawable,
- glitz_format_name_t format_name);
-
-glitz_format_t *
-glitz_find_format (glitz_drawable_t *drawable,
- unsigned long mask,
- const glitz_format_t *templ,
- int count);
-
-glitz_drawable_format_t *
-glitz_find_drawable_format (glitz_drawable_t *other,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count);
-
-glitz_drawable_format_t *
-glitz_find_pbuffer_format (glitz_drawable_t *other,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count);
-
-
-/* glitz_status.c */
-
-typedef enum {
- GLITZ_STATUS_SUCCESS = 0,
- GLITZ_STATUS_NO_MEMORY,
- GLITZ_STATUS_BAD_COORDINATE,
- GLITZ_STATUS_NOT_SUPPORTED,
- GLITZ_STATUS_CONTENT_DESTROYED
-} glitz_status_t;
-
-const char *
-glitz_status_string (glitz_status_t status);
-
-
-/* glitz_drawable.c */
-
-typedef enum {
- GLITZ_DRAWABLE_BUFFER_FRONT_COLOR,
- GLITZ_DRAWABLE_BUFFER_BACK_COLOR
-} glitz_drawable_buffer_t;
-
-glitz_drawable_t *
-glitz_create_drawable (glitz_drawable_t *other,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height);
-
-glitz_drawable_t *
-glitz_create_pbuffer_drawable (glitz_drawable_t *other,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height);
-
-void
-glitz_drawable_destroy (glitz_drawable_t *drawable);
-
-void
-glitz_drawable_reference (glitz_drawable_t *drawable);
-
-void
-glitz_drawable_update_size (glitz_drawable_t *drawable,
- unsigned int width,
- unsigned int height);
-
-unsigned int
-glitz_drawable_get_width (glitz_drawable_t *drawable);
-
-unsigned int
-glitz_drawable_get_height (glitz_drawable_t *drawable);
-
-void
-glitz_drawable_swap_buffer_region (glitz_drawable_t *drawable,
- int x_origin,
- int y_origin,
- glitz_box_t *box,
- int n_box);
-
-void
-glitz_drawable_swap_buffers (glitz_drawable_t *drawable);
-
-void
-glitz_drawable_flush (glitz_drawable_t *drawable);
-
-void
-glitz_drawable_finish (glitz_drawable_t *drawable);
-
-unsigned long
-glitz_drawable_get_features (glitz_drawable_t *drawable);
-
-glitz_drawable_format_t *
-glitz_drawable_get_format (glitz_drawable_t *drawable);
-
-
-/* glitz_surface.c */
-
-#define GLITZ_SURFACE_UNNORMALIZED_MASK (1L << 0)
-
-typedef struct _glitz_surface_attributes_t {
- glitz_bool_t unnormalized;
-} glitz_surface_attributes_t;
-
-glitz_surface_t *
-glitz_surface_create (glitz_drawable_t *drawable,
- glitz_format_t *format,
- unsigned int width,
- unsigned int height,
- unsigned long mask,
- glitz_surface_attributes_t *attributes);
-
-void
-glitz_surface_destroy (glitz_surface_t *surface);
-
-void
-glitz_surface_reference (glitz_surface_t *surface);
-
-void
-glitz_surface_attach (glitz_surface_t *surface,
- glitz_drawable_t *drawable,
- glitz_drawable_buffer_t buffer);
-
-void
-glitz_surface_detach (glitz_surface_t *surface);
-
-void
-glitz_surface_flush (glitz_surface_t *surface);
-
-glitz_drawable_t *
-glitz_surface_get_drawable (glitz_surface_t *surface);
-
-glitz_drawable_t *
-glitz_surface_get_attached_drawable (glitz_surface_t *surface);
-
-void
-glitz_surface_set_transform (glitz_surface_t *surface,
- glitz_transform_t *transform);
-
-typedef enum {
- GLITZ_FILL_TRANSPARENT,
- GLITZ_FILL_NEAREST,
- GLITZ_FILL_REPEAT,
- GLITZ_FILL_REFLECT
-} glitz_fill_t;
-
-void
-glitz_surface_set_fill (glitz_surface_t *surface,
- glitz_fill_t fill);
-
-void
-glitz_surface_set_component_alpha (glitz_surface_t *surface,
- glitz_bool_t component_alpha);
-
-void
-glitz_surface_set_filter (glitz_surface_t *surface,
- glitz_filter_t filter,
- glitz_fixed16_16_t *params,
- int n_params);
-
-void
-glitz_surface_set_dither (glitz_surface_t *surface,
- glitz_bool_t dither);
-
-unsigned int
-glitz_surface_get_width (glitz_surface_t *surface);
-
-unsigned int
-glitz_surface_get_height (glitz_surface_t *surface);
-
-glitz_status_t
-glitz_surface_get_status (glitz_surface_t *surface);
-
-glitz_format_t *
-glitz_surface_get_format (glitz_surface_t *surface);
-
-void
-glitz_surface_translate_point (glitz_surface_t *surface,
- glitz_point_fixed_t *src,
- glitz_point_fixed_t *dst);
-
-void
-glitz_surface_set_clip_region (glitz_surface_t *surface,
- int x_origin,
- int y_origin,
- glitz_box_t *box,
- int n_box);
-
-glitz_bool_t
-glitz_surface_valid_target (glitz_surface_t *surface);
-
-
-/* glitz_texture.c */
-
-typedef struct _glitz_texture_object glitz_texture_object_t;
-
-glitz_texture_object_t *
-glitz_texture_object_create (glitz_surface_t *surface);
-
-void
-glitz_texture_object_destroy (glitz_texture_object_t *texture);
-
-void
-glitz_texture_object_reference (glitz_texture_object_t *texture);
-
-typedef enum {
- GLITZ_TEXTURE_FILTER_TYPE_MAG = 0,
- GLITZ_TEXTURE_FILTER_TYPE_MIN = 1
-} glitz_texture_filter_type_t;
-
-typedef enum {
- GLITZ_TEXTURE_FILTER_NEAREST = 0,
- GLITZ_TEXTURE_FILTER_LINEAR = 1,
- GLITZ_TEXTURE_FILTER_NEAREST_MIPMAP_NEAREST = 2,
- GLITZ_TEXTURE_FILTER_LINEAR_MIPMAP_NEAREST = 3,
- GLITZ_TEXTURE_FILTER_NEAREST_MIPMAP_LINEAR = 3,
- GLITZ_TEXTURE_FILTER_LINEAR_MIPMAP_LINEAR = 4
-} glitz_texture_filter_t;
-
-void
-glitz_texture_object_set_filter (glitz_texture_object_t *texture,
- glitz_texture_filter_type_t type,
- glitz_texture_filter_t filter);
-
-typedef enum {
- GLITZ_TEXTURE_WRAP_TYPE_S = 0,
- GLITZ_TEXTURE_WRAP_TYPE_T = 1
-} glitz_texture_wrap_type_t;
-
-typedef enum {
- GLITZ_TEXTURE_WRAP_CLAMP = 0,
- GLITZ_TEXTURE_WRAP_CLAMP_TO_EDGE = 1,
- GLITZ_TEXTURE_WRAP_CLAMP_TO_BORDER = 2,
- GLITZ_TEXTURE_WRAP_REPEAT = 3,
- GLITZ_TEXTURE_WRAP_MIRRORED_REPEAT = 4
-} glitz_texture_wrap_t;
-
-void
-glitz_texture_object_set_wrap (glitz_texture_object_t *texture,
- glitz_texture_wrap_type_t type,
- glitz_texture_wrap_t wrap);
-
-void
-glitz_texture_object_set_border_color (glitz_texture_object_t *texture,
- glitz_color_t *color);
-
-typedef enum {
- GLITZ_TEXTURE_TARGET_2D = 0,
- GLITZ_TEXTURE_TARGET_RECT = 1
-} glitz_texture_target_t;
-
-glitz_texture_target_t
-glitz_texture_object_get_target (glitz_texture_object_t *texture);
-
-
-/* glitz_context.c */
-
-typedef struct _glitz_context glitz_context_t;
-
-glitz_context_t *
-glitz_context_create (glitz_drawable_t *drawable,
- glitz_drawable_format_t *format);
-
-void
-glitz_context_destroy (glitz_context_t *context);
-
-void
-glitz_context_reference (glitz_context_t *context);
-
-void
-glitz_context_copy (glitz_context_t *src,
- glitz_context_t *dst,
- unsigned long mask);
-
-typedef void (*glitz_lose_current_function_t) (void *closure);
-
-void
-glitz_context_set_user_data (glitz_context_t *context,
- void *closure,
- glitz_lose_current_function_t lose_current);
-
-typedef void (*glitz_function_pointer_t) (void);
-
-glitz_function_pointer_t
-glitz_context_get_proc_address (glitz_context_t *context,
- const char *name);
-
-void
-glitz_context_make_current (glitz_context_t *context,
- glitz_drawable_t *drawable);
-
-void
-glitz_context_bind_texture (glitz_context_t *context,
- glitz_texture_object_t *texture);
-
-void
-glitz_context_draw_buffers (glitz_context_t *context,
- const glitz_drawable_buffer_t *buffers,
- int n);
-
-void
-glitz_context_read_buffer (glitz_context_t *context,
- const glitz_drawable_buffer_t buffer);
-
-
-/* glitz_rect.c */
-
-void
-glitz_set_rectangle (glitz_surface_t *dst,
- const glitz_color_t *color,
- int x,
- int y,
- unsigned int width,
- unsigned int height);
-
-void
-glitz_set_rectangles (glitz_surface_t *dst,
- const glitz_color_t *color,
- const glitz_rectangle_t *rects,
- int n_rects);
-
-
-/* glitz_buffer.c */
-
-typedef struct _glitz_buffer glitz_buffer_t;
-
-typedef enum {
- GLITZ_BUFFER_HINT_STREAM_DRAW,
- GLITZ_BUFFER_HINT_STREAM_READ,
- GLITZ_BUFFER_HINT_STREAM_COPY,
- GLITZ_BUFFER_HINT_STATIC_DRAW,
- GLITZ_BUFFER_HINT_STATIC_READ,
- GLITZ_BUFFER_HINT_STATIC_COPY,
- GLITZ_BUFFER_HINT_DYNAMIC_DRAW,
- GLITZ_BUFFER_HINT_DYNAMIC_READ,
- GLITZ_BUFFER_HINT_DYNAMIC_COPY
-} glitz_buffer_hint_t;
-
-typedef enum {
- GLITZ_BUFFER_ACCESS_READ_ONLY,
- GLITZ_BUFFER_ACCESS_WRITE_ONLY,
- GLITZ_BUFFER_ACCESS_READ_WRITE
-} glitz_buffer_access_t;
-
-glitz_buffer_t *
-glitz_vertex_buffer_create (glitz_drawable_t *drawable,
- void *data,
- unsigned int size,
- glitz_buffer_hint_t hint);
-
-glitz_buffer_t *
-glitz_pixel_buffer_create (glitz_drawable_t *drawable,
- void *data,
- unsigned int size,
- glitz_buffer_hint_t hint);
-
-glitz_buffer_t *
-glitz_buffer_create_for_data (void *data);
-
-void
-glitz_buffer_destroy (glitz_buffer_t *buffer);
-
-void
-glitz_buffer_reference (glitz_buffer_t *buffer);
-
-void
-glitz_buffer_set_data (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- const void *data);
-
-void
-glitz_buffer_get_data (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- void *data);
-
-void *
-glitz_buffer_map (glitz_buffer_t *buffer,
- glitz_buffer_access_t access);
-
-glitz_status_t
-glitz_buffer_unmap (glitz_buffer_t *buffer);
-
-
-/* glitz_pixel.c */
-
-typedef enum {
- GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN,
- GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
-} glitz_pixel_scanline_order_t;
-
-typedef struct _glitz_pixel_masks {
- int bpp;
- unsigned long alpha_mask;
- unsigned long red_mask;
- unsigned long green_mask;
- unsigned long blue_mask;
-} glitz_pixel_masks_t;
-
-typedef struct _glitz_pixel_format {
- glitz_fourcc_t fourcc;
- glitz_pixel_masks_t masks;
- int xoffset;
- int skip_lines;
- int bytes_per_line;
- glitz_pixel_scanline_order_t scanline_order;
-} glitz_pixel_format_t;
-
-void
-glitz_set_pixels (glitz_surface_t *dst,
- int x_dst,
- int y_dst,
- int width,
- int height,
- glitz_pixel_format_t *format,
- glitz_buffer_t *buffer);
-
-void
-glitz_get_pixels (glitz_surface_t *src,
- int x_src,
- int y_src,
- int width,
- int height,
- glitz_pixel_format_t *format,
- glitz_buffer_t *buffer);
-
-
-/* glitz_geometry.c */
-
-typedef enum {
- GLITZ_PRIMITIVE_POINTS,
- GLITZ_PRIMITIVE_LINES,
- GLITZ_PRIMITIVE_LINE_STRIP,
- GLITZ_PRIMITIVE_LINE_LOOP,
- GLITZ_PRIMITIVE_TRIANGLES,
- GLITZ_PRIMITIVE_TRIANGLE_STRIP,
- GLITZ_PRIMITIVE_TRIANGLE_FAN,
- GLITZ_PRIMITIVE_QUADS,
- GLITZ_PRIMITIVE_QUAD_STRIP,
- GLITZ_PRIMITIVE_POLYGON
-} glitz_primitive_t;
-
-typedef enum {
- GLITZ_DATA_TYPE_SHORT,
- GLITZ_DATA_TYPE_INT,
- GLITZ_DATA_TYPE_FLOAT,
- GLITZ_DATA_TYPE_DOUBLE
-} glitz_data_type_t;
-
-typedef enum {
- GLITZ_COORDINATE_SIZE_X,
- GLITZ_COORDINATE_SIZE_XY
-} glitz_coordinate_size_t;
-
-typedef struct _glitz_coordinate_attribute {
- glitz_data_type_t type;
- glitz_coordinate_size_t size;
- int offset;
-} glitz_coordinate_attribute_t;
-
-#define GLITZ_VERTEX_ATTRIBUTE_SRC_COORD_MASK (1L << 0)
-#define GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK (1L << 1)
-
-typedef struct _glitz_vertex_format {
- glitz_primitive_t primitive;
- glitz_data_type_t type;
- unsigned int bytes_per_vertex;
- unsigned long attributes;
- glitz_coordinate_attribute_t src;
- glitz_coordinate_attribute_t mask;
-} glitz_vertex_format_t;
-
-typedef struct _glitz_bitmap_format {
- glitz_pixel_scanline_order_t scanline_order;
- unsigned int bytes_per_line;
- int pad;
-} glitz_bitmap_format_t;
-
-typedef enum {
- GLITZ_GEOMETRY_TYPE_NONE,
- GLITZ_GEOMETRY_TYPE_VERTEX,
- GLITZ_GEOMETRY_TYPE_BITMAP
-} glitz_geometry_type_t;
-
-typedef union _glitz_geometry_format {
- glitz_vertex_format_t vertex;
- glitz_bitmap_format_t bitmap;
-} glitz_geometry_format_t;
-
-void
-glitz_set_geometry (glitz_surface_t *dst,
- glitz_geometry_type_t type,
- glitz_geometry_format_t *format,
- glitz_buffer_t *buffer);
-
-void
-glitz_set_array (glitz_surface_t *dst,
- int first,
- int size,
- unsigned int count,
- glitz_fixed16_16_t x_off,
- glitz_fixed16_16_t y_off);
-
-typedef struct _glitz_multi_array glitz_multi_array_t;
-
-glitz_multi_array_t *
-glitz_multi_array_create (unsigned int size);
-
-void
-glitz_multi_array_destroy (glitz_multi_array_t *array);
-
-void
-glitz_multi_array_reference (glitz_multi_array_t *array);
-
-void
-glitz_multi_array_add (glitz_multi_array_t *array,
- int first,
- int size,
- unsigned int count,
- glitz_fixed16_16_t x_off,
- glitz_fixed16_16_t y_off);
-
-void
-glitz_multi_array_reset (glitz_multi_array_t *array);
-
-void
-glitz_set_multi_array (glitz_surface_t *dst,
- glitz_multi_array_t *array,
- glitz_fixed16_16_t x_off,
- glitz_fixed16_16_t y_off);
-
-
-/* glitz_trap.c */
-
-int
-glitz_add_trapezoids (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- glitz_data_type_t type,
- glitz_surface_t *mask,
- glitz_trapezoid_t *traps,
- int n_traps,
- int *n_added);
-
-int
-glitz_add_traps (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- glitz_data_type_t type,
- glitz_surface_t *mask,
- glitz_trap_t *traps,
- int n_traps,
- int *n_added);
-
-
-/* glitz.c */
-
-void
-glitz_composite (glitz_operator_t op,
- glitz_surface_t *src,
- glitz_surface_t *mask,
- glitz_surface_t *dst,
- int x_src,
- int y_src,
- int x_mask,
- int y_mask,
- int x_dst,
- int y_dst,
- int width,
- int height);
-
-void
-glitz_copy_area (glitz_surface_t *src,
- glitz_surface_t *dst,
- int x_src,
- int y_src,
- int width,
- int height,
- int x_dst,
- int y_dst);
-
-#if defined(__cplusplus) || defined(c_plusplus)
-}
-#endif
-
-#endif /* GLITZ_H_INCLUDED */
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz.man
+++ /dev/null
@@ -1,38 +0,0 @@
-.\"
-.\"
-.de TQ
-.br
-.ns
-.TP
-\\$1
-..
-.TH GLITZ 3 "Version 1.0"
-
-.SH NAME
-GLITZ \- OpenGL image compositing library
-
-.SH SYNOPSIS
-.nf
-.B #include <glitz.h>
-.fi
-.SH DESCRIPTION
-
-Glitz is an OpenGL image compositing library. Glitz provides
-Porter/Duff compositing of images and implicit mask generation for
-geometric primitives including trapezoids, triangles, and rectangles.
-
-The semantics of glitz are designed to precisely match the
-specification of the X Render extension. Glitz does not only implement
-X Render features like component alpha and image transformations, but
-also support for additional features like convolution filters and color
-gradients, which are not currently part of the X Render specification.
-
-The performance and capabilities of glitz are much dependent on
-graphics hardware. Glitz does not in any way handle software
-fall-backs when graphics hardware is insufficient. However, glitz
-will report if any requested operation cannot be carried out by
-graphics hardware, hence making a higher level software layer
-responsible for appropriate actions.
-
-.SH AUTHOR
-David Reveman
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz_buffer.c
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitzint.h"
-
-static glitz_status_t
-_glitz_buffer_init (glitz_buffer_t *buffer,
- glitz_drawable_t *drawable,
- void *data,
- unsigned int size,
- glitz_buffer_hint_t hint)
-{
- glitz_gl_enum_t usage;
-
- buffer->ref_count = 1;
- buffer->name = 0;
-
- if (drawable)
- {
- GLITZ_GL_DRAWABLE (drawable);
-
- switch (hint) {
- case GLITZ_BUFFER_HINT_STREAM_DRAW:
- usage = GLITZ_GL_STREAM_DRAW;
- break;
- case GLITZ_BUFFER_HINT_STREAM_READ:
- usage = GLITZ_GL_STREAM_READ;
- break;
- case GLITZ_BUFFER_HINT_STREAM_COPY:
- usage = GLITZ_GL_STREAM_COPY;
- break;
- case GLITZ_BUFFER_HINT_STATIC_DRAW:
- usage = GLITZ_GL_STATIC_DRAW;
- break;
- case GLITZ_BUFFER_HINT_STATIC_READ:
- usage = GLITZ_GL_STATIC_READ;
- break;
- case GLITZ_BUFFER_HINT_STATIC_COPY:
- usage = GLITZ_GL_STATIC_COPY;
- break;
- case GLITZ_BUFFER_HINT_DYNAMIC_DRAW:
- usage = GLITZ_GL_DYNAMIC_DRAW;
- break;
- case GLITZ_BUFFER_HINT_DYNAMIC_READ:
- usage = GLITZ_GL_DYNAMIC_READ;
- break;
- default:
- usage = GLITZ_GL_DYNAMIC_COPY;
- break;
- }
-
- buffer->owns_data = 1;
- buffer->drawable = drawable;
- glitz_drawable_reference (drawable);
-
- drawable->backend->push_current (drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT, NULL);
-
- gl->gen_buffers (1, &buffer->name);
- if (buffer->name) {
- gl->bind_buffer (buffer->target, buffer->name);
- gl->buffer_data (buffer->target, size, data, usage);
- gl->bind_buffer (buffer->target, 0);
- }
-
- drawable->backend->pop_current (drawable);
- }
- else
- {
- buffer->drawable = NULL;
- usage = GLITZ_GL_DYNAMIC_COPY;
- }
-
- if (size > 0 && buffer->name == 0)
- {
- buffer->data = malloc (size);
- if (buffer->data == NULL)
- return GLITZ_STATUS_NO_MEMORY;
-
- if (data)
- memcpy (buffer->data, data, size);
-
- buffer->owns_data = 1;
- }
- else
- {
- buffer->owns_data = 0;
- buffer->data = data;
- }
-
- return GLITZ_STATUS_SUCCESS;
-}
-
-glitz_buffer_t *
-glitz_vertex_buffer_create (glitz_drawable_t *drawable,
- void *data,
- unsigned int size,
- glitz_buffer_hint_t hint)
-{
- glitz_buffer_t *buffer;
- glitz_status_t status;
-
- if (size == 0)
- return NULL;
-
- buffer = (glitz_buffer_t *) malloc (sizeof (glitz_buffer_t));
- if (buffer == NULL)
- return NULL;
-
- buffer->target = GLITZ_GL_ARRAY_BUFFER;
-
- if (drawable->backend->feature_mask &
- GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK)
- status = _glitz_buffer_init (buffer, drawable, data, size, hint);
- else
- status = _glitz_buffer_init (buffer, NULL, data, size, hint);
-
- if (status != GLITZ_STATUS_SUCCESS) {
- free (buffer);
- return NULL;
- }
-
- return buffer;
-}
-
-glitz_buffer_t *
-glitz_pixel_buffer_create (glitz_drawable_t *drawable,
- void *data,
- unsigned int size,
- glitz_buffer_hint_t hint)
-{
- glitz_buffer_t *buffer;
- glitz_status_t status;
-
- if (size == 0)
- return NULL;
-
- buffer = (glitz_buffer_t *) malloc (sizeof (glitz_buffer_t));
- if (buffer == NULL)
- return NULL;
-
- switch (hint) {
- case GLITZ_BUFFER_HINT_STREAM_READ:
- case GLITZ_BUFFER_HINT_STATIC_READ:
- case GLITZ_BUFFER_HINT_DYNAMIC_READ:
- buffer->target = GLITZ_GL_PIXEL_PACK_BUFFER;
- break;
- default:
- buffer->target = GLITZ_GL_PIXEL_UNPACK_BUFFER;
- break;
- }
-
- if (drawable->backend->feature_mask &
- GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK)
- status = _glitz_buffer_init (buffer, drawable, data, size, hint);
- else
- status = _glitz_buffer_init (buffer, NULL, data, size, hint);
-
- if (status != GLITZ_STATUS_SUCCESS) {
- free (buffer);
- return NULL;
- }
-
- return buffer;
-}
-
-glitz_buffer_t *
-glitz_buffer_create_for_data (void *data)
-{
- glitz_buffer_t *buffer;
-
- buffer = (glitz_buffer_t *) malloc (sizeof (glitz_buffer_t));
- if (buffer == NULL)
- return NULL;
-
- if (_glitz_buffer_init (buffer, NULL, data, 0, 0)) {
- free (buffer);
- return NULL;
- }
-
- return buffer;
-}
-
-void
-glitz_buffer_destroy (glitz_buffer_t *buffer)
-{
- if (!buffer)
- return;
-
- buffer->ref_count--;
- if (buffer->ref_count)
- return;
-
- if (buffer->drawable) {
- buffer->drawable->backend->push_current (buffer->drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT,
- NULL);
- buffer->drawable->backend->gl->delete_buffers (1, &buffer->name);
- buffer->drawable->backend->pop_current (buffer->drawable);
- glitz_drawable_destroy (buffer->drawable);
- } else if (buffer->owns_data)
- free (buffer->data);
-
- free (buffer);
-}
-
-void
-glitz_buffer_reference (glitz_buffer_t *buffer)
-{
- if (!buffer)
- return;
-
- buffer->ref_count++;
-}
-
-void
-glitz_buffer_set_data (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- const void *data)
-{
- if (buffer->drawable) {
- GLITZ_GL_DRAWABLE (buffer->drawable);
-
- buffer->drawable->backend->push_current (buffer->drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT,
- NULL);
- gl->bind_buffer (buffer->target, buffer->name);
- gl->buffer_sub_data (buffer->target, offset, size, data);
- gl->bind_buffer (buffer->target, 0);
- buffer->drawable->backend->pop_current (buffer->drawable);
- } else if (buffer->data)
- memcpy ((char *) buffer->data + offset, data, size);
-}
-slim_hidden_def(glitz_buffer_set_data);
-
-void
-glitz_buffer_get_data (glitz_buffer_t *buffer,
- int offset,
- unsigned int size,
- void *data)
-{
- if (buffer->drawable) {
- GLITZ_GL_DRAWABLE (buffer->drawable);
-
- buffer->drawable->backend->push_current (buffer->drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT,
- NULL);
- gl->bind_buffer (buffer->target, buffer->name);
- gl->get_buffer_sub_data (buffer->target, offset, size, data);
- gl->bind_buffer (buffer->target, 0);
-
- buffer->drawable->backend->pop_current (buffer->drawable);
- } else if (buffer->data)
- memcpy (data, (char *) buffer->data + offset, size);
-}
-slim_hidden_def(glitz_buffer_get_data);
-
-void *
-glitz_buffer_map (glitz_buffer_t *buffer,
- glitz_buffer_access_t access)
-{
- void *pointer = NULL;
-
- if (buffer->drawable) {
- glitz_gl_enum_t buffer_access;
-
- GLITZ_GL_DRAWABLE (buffer->drawable);
-
- buffer->drawable->backend->push_current (buffer->drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT,
- NULL);
-
- switch (access) {
- case GLITZ_BUFFER_ACCESS_READ_ONLY:
- buffer_access = GLITZ_GL_READ_ONLY;
- break;
- case GLITZ_BUFFER_ACCESS_WRITE_ONLY:
- buffer_access = GLITZ_GL_WRITE_ONLY;
- break;
- default:
- buffer_access = GLITZ_GL_READ_WRITE;
- break;
- }
-
- gl->bind_buffer (buffer->target, buffer->name);
- pointer = gl->map_buffer (buffer->target, buffer_access);
- gl->bind_buffer (buffer->target, 0);
-
- buffer->drawable->backend->pop_current (buffer->drawable);
- }
-
- if (pointer == NULL)
- pointer = buffer->data;
-
- return pointer;
-}
-
-glitz_status_t
-glitz_buffer_unmap (glitz_buffer_t *buffer)
-{
- glitz_status_t status = GLITZ_STATUS_SUCCESS;
-
- if (buffer->drawable) {
- GLITZ_GL_DRAWABLE (buffer->drawable);
-
- buffer->drawable->backend->push_current (buffer->drawable, NULL,
- GLITZ_ANY_CONTEXT_CURRENT,
- NULL);
-
- gl->bind_buffer (buffer->target, buffer->name);
-
- if (gl->unmap_buffer (buffer->target) == GLITZ_GL_FALSE)
- status = GLITZ_STATUS_CONTENT_DESTROYED;
-
- gl->bind_buffer (buffer->target, 0);
-
- buffer->drawable->backend->pop_current (buffer->drawable);
- }
-
- return status;
-}
-
-void *
-glitz_buffer_bind (glitz_buffer_t *buffer,
- glitz_gl_enum_t target)
-{
- if (buffer->drawable) {
- buffer->drawable->backend->gl->bind_buffer (target, buffer->name);
- buffer->target = target;
-
- return NULL;
- }
-
- return buffer->data;
-}
-
-void
-glitz_buffer_unbind (glitz_buffer_t *buffer)
-{
- if (buffer->drawable)
- buffer->drawable->backend->gl->bind_buffer (buffer->target, 0);
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz_compose.c
+++ /dev/null
@@ -1,623 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitzint.h"
-
-static void
-_glitz_combine_argb_argb (glitz_composite_op_t *op)
-{
- glitz_set_operator (op->gl, op->render_op);
-
- op->gl->active_texture (GLITZ_GL_TEXTURE0);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_REPLACE);
- op->gl->color_4us (0x0, 0x0, 0x0, 0xffff);
-
- op->gl->active_texture (GLITZ_GL_TEXTURE1);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_COMBINE);
-
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_COMBINE_RGB,
- GLITZ_GL_MODULATE);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE0_RGB,
- GLITZ_GL_TEXTURE);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE1_RGB,
- GLITZ_GL_PREVIOUS);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND0_RGB,
- GLITZ_GL_SRC_COLOR);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND1_RGB,
- GLITZ_GL_SRC_ALPHA);
-
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_COMBINE_ALPHA,
- GLITZ_GL_MODULATE);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE0_ALPHA,
- GLITZ_GL_TEXTURE);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE1_ALPHA,
- GLITZ_GL_PREVIOUS);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND0_ALPHA,
- GLITZ_GL_SRC_ALPHA);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND1_ALPHA,
- GLITZ_GL_SRC_ALPHA);
-}
-
-static void
-_glitz_combine_argb_argbc (glitz_composite_op_t *op)
-{
- if (op->count == 0) {
- glitz_set_operator (op->gl, op->render_op);
-
- op->gl->active_texture (GLITZ_GL_TEXTURE0);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_COMBINE);
-
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_COMBINE_RGB,
- GLITZ_GL_INTERPOLATE);
-
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE0_RGB,
- GLITZ_GL_TEXTURE);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE1_RGB,
- GLITZ_GL_PRIMARY_COLOR);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE2_RGB,
- GLITZ_GL_PRIMARY_COLOR);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND0_RGB,
- GLITZ_GL_SRC_COLOR);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND1_RGB,
- GLITZ_GL_SRC_COLOR);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND2_RGB,
- GLITZ_GL_SRC_ALPHA);
-
- /* we don't care about the alpha channel */
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_COMBINE_ALPHA,
- GLITZ_GL_REPLACE);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE0_ALPHA,
- GLITZ_GL_PRIMARY_COLOR);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND0_ALPHA,
- GLITZ_GL_SRC_ALPHA);
-
-
- op->gl->active_texture (GLITZ_GL_TEXTURE1);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_COMBINE);
-
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_COMBINE_RGB,
- GLITZ_GL_DOT3_RGBA);
-
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE0_RGB,
- GLITZ_GL_PREVIOUS);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE1_RGB,
- GLITZ_GL_PRIMARY_COLOR);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND0_RGB,
- GLITZ_GL_SRC_COLOR);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND1_RGB,
- GLITZ_GL_SRC_COLOR);
-
- op->gl->active_texture (GLITZ_GL_TEXTURE2);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_MODULATE);
- }
-
- if (op->alpha_mask.red) {
- op->gl->color_4f (1.0f, 0.5f, 0.5f, 0.5f);
- } else if (op->alpha_mask.green) {
- op->gl->color_4f (0.5f, 1.0f, 0.5f, 0.5f);
- } else if (op->alpha_mask.blue) {
- op->gl->color_4f (0.5f, 0.5f, 1.0f, 0.5f);
- } else {
- op->gl->active_texture (GLITZ_GL_TEXTURE0);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_REPLACE);
- op->gl->color_4us (0x0, 0x0, 0x0, 0xffff);
-
- op->gl->active_texture (GLITZ_GL_TEXTURE1);
- glitz_texture_unbind (op->gl, &op->src->texture);
-
- op->gl->active_texture (GLITZ_GL_TEXTURE2);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_MODULATE);
- }
-}
-
-static void
-_glitz_combine_argb_argbf (glitz_composite_op_t *op)
-{
- glitz_set_operator (op->gl, op->render_op);
- glitz_filter_enable (op->mask, op);
-
- op->gl->color_4us (op->alpha_mask.red,
- op->alpha_mask.green,
- op->alpha_mask.blue,
- op->alpha_mask.alpha);
-}
-
-static void
-_glitz_combine_argb_solid (glitz_composite_op_t *op)
-{
- glitz_set_operator (op->gl, op->render_op);
-
- if (op->alpha_mask.alpha != 0xffff) {
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_MODULATE);
- op->gl->color_4us (op->alpha_mask.alpha,
- op->alpha_mask.alpha,
- op->alpha_mask.alpha,
- op->alpha_mask.alpha);
- } else {
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_REPLACE);
- op->gl->color_4us (0x0, 0x0, 0x0, 0xffff);
- }
-}
-
-static void
-_glitz_combine_argb_solidc (glitz_composite_op_t *op)
-{
- unsigned short alpha;
-
- if (op->count == 0)
- glitz_set_operator (op->gl, op->render_op);
-
- if (op->alpha_mask.red)
- alpha = op->alpha_mask.red;
- else if (op->alpha_mask.green)
- alpha = op->alpha_mask.green;
- else if (op->alpha_mask.blue)
- alpha = op->alpha_mask.blue;
- else
- alpha = op->alpha_mask.alpha;
-
- if (alpha != 0xffff) {
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_MODULATE);
- op->gl->color_4us (alpha, alpha, alpha, alpha);
- } else {
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_REPLACE);
- op->gl->color_4us (0x0, 0x0, 0x0, 0xffff);
- }
-}
-
-static void
-_glitz_combine_argbf_solid (glitz_composite_op_t *op)
-{
- if (op->count == 0) {
- glitz_set_operator (op->gl, op->render_op);
- glitz_filter_enable (op->src, op);
- }
-
- op->gl->color_4us (0x0, 0x0, 0x0, op->alpha_mask.alpha);
-}
-
-static void
-_glitz_combine_argbf_argbc (glitz_composite_op_t *op)
-{
- if (op->count == 0) {
- glitz_set_operator (op->gl, op->render_op);
- glitz_filter_enable (op->src, op);
- }
-
- op->gl->color_4us (op->alpha_mask.red,
- op->alpha_mask.green,
- op->alpha_mask.blue,
- op->alpha_mask.alpha);
-}
-
-static void
-_glitz_combine_argbf_solidc (glitz_composite_op_t *op)
-{
- unsigned short alpha;
-
- if (op->count == 0) {
- glitz_set_operator (op->gl, op->render_op);
- glitz_filter_enable (op->src, op);
- }
-
- if (op->alpha_mask.red)
- alpha = op->alpha_mask.red;
- else if (op->alpha_mask.green)
- alpha = op->alpha_mask.green;
- else if (op->alpha_mask.blue)
- alpha = op->alpha_mask.blue;
- else
- alpha = op->alpha_mask.alpha;
-
- op->gl->color_4us (0x0, 0x0, 0x0, alpha);
-}
-
-static void
-_glitz_combine_solid_solid (glitz_composite_op_t *op)
-{
- glitz_set_operator (op->gl, op->render_op);
-
- op->gl->color_4us (SHORT_MULT (op->solid->red, op->alpha_mask.alpha),
- SHORT_MULT (op->solid->green, op->alpha_mask.alpha),
- SHORT_MULT (op->solid->blue, op->alpha_mask.alpha),
- SHORT_MULT (op->solid->alpha, op->alpha_mask.alpha));
-}
-
-static void
-_glitz_combine_solid_argb (glitz_composite_op_t *op)
-{
- glitz_set_operator (op->gl, op->render_op);
-
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_COMBINE);
-
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_COMBINE_RGB,
- GLITZ_GL_MODULATE);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE0_RGB,
- GLITZ_GL_TEXTURE);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE1_RGB,
- GLITZ_GL_PRIMARY_COLOR);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND0_RGB,
- GLITZ_GL_SRC_ALPHA);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND1_RGB,
- GLITZ_GL_SRC_COLOR);
-
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_COMBINE_ALPHA,
- GLITZ_GL_MODULATE);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE0_ALPHA,
- GLITZ_GL_TEXTURE);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_SOURCE1_ALPHA,
- GLITZ_GL_PRIMARY_COLOR);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND0_ALPHA,
- GLITZ_GL_SRC_ALPHA);
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_OPERAND1_ALPHA,
- GLITZ_GL_SRC_ALPHA);
-
- op->gl->color_4us (SHORT_MULT (op->solid->red, op->alpha_mask.alpha),
- SHORT_MULT (op->solid->green, op->alpha_mask.alpha),
- SHORT_MULT (op->solid->blue, op->alpha_mask.alpha),
- SHORT_MULT (op->solid->alpha, op->alpha_mask.alpha));
-}
-
-/* This only works with the OVER operator. */
-static void
-_glitz_combine_solid_argbc (glitz_composite_op_t *op)
-{
- glitz_color_t solid;
-
- solid.red = SHORT_MULT (op->solid->red, op->alpha_mask.alpha);
- solid.green = SHORT_MULT (op->solid->green, op->alpha_mask.alpha);
- solid.blue = SHORT_MULT (op->solid->blue, op->alpha_mask.alpha);
- solid.alpha = SHORT_MULT (op->solid->alpha, op->alpha_mask.alpha);
-
- op->gl->enable (GLITZ_GL_BLEND);
- op->gl->blend_func (GLITZ_GL_CONSTANT_COLOR, GLITZ_GL_ONE_MINUS_SRC_COLOR);
-
- if (solid.alpha > 0)
- op->gl->blend_color ((glitz_gl_clampf_t) solid.red / solid.alpha,
- (glitz_gl_clampf_t) solid.green / solid.alpha,
- (glitz_gl_clampf_t) solid.blue / solid.alpha,
- 1.0f);
- else
- op->gl->blend_color (1.0f, 1.0f, 1.0f, 1.0f);
-
- op->gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
- GLITZ_GL_MODULATE);
- op->gl->color_4us (solid.alpha,
- solid.alpha,
- solid.alpha,
- solid.alpha);
-}
-
-static void
-_glitz_combine_solid_argbf (glitz_composite_op_t *op)
-{
- glitz_set_operator (op->gl, op->render_op);
- glitz_filter_enable (op->mask, op);
-
- op->gl->color_4us (SHORT_MULT (op->solid->red, op->alpha_mask.alpha),
- SHORT_MULT (op->solid->green, op->alpha_mask.alpha),
- SHORT_MULT (op->solid->blue, op->alpha_mask.alpha),
- SHORT_MULT (op->solid->alpha, op->alpha_mask.alpha));
-}
-
-/* This only works with the OVER operator. */
-static void
-_glitz_combine_solid_solidc (glitz_composite_op_t *op)
-{
- op->gl->enable (GLITZ_GL_BLEND);
- op->gl->blend_func (GLITZ_GL_CONSTANT_COLOR, GLITZ_GL_ONE_MINUS_SRC_COLOR);
-
- if (op->solid->alpha > 0)
- op->gl->blend_color ((glitz_gl_clampf_t)
- op->solid->red / op->solid->alpha,
- (glitz_gl_clampf_t)
- op->solid->green / op->solid->alpha,
- (glitz_gl_clampf_t)
- op->solid->blue / op->solid->alpha,
- 1.0f);
- else
- op->gl->blend_color (1.0f, 1.0f, 1.0f, 1.0f);
-
- op->gl->color_4us (SHORT_MULT (op->alpha_mask.red, op->solid->alpha),
- SHORT_MULT (op->alpha_mask.green, op->solid->alpha),
- SHORT_MULT (op->alpha_mask.blue, op->solid->alpha),
- SHORT_MULT (op->alpha_mask.alpha, op->solid->alpha));
-}
-
-static glitz_combine_t
-_glitz_combine_map[GLITZ_SURFACE_TYPES][GLITZ_SURFACE_TYPES] = {
- {
- { GLITZ_COMBINE_TYPE_NA, NULL, 0, 0 },
- { GLITZ_COMBINE_TYPE_NA, NULL, 0, 0 },
- { GLITZ_COMBINE_TYPE_NA, NULL, 0, 0 },
- { GLITZ_COMBINE_TYPE_NA, NULL, 0, 0 },
- { GLITZ_COMBINE_TYPE_NA, NULL, 0, 0 },
- { GLITZ_COMBINE_TYPE_NA, NULL, 0, 0 }
- }, {
- { GLITZ_COMBINE_TYPE_ARGB, _glitz_combine_argb_solid, 1, 0 },
- { GLITZ_COMBINE_TYPE_ARGB_ARGB, _glitz_combine_argb_argb, 2, 0 },
- { GLITZ_COMBINE_TYPE_ARGB_ARGBC, _glitz_combine_argb_argbc, 3, 0 },
- { GLITZ_COMBINE_TYPE_ARGB_ARGBF, _glitz_combine_argb_argbf, 2, 2 },
- { GLITZ_COMBINE_TYPE_ARGB_SOLID, _glitz_combine_argb_solid, 1, 0 },
- { GLITZ_COMBINE_TYPE_ARGB_SOLIDC, _glitz_combine_argb_solidc, 1, 0 }
- }, {
- { GLITZ_COMBINE_TYPE_ARGB, _glitz_combine_argb_solid, 1, 0 },
- { GLITZ_COMBINE_TYPE_ARGB_ARGB, _glitz_combine_argb_argb, 2, 0 },
- { GLITZ_COMBINE_TYPE_ARGB_ARGBC, _glitz_combine_argb_argbc, 3, 0 },
- { GLITZ_COMBINE_TYPE_ARGB_ARGBF, _glitz_combine_argb_argbf, 2, 2 },
- { GLITZ_COMBINE_TYPE_ARGB_SOLID, _glitz_combine_argb_solid, 1, 0 },
- { GLITZ_COMBINE_TYPE_ARGB_SOLIDC, _glitz_combine_argb_solidc, 1, 0 }
- }, {
- { GLITZ_COMBINE_TYPE_ARGBF, _glitz_combine_argbf_solid, 1, 1 },
- { GLITZ_COMBINE_TYPE_ARGBF_ARGB, _glitz_combine_argbf_solid, 2, 1 },
- { GLITZ_COMBINE_TYPE_ARGBF_ARGBC, _glitz_combine_argbf_argbc, 2, 1 },
- { GLITZ_COMBINE_TYPE_NA, NULL, 0, 0 },
- { GLITZ_COMBINE_TYPE_ARGBF_SOLID, _glitz_combine_argbf_solid, 1, 1 },
- { GLITZ_COMBINE_TYPE_ARGBF_SOLIDC, _glitz_combine_argbf_solidc, 1, 1 }
- }, {
- { GLITZ_COMBINE_TYPE_SOLID, _glitz_combine_solid_solid, 0, 0 },
- { GLITZ_COMBINE_TYPE_SOLID_ARGB, _glitz_combine_solid_argb, 1, 0 },
- { GLITZ_COMBINE_TYPE_SOLID_ARGBC, _glitz_combine_solid_argbc, 1, 0 },
- { GLITZ_COMBINE_TYPE_SOLID_ARGBF, _glitz_combine_solid_argbf, 1, 2 },
- { GLITZ_COMBINE_TYPE_SOLID_SOLID, _glitz_combine_solid_solid, 0, 0 },
- { GLITZ_COMBINE_TYPE_SOLID_SOLIDC, _glitz_combine_solid_solidc, 1, 0 }
- }, {
- { GLITZ_COMBINE_TYPE_SOLID, _glitz_combine_solid_solid, 0, 0 },
- { GLITZ_COMBINE_TYPE_SOLID_ARGB, _glitz_combine_solid_argb, 1, 0 },
- { GLITZ_COMBINE_TYPE_SOLID_ARGBC, _glitz_combine_solid_argbc, 1, 0 },
- { GLITZ_COMBINE_TYPE_SOLID_ARGBF, _glitz_combine_solid_argbf, 1, 2 },
- { GLITZ_COMBINE_TYPE_SOLID_SOLID, _glitz_combine_solid_solid, 0, 0 },
- { GLITZ_COMBINE_TYPE_SOLID_SOLIDC, _glitz_combine_solid_solidc, 1, 0 }
- }
-};
-
-#define SURFACE_WRAP(surface, feature_mask) \
- (SURFACE_REPEAT (surface)? \
- (TEXTURE_REPEATABLE (&(surface)->texture) && \
- ( \
- (!SURFACE_MIRRORED (surface)) || \
- ((feature_mask) & GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK) \
- ) \
- ) \
- : \
- ((SURFACE_PAD (surface))? \
- (TEXTURE_PADABLE (&(surface)->texture)) \
- : \
- (TEXTURE_CLAMPABLE (&(surface)->texture) && \
- ((!SURFACE_PROJECTIVE_TRANSFORM (surface)) || \
- ((feature_mask) & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) \
- ) \
- ) \
- ) \
- )
-
-static glitz_surface_type_t
-_glitz_get_surface_type (glitz_surface_t *surface,
- unsigned long feature_mask)
-{
- if (surface == NULL)
- return GLITZ_SURFACE_TYPE_NULL;
-
- if (SURFACE_SOLID (surface) &&
- (SURFACE_REPEAT (surface) || SURFACE_PAD (surface))) {
- if (SURFACE_COMPONENT_ALPHA (surface))
- return GLITZ_SURFACE_TYPE_SOLIDC;
- else
- return GLITZ_SURFACE_TYPE_SOLID;
- }
-
- if (SURFACE_WRAP (surface, feature_mask)) {
- if (SURFACE_FRAGMENT_FILTER (surface)) {
- if (SURFACE_COMPONENT_ALPHA (surface))
- return GLITZ_SURFACE_TYPE_NA;
-
- if (feature_mask & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK)
- return GLITZ_SURFACE_TYPE_ARGBF;
-
- } else if (SURFACE_COMPONENT_ALPHA (surface)) {
- return GLITZ_SURFACE_TYPE_ARGBC;
- } else
- return GLITZ_SURFACE_TYPE_ARGB;
- }
-
- return GLITZ_SURFACE_TYPE_NA;
-}
-
-static glitz_color_t _default_alpha_mask = {
- 0xffff, 0xffff, 0xffff, 0xffff
-};
-
-void
-glitz_composite_op_init (glitz_composite_op_t *op,
- glitz_operator_t render_op,
- glitz_surface_t *src,
- glitz_surface_t *mask,
- glitz_surface_t *dst)
-{
- glitz_surface_type_t src_type;
- glitz_surface_type_t mask_type;
- glitz_combine_t *combine;
- unsigned long feature_mask;
-
- op->render_op = render_op;
- op->type = GLITZ_COMBINE_TYPE_NA;
- op->combine = NULL;
- op->alpha_mask = _default_alpha_mask;
- op->src = src;
- op->mask = mask;
- op->dst = dst;
- op->count = 0;
- op->solid = NULL;
- op->per_component = 0;
- op->fp = 0;
-
- if (dst->attached)
- {
- op->gl = dst->attached->backend->gl;
- feature_mask = dst->attached->backend->feature_mask;
- }
- else
- {
- op->gl = dst->drawable->backend->gl;
- feature_mask = dst->drawable->backend->feature_mask;
- }
-
- src_type = _glitz_get_surface_type (src, feature_mask);
- if (src_type < 1)
- return;
-
- mask_type = _glitz_get_surface_type (mask, feature_mask);
- if (mask_type < 0)
- return;
-
- if (src_type == GLITZ_SURFACE_TYPE_SOLIDC)
- src_type = GLITZ_SURFACE_TYPE_SOLID;
-
- /* We can't do solid IN argbc OP dest, unless OP is OVER.
- But we can do argb IN argbc OP dest, so lets just not use the
- source as a solid color if this is the case. I need to figure out
- a better way to handle special cases like this. */
- if (src_type == GLITZ_SURFACE_TYPE_SOLID &&
- (mask_type == GLITZ_SURFACE_TYPE_SOLIDC ||
- mask_type == GLITZ_SURFACE_TYPE_ARGBC) &&
- render_op != GLITZ_OPERATOR_OVER)
- src_type = GLITZ_SURFACE_TYPE_ARGB;
-
- combine = &_glitz_combine_map[src_type][mask_type];
- if (!combine->type)
- return;
-
- if (dst->geometry.type == GLITZ_GEOMETRY_TYPE_BITMAP)
- {
- /* We can't do anything but solid colors with bitmaps yet. */
- if (src_type != GLITZ_SURFACE_TYPE_SOLID ||
- (mask_type != GLITZ_SURFACE_TYPE_NULL &&
- mask_type != GLITZ_SURFACE_TYPE_SOLID))
- return;
- }
-
- if (src_type == GLITZ_SURFACE_TYPE_SOLID) {
- if (SURFACE_SOLID_DAMAGE (src)) {
- glitz_surface_push_current (dst, GLITZ_ANY_CONTEXT_CURRENT);
- glitz_surface_sync_solid (src);
- glitz_surface_pop_current (dst);
- }
- op->solid = &src->solid;
- op->src = NULL;
- }
-
- if (mask_type == GLITZ_SURFACE_TYPE_SOLID) {
- if (SURFACE_SOLID_DAMAGE (mask)) {
- glitz_surface_push_current (dst, GLITZ_ANY_CONTEXT_CURRENT);
- glitz_surface_sync_solid (mask);
- glitz_surface_pop_current (dst);
- }
- op->alpha_mask = mask->solid;
- op->mask = NULL;
- op->combine = combine;
- } else if (mask_type == GLITZ_SURFACE_TYPE_SOLIDC) {
- if (SURFACE_SOLID_DAMAGE (mask)) {
- glitz_surface_push_current (dst, GLITZ_ANY_CONTEXT_CURRENT);
- glitz_surface_sync_solid (mask);
- glitz_surface_pop_current (dst);
- }
- op->alpha_mask = mask->solid;
- op->mask = NULL;
-
- if (op->src) {
- op->per_component = 4;
- op->combine = combine;
- } else if (feature_mask & GLITZ_FEATURE_BLEND_COLOR_MASK)
- op->combine = combine;
-
- } else if (mask_type != GLITZ_SURFACE_TYPE_NULL) {
- if (mask_type == GLITZ_SURFACE_TYPE_ARGBC) {
- if (op->src) {
- /* we can't do component alpha with alpha only surfaces */
- if (op->src->format->color.red_size) {
- op->per_component = 4;
- if (feature_mask & GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK)
- op->combine = combine;
- }
- } else if (feature_mask & GLITZ_FEATURE_BLEND_COLOR_MASK)
- op->combine = combine;
- } else if (feature_mask & GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK)
- op->combine = combine;
- } else
- op->combine = combine;
-
- if (!(feature_mask & GLITZ_FEATURE_MULTITEXTURE_MASK)) {
- if (op->src && op->mask)
- op->combine = NULL;
- }
-
- if (op->per_component &&
- (!(feature_mask & GLITZ_FEATURE_PER_COMPONENT_RENDERING_MASK)))
- op->combine = NULL;
-
- if (op->combine == combine) {
- op->type = combine->type;
- if (combine->source_shader) {
- if (combine->source_shader == 1)
- op->fp = glitz_filter_get_fragment_program (src, op);
- else
- op->fp = glitz_filter_get_fragment_program (mask, op);
- if (op->fp == 0)
- op->type = GLITZ_COMBINE_TYPE_NA;
- }
- }
-}
-
-void
-glitz_composite_enable (glitz_composite_op_t *op)
-{
- op->combine->enable (op);
- op->count++;
-}
-
-void
-glitz_composite_disable (glitz_composite_op_t *op)
-{
- if (op->fp) {
- op->gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, 0);
- op->gl->disable (GLITZ_GL_FRAGMENT_PROGRAM);
- }
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz_context.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitzint.h"
-
-void
-_glitz_context_init (glitz_context_t *context,
- glitz_drawable_t *drawable)
-{
- glitz_drawable_reference (drawable);
-
- context->ref_count = 1;
- context->drawable = drawable;
- context->closure = NULL;
- context->lose_current = NULL;
-}
-
-void
-_glitz_context_fini (glitz_context_t *context)
-{
- glitz_drawable_destroy (context->drawable);
-}
-
-glitz_context_t *
-glitz_context_create (glitz_drawable_t *drawable,
- glitz_drawable_format_t *format)
-{
- return drawable->backend->create_context (drawable, format);
-}
-slim_hidden_def(glitz_context_create);
-
-void
-glitz_context_destroy (glitz_context_t *context)
-{
- if (!context)
- return;
-
- context->ref_count--;
- if (context->ref_count)
- return;
-
- context->drawable->backend->destroy_context (context);
-}
-slim_hidden_def(glitz_context_destroy);
-
-void
-glitz_context_reference (glitz_context_t *context)
-{
- if (!context)
- return;
-
- context->ref_count++;
-}
-slim_hidden_def(glitz_context_reference);
-
-void
-glitz_context_copy (glitz_context_t *src,
- glitz_context_t *dst,
- unsigned long mask)
-{
- src->drawable->backend->copy_context (src, dst, mask);
-}
-slim_hidden_def(glitz_context_copy);
-
-void
-glitz_context_set_user_data (glitz_context_t *context,
- void *closure,
- glitz_lose_current_function_t lose_current)
-{
- context->closure = closure;
- context->lose_current = lose_current;
-}
-slim_hidden_def(glitz_context_set_user_data);
-
-glitz_function_pointer_t
-glitz_context_get_proc_address (glitz_context_t *context,
- const char *name)
-{
- return context->drawable->backend->get_proc_address (context, name);
-}
-slim_hidden_def(glitz_context_get_proc_address);
-
-void
-glitz_context_make_current (glitz_context_t *context,
- glitz_drawable_t *drawable)
-{
- glitz_lose_current_function_t lose_current;
-
- lose_current = context->lose_current;
- context->lose_current = 0;
-
- if (drawable != context->drawable)
- {
- glitz_drawable_reference (drawable);
- glitz_drawable_destroy (context->drawable);
- context->drawable = drawable;
- }
-
- if (drawable->front)
- {
- if (REGION_NOTEMPTY (&drawable->front->drawable_damage))
- {
- glitz_surface_push_current (drawable->front,
- GLITZ_DRAWABLE_CURRENT);
- glitz_surface_pop_current (drawable->front);
- }
-
- glitz_surface_damage (drawable->front, NULL,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_SOLID_MASK);
- }
-
- if (drawable->back)
- {
- if (REGION_NOTEMPTY (&drawable->back->drawable_damage))
- {
- glitz_surface_push_current (drawable->back,
- GLITZ_DRAWABLE_CURRENT);
- glitz_surface_pop_current (drawable->back);
- }
-
- glitz_surface_damage (drawable->back, NULL,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_SOLID_MASK);
- }
-
- context->lose_current = lose_current;
-
- drawable->backend->make_current (drawable, context);
-}
-slim_hidden_def(glitz_context_make_current);
-
-void
-glitz_context_bind_texture (glitz_context_t *context,
- glitz_texture_object_t *texture)
-{
- glitz_gl_proc_address_list_t *gl = context->drawable->backend->gl;
-
- if (REGION_NOTEMPTY (&texture->surface->texture_damage))
- {
- glitz_lose_current_function_t lose_current;
-
- lose_current = context->lose_current;
- context->lose_current = 0;
-
- glitz_surface_push_current (texture->surface, GLITZ_CONTEXT_CURRENT);
- _glitz_surface_sync_texture (texture->surface);
- glitz_surface_pop_current (texture->surface);
-
- context->lose_current = lose_current;
-
- glitz_context_make_current (context, context->drawable);
- }
-
- gl->bind_texture (texture->surface->texture.target,
- texture->surface->texture.name);
-
- glitz_texture_ensure_parameters (gl,
- &texture->surface->texture,
- &texture->param);
-}
-slim_hidden_def(glitz_context_bind_texture);
-
-void
-glitz_context_draw_buffers (glitz_context_t *context,
- const glitz_drawable_buffer_t *buffers,
- int n)
-{
- unsigned int mask = 0;
-
-#define FRONT_BIT (1 << 0)
-#define BACK_BIT (1 << 1)
-
- while (n--)
- {
- switch (*buffers++) {
- case GLITZ_DRAWABLE_BUFFER_FRONT_COLOR:
- mask |= FRONT_BIT;
- break;
- case GLITZ_DRAWABLE_BUFFER_BACK_COLOR:
- mask |= BACK_BIT;
- default:
- break;
- }
- }
-
- if (mask)
- {
- static const glitz_gl_enum_t mode[] = {
- GLITZ_GL_FRONT,
- GLITZ_GL_BACK,
- GLITZ_GL_FRONT_AND_BACK
- };
-
- context->drawable->backend->draw_buffer (context->drawable,
- mode[mask - 1]);
- }
-
-#undef FRONT_BIT
-#undef BACK_BIT
-
-}
-slim_hidden_def(glitz_context_draw_buffers);
-
-void
-glitz_context_read_buffer (glitz_context_t *context,
- const glitz_drawable_buffer_t buffer)
-{
- switch (buffer) {
- case GLITZ_DRAWABLE_BUFFER_FRONT_COLOR:
- context->drawable->backend->read_buffer (context->drawable,
- GLITZ_GL_FRONT);
- break;
- case GLITZ_DRAWABLE_BUFFER_BACK_COLOR:
- context->drawable->backend->read_buffer (context->drawable,
- GLITZ_GL_BACK);
- default:
- break;
- }
-}
-slim_hidden_def(glitz_context_read_buffer);
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz_drawable.c
+++ /dev/null
@@ -1,410 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitzint.h"
-
-void
-_glitz_drawable_init (glitz_drawable_t *drawable,
- glitz_int_drawable_format_t *format,
- glitz_backend_t *backend,
- int width,
- int height)
-{
- drawable->ref_count = 1;
-
- drawable->format = format;
- drawable->backend = backend;
-
- drawable->width = width;
- drawable->height = height;
-
- drawable->front = NULL;
- drawable->back = NULL;
-
- drawable->viewport.x = -32767;
- drawable->viewport.y = -32767;
- drawable->viewport.width = 65535;
- drawable->viewport.height = 65535;
-
- drawable->update_all = 1;
- drawable->flushed = 0;
- drawable->finished = 0;
-}
-
-void
-_glitz_drawable_draw_buffer (void *abstract_drawable,
- const glitz_gl_enum_t buffer)
-{
- glitz_drawable_t *drawable = abstract_drawable;
-
- GLITZ_GL_DRAWABLE (drawable);
-
- gl->draw_buffer (buffer);
-}
-
-void
-_glitz_drawable_read_buffer (void *abstract_drawable,
- const glitz_gl_enum_t buffer)
-{
- glitz_drawable_t *drawable = abstract_drawable;
-
- GLITZ_GL_DRAWABLE (drawable);
-
- gl->read_buffer (buffer);
-}
-
-static glitz_bool_t
-_glitz_drawable_size_check (glitz_drawable_t *other,
- unsigned int width,
- unsigned int height)
-{
- if (width == 0 || height == 0)
- return 0;
-
- if (width > other->backend->max_viewport_dims[0] ||
- height > other->backend->max_viewport_dims[1])
- return 0;
-
- return 1;
-}
-
-glitz_drawable_t *
-glitz_create_drawable (glitz_drawable_t *other,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height)
-{
- glitz_int_drawable_format_t *iformat;
-
- if (!_glitz_drawable_size_check (other, width, height))
- return NULL;
-
- if (format->id >= other->backend->n_drawable_formats)
- return NULL;
-
- iformat = &other->backend->drawable_formats[format->id];
- if (!(iformat->types & GLITZ_DRAWABLE_TYPE_FBO_MASK))
- return NULL;
-
- return _glitz_fbo_drawable_create (other, iformat, width, height);
-}
-slim_hidden_def(glitz_create_drawable);
-
-glitz_drawable_t *
-glitz_create_pbuffer_drawable (glitz_drawable_t *other,
- glitz_drawable_format_t *format,
- unsigned int width,
- unsigned int height)
-{
- glitz_int_drawable_format_t *iformat;
-
- if (!_glitz_drawable_size_check (other, width, height))
- return NULL;
-
- if (format->id >= other->backend->n_drawable_formats)
- return NULL;
-
- iformat = &other->backend->drawable_formats[format->id];
- if (!(iformat->types & GLITZ_DRAWABLE_TYPE_PBUFFER_MASK))
- return NULL;
-
- return other->backend->create_pbuffer (other, format, width, height);
-}
-slim_hidden_def(glitz_create_pbuffer_drawable);
-
-void
-glitz_drawable_destroy (glitz_drawable_t *drawable)
-{
- if (!drawable)
- return;
-
- drawable->ref_count--;
- if (drawable->ref_count)
- return;
-
- drawable->backend->destroy (drawable);
-}
-
-void
-glitz_drawable_reference (glitz_drawable_t *drawable)
-{
- if (!drawable)
- return;
-
- drawable->ref_count++;
-}
-
-void
-glitz_drawable_update_size (glitz_drawable_t *drawable,
- unsigned int width,
- unsigned int height)
-{
- drawable->width = (int) width;
- drawable->height = (int) height;
-
- drawable->viewport.x = -32767;
- drawable->viewport.y = -32767;
- drawable->viewport.width = 65535;
- drawable->viewport.height = 65535;
-
- drawable->update_all = 1;
-}
-
-unsigned int
-glitz_drawable_get_width (glitz_drawable_t *drawable)
-{
- return (unsigned int) drawable->width;
-}
-slim_hidden_def(glitz_drawable_get_width);
-
-unsigned int
-glitz_drawable_get_height (glitz_drawable_t *drawable)
-{
- return (unsigned int) drawable->height;
-}
-slim_hidden_def(glitz_drawable_get_height);
-
-void
-glitz_drawable_swap_buffer_region (glitz_drawable_t *drawable,
- int x_origin,
- int y_origin,
- glitz_box_t *box,
- int n_box)
-{
- glitz_box_t rect;
- glitz_surface_t *surface = NULL;
- int x_pos, y_pos;
- int x, y, w, h;
-
- GLITZ_GL_DRAWABLE (drawable);
-
- if (!drawable->format->d.doublebuffer || !n_box)
- return;
-
- /* try swap buffers (fastest) */
- if (n_box == 1)
- {
- rect.x1 = x_origin + box->x1;
- rect.y1 = y_origin + box->y1;
- rect.x2 = x_origin + box->x2;
- rect.y2 = y_origin + box->y2;
-
- if (rect.x1 <= 0 &&
- rect.y1 <= 0 &&
- rect.x2 >= drawable->width &&
- rect.x2 >= drawable->height)
- {
- if (drawable->backend->swap_buffers (drawable))
- {
- if (drawable->front)
- {
- REGION_EMPTY (&drawable->front->drawable_damage);
- glitz_surface_damage (drawable->front, NULL,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_SOLID_MASK);
- }
- return;
- }
- }
- }
-
- /* try copy sub buffer (almost as fast) */
- while (n_box)
- {
- rect.x1 = x_origin + box->x1;
- rect.y1 = y_origin + box->y1;
- rect.x2 = x_origin + box->x2;
- rect.y2 = y_origin + box->y2;
-
- if (rect.x1 < rect.x2 && rect.y1 < rect.y2)
- {
- x = rect.x1;
- y = drawable->height - rect.y2;
- w = rect.x2 - rect.x1;
- h = rect.y2 - rect.y1;
-
- if (!drawable->backend->copy_sub_buffer (drawable, x, y, w, h))
- break;
-
- if (drawable->front)
- glitz_surface_damage (drawable->front, &rect,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_SOLID_MASK);
- }
-
- n_box--;
- box++;
- }
-
- if (!n_box)
- return;
-
- /* do copy pixels (slow) */
- if (drawable->front)
- {
- if (glitz_surface_push_current (drawable->front,
- GLITZ_DRAWABLE_CURRENT))
- surface = drawable->front;
- }
- if (!surface)
- {
- if (drawable->backend->push_current (drawable, NULL,
- GLITZ_DRAWABLE_CURRENT, NULL))
- {
- drawable->update_all = 1;
-
- gl->viewport (0, 0, drawable->width, drawable->height);
- gl->matrix_mode (GLITZ_GL_PROJECTION);
- gl->load_identity ();
- gl->ortho (0.0, drawable->width, 0.0,
- drawable->height, -1.0, 1.0);
- gl->matrix_mode (GLITZ_GL_MODELVIEW);
- gl->load_identity ();
- gl->scale_f (1.0f, -1.0f, 1.0f);
- gl->translate_f (0.0f, -drawable->height, 0.0f);
- }
- else
- {
- drawable->backend->pop_current (drawable);
- return;
- }
- }
-
- gl->disable (GLITZ_GL_DITHER);
-
- drawable->backend->read_buffer (drawable, GLITZ_GL_BACK);
- drawable->backend->draw_buffer (drawable, GLITZ_GL_FRONT);
-
- glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
-
- x_pos = 0;
- y_pos = 0;
-
- glitz_set_raster_pos (gl, x_pos, y_pos);
-
- while (n_box--)
- {
- rect.x1 = x_origin + box->x1;
- rect.y1 = y_origin + box->y1;
- rect.x2 = x_origin + box->x2;
- rect.y2 = y_origin + box->y2;
-
- if (rect.x1 < rect.x2 && rect.y1 < rect.y2)
- {
- x = rect.x1;
- y = drawable->height - rect.y2;
- w = rect.x2 - rect.x1;
- h = rect.y2 - rect.y1;
-
- if (x != x_pos || y != y_pos)
- {
- gl->bitmap (0, 0, 0, 0, x - x_pos, y - y_pos, NULL);
-
- x_pos = x;
- y_pos = y;
- }
-
- gl->scissor (x, y, w, h);
- gl->copy_pixels (x, y, w, h, GLITZ_GL_COLOR);
-
- if (surface)
- glitz_surface_damage (surface, &rect,
- GLITZ_DAMAGE_TEXTURE_MASK |
- GLITZ_DAMAGE_SOLID_MASK);
-
- box++;
- }
- }
-
- drawable->backend->gl->flush ();
- drawable->flushed = 1;
-
- if (surface)
- glitz_surface_pop_current (surface);
- else
- drawable->backend->pop_current (drawable);
-}
-
-void
-glitz_drawable_swap_buffers (glitz_drawable_t *drawable)
-{
- glitz_box_t box;
-
- box.x1 = 0;
- box.y1 = 0;
- box.x2 = drawable->width;
- box.y2 = drawable->height;
-
- glitz_drawable_swap_buffer_region (drawable, 0, 0, &box, 1);
-}
-slim_hidden_def(glitz_drawable_swap_buffers);
-
-void
-glitz_drawable_flush (glitz_drawable_t *drawable)
-{
- if (drawable->flushed)
- return;
-
- drawable->backend->push_current (drawable, NULL, GLITZ_DRAWABLE_CURRENT,
- NULL);
- drawable->backend->gl->flush ();
- drawable->backend->pop_current (drawable);
-
- drawable->flushed = 1;
-}
-slim_hidden_def(glitz_drawable_flush);
-
-void
-glitz_drawable_finish (glitz_drawable_t *drawable)
-{
- if (drawable->finished)
- return;
-
- drawable->backend->push_current (drawable, NULL, GLITZ_DRAWABLE_CURRENT,
- NULL);
- drawable->backend->gl->finish ();
- drawable->backend->pop_current (drawable);
-
- drawable->finished = drawable->flushed = 1;
-}
-slim_hidden_def(glitz_drawable_finish);
-
-unsigned long
-glitz_drawable_get_features (glitz_drawable_t *drawable)
-{
- return drawable->backend->feature_mask;
-}
-slim_hidden_def(glitz_drawable_get_features);
-
-glitz_drawable_format_t *
-glitz_drawable_get_format (glitz_drawable_t *drawable)
-{
- return &drawable->format->d;
-}
-slim_hidden_def(glitz_drawable_get_format);
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz_filter.c
+++ /dev/null
@@ -1,520 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitzint.h"
-
-struct _glitz_filter_params_t {
- int fp_type;
- int id;
- glitz_vec4_t *vectors;
- int n_vectors;
-};
-
-static glitz_status_t
-_glitz_filter_params_ensure (glitz_surface_t *surface,
- int vectors)
-{
- int size;
-
- size = sizeof (glitz_filter_params_t) + vectors * sizeof (glitz_vec4_t);
-
- if (!surface->filter_params ||
- surface->filter_params->n_vectors != vectors)
- {
- if (surface->filter_params)
- free (surface->filter_params);
-
- surface->filter_params = malloc (size);
- if (surface->filter_params == NULL)
- return GLITZ_STATUS_NO_MEMORY;
-
- surface->filter_params->fp_type = 0;
- surface->filter_params->id = 0;
- surface->filter_params->vectors =
- (glitz_vec4_t *) (surface->filter_params + 1);
- surface->filter_params->n_vectors = vectors;
- }
-
- return GLITZ_STATUS_SUCCESS;
-}
-
-static void
-_glitz_filter_params_set (glitz_float_t *value,
- const glitz_float_t default_value,
- glitz_fixed16_16_t **params,
- int *n_params)
-{
- if (*n_params > 0) {
- *value = FIXED_TO_FLOAT (**params);
- (*params)++;
- (*n_params)--;
- } else
- *value = default_value;
-}
-
-static int
-_glitz_color_stop_compare (const void *elem1, const void *elem2)
-{
- return
- (((glitz_vec4_t *) elem1)->v[2] == ((glitz_vec4_t *) elem2)->v[2]) ?
- /* equal offsets, sort on id */
- ((((glitz_vec4_t *) elem1)->v[3] <
- ((glitz_vec4_t *) elem2)->v[3]) ? -1 : 1) :
- /* sort on offset */
- ((((glitz_vec4_t *) elem1)->v[2] <
- ((glitz_vec4_t *) elem2)->v[2]) ? -1 : 1);
-}
-
-glitz_status_t
-glitz_filter_set_params (glitz_surface_t *surface,
- glitz_filter_t filter,
- glitz_fixed16_16_t *params,
- int n_params)
-{
- glitz_vec4_t *vecs;
- int i, size = 0;
-
- switch (filter) {
- case GLITZ_FILTER_CONVOLUTION: {
- glitz_float_t dm, dn;
- int cx, cy, m, n, j;
-
- _glitz_filter_params_set (&dm, 3.0f, ¶ms, &n_params);
- _glitz_filter_params_set (&dn, 3.0f, ¶ms, &n_params);
-
- glitz_clamp_value (&dm, 1.0f, 1024.0f);
- glitz_clamp_value (&dn, 1.0f, 1024.0f);
-
- m = dm;
- n = dn;
-
- size = m * n;
- if (_glitz_filter_params_ensure (surface, size))
- return GLITZ_STATUS_NO_MEMORY;
-
- vecs = surface->filter_params->vectors;
-
- surface->filter_params->id = 0;
-
- /* center point is rounded down in case dimensions are not even */
- cx = m / 2;
- cy = n / 2;
-
- for (i = 0; i < m; i++) {
- glitz_vec4_t *vec;
- glitz_float_t weight;
-
- for (j = 0; j < n; j++) {
- _glitz_filter_params_set (&weight, 0.0f, ¶ms, &n_params);
- if (weight != 0.0f) {
- vec = &vecs[surface->filter_params->id++];
- vec->v[0] = (i - cx) *
- surface->texture.texcoord_width_unit;
- vec->v[1] = (cy - j) *
- surface->texture.texcoord_height_unit;
- vec->v[2] = weight;
- vec->v[3] = 0.0f;
- }
- }
- }
- } break;
- case GLITZ_FILTER_GAUSSIAN: {
- glitz_float_t radius, sigma, alpha, scale, xy_scale, sum;
- int half_size, x, y;
-
- _glitz_filter_params_set (&radius, 1.0f, ¶ms, &n_params);
- glitz_clamp_value (&radius, 0.0f, 1024.0f);
-
- _glitz_filter_params_set (&sigma, radius / 2.0f, ¶ms, &n_params);
- glitz_clamp_value (&sigma, 0.0f, 1024.0f);
-
- _glitz_filter_params_set (&alpha, radius, ¶ms, &n_params);
- glitz_clamp_value (&alpha, 0.0f, 1024.0f);
-
- scale = 1.0f / (2.0f * GLITZ_PI * sigma * sigma);
- half_size = alpha + 0.5f;
-
- if (half_size == 0)
- half_size = 1;
-
- size = half_size * 2 + 1;
- xy_scale = 2.0f * radius / size;
-
- if (_glitz_filter_params_ensure (surface, size * size))
- return GLITZ_STATUS_NO_MEMORY;
-
- vecs = surface->filter_params->vectors;
-
- surface->filter_params->id = 0;
-
- sum = 0.0f;
- for (x = 0; x < size; x++) {
- glitz_vec4_t *vec;
- glitz_float_t fx, fy, amp;
-
- fx = xy_scale * (x - half_size);
-
- for (y = 0; y < size; y++) {
- fy = xy_scale * (y - half_size);
-
- amp = scale * exp ((-1.0f * (fx * fx + fy * fy)) /
- (2.0f * sigma * sigma));
-
- if (amp > 0.0f) {
- vec = &vecs[surface->filter_params->id++];
- vec->v[0] = fx * surface->texture.texcoord_width_unit;
- vec->v[1] = fy * surface->texture.texcoord_height_unit;
- vec->v[2] = amp;
- vec->v[3] = 0.0f;
- sum += amp;
- }
- }
- }
-
- /* normalize */
- if (sum != 0.0f)
- sum = 1.0f / sum;
-
- for (i = 0; i < surface->filter_params->id; i++)
- vecs[i].v[2] *= sum;
- } break;
- case GLITZ_FILTER_LINEAR_GRADIENT:
- case GLITZ_FILTER_RADIAL_GRADIENT:
- if (n_params <= 4) {
- if (surface->box.x2 == 1)
- size = surface->box.y2;
- else if (surface->box.y2 == 1)
- size = surface->box.x2;
- } else
- size = (n_params - 2) / 3;
-
- if (size < 2)
- size = 2;
-
- if (filter == GLITZ_FILTER_LINEAR_GRADIENT)
- {
- glitz_float_t length, dh, dv;
- glitz_float_t start_x, start_y, stop_x, stop_y;
-
- if (_glitz_filter_params_ensure (surface, size + 1))
- return GLITZ_STATUS_NO_MEMORY;
-
- vecs = surface->filter_params->vectors;
-
- _glitz_filter_params_set (&start_x, 0.0f, ¶ms, &n_params);
- _glitz_filter_params_set (&start_y, 0.0f, ¶ms, &n_params);
- _glitz_filter_params_set (&stop_x, 1.0f, ¶ms, &n_params);
- _glitz_filter_params_set (&stop_y, 0.0f, ¶ms, &n_params);
-
- dh = stop_x - start_x;
- dv = stop_y - start_y;
-
- length = dh * dh + dv * dv;
-
- vecs->v[0] = dh / length;
- vecs->v[1] = dv / length;
- vecs->v[2] = -vecs->v[0] * start_x - vecs->v[1] * start_y;
- vecs->v[3] = 0.0f;
- }
- else
- {
- glitz_float_t r0, r1, r, x0, y0, x1, y1, dx, dy;
-
- if (_glitz_filter_params_ensure (surface, size + 2))
- return GLITZ_STATUS_NO_MEMORY;
-
- vecs = surface->filter_params->vectors;
-
- _glitz_filter_params_set (&x0, 0.5f, ¶ms, &n_params);
- _glitz_filter_params_set (&y0, 0.5f, ¶ms, &n_params);
- _glitz_filter_params_set (&r0, 0.0f, ¶ms, &n_params);
-
- _glitz_filter_params_set (&x1, x0, ¶ms, &n_params);
- _glitz_filter_params_set (&y1, y0, ¶ms, &n_params);
- _glitz_filter_params_set (&r1, r0 + 0.5f, ¶ms, &n_params);
-
- glitz_clamp_value (&r0, 0.0f, r1);
-
- r = r0 / r1;
-
- dx = x1 - x0;
- dy = y1 - y0;
-
- vecs->v[0] = x0 - r * dx;
- vecs->v[1] = y0 - r * dy;
- vecs->v[2] = dx * 2.0f;
- vecs->v[3] = dy * 2.0f;
-
- vecs++;
-
- vecs->v[0] = 1.0f / (1.0f + r);
- vecs->v[1] = -r * vecs->v[0];
- vecs->v[2] = (r1 * r1 - dx * dx - dy * dy) * 4.0f;
- vecs->v[3] = 2.0f / vecs->v[2];
- }
-
- vecs++;
- surface->filter_params->id = size;
-
- for (i = 0; i < size; i++) {
- glitz_float_t x_default, y_default, o_default;
-
- o_default = i / (glitz_float_t) (size - 1);
- x_default = (surface->box.x2 * i) / (glitz_float_t) size;
- y_default = (surface->box.y2 * i) / (glitz_float_t) size;
-
- _glitz_filter_params_set (&vecs[i].v[2], o_default, ¶ms,
- &n_params);
- _glitz_filter_params_set (&vecs[i].v[0], x_default, ¶ms,
- &n_params);
- _glitz_filter_params_set (&vecs[i].v[1], y_default, ¶ms,
- &n_params);
-
- glitz_clamp_value (&vecs[i].v[2], 0.0f, 1.0f);
- glitz_clamp_value (&vecs[i].v[0], 0.0f, surface->box.x2 - 1.0f);
- glitz_clamp_value (&vecs[i].v[1], 0.0f, surface->box.y2 - 1.0f);
-
- vecs[i].v[0] += 0.5f;
- vecs[i].v[1] += 0.5f;
-
- vecs[i].v[0] += surface->texture.box.x1;
- vecs[i].v[1] = surface->texture.box.y2 - vecs[i].v[1];
-
- vecs[i].v[0] *= surface->texture.texcoord_width_unit;
- vecs[i].v[1] *= surface->texture.texcoord_height_unit;
-
- vecs[i].v[3] = i;
- }
-
- /* sort color stops in ascending order */
- qsort (vecs, surface->filter_params->id, sizeof (glitz_vec4_t),
- _glitz_color_stop_compare);
-
- for (i = 0; i < size; i++) {
- glitz_float_t diff;
-
- if ((i + 1) == size)
- diff = 1.0f - vecs[i].v[2];
- else
- diff = vecs[i + 1].v[2] - vecs[i].v[2];
-
- if (diff != 0.0f)
- vecs[i].v[3] = 1.0f / diff;
- else
- vecs[i].v[3] = 2147483647.0f;
- }
- break;
- case GLITZ_FILTER_BILINEAR:
- case GLITZ_FILTER_NEAREST:
- switch (surface->format->color.fourcc) {
- case GLITZ_FOURCC_YV12:
- if (_glitz_filter_params_ensure (surface, 2))
- return GLITZ_STATUS_NO_MEMORY;
-
- vecs = surface->filter_params->vectors;
-
- vecs->v[0] = 0.0f;
- vecs->v[1] = surface->texture.texcoord_height_unit *
- ((surface->texture.box.y2 + 1) & ~1);
- vecs->v[2] = surface->texture.texcoord_width_unit *
- (surface->texture.width >> 1);
- vecs->v[3] = 0.0f;
-
- vecs++;
-
- vecs->v[0] = surface->texture.texcoord_width_unit;
- vecs->v[1] = surface->texture.texcoord_height_unit;
- vecs->v[2] = surface->texture.texcoord_width_unit *
- surface->texture.box.x2 - vecs->v[0];
- vecs->v[3] = surface->texture.texcoord_height_unit *
- surface->texture.box.y2 - vecs->v[1];
-
- surface->filter_params->id = 1;
- break;
- default:
- free (surface->filter_params);
- surface->filter_params = NULL;
- }
- break;
- }
-
- glitz_filter_set_type (surface, filter);
-
- return GLITZ_STATUS_SUCCESS;
-}
-
-glitz_gl_uint_t
-glitz_filter_get_fragment_program (glitz_surface_t *surface,
- glitz_composite_op_t *op)
-{
- if (surface->filter_params->fp_type == GLITZ_FP_UNSUPPORTED)
- return 0;
-
- return glitz_get_fragment_program (op,
- surface->filter_params->fp_type,
- surface->filter_params->id);
-}
-
-void
-glitz_filter_set_type (glitz_surface_t *surface,
- glitz_filter_t filter)
-{
- switch (surface->format->color.fourcc) {
- case GLITZ_FOURCC_YV12:
- switch (filter) {
- case GLITZ_FILTER_BILINEAR:
- case GLITZ_FILTER_NEAREST:
- surface->filter_params->fp_type = GLITZ_FP_COLORSPACE_YV12;
- break;
- default:
- surface->filter_params->fp_type = GLITZ_FP_UNSUPPORTED;
- break;
- }
- break;
- default:
- switch (filter) {
- case GLITZ_FILTER_CONVOLUTION:
- case GLITZ_FILTER_GAUSSIAN:
- surface->filter_params->fp_type = GLITZ_FP_CONVOLUTION;
- break;
- case GLITZ_FILTER_LINEAR_GRADIENT:
- if (surface->flags & GLITZ_SURFACE_FLAG_REPEAT_MASK) {
- if (SURFACE_MIRRORED (surface))
- surface->filter_params->fp_type =
- GLITZ_FP_LINEAR_GRADIENT_REFLECT;
- else
- surface->filter_params->fp_type =
- GLITZ_FP_LINEAR_GRADIENT_REPEAT;
- } else if (surface->flags & GLITZ_SURFACE_FLAG_PAD_MASK) {
- surface->filter_params->fp_type =
- GLITZ_FP_LINEAR_GRADIENT_NEAREST;
- } else
- surface->filter_params->fp_type =
- GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT;
- break;
- case GLITZ_FILTER_RADIAL_GRADIENT:
- if (surface->flags & GLITZ_SURFACE_FLAG_REPEAT_MASK) {
- if (SURFACE_MIRRORED (surface))
- surface->filter_params->fp_type =
- GLITZ_FP_RADIAL_GRADIENT_REFLECT;
- else
- surface->filter_params->fp_type =
- GLITZ_FP_RADIAL_GRADIENT_REPEAT;
- } else if (surface->flags & GLITZ_SURFACE_FLAG_PAD_MASK) {
- surface->filter_params->fp_type =
- GLITZ_FP_RADIAL_GRADIENT_NEAREST;
- } else
- surface->filter_params->fp_type =
- GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT;
- default:
- break;
- }
- }
-}
-
-void
-glitz_filter_enable (glitz_surface_t *surface,
- glitz_composite_op_t *op)
-{
- glitz_gl_proc_address_list_t *gl = op->gl;
- int i;
-
- gl->enable (GLITZ_GL_FRAGMENT_PROGRAM);
- gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, op->fp);
-
- switch (surface->filter) {
- case GLITZ_FILTER_GAUSSIAN:
- case GLITZ_FILTER_CONVOLUTION:
- for (i = 0; i < surface->filter_params->id; i++)
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, i,
- surface->filter_params->vectors[i].v);
- break;
- case GLITZ_FILTER_LINEAR_GRADIENT:
- case GLITZ_FILTER_RADIAL_GRADIENT: {
- int j, fp_type = surface->filter_params->fp_type;
- glitz_vec4_t *vec;
-
- vec = surface->filter_params->vectors;
-
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, 0, vec->v);
-
- vec++;
-
- j = 1;
- if (surface->filter == GLITZ_FILTER_RADIAL_GRADIENT)
- {
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, j++,
- vec->v);
-
- vec++;
- }
-
- if (fp_type == GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT ||
- fp_type == GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT) {
- glitz_vec4_t v;
-
- v.v[0] = v.v[1] = -1.0f;
- v.v[2] = 0.0f;
- v.v[3] = (vec->v[3])? 1.0f / vec->v[3]: 1.0f;
-
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, j++, v.v);
- }
-
- for (i = 0; i < surface->filter_params->id; i++, vec++)
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM,
- i + j, vec->v);
-
- if (fp_type == GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT ||
- fp_type == GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT) {
- glitz_vec4_t v;
-
- v.v[0] = v.v[1] = -1.0f;
- v.v[2] = v.v[3] = 1.0f;
-
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM,
- i + j, v.v);
- }
- } break;
- case GLITZ_FILTER_BILINEAR:
- case GLITZ_FILTER_NEAREST:
- switch (surface->format->color.fourcc) {
- case GLITZ_FOURCC_YV12: {
- glitz_vec4_t *vec;
-
- vec = surface->filter_params->vectors;
-
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, 0,
- vec[0].v);
- gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, 1,
- vec[1].v);
- } break;
- }
- break;
- }
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz_format.c
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitzint.h"
-
-#include <stdlib.h>
-
-static struct _texture_format {
- glitz_gl_int_t texture_format;
- glitz_format_t format;
-} _texture_formats[] = {
- { GLITZ_GL_ALPHA4, { 0, { GLITZ_FOURCC_RGB, 0, 0, 0, 4 } } },
- { GLITZ_GL_ALPHA8, { 0, { GLITZ_FOURCC_RGB, 0, 0, 0, 8 } } },
- { GLITZ_GL_ALPHA12, { 0, { GLITZ_FOURCC_RGB, 0, 0, 0, 12 } } },
- { GLITZ_GL_ALPHA16, { 0, { GLITZ_FOURCC_RGB, 0, 0, 0, 16 } } },
- { GLITZ_GL_R3_G3_B2, { 0, { GLITZ_FOURCC_RGB, 3, 3, 2, 0 } } },
- { GLITZ_GL_RGB4, { 0, { GLITZ_FOURCC_RGB, 4, 4, 4, 0 } } },
- { GLITZ_GL_RGB5, { 0, { GLITZ_FOURCC_RGB, 5, 6, 5, 0 } } },
- { GLITZ_GL_RGB8, { 0, { GLITZ_FOURCC_RGB, 8, 8, 8, 0 } } },
- { GLITZ_GL_RGB10, { 0, { GLITZ_FOURCC_RGB, 10, 10, 10, 0 } } },
- { GLITZ_GL_RGB12, { 0, { GLITZ_FOURCC_RGB, 12, 12, 12, 0 } } },
- { GLITZ_GL_RGB16, { 0, { GLITZ_FOURCC_RGB, 16, 16, 16, 0 } } },
- { GLITZ_GL_RGBA2, { 0, { GLITZ_FOURCC_RGB, 2, 2, 2, 2 } } },
- { GLITZ_GL_RGB5_A1, { 0, { GLITZ_FOURCC_RGB, 5, 5, 5, 1 } } },
- { GLITZ_GL_RGBA4, { 0, { GLITZ_FOURCC_RGB, 4, 4, 4, 4 } } },
- { GLITZ_GL_RGBA8, { 0, { GLITZ_FOURCC_RGB, 8, 8, 8, 8 } } },
- { GLITZ_GL_RGB10_A2, { 0, { GLITZ_FOURCC_RGB, 10, 10, 10, 2 } } },
- { GLITZ_GL_RGBA12, { 0, { GLITZ_FOURCC_RGB, 12, 12, 12, 12 } } },
- { GLITZ_GL_RGBA16, { 0, { GLITZ_FOURCC_RGB, 16, 16, 16, 16 } } }
-};
-
-static glitz_format_t _texture_format_yv12 = {
- 0, { GLITZ_FOURCC_YV12, 0, 0, 0, 0 }
-};
-
-static void
-_glitz_add_texture_format (glitz_format_t **formats,
- glitz_gl_int_t **texture_formats,
- int *n_formats,
- glitz_gl_int_t texture_format,
- glitz_format_t *format)
-{
- *formats = realloc (*formats, sizeof (glitz_format_t) * (*n_formats + 1));
- *texture_formats = realloc (*texture_formats,
- sizeof (glitz_gl_enum_t) * (*n_formats + 1));
-
- if (*formats && *texture_formats) {
- (*texture_formats)[*n_formats] = texture_format;
- (*formats)[*n_formats] = *format;
- (*formats)[*n_formats].id = *n_formats;
- (*n_formats)++;
- } else
- *n_formats = 0;
-}
-
-void
-glitz_create_surface_formats (glitz_gl_proc_address_list_t *gl,
- glitz_format_t **formats,
- glitz_gl_int_t **texture_formats,
- int *n_formats,
- unsigned long features)
-{
- glitz_gl_int_t value;
- int i, n_texture_formats;
-
- n_texture_formats =
- sizeof (_texture_formats) / sizeof (struct _texture_format);
-
- for (i = 0; i < n_texture_formats; i++) {
- switch (_texture_formats[i].format.color.fourcc) {
- case GLITZ_FOURCC_RGB:
- gl->tex_image_2d (GLITZ_GL_PROXY_TEXTURE_2D, 0,
- _texture_formats[i].texture_format, 1, 1, 0,
- GLITZ_GL_RGBA, GLITZ_GL_UNSIGNED_BYTE, NULL);
-
- if (_texture_formats[i].format.color.red_size) {
- gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
- GLITZ_GL_TEXTURE_RED_SIZE,
- &value);
- if (value != _texture_formats[i].format.color.red_size)
- continue;
- }
-
- if (_texture_formats[i].format.color.green_size) {
- gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
- GLITZ_GL_TEXTURE_GREEN_SIZE,
- &value);
- if (value != _texture_formats[i].format.color.green_size)
- continue;
- }
-
- if (_texture_formats[i].format.color.blue_size) {
- gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
- GLITZ_GL_TEXTURE_BLUE_SIZE,
- &value);
- if (value != _texture_formats[i].format.color.blue_size)
- continue;
- }
-
- if (_texture_formats[i].format.color.alpha_size) {
- gl->get_tex_level_parameter_iv (GLITZ_GL_PROXY_TEXTURE_2D, 0,
- GLITZ_GL_TEXTURE_ALPHA_SIZE,
- &value);
- if (value != _texture_formats[i].format.color.alpha_size)
- continue;
- }
- break;
- default:
- continue;
- }
-
- _glitz_add_texture_format (formats,
- texture_formats,
- n_formats,
- _texture_formats[i].texture_format,
- &_texture_formats[i].format);
- }
-
- /* formats used for YUV surfaces */
- if (features & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK)
- {
- _glitz_add_texture_format (formats, texture_formats, n_formats,
- GLITZ_GL_LUMINANCE8, &_texture_format_yv12);
- }
-}
-
-static void
-_glitz_add_drawable_format (glitz_int_drawable_format_t *format,
- glitz_int_drawable_format_t **formats,
- int *n_formats)
-{
- void *ptr;
-
- ptr = realloc (*formats,
- sizeof (glitz_int_drawable_format_t) * (*n_formats + 1));
- if (ptr)
- {
- *formats = ptr;
- (*formats)[*n_formats] = *format;
- (*n_formats)++;
- }
-}
-
-/* TODO: Available drawable formats needs to be validated in a similar way
- as surface formats. */
-void
-_glitz_add_drawable_formats (glitz_gl_proc_address_list_t *gl,
- unsigned long feature_mask,
- glitz_int_drawable_format_t **formats,
- int *n_formats)
-{
- if (feature_mask & GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK)
- {
- glitz_int_drawable_format_t format;
- glitz_drawable_format_t d[] = {
- { 0, { GLITZ_FOURCC_RGB, 8, 8, 8, 0 }, 0, 0, 1, 0 },
- { 0, { GLITZ_FOURCC_RGB, 8, 8, 8, 8 }, 0, 0, 1, 0 },
- { 0, { GLITZ_FOURCC_RGB, 8, 8, 8, 0 }, 24, 8, 1, 1 },
- { 0, { GLITZ_FOURCC_RGB, 8, 8, 8, 8 }, 24, 8, 1, 1 }
- };
- int i;
-
- format.types = GLITZ_DRAWABLE_TYPE_FBO_MASK;
- format.caveat = 0;
- format.u.val = 0;
-
- for (i = 0; i < sizeof (d) / sizeof (d[0]); i++)
- {
- format.d = d[i];
- format.d.id = *n_formats;
-
- _glitz_add_drawable_format (&format, formats, n_formats);
- }
- }
-}
-
-void
-glitz_drawable_format_copy (const glitz_drawable_format_t *src,
- glitz_drawable_format_t *dst,
- unsigned long mask)
-{
- if (mask & GLITZ_FORMAT_ID_MASK)
- dst->id = src->id;
-
- if (mask & GLITZ_FORMAT_FOURCC_MASK)
- dst->color.fourcc = src->color.fourcc;
-
- if (mask & GLITZ_FORMAT_RED_SIZE_MASK)
- dst->color.red_size = src->color.red_size;
-
- if (mask & GLITZ_FORMAT_GREEN_SIZE_MASK)
- dst->color.green_size = src->color.green_size;
-
- if (mask & GLITZ_FORMAT_BLUE_SIZE_MASK)
- dst->color.blue_size = src->color.blue_size;
-
- if (mask & GLITZ_FORMAT_ALPHA_SIZE_MASK)
- dst->color.alpha_size = src->color.alpha_size;
-
- if (mask & GLITZ_FORMAT_DEPTH_SIZE_MASK)
- dst->depth_size = src->depth_size;
-
- if (mask & GLITZ_FORMAT_STENCIL_SIZE_MASK)
- dst->stencil_size = src->stencil_size;
-
- if (mask & GLITZ_FORMAT_DOUBLEBUFFER_MASK)
- dst->doublebuffer = src->doublebuffer;
-
- if (mask & GLITZ_FORMAT_SAMPLES_MASK)
- dst->samples = src->samples;
-}
-
-glitz_drawable_format_t *
-glitz_drawable_format_find (glitz_int_drawable_format_t *formats,
- int n_formats,
- unsigned long mask,
- const glitz_int_drawable_format_t *templ,
- int count)
-{
- for (; n_formats; n_formats--, formats++)
- {
- if (mask & GLITZ_FORMAT_ID_MASK)
- if (templ->d.id != formats->d.id)
- continue;
-
- if (mask & GLITZ_FORMAT_FOURCC_MASK)
- if (templ->d.color.fourcc != formats->d.color.fourcc)
- continue;
-
- if (mask & GLITZ_FORMAT_RED_SIZE_MASK)
- if (templ->d.color.red_size != formats->d.color.red_size)
- continue;
-
- if (mask & GLITZ_FORMAT_GREEN_SIZE_MASK)
- if (templ->d.color.green_size != formats->d.color.green_size)
- continue;
-
- if (mask & GLITZ_FORMAT_BLUE_SIZE_MASK)
- if (templ->d.color.blue_size != formats->d.color.blue_size)
- continue;
-
- if (mask & GLITZ_FORMAT_ALPHA_SIZE_MASK)
- if (templ->d.color.alpha_size != formats->d.color.alpha_size)
- continue;
-
- if (mask & GLITZ_FORMAT_DEPTH_SIZE_MASK)
- if (templ->d.depth_size != formats->d.depth_size)
- continue;
-
- if (mask & GLITZ_FORMAT_STENCIL_SIZE_MASK)
- if (templ->d.stencil_size != formats->d.stencil_size)
- continue;
-
- if (mask & GLITZ_FORMAT_DOUBLEBUFFER_MASK)
- if (templ->d.doublebuffer != formats->d.doublebuffer)
- continue;
-
- if (mask & GLITZ_FORMAT_SAMPLES_MASK)
- if (templ->d.samples != formats->d.samples)
- continue;
-
- if (mask & GLITZ_INT_FORMAT_WINDOW_MASK)
- if ((templ->types & GLITZ_DRAWABLE_TYPE_WINDOW_MASK) !=
- (formats->types & GLITZ_DRAWABLE_TYPE_WINDOW_MASK))
- continue;
-
- if (mask & GLITZ_INT_FORMAT_PBUFFER_MASK)
- if ((templ->types & GLITZ_DRAWABLE_TYPE_PBUFFER_MASK) !=
- (formats->types & GLITZ_DRAWABLE_TYPE_PBUFFER_MASK))
- continue;
-
- if (mask & GLITZ_INT_FORMAT_FBO_MASK)
- if ((templ->types & GLITZ_DRAWABLE_TYPE_FBO_MASK) !=
- (formats->types & GLITZ_DRAWABLE_TYPE_FBO_MASK))
- continue;
-
- if (count-- == 0)
- return &formats->d;
- }
-
- return NULL;
-}
-
-static glitz_format_t *
-_glitz_format_find (glitz_format_t *formats,
- int n_formats,
- unsigned long mask,
- const glitz_format_t *templ,
- int count)
-{
- for (; n_formats; n_formats--, formats++) {
- if (mask & GLITZ_FORMAT_ID_MASK)
- if (templ->id != formats->id)
- continue;
-
- if (mask & GLITZ_FORMAT_FOURCC_MASK)
- if (templ->color.fourcc != formats->color.fourcc)
- continue;
-
- if (mask & GLITZ_FORMAT_RED_SIZE_MASK)
- if (templ->color.red_size != formats->color.red_size)
- continue;
-
- if (mask & GLITZ_FORMAT_GREEN_SIZE_MASK)
- if (templ->color.green_size != formats->color.green_size)
- continue;
-
- if (mask & GLITZ_FORMAT_BLUE_SIZE_MASK)
- if (templ->color.blue_size != formats->color.blue_size)
- continue;
-
- if (mask & GLITZ_FORMAT_ALPHA_SIZE_MASK)
- if (templ->color.alpha_size != formats->color.alpha_size)
- continue;
-
- if (count-- == 0)
- return formats;
- }
-
- return NULL;
-}
-
-glitz_format_t *
-glitz_find_format (glitz_drawable_t *drawable,
- unsigned long mask,
- const glitz_format_t *templ,
- int count)
-{
- return _glitz_format_find (drawable->backend->formats,
- drawable->backend->n_formats,
- mask, templ, count);
-}
-
-glitz_format_t *
-glitz_find_standard_format (glitz_drawable_t *drawable,
- glitz_format_name_t format_name)
-{
- glitz_format_t templ;
- unsigned long mask = GLITZ_FORMAT_RED_SIZE_MASK |
- GLITZ_FORMAT_GREEN_SIZE_MASK | GLITZ_FORMAT_BLUE_SIZE_MASK |
- GLITZ_FORMAT_ALPHA_SIZE_MASK | GLITZ_FORMAT_FOURCC_MASK;
-
- templ.color.fourcc = GLITZ_FOURCC_RGB;
- templ.color.red_size = 0;
- templ.color.green_size = 0;
- templ.color.blue_size = 0;
- templ.color.alpha_size = 0;
-
- switch (format_name) {
- case GLITZ_STANDARD_ARGB32:
- templ.color.red_size = 8;
- templ.color.green_size = 8;
- templ.color.blue_size = 8;
- templ.color.alpha_size = 8;
- break;
- case GLITZ_STANDARD_RGB24:
- templ.color.red_size = 8;
- templ.color.green_size = 8;
- templ.color.blue_size = 8;
- break;
- case GLITZ_STANDARD_A8:
- templ.color.alpha_size = 8;
- break;
- case GLITZ_STANDARD_A1:
- templ.color.alpha_size = 1;
- break;
- }
-
- return glitz_find_format (drawable, mask, &templ, 0);
-}
-
-glitz_drawable_format_t *
-glitz_find_drawable_format (glitz_drawable_t *other,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count)
-{
- glitz_int_drawable_format_t itempl;
-
- glitz_drawable_format_copy (templ, &itempl.d, mask);
-
- itempl.types = GLITZ_DRAWABLE_TYPE_FBO_MASK;
- mask |= GLITZ_INT_FORMAT_FBO_MASK;
-
- return glitz_drawable_format_find (other->backend->drawable_formats,
- other->backend->n_drawable_formats,
- mask, &itempl, count);
-}
-slim_hidden_def(glitz_find_drawable_format);
-
-glitz_drawable_format_t *
-glitz_find_pbuffer_format (glitz_drawable_t *other,
- unsigned long mask,
- const glitz_drawable_format_t *templ,
- int count)
-{
- glitz_int_drawable_format_t itempl;
-
- glitz_drawable_format_copy (templ, &itempl.d, mask);
-
- itempl.types = GLITZ_DRAWABLE_TYPE_PBUFFER_MASK;
- mask |= GLITZ_INT_FORMAT_PBUFFER_MASK;
-
- return glitz_drawable_format_find (other->backend->drawable_formats,
- other->backend->n_drawable_formats,
- mask, &itempl, count);
-}
-slim_hidden_def(glitz_find_pbuffer_format);
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz_framebuffer.c
+++ /dev/null
@@ -1,477 +0,0 @@
-/*
- * Copyright © 2005 Novell, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * Novell, Inc. not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * Novell, Inc. makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * NOVELL, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL NOVELL, INC. BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitzint.h"
-
-typedef struct _glitz_fbo_drawable {
- glitz_drawable_t base;
- glitz_drawable_t *other;
- int width;
- int height;
- glitz_gl_uint_t fb;
- glitz_gl_uint_t front;
- glitz_gl_uint_t back;
- glitz_gl_uint_t depth;
- glitz_gl_uint_t stencil;
- glitz_gl_uint_t front_texture;
- glitz_gl_uint_t back_texture;
- glitz_gl_enum_t internal_format;
-} glitz_fbo_drawable_t;
-
-static glitz_bool_t
-_glitz_fbo_bind (glitz_fbo_drawable_t *drawable)
-{
- glitz_bool_t update = 0;
- glitz_gl_enum_t status;
-
- GLITZ_GL_DRAWABLE (drawable->other);
-
- if (!drawable->fb)
- {
- gl->gen_framebuffers (1, &drawable->fb);
-
- drawable->width = drawable->base.width;
- drawable->height = drawable->base.height;
- update = 1;
- }
- else if (drawable->width != drawable->base.width ||
- drawable->height != drawable->base.height)
- {
- drawable->width = drawable->base.width;
- drawable->height = drawable->base.height;
- update = 1;
- }
-
- gl->bind_framebuffer (GLITZ_GL_FRAMEBUFFER, drawable->fb);
-
- if (drawable->base.front &&
- drawable->front_texture != drawable->base.front->texture.name)
- {
- gl->framebuffer_texture_2d (GLITZ_GL_FRAMEBUFFER,
- GLITZ_GL_COLOR_ATTACHMENT0,
- drawable->base.front->texture.target,
- drawable->base.front->texture.name,
- 0);
-
- drawable->front_texture = drawable->base.front->texture.name;
-
- if (drawable->front)
- {
- gl->delete_renderbuffers (1, &drawable->front);
- drawable->front = 0;
- }
- }
-
- if (!drawable->front_texture && !drawable->front)
- {
- gl->gen_renderbuffers (1, &drawable->front);
- gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, drawable->front);
- gl->renderbuffer_storage (GLITZ_GL_RENDERBUFFER,
- drawable->internal_format,
- drawable->base.width,
- drawable->base.height);
- gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, 0);
- gl->framebuffer_renderbuffer (GLITZ_GL_FRAMEBUFFER,
- GLITZ_GL_COLOR_ATTACHMENT0,
- GLITZ_GL_RENDERBUFFER,
- drawable->front);
- }
-
- if (drawable->base.format->d.doublebuffer)
- {
- if (drawable->base.back &&
- drawable->back_texture != drawable->base.back->texture.name)
- {
- gl->framebuffer_texture_2d (GLITZ_GL_FRAMEBUFFER,
- GLITZ_GL_COLOR_ATTACHMENT1,
- drawable->base.back->texture.target,
- drawable->base.back->texture.name,
- 0);
-
- drawable->back_texture = drawable->base.back->texture.name;
-
- if (drawable->back)
- {
- gl->delete_renderbuffers (1, &drawable->back);
- drawable->back = 0;
- }
- }
-
- if (!drawable->back_texture && !drawable->back)
- {
- gl->gen_renderbuffers (1, &drawable->back);
- gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER,
- drawable->back);
- gl->renderbuffer_storage (GLITZ_GL_RENDERBUFFER,
- drawable->internal_format,
- drawable->base.width,
- drawable->base.height);
- gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, 0);
- gl->framebuffer_renderbuffer (GLITZ_GL_FRAMEBUFFER,
- GLITZ_GL_COLOR_ATTACHMENT1,
- GLITZ_GL_RENDERBUFFER,
- drawable->back);
- }
- }
-
- if (update)
- {
- if (drawable->base.format->d.depth_size)
- {
- if (!drawable->depth)
- gl->gen_renderbuffers (1, &drawable->depth);
-
- gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, drawable->depth);
- gl->renderbuffer_storage (GLITZ_GL_RENDERBUFFER,
- GLITZ_GL_DEPTH_COMPONENT,
- drawable->base.width,
- drawable->base.height);
- gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, 0);
-
- gl->framebuffer_renderbuffer (GLITZ_GL_FRAMEBUFFER,
- GLITZ_GL_DEPTH_ATTACHMENT,
- GLITZ_GL_RENDERBUFFER,
- drawable->depth);
- }
-
- if (drawable->base.format->d.stencil_size)
- {
- if (!drawable->stencil)
- gl->gen_renderbuffers (1, &drawable->stencil);
-
- gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER,
- drawable->stencil);
- gl->renderbuffer_storage (GLITZ_GL_RENDERBUFFER,
- GLITZ_GL_STENCIL_INDEX,
- drawable->base.width,
- drawable->base.height);
- gl->bind_renderbuffer (GLITZ_GL_RENDERBUFFER, 0);
-
- gl->framebuffer_renderbuffer (GLITZ_GL_FRAMEBUFFER,
- GLITZ_GL_STENCIL_ATTACHMENT,
- GLITZ_GL_RENDERBUFFER,
- drawable->stencil);
- }
- }
-
- status = gl->check_framebuffer_status (GLITZ_GL_FRAMEBUFFER);
- if (status == GLITZ_GL_FRAMEBUFFER_COMPLETE)
- return 1;
-
- return 0;
-}
-
-static void
-_glitz_fbo_attach_notify (void *abstract_drawable,
- glitz_surface_t *surface)
-{
- glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
- abstract_drawable;
- glitz_texture_t *texture;
-
- GLITZ_GL_DRAWABLE (drawable->other);
-
- texture = &surface->texture;
- if (!TEXTURE_ALLOCATED (texture))
- {
- drawable->other->backend->push_current (drawable->other, NULL,
- GLITZ_ANY_CONTEXT_CURRENT,
- NULL);
- glitz_texture_allocate (gl, texture);
- drawable->other->backend->pop_current (drawable->other);
-
- if (!TEXTURE_ALLOCATED (texture))
- return;
- }
-
- REGION_EMPTY (&surface->drawable_damage);
-}
-
-static void
-_glitz_fbo_detach_notify (void *abstract_drawable,
- glitz_surface_t *surface)
-{
- glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
- abstract_drawable;
-
- if (surface->texture.name == drawable->front_texture ||
- surface->texture.name == drawable->back_texture)
- {
- GLITZ_GL_DRAWABLE (drawable->other);
-
- drawable->other->backend->push_current (drawable->other, NULL,
- GLITZ_ANY_CONTEXT_CURRENT,
- NULL);
-
- gl->bind_framebuffer (GLITZ_GL_FRAMEBUFFER, drawable->fb);
-
- if (surface->texture.name == drawable->front_texture)
- {
- gl->framebuffer_texture_2d (GLITZ_GL_FRAMEBUFFER,
- GLITZ_GL_COLOR_ATTACHMENT0,
- surface->texture.target,
- 0, 0);
- drawable->front_texture = 0;
- }
-
- if (surface->texture.name == drawable->back_texture)
- {
- gl->framebuffer_texture_2d (GLITZ_GL_FRAMEBUFFER,
- GLITZ_GL_COLOR_ATTACHMENT1,
- surface->texture.target,
- 0, 0);
- drawable->back_texture = 0;
- }
-
- gl->bind_framebuffer (GLITZ_GL_FRAMEBUFFER, 0);
-
- surface->fb = 0;
-
- drawable->other->backend->pop_current (drawable->other);
- }
-}
-
-static glitz_bool_t
-_glitz_fbo_push_current (void *abstract_drawable,
- glitz_surface_t *surface,
- glitz_constraint_t constraint,
- glitz_bool_t *restore_state)
-{
- glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
- abstract_drawable;
-
- drawable->other->backend->push_current (drawable->other, surface,
- constraint, restore_state);
-
- if (constraint == GLITZ_DRAWABLE_CURRENT)
- {
- if (_glitz_fbo_bind (drawable))
- {
- drawable->base.update_all = drawable->other->update_all = 1;
- surface->fb = drawable->fb;
- return 1;
- }
- }
-
- return 0;
-}
-
-static glitz_surface_t *
-_glitz_fbo_pop_current (void *abstract_drawable)
-{
- glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
- abstract_drawable;
-
- GLITZ_GL_DRAWABLE (drawable->other);
-
- gl->bind_framebuffer (GLITZ_GL_FRAMEBUFFER, 0);
-
- return drawable->other->backend->pop_current (drawable->other);
-}
-
-static void
-_glitz_fbo_make_current (void *abstract_drawable,
- void *abstract_context)
-{
- glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
- abstract_drawable;
-
- drawable->other->backend->make_current (drawable->other, abstract_context);
-
- _glitz_fbo_bind (drawable);
-}
-
-static glitz_bool_t
-_glitz_fbo_swap_buffers (void *abstract_drawable)
-{
- glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
- abstract_drawable;
-
- if (!drawable->fb)
- return 1;
-
- /* flip */
- if (drawable->base.back && drawable->base.front)
- {
- glitz_texture_t tmp;
-
- tmp = drawable->base.front->texture;
-
- drawable->base.front->texture = drawable->base.back->texture;
- drawable->base.back->texture = tmp;
-
- return 1;
- }
-
- return 0;
-}
-
-static glitz_bool_t
-_glitz_fbo_copy_sub_buffer (void *abstract_drawable,
- int x,
- int y,
- int width,
- int height)
-{
- return 0;
-}
-
-static void
-_glitz_fbo_destroy (void *abstract_drawable)
-{
- glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
- abstract_drawable;
-
- if (drawable->fb)
- {
- GLITZ_GL_DRAWABLE (drawable->other);
-
- drawable->other->backend->push_current (drawable->other, NULL,
- GLITZ_ANY_CONTEXT_CURRENT,
- NULL);
-
- gl->delete_framebuffers (1, &drawable->fb);
-
- if (drawable->front)
- gl->delete_renderbuffers (1, &drawable->front);
-
- if (drawable->back)
- gl->delete_renderbuffers (1, &drawable->back);
-
- if (drawable->depth)
- gl->delete_renderbuffers (1, &drawable->depth);
-
- if (drawable->stencil)
- gl->delete_renderbuffers (1, &drawable->stencil);
-
- drawable->other->backend->pop_current (drawable->other);
- }
-
- glitz_drawable_destroy (drawable->other);
-
- free (drawable);
-}
-
-static void
-_glitz_fbo_draw_buffer (void *abstract_drawable,
- const glitz_gl_enum_t buffer)
-{
- glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
- abstract_drawable;
-
- GLITZ_GL_DRAWABLE (drawable->other);
-
- switch (buffer) {
- case GLITZ_GL_FRONT:
- gl->draw_buffer (GLITZ_GL_COLOR_ATTACHMENT0);
- break;
- case GLITZ_GL_BACK:
- gl->draw_buffer (GLITZ_GL_COLOR_ATTACHMENT1);
- break;
- /* TODO: use GL_ARB_draw_buffers
- case GLITZ_GL_FRONT_AND_BACK:
- */
- default:
- break;
- }
-}
-
-static void
-_glitz_fbo_read_buffer (void *abstract_drawable,
- const glitz_gl_enum_t buffer)
-{
- glitz_fbo_drawable_t *drawable = (glitz_fbo_drawable_t *)
- abstract_drawable;
-
- GLITZ_GL_DRAWABLE (drawable->other);
-
- switch (buffer) {
- case GLITZ_GL_FRONT:
- gl->read_buffer (GLITZ_GL_COLOR_ATTACHMENT0);
- break;
- case GLITZ_GL_BACK:
- gl->read_buffer (GLITZ_GL_COLOR_ATTACHMENT1);
- default:
- break;
- }
-}
-
-glitz_drawable_t *
-_glitz_fbo_drawable_create (glitz_drawable_t *other,
- glitz_int_drawable_format_t *format,
- int width,
- int height)
-{
- glitz_fbo_drawable_t *drawable;
- glitz_backend_t *backend;
-
- drawable = malloc (sizeof (glitz_fbo_drawable_t) +
- sizeof (glitz_backend_t));
- if (!drawable)
- return NULL;
-
- glitz_drawable_reference (other);
- drawable->other = other;
- backend = (glitz_backend_t *) (drawable + 1);
- *backend = *other->backend;
-
- backend->destroy = _glitz_fbo_destroy;
- backend->push_current = _glitz_fbo_push_current;
- backend->pop_current = _glitz_fbo_pop_current;
- backend->attach_notify = _glitz_fbo_attach_notify;
- backend->detach_notify = _glitz_fbo_detach_notify;
- backend->swap_buffers = _glitz_fbo_swap_buffers;
- backend->copy_sub_buffer = _glitz_fbo_copy_sub_buffer;
- backend->make_current = _glitz_fbo_make_current;
- backend->draw_buffer = _glitz_fbo_draw_buffer;
- backend->read_buffer = _glitz_fbo_read_buffer;
-
- drawable->fb = 0;
-
- drawable->width = 0;
- drawable->height = 0;
-
- drawable->front = 0;
- drawable->back = 0;
- drawable->depth = 0;
- drawable->stencil = 0;
-
- drawable->front_texture = 0;
- drawable->back_texture = 0;
-
- /* XXX: temporary solution until we have proper format validation */
- if (format->d.color.alpha_size)
- drawable->internal_format = GLITZ_GL_RGBA;
- else
- drawable->internal_format = GLITZ_GL_RGB;
-
- _glitz_drawable_init (&drawable->base, format, backend, width, height);
-
- return &drawable->base;
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz_geometry.c
+++ /dev/null
@@ -1,680 +0,0 @@
-/*
- * Copyright © 2004 David Reveman
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the name of
- * David Reveman not be used in advertising or publicity pertaining to
- * distribution of the software without specific, written prior permission.
- * David Reveman makes no representations about the suitability of this
- * software for any purpose. It is provided "as is" without express or
- * implied warranty.
- *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
- * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
- * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
- * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Author: David Reveman <davidr@novell.com>
- */
-
-#ifdef HAVE_CONFIG_H
-# include "../config.h"
-#endif
-
-#include "glitzint.h"
-
-
-static glitz_gl_enum_t
-_glitz_data_type (glitz_data_type_t type)
-{
- switch (type) {
- case GLITZ_DATA_TYPE_SHORT:
- return GLITZ_GL_SHORT;
- case GLITZ_DATA_TYPE_INT:
- return GLITZ_GL_INT;
- case GLITZ_DATA_TYPE_DOUBLE:
- return GLITZ_GL_DOUBLE;
- default:
- return GLITZ_GL_FLOAT;
- }
-}
-
-void
-glitz_set_geometry (glitz_surface_t *dst,
- glitz_geometry_type_t type,
- glitz_geometry_format_t *format,
- glitz_buffer_t *buffer)
-{
- switch (type) {
- case GLITZ_GEOMETRY_TYPE_VERTEX:
- {
- glitz_buffer_reference (buffer);
- if (dst->geometry.buffer)
- glitz_buffer_destroy (dst->geometry.buffer);
- dst->geometry.buffer = buffer;
-
- dst->geometry.type = GLITZ_GEOMETRY_TYPE_VERTEX;
-
- switch (format->vertex.primitive) {
- case GLITZ_PRIMITIVE_POINTS:
- dst->geometry.u.v.prim = GLITZ_GL_POINTS;
- break;
- case GLITZ_PRIMITIVE_LINES:
- dst->geometry.u.v.prim = GLITZ_GL_LINES;
- break;
- case GLITZ_PRIMITIVE_LINE_STRIP:
- dst->geometry.u.v.prim = GLITZ_GL_LINE_STRIP;
- break;
- case GLITZ_PRIMITIVE_LINE_LOOP:
- dst->geometry.u.v.prim = GLITZ_GL_LINE_LOOP;
- break;
- case GLITZ_PRIMITIVE_TRIANGLES:
- dst->geometry.u.v.prim = GLITZ_GL_TRIANGLES;
- break;
- case GLITZ_PRIMITIVE_TRIANGLE_STRIP:
- dst->geometry.u.v.prim = GLITZ_GL_TRIANGLE_STRIP;
- break;
- case GLITZ_PRIMITIVE_TRIANGLE_FAN:
- dst->geometry.u.v.prim = GLITZ_GL_TRIANGLE_FAN;
- break;
- case GLITZ_PRIMITIVE_QUADS:
- dst->geometry.u.v.prim = GLITZ_GL_QUADS;
- break;
- case GLITZ_PRIMITIVE_QUAD_STRIP:
- dst->geometry.u.v.prim = GLITZ_GL_QUAD_STRIP;
- break;
- default:
- dst->geometry.u.v.prim = GLITZ_GL_POLYGON;
- break;
- }
-
- dst->geometry.u.v.type = _glitz_data_type (format->vertex.type);
- dst->geometry.stride = format->vertex.bytes_per_vertex;
- dst->geometry.attributes = format->vertex.attributes;
-
- if (format->vertex.attributes & GLITZ_VERTEX_ATTRIBUTE_SRC_COORD_MASK)
- {
- dst->geometry.u.v.src.type =
- _glitz_data_type (format->vertex.src.type);
- dst->geometry.u.v.src.offset = format->vertex.src.offset;
-
- if (format->vertex.src.size == GLITZ_COORDINATE_SIZE_XY)
- dst->geometry.u.v.src.size = 2;
- else
- dst->geometry.u.v.src.size = 1;
- }
-
- if (format->vertex.attributes & GLITZ_VERTEX_ATTRIBUTE_MASK_COORD_MASK)
- {
- dst->geometry.u.v.mask.type =
- _glitz_data_type (format->vertex.mask.type);
- dst->geometry.u.v.mask.offset = format->vertex.mask.offset;
-
- if (format->vertex.mask.size == GLITZ_COORDINATE_SIZE_XY)
- dst->geometry.u.v.mask.size = 2;
- else
- dst->geometry.u.v.mask.size = 1;
- }
- } break;
- case GLITZ_GEOMETRY_TYPE_BITMAP:
- glitz_buffer_reference (buffer);
- if (dst->geometry.buffer)
- glitz_buffer_destroy (dst->geometry.buffer);
- dst->geometry.buffer = buffer;
-
- dst->geometry.type = GLITZ_GEOMETRY_TYPE_BITMAP;
-
- if (format->bitmap.scanline_order ==
- GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN)
- dst->geometry.u.b.top_down = 1;
- else
- dst->geometry.u.b.top_down = 0;
-
- switch (format->bitmap.pad) {
- case 2:
- dst->geometry.u.b.pad = 2;
- break;
- case 4:
- dst->geometry.u.b.pad = 4;
- break;
- case 8:
- dst->geometry.u.b.pad = 8;
- break;
- default:
- dst->geometry.u.b.pad = 1;
- break;
- }
-
- dst->geometry.stride = format->bitmap.bytes_per_line;
- dst->geometry.attributes = 0;
- break;
- default:
- dst->geometry.type = GLITZ_GEOMETRY_TYPE_NONE;
- if (dst->geometry.buffer)
- glitz_buffer_destroy (dst->geometry.buffer);
-
- dst->geometry.buffer = NULL;
- dst->geometry.attributes = 0;
- break;
- }
-}
-slim_hidden_def(glitz_set_geometry);
-
-void
-glitz_set_array (glitz_surface_t *dst,
- int first,
- int size,
- unsigned int count,
- glitz_fixed16_16_t x_off,
- glitz_fixed16_16_t y_off)
-{
- if (dst->geometry.array)
- {
- glitz_multi_array_destroy (dst->geometry.array);
- dst->geometry.array = NULL;
- }
-
- dst->geometry.first = first;
- dst->geometry.size = size;
- dst->geometry.count = count;
- dst->geometry.off.v[0] = FIXED_TO_FLOAT (x_off);
- dst->geometry.off.v[1] = FIXED_TO_FLOAT (y_off);
-}
-slim_hidden_def(glitz_set_array);
-
-glitz_multi_array_t *
-glitz_multi_array_create (unsigned int size)
-{
- glitz_multi_array_t *array;
- int alloc_size;
-
- if (!size)
- return NULL;
-
- alloc_size = sizeof (glitz_multi_array_t) + (sizeof (int) +
- sizeof (int) +
- sizeof (unsigned int) +
- sizeof (glitz_vec2_t) +
- sizeof (int)) * (size);
-
- array = (glitz_multi_array_t *) malloc (alloc_size);
- if (array == NULL)
- return NULL;
-
- array->ref_count = 1;
- array->size = size;
- array->first = (int *) (array + 1);
- array->sizes = (int *) (array->first + size);
- array->count = (int *) (array->sizes + size);
- array->off = (glitz_vec2_t *) (array->count + size);
- array->span = (int *) (array->off + size);
-
- array->n_arrays = 0;
-
- return array;
-}
-slim_hidden_def(glitz_multi_array_create);
-
-void
-glitz_multi_array_destroy (glitz_multi_array_t *array)
-{
- if (!array)
- return;
-
- array->ref_count--;
- if (array->ref_count)
- return;
-
- free (array);
-}
-
-void
-glitz_multi_array_reference (glitz_multi_array_t *array)
-{
- if (array == NULL)
- return;
-
- array->ref_count++;
-}
-
-void
-glitz_multi_array_add (glitz_multi_array_t *array,
- int first,
- int size,
- unsigned int count,
- glitz_fixed16_16_t x_off,
- glitz_fixed16_16_t y_off)
-{
- int i;
-
- if (array->size == array->n_arrays)
- return;
-
- i = array->n_arrays++;
-
- array->first[i] = first;
- array->sizes[i] = size;
- array->count[i] = count;
- array->span[i] = 0;
-
- if (i == 0 || x_off || y_off)
- {
- array->off[i].v[0] = FIXED_TO_FLOAT (x_off);
- array->off[i].v[1] = FIXED_TO_FLOAT (y_off);
- array->current_span = &array->span[i];
- }
-
- (*array->current_span)++;
-}
-slim_hidden_def(glitz_multi_array_add);
-
-void
-glitz_multi_array_reset (glitz_multi_array_t *array)
-{
- array->n_arrays = 0;
-}
-slim_hidden_def(glitz_multi_array_reset);
-
-void
-glitz_set_multi_array (glitz_surface_t *dst,
- glitz_multi_array_t *array,
- glitz_fixed16_16_t x_off,
- glitz_fixed16_16_t y_off)
-{
- glitz_multi_array_reference (array);
-
- if (dst->geometry.array)
- glitz_multi_array_destroy (dst->geometry.array);
-
- dst->geometry.array = array;
- dst->geometry.count = array->n_arrays;
- dst->geometry.off.v[0] = FIXED_TO_FLOAT (x_off);
- dst->geometry.off.v[1] = FIXED_TO_FLOAT (y_off);
-}
-slim_hidden_def(glitz_set_multi_array);
-
-void
-glitz_geometry_enable_none (glitz_gl_proc_address_list_t *gl,
- glitz_surface_t *dst,
- glitz_box_t *box)
-{
- dst->geometry.data[0] = (glitz_float_t) box->x1;
- dst->geometry.data[1] = (glitz_float_t) box->y1;
- dst->geometry.data[2] = (glitz_float_t) box->x2;
- dst->geometry.data[3] = (glitz_float_t) box->y1;
- dst->geometry.data[4] = (glitz_float_t) box->x2;
- dst->geometry.data[5] = (glitz_float_t) box->y2;
- dst->geometry.data[6] = (glitz_float_t) box->x1;
- dst->geometry.data[7] = (glitz_float_t) box->y2;
-
- gl->vertex_pointer (2, GLITZ_GL_FLOAT, 0, dst->geometry.data);
-}
-
-void
-glitz_geometry_enable (glitz_gl_proc_address_list_t *gl,
- glitz_surface_t *dst,
- glitz_box_t *box)
-{
- switch (dst->geometry.type) {
- case GLITZ_GEOMETRY_TYPE_VERTEX:
- gl->vertex_pointer (2, dst->geometry.u.v.type, dst->geometry.stride,
- glitz_buffer_bind (dst->geometry.buffer,
- GLITZ_GL_ARRAY_BUFFER));
- break;
- case GLITZ_GEOMETRY_TYPE_BITMAP:
- dst->geometry.u.b.base =
- glitz_buffer_bind (dst->geometry.buffer,
- GLITZ_GL_PIXEL_UNPACK_BUFFER);
-
- gl->pixel_store_i (GLITZ_GL_UNPACK_SKIP_PIXELS, 0);
- gl->pixel_store_i (GLITZ_GL_UNPACK_SKIP_ROWS, 0);
-
-#if BITMAP_BIT_ORDER == MSBFirst
- gl->pixel_store_i (GLITZ_GL_UNPACK_LSB_FIRST, GLITZ_GL_FALSE);
-#else
- gl->pixel_store_i (GLITZ_GL_UNPACK_LSB_FIRST, GLITZ_GL_TRUE);
-#endif
-
- break;
- case GLITZ_GEOMETRY_TYPE_NONE:
- glitz_geometry_enable_none (gl, dst, box);
- }
-}
-
-void
-glitz_geometry_disable (glitz_surface_t *dst)
-{
- if (dst->geometry.buffer)
- glitz_buffer_unbind (dst->geometry.buffer);
-}
-
-static void
-_glitz_draw_rectangle (glitz_gl_proc_address_list_t *gl,
- glitz_surface_t *dst,
- glitz_box_t *bounds,
- int damage)
-{
- glitz_box_t *clip = dst->clip;
- int n_clip = dst->n_clip;
- glitz_box_t box;
-
- while (n_clip--)
- {
- box.x1 = clip->x1 + dst->x_clip;
- box.y1 = clip->y1 + dst->y_clip;
- box.x2 = clip->x2 + dst->x_clip;
- box.y2 = clip->y2 + dst->y_clip;
- if (bounds->x1 > box.x1)
- box.x1 = bounds->x1;
- if (bounds->y1 > box.y1)
- box.y1 = bounds->y1;
- if (bounds->x2 < box.x2)
- box.x2 = bounds->x2;
- if (bounds->y2 < box.y2)
- box.y2 = bounds->y2;
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- gl->scissor (box.x1 + dst->x,
- dst->attached->height - dst->y - box.y2,
- box.x2 - box.x1, box.y2 - box.y1);
-
- gl->draw_arrays (GLITZ_GL_QUADS, 0, 4);
-
- if (damage)
- glitz_surface_damage (dst, &box, damage);
- }
-
- clip++;
- }
-}
-
-#define MULTI_DRAW_ARRAYS(surface) \
- ((surface)->drawable->backend->feature_mask & \
- GLITZ_FEATURE_MULTI_DRAW_ARRAYS_MASK)
-
-static void
-_glitz_draw_vertex_arrays (glitz_gl_proc_address_list_t *gl,
- glitz_surface_t *dst,
- glitz_box_t *bounds,
- int damage)
-{
- glitz_multi_array_t *array = dst->geometry.array;
- glitz_box_t *clip = dst->clip;
- int i, n_clip = dst->n_clip;
- glitz_box_t box;
-
- while (n_clip--)
- {
- box.x1 = clip->x1 + dst->x_clip;
- box.y1 = clip->y1 + dst->y_clip;
- box.x2 = clip->x2 + dst->x_clip;
- box.y2 = clip->y2 + dst->y_clip;
- if (bounds->x1 > box.x1)
- box.x1 = bounds->x1;
- if (bounds->y1 > box.y1)
- box.y1 = bounds->y1;
- if (bounds->x2 < box.x2)
- box.x2 = bounds->x2;
- if (bounds->y2 < box.y2)
- box.y2 = bounds->y2;
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- gl->scissor (box.x1 + dst->x,
- dst->attached->height - dst->y - box.y2,
- box.x2 - box.x1, box.y2 - box.y1);
-
- gl->push_matrix ();
-
- if (dst->geometry.off.v[0] || dst->geometry.off.v[1])
- gl->translate_f (dst->geometry.off.v[0],
- dst->geometry.off.v[1], 0.0f);
-
- if (array)
- {
- for (i = 0; i < array->n_arrays;)
- {
- gl->translate_f (array->off[i].v[0],
- array->off[i].v[1], 0.0f);
-
- if (MULTI_DRAW_ARRAYS (dst))
- {
- gl->multi_draw_arrays (dst->geometry.u.v.prim,
- &array->first[i],
- &array->count[i],
- array->span[i]);
- i += array->span[i];
- }
- else
- {
- do {
- if (array->count[i])
- gl->draw_arrays (dst->geometry.u.v.prim,
- array->first[i],
- array->count[i]);
-
- } while (array->span[++i] == 0);
- }
- }
- } else
- gl->draw_arrays (dst->geometry.u.v.prim,
- dst->geometry.first,
- dst->geometry.count);
-
- gl->pop_matrix ();
-
- if (damage)
- glitz_surface_damage (dst, &box, damage);
- }
-
- clip++;
- }
-}
-
-#define N_STACK_BITMAP 128
-
-#define BITMAP_PAD 4
-#define BITMAP_STRIDE(x, w, a) \
- (((((x) & 3) + (w) + (((a) << 3) - 1)) / ((a) << 3)) * (a))
-
-#define BITMAP_SETUP(dst, first, size, count, _w, _h, _b_off, _p_off) \
- (_w) = (size); \
- (_h) = (count); \
- (_b_off) = (first) >> 3; \
- if ((_p_off) != ((first) & 3)) \
- { \
- (_p_off) = (first) & 3; \
- gl->pixel_store_i (GLITZ_GL_UNPACK_SKIP_PIXELS, _p_off); \
- } \
- if ((dst)->geometry.u.b.top_down) \
- { \
- dst_stride = BITMAP_STRIDE ((first), _w, BITMAP_PAD); \
- if ((dst)->geometry.stride) \
- src_stride = (dst)->geometry.stride; \
- else \
- src_stride = BITMAP_STRIDE ((first), _w, \
- (dst)->geometry.u.b.pad); \
- min_stride = MIN (src_stride, dst_stride); \
- base = (dst)->geometry.u.b.base + (_b_off); \
- y = (_h); \
- while (y--) \
- memcpy (bitmap + ((_h) - 1 - y) * dst_stride, \
- base + y * src_stride, \
- min_stride); \
- (_b_off) = 0; \
- }
-
-/* TODO: clipping could be done without glScissor, that might be
- faster. Other then solid colors can be used if bitmap fits into a
- stipple pattern. Maybe we should add a repeat parameter to
- glitz_bitmap_format_t as 2, 4, 8, 16 and 32 sized bitmaps can be tiled.
-*/
-static void
-_glitz_draw_bitmap_arrays (glitz_gl_proc_address_list_t *gl,
- glitz_surface_t *dst,
- glitz_box_t *bounds,
- int damage)
-{
- glitz_multi_array_t *array = dst->geometry.array;
- glitz_box_t *clip = dst->clip;
- int n, i, n_clip = dst->n_clip;
- int x, y, w, h, min_stride, dst_stride, src_stride;
- glitz_gl_ubyte_t *heap_bitmap = NULL;
- glitz_gl_ubyte_t stack_bitmap[N_STACK_BITMAP];
- glitz_gl_ubyte_t *base, *bitmap = dst->geometry.u.b.base;
- int byte_offset, pixel_offset = 0;
- glitz_float_t x_off, y_off;
- glitz_box_t box;
-
- if (dst->geometry.u.b.top_down)
- {
- int max_size = 0;
-
- if (array)
- {
- int size;
-
- for (i = 0, n = array->n_arrays; n--; i++)
- {
- x = array->first[i];
- w = array->sizes[i];
- size = BITMAP_STRIDE (x, w, BITMAP_PAD) * array->count[i];
- if (size > max_size)
- max_size = size;
- }
- }
- else
- {
- x = dst->geometry.first;
- w = dst->geometry.size;
- max_size = BITMAP_STRIDE (x, w, BITMAP_PAD) * dst->geometry.count;
- }
-
- if (max_size > N_STACK_BITMAP)
- {
- heap_bitmap = malloc (max_size);
- if (!heap_bitmap)
- {
- glitz_surface_status_add (dst, GLITZ_STATUS_NO_MEMORY_MASK);
- return;
- }
- bitmap = heap_bitmap;
- } else
- bitmap = stack_bitmap;
-
- gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, BITMAP_PAD);
- gl->pixel_store_i (GLITZ_GL_UNPACK_ROW_LENGTH, 0);
- }
- else
- {
- gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, dst->geometry.u.b.pad);
- gl->pixel_store_i (GLITZ_GL_UNPACK_ROW_LENGTH,
- dst->geometry.stride * 8);
- }
-
- while (n_clip--)
- {
- box.x1 = clip->x1 + dst->x_clip;
- box.y1 = clip->y1 + dst->y_clip;
- box.x2 = clip->x2 + dst->x_clip;
- box.y2 = clip->y2 + dst->y_clip;
- if (bounds->x1 > box.x1)
- box.x1 = bounds->x1;
- if (bounds->y1 > box.y1)
- box.y1 = bounds->y1;
- if (bounds->x2 < box.x2)
- box.x2 = bounds->x2;
- if (bounds->y2 < box.y2)
- box.y2 = bounds->y2;
-
- if (box.x1 < box.x2 && box.y1 < box.y2)
- {
- gl->scissor (box.x1 + dst->x,
- dst->attached->height - dst->y - box.y2,
- box.x2 - box.x1, box.y2 - box.y1);
-
- x_off = dst->x + dst->geometry.off.v[0];
- y_off = dst->y + dst->geometry.off.v[1];
-
- if (array)
- {
- x_off += array->off->v[0];
- y_off += array->off->v[1];
-
- glitz_set_raster_pos (gl, x_off,
- dst->attached->height - y_off);
-
- for (i = 0, n = array->n_arrays; n--; i++)
- {
- if (n)
- {
- x_off = array->off[i + 1].v[0];
- y_off = array->off[i + 1].v[1];
- }
-
- BITMAP_SETUP (dst,
- array->first[i],
- array->sizes[i],
- array->count[i],
- w, h, byte_offset, pixel_offset);
-
- gl->bitmap (w, h,
- 0.0f, (glitz_gl_float_t) array->count[i],
- x_off, -y_off,
- bitmap + byte_offset);
- }
- }
- else
- {
- glitz_set_raster_pos (gl, x_off,
- dst->attached->height - y_off);
-
- BITMAP_SETUP (dst,
- dst->geometry.first,
- dst->geometry.size,
- dst->geometry.count,
- w, h, byte_offset, pixel_offset);
-
- gl->bitmap (w, h,
- 0.0f, (glitz_gl_float_t) dst->geometry.count,
- 0.0f, 0.0f,
- bitmap + byte_offset);
- }
-
- if (damage)
- glitz_surface_damage (dst, &box, damage);
- }
-
- clip++;
- }
-
- if (heap_bitmap)
- free (heap_bitmap);
-}
-
-void
-glitz_geometry_draw_arrays (glitz_gl_proc_address_list_t *gl,
- glitz_surface_t *dst,
- glitz_geometry_type_t type,
- glitz_box_t *bounds,
- int damage)
-{
- switch (type) {
- case GLITZ_GEOMETRY_TYPE_VERTEX:
- _glitz_draw_vertex_arrays (gl, dst, bounds, damage);
- break;
- case GLITZ_GEOMETRY_TYPE_BITMAP:
- _glitz_draw_bitmap_arrays (gl, dst, bounds, damage);
- break;
- case GLITZ_GEOMETRY_TYPE_NONE:
- _glitz_draw_rectangle (gl, dst, bounds, damage);
- break;
- }
-}
deleted file mode 100644
--- a/gfx/cairo/glitz/src/glitz_gl.h
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * Copyright © 2004 David Reveman, Peter Nilsson
- *
- * Permission to use, copy, modify, distribute, and sell this software
- * and its documentation for any purpose is hereby granted without
- * fee, provided that the above copyright notice appear in all copies
- * and that both that copyright notice and this permission notice
- * appear in supporting documentation, and that the names of
- * David Reveman and Peter Nilsson not be used in advertising or
- * publicity pertaining to distribution of the software without
- * specific, written prior permission. David Reveman and Peter Nilsson
- * makes no representations about the suitability of this software for
- * any purpose. It is provided "as is" without express or implied warranty.
- *
- * DAVID REVEMAN AND PETER NILSSON DISCLAIMS ALL WARRANTIES WITH
- * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DAVID REVEMAN AND
- * PETER NILSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
- * OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: David Reveman <davidr@novell.com>
- * Peter Nilsson <c99pnn@cs.umu.se>
- */
-
-#ifndef GLITZ_GL_H_INCLUDED
-#define GLITZ_GL_H_INCLUDED
-
-#include <stddef.h>
-
-#ifdef _WIN32
-#define GLITZ_GL_API_ATTRIBUTE __stdcall
-#else
-#define GLITZ_GL_API_ATTRIBUTE
-#endif
-
-typedef unsigned int glitz_gl_enum_t;
-typedef unsigned char glitz_gl_boolean_t;
-typedef void glitz_gl_void_t;
-typedef int glitz_gl_int_t;
-typedef unsigned int glitz_gl_uint_t;
-typedef int glitz_gl_sizei_t;
-typedef double glitz_gl_double_t;
-typedef float glitz_gl_float_t;
-typedef unsigned short glitz_gl_ushort_t;
-typedef short glitz_gl_short_t;
-typedef unsigned int glitz_gl_bitfield_t;
-typedef double glitz_gl_clampd_t;
-typedef float glitz_gl_clampf_t;
-typedef unsigned char glitz_gl_ubyte_t;
-typedef ptrdiff_t glitz_gl_intptr_t;
-typedef ptrdiff_t glitz_gl_sizeiptr_t;
-
-
-#define GLITZ_GL_FALSE 0x0
-#define GLITZ_GL_TRUE 0x1
-
-#define GLITZ_GL_NO_ERROR 0x0
-#define GLITZ_GL_INVALID_OPERATION 0x0502
-
-#define GLITZ_GL_VERSION 0x1F02
-#define GLITZ_GL_EXTENSIONS 0x1F03
-
-#define GLITZ_GL_UNSIGNED_BYTE 0x1401
-#define GLITZ_GL_UNSIGNED_BYTE_3_3_2 0x8032
-#define GLITZ_GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
-#define GLITZ_GL_UNSIGNED_SHORT_5_6_5 0x8363
-#define GLITZ_GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
-#define GLITZ_GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GLITZ_GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
-#define GLITZ_GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GLITZ_GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
-#define GLITZ_GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
-#define GLITZ_GL_UNSIGNED_INT_10_10_10_2 0x8036
-#define GLITZ_GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-
-#define GLITZ_GL_MODELVIEW 0x1700
-#define GLITZ_GL_PROJECTION 0x1701
-
-#define GLITZ_GL_SHORT 0x1402
-#define GLITZ_GL_INT 0x1404
-#define GLITZ_GL_FLOAT 0x1406
-#define GLITZ_GL_DOUBLE 0x140A
-
-#define GLITZ_GL_POINTS 0x0000
-#define GLITZ_GL_LINES 0x0001
-#define GLITZ_GL_LINE_LOOP 0x0002
-#define GLITZ_GL_LINE_STRIP 0x0003
-#define GLITZ_GL_TRIANGLES 0x0004
-#define GLITZ_GL_TRIANGLE_STRIP 0x0005
-#define GLITZ_GL_TRIANGLE_FAN 0x0006
-#define GLITZ_GL_QUADS 0x0007
-#define GLITZ_GL_QUAD_STRIP 0x0008
-#define GLITZ_GL_POLYGON 0x0009
-
-#define GLITZ_GL_VERTEX_ARRAY 0x8074
-#define GLITZ_GL_TEXTURE_COORD_ARRAY 0x8078
-
-#define GLITZ_GL_FILL 0x1B02
-#define GLITZ_GL_FRONT 0x0404
-#define GLITZ_GL_BACK 0x0405
-#define GLITZ_GL_CULL_FACE 0x0B44
-
-#define GLITZ_GL_POINT_SMOOTH 0x0B10
-#define GLITZ_GL_LINE_SMOOTH 0x0B20
-#define GLITZ_GL_POLYGON_SMOOTH 0x0B41
-
-#define GLITZ_GL_SCISSOR_TEST 0x0C11
-
-#define GLITZ_GL_MAX_TEXTURE_SIZE 0x0D33
-#define GLITZ_GL_MAX_VIEWPORT_DIMS 0x0D3A
-
-#define GLITZ_GL_TEXTURE_WIDTH 0x1000
-#define GLITZ_GL_TEXTURE_HEIGHT 0x1001
-#define GLITZ_GL_TEXTURE_BORDER_COLOR 0x1004
-
-#define GLITZ_GL_TEXTURE_BINDING_2D 0x8069
-#define GLITZ_GL_TEXTURE_BINDING_RECTANGLE 0x84F6
-
-#define GLITZ_GL_TEXTURE_ENV 0x2300
-#define GLITZ_GL_TEXTURE_ENV_MODE 0x2200
-#define GLITZ_GL_TEXTURE_2D 0x0DE1
-#define GLITZ_GL_PROXY_TEXTURE_2D 0x8064
-#define GLITZ_GL_TEXTURE_WRAP_S 0x2802
-#define GLITZ_GL_TEXTURE_WRAP_T 0x2803
-#define GLITZ_GL_TEXTURE_MAG_FILTER 0x2800
-#define GLITZ_GL_TEXTURE_MIN_FILTER 0x2801
-#define GLITZ_GL_TEXTURE_ENV_COLOR 0x2201
-#define GLITZ_GL_TEXTURE_GEN_S 0x0C60
-#define GLITZ_GL_TEXTURE_GEN_T 0x0C61
-#define GLITZ_GL_TEXTURE_GEN_MODE 0x2500
-#define GLITZ_GL_EYE_LINEAR 0x2400
-#define GLITZ_GL_EYE_PLANE 0x2502
-#define GLITZ_GL_S 0x2000
-#define GLITZ_GL_T 0x2001
-
-#define GLITZ_GL_MODULATE 0x2100
-#define GLITZ_GL_NEAREST 0x2600
-#define GLITZ_GL_LINEAR 0x2601
-#define GLITZ_GL_CLAMP 0x2900
-#define GLITZ_GL_REPEAT 0x2901
-#define GLITZ_GL_CLAMP_TO_EDGE 0x812F
-#define GLITZ_GL_CLAMP_TO_BORDER 0x812D
-#define GLITZ_GL_TEXTURE_RED_SIZE 0x805C
-#define GLITZ_GL_TEXTURE_GREEN_SIZE 0x805D
-#define GLITZ_GL_TEXTURE_BLUE_SIZE 0x805E
-#define GLITZ_GL_TEXTURE_ALPHA_SIZE 0x805F
-
-#define GLITZ_GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GLITZ_GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GLITZ_GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GLITZ_GL_LINEAR_MIPMAP_LINEAR 0x2703
-
-#define GLITZ_GL_TEXTURE 0x1702
-#define GLITZ_GL_SRC_COLOR 0x0300
-
-#define GLITZ_GL_COMBINE 0x8570
-#define GLITZ_GL_COMBINE_RGB 0x8571
-#define GLITZ_GL_COMBINE_ALPHA 0x8572
-#define GLITZ_GL_SOURCE0_RGB 0x8580
-#define GLITZ_GL_SOURCE1_RGB 0x8581
-#define GLITZ_GL_SOURCE2_RGB 0x8582
-#define GLITZ_GL_SOURCE0_ALPHA 0x8588
-#define GLITZ_GL_SOURCE1_ALPHA 0x8589
-#define GLITZ_GL_SOURCE2_ALPHA 0x858A
-#define GLITZ_GL_OPERAND0_RGB 0x8590
-#define GLITZ_GL_OPERAND1_RGB 0x8591
-#define GLITZ_GL_OPERAND2_RGB 0x8592
-#define GLITZ_GL_OPERAND0_ALPHA 0x8598
-#define GLITZ_GL_OPERAND1_ALPHA 0x8599
-#define GLITZ_GL_OPERAND2_ALPHA 0x859A
-#define GLITZ_GL_RGB_SCALE 0x8573
-#define GLITZ_GL_ADD_SIGNED 0x8574
-#define GLITZ_GL_INTERPOLATE 0x8575
-#define GLITZ_GL_SUBTRACT 0x84E7
-#define GLITZ_GL_CONSTANT 0x8576
-#define GLITZ_GL_PRIMARY_COLOR 0x8577
-#define GLITZ_GL_PREVIOUS 0x8578
-#define GLITZ_GL_DOT3_RGB 0x86AE
-#define GLITZ_GL_DOT3_RGBA 0x86AF
-
-#define GLITZ_GL_STENCIL_TEST 0x0B90
-#define GLITZ_GL_KEEP 0x1E00
-#define GLITZ_GL_REPLACE 0x1E01
-#define GLITZ_GL_INCR 0x1E02
-#define GLITZ_GL_DECR 0x1E03
-
-#define GLITZ_GL_LESS 0x0201
-#define GLITZ_GL_EQUAL 0x0202
-#define GLITZ_GL_LEQUAL 0x0203
-#define GLITZ_GL_ALWAYS 0x0207
-#define GLITZ_GL_DEPTH_TEST 0x0B71
-
-#define GLITZ_GL_STENCIL_BUFFER_BIT 0x00000400
-#define GLITZ_GL_VIEWPORT_BIT 0x00000800
-#define GLITZ_GL_TRANSFORM_BIT 0x00001000
-#define GLITZ_GL_COLOR_BUFFER_BIT 0x00004000
-
-#define GLITZ_GL_STENCIL_INDEX 0x1901
-#define GLITZ_GL_DEPTH_COMPONENT 0x1902
-
-#define GLITZ_GL_ALPHA 0x1906
-#define GLITZ_GL_RGB 0x1907
-#define GLITZ_GL_LUMINANCE 0x1909
-#define GLITZ_GL_COLOR 0x1800
-#define GLITZ_GL_DITHER 0x0BD0
-#define GLITZ_GL_RGBA 0x1908
-#define GLITZ_GL_BGR 0x80E0
-#define GLITZ_GL_BGRA 0x80E1
-
-#define GLITZ_GL_ALPHA4 0x803B
-#define GLITZ_GL_ALPHA8 0x803C
-#define GLITZ_GL_ALPHA12 0x803D
-#define GLITZ_GL_ALPHA16 0x803E
-#define GLITZ_GL_LUMINANCE8 0x8040
-#define GLITZ_GL_R3_G3_B2 0x2A10
-#define GLITZ_GL_RGB4 0x804F
-#define GLITZ_GL_RGB5 0x8050
-#define GLITZ_GL_RGB8 0x8051
-#define GLITZ_GL_RGB10 0x8052
-#define GLITZ_GL_RGB12 0x8053
-#define GLITZ_GL_RGB16 0x8054
-#define GLITZ_GL_RGBA2 0x8055
-#define GLITZ_GL_RGBA4 0x8056
-#define GLITZ_GL_RGB5_A1 0x8057
-#define GLITZ_GL_RGBA8 0x8058
-#define GLITZ_GL_RGB10_A2 0x8059
-#define GLITZ_GL_RGBA12 0x805A
-#define GLITZ_GL_RGBA16 0x805B
-
-#define GLITZ_GL_FRONT_AND_BACK 0x0408
-#define GLITZ_GL_FLAT 0x1D00
-#define GLITZ_GL_SMOOTH 0x1D01
-
-#define GLITZ_GL_BLEND 0x0BE2
-#define GLITZ_GL_ZERO 0x0000
-#define GLITZ_GL_ONE 0x0001
-#define GLITZ_GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GLITZ_GL_SRC_ALPHA 0x0302
-#define GLITZ_GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GLITZ_GL_DST_ALPHA 0x0304
-#define GLITZ_GL_ONE_MINUS_DST_ALPHA 0x0305
-#define GLITZ_GL_SRC_ALPHA_SATURATE 0x0308
-#define GLITZ_GL_CONSTANT_COLOR 0x8001
-
-#define GLITZ_GL_PACK_ALIGNMENT 0x0D05
-#define GLITZ_GL_PACK_LSB_FIRST 0x0D01
-#define GLITZ_GL_PACK_ROW_LENGTH 0x0D02
-#define GLITZ_GL_PACK_SKIP_PIXELS 0x0D04
-#define GLITZ_GL_PACK_SKIP_ROWS 0x0D03
-#define GLITZ_GL_UNPACK_ALIGNMENT 0x0CF5
-#define GLITZ_GL_UNPACK_LSB_FIRST 0x0CF1
-#define GLITZ_GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GLITZ_GL_UNPACK_SKIP_PIXELS 0x0CF4
-#define GLITZ_GL_UNPACK_SKIP_ROWS 0x0CF3
-
-#define GLITZ_GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
-#define GLITZ_GL_FASTEST 0x1101
-#define GLITZ_GL_NICEST 0x1102
-
-#define GLITZ_GL_COMPILE 0x1300
-
-#define GLITZ_GL_TEXTURE_RECTANGLE 0x84F5
-#define GLITZ_GL_PROXY_TEXTURE_RECTANGLE 0x84F7
-#define GLITZ_GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8
-
-#define GLITZ_GL_MIRRORED_REPEAT 0x8370
-
-#define GLITZ_GL_TEXTURE0 0x84C0
-#define GLITZ_GL_TEXTURE1 0x84C1
-#define GLITZ_GL_TEXTURE2 0x84C2
-#define GLITZ_GL_ACTIVE_TEXTURE 0x84E0
-#define GLITZ_GL_MAX_TEXTURE_UNITS 0x84E2
-
-#define GLITZ_GL_MULTISAMPLE 0x809D
-
-#define GLITZ_GL_MULTISAMPLE_FILTER_HINT 0x8534
-
-#define GLITZ_GL_FRAGMENT_PROGRAM 0x8804
-#define GLITZ_GL_PROGRAM_STRING 0x8628
-#define GLITZ_GL_PROGRAM_FORMAT_ASCII 0x8875
-#define GLITZ_GL_PROGRAM_ERROR_POSITION 0x864B
-#define GLITZ_GL_MAX_PROGRAM_LOCAL_PARAMETERS 0x88B4
-#define GLITZ_GL_PROGRAM_INSTRUCTIONS 0x88A0
-#define GLITZ_GL_MAX_PROGRAM_INSTRUCTIONS 0x88A1
-#define GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS 0x88A2
-#define GLITZ_GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS 0x88A3
-#define GLITZ_GL_PROGRAM_PARAMETERS 0x88A8
-#define GLITZ_GL_MAX_PROGRAM_PARAMETERS 0x88A9
-#define GLITZ_GL_PROGRAM_NATIVE_PARAMETERS 0x88AA
-#define GLITZ_GL_MAX_PROGRAM_NATIVE_PARAMETERS 0x88AB
-#define GLITZ_GL_PROGRAM_UNDER_NATIVE_LIMITS 0x88B6
-#define GLITZ_GL_PROGRAM_ALU_INSTRUCTIONS 0x8805
-#define GLITZ_GL_PROGRAM_TEX_INSTRUCTIONS 0x8806
-#define GLITZ_GL_PROGRAM_TEX_INDIRECTIONS 0x8807
-#define GLITZ_GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS 0x8808
-#define GLITZ_GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS 0x8809
-#define GLITZ_GL_PROGRAM_NATIVE_TEX_INDIRECTIONS 0x880A
-#define GLITZ_GL_MAX_PROGRAM_ALU_INSTRUCTIONS 0x880B
-#define GLITZ_GL_MAX_PROGRAM_TEX_INSTRUCTIONS 0x880C
-#define GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS 0x880D
-#define GLITZ_GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS 0x880E
-#define GLITZ_GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS 0x880F
-#define GLITZ_GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS 0x8810
-
-#define GLITZ_GL_ARRAY_BUFFER 0x8892
-#define GLITZ_GL_PIXEL_PACK_BUFFER 0x88EB
-#define GLITZ_GL_PIXEL_UNPACK_BUFFER 0x88EC
-
-#define GLITZ_GL_STREAM_DRAW 0x88E0
-#define GLITZ_GL_STREAM_READ 0x88E1
-#define GLITZ_GL_STREAM_COPY 0x88E2
-#define GLITZ_GL_STATIC_DRAW 0x88E4
-#define GLITZ_GL_STATIC_READ 0x88E5
-#define GLITZ_GL_STATIC_COPY 0x88E6
-#define GLITZ_GL_DYNAMIC_DRAW 0x88E8
-#define GLITZ_GL_DYNAMIC_READ 0x88E9
-#define GLITZ_GL_DYNAMIC_COPY 0x88EA
-
-#define GLITZ_GL_READ_ONLY 0x88B8
-#define GLITZ_GL_WRITE_ONLY 0x88B9
-#define GLITZ_GL_READ_WRITE 0x88BA
-
-#define GLITZ_GL_FRAMEBUFFER 0x8D40
-#define GLITZ_GL_RENDERBUFFER 0x8D41
-
-#define GLITZ_GL_COLOR_ATTACHMENT0 0x8CE0
-#define GLITZ_GL_COLOR_ATTACHMENT1 0x8CE1
-#define GLITZ_GL_DEPTH_ATTACHMENT 0x8D00
-#define GLITZ_GL_STENCIL_ATTACHMENT 0x8D20
-
-#define GLITZ_GL_FRAMEBUFFER_COMPLETE 0x8CD5
-#define GLITZ_GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
-#define GLITZ_GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
-#define GLITZ_GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT 0x8CD8
-#define GLITZ_GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
-#define GLITZ_GL_FRAMEBUFFER_INCOMPLETE_FORMATS 0x8CDA
-#define GLITZ_GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
-#define GLITZ_GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
-#define GLITZ_GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
-#define GLITZ_GL_FRAMEBUFFER_STATUS_ERROR 0x8CDE
-
-#define GLITZ_GL_RENDERBUFFER_RED_SIZE 0x8D50
-#define GLITZ_GL_RENDERBUFFER_GREEN_SIZE 0x8D51
-#define GLITZ_GL_RENDERBUFFER_BLUE_SIZE 0x8D52
-#define GLITZ_GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
-#define GLITZ_GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
-#define GLITZ_GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
-
-typedef glitz_gl_void_t (GLITZ_GL_API_ATTRIBUTE * glitz_gl_enable_t)
- (glitz_gl_enum_t cap);
-t