[cairo-commit] glitz/src Makefile.am, 1.10, 1.11 glitz.c, 1.31, 1.32 glitz.h, 1.28, 1.29 glitz_surface.c, 1.27, 1.28 glitz_util.c, 1.13, 1.14 glitzint.h, 1.32, 1.33

David Reveman commit at pdx.freedesktop.org
Tue Apr 12 07:54:59 PDT 2005


Committed by: davidr

Update of /cvs/cairo/glitz/src
In directory gabe:/tmp/cvs-serv20487/src

Modified Files:
	Makefile.am glitz.c glitz.h glitz_surface.c glitz_util.c 
	glitzint.h 
Log Message:
Add glitz_context_t interface

Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/glitz/src/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.am	10 Feb 2005 01:03:00 -0000	1.10
+++ Makefile.am	12 Apr 2005 14:54:56 -0000	1.11
@@ -23,6 +23,7 @@
 	glitz_pixel.c	    \
 	glitz_trap.c	    \
 	glitz_framebuffer.c \
+	glitz_context.c	    \
 	glitz_trapimp.h	    \
 	glitz_gl.h	    \
 	glitzint.h

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- glitz.c	25 Jan 2005 19:50:26 -0000	1.31
+++ glitz.c	12 Apr 2005 14:54:56 -0000	1.32
@@ -399,19 +399,14 @@
     {
         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);
             }
-            status = GLITZ_STATUS_SUCCESS;
-        } else
-            status = glitz_surface_make_current_read (src);
-
-        if (!status)
-        {
-            glitz_box_t box, *clip = dst->clip;
-            int         n_clip = dst->n_clip;
             
             gl->read_buffer (src->buffer);
             gl->draw_buffer (dst->buffer);

Index: glitz.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- glitz.h	1 Mar 2005 15:49:37 -0000	1.28
+++ glitz.h	12 Apr 2005 14:54:56 -0000	1.29
@@ -374,6 +374,61 @@
 glitz_bool_t
 glitz_surface_valid_target (glitz_surface_t *surface);
 
+
+/* 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);
+
+/* XXX: The following context functions are part of a temporary solution and
+   will be removed soon. It should not be possible to attach a surface to a
+   context. Only drawables can be used with contexts. */
+void
+glitz_context_set_surface (glitz_context_t *context,
+                           glitz_surface_t *surface);
+
+void
+glitz_context_set_viewport (glitz_context_t *context,
+                            int             x,
+                            int             y,
+                            int             width,
+                            int             height);
+void
+glitz_context_set_scissor (glitz_context_t *context,
+                           int             x,
+                           int             y,
+                           int             width,
+                           int             height);
+
   
 /* glitz_rect.c */
 

Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- glitz_surface.c	10 Feb 2005 01:03:00 -0000	1.27
+++ glitz_surface.c	12 Apr 2005 14:54:56 -0000	1.28
@@ -236,8 +236,8 @@
     }
 }
 
-static void
-_glitz_surface_sync_drawable (glitz_surface_t *surface)
+void
+glitz_surface_sync_drawable (glitz_surface_t *surface)
 {   
     if (REGION_NOTEMPTY (&surface->drawable_damage))
     {
@@ -440,7 +440,7 @@
         height   = surface->texture.height;
     }
     
-    if (drawable->update_all                          ||
+    if (drawable->update_all                         ||
         drawable->viewport.x      != surface->x      ||
         drawable->viewport.y      != surface->y      ||
         drawable->viewport.width  != surface->box.x2 ||
@@ -560,7 +560,7 @@
               glitz_framebuffer_unbind (&surface->attached->backend->gl);
               
           _glitz_surface_update_state (surface);
-          _glitz_surface_sync_drawable (surface);
+          glitz_surface_sync_drawable (surface);
       }
   }
   else
@@ -603,15 +603,6 @@
     _glitz_surface_update_state (other);
 }
 
-glitz_status_t
-glitz_surface_make_current_read (glitz_surface_t *surface)
-{
-  if (surface->attached)
-    return surface->attached->backend->make_current_read (surface->attached);
-  else
-    return surface->drawable->backend->make_current_read (surface->drawable);
-}
-
 void
 glitz_surface_set_transform (glitz_surface_t   *surface,
                              glitz_transform_t *transform)

Index: glitz_util.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_util.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- glitz_util.c	10 Feb 2005 01:03:00 -0000	1.13
+++ glitz_util.c	12 Apr 2005 14:54:56 -0000	1.14
@@ -351,7 +351,6 @@
 void
 glitz_initiate_state (glitz_gl_proc_address_list_t *gl)
 {
-  gl->disable (GLITZ_GL_DEPTH_TEST); 
   gl->hint (GLITZ_GL_PERSPECTIVE_CORRECTION_HINT, GLITZ_GL_FASTEST);
   gl->disable (GLITZ_GL_CULL_FACE);
   gl->depth_mask (GLITZ_GL_FALSE);  

Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- glitzint.h	10 Feb 2005 01:03:00 -0000	1.32
+++ glitzint.h	12 Apr 2005 14:54:56 -0000	1.33
@@ -87,8 +87,6 @@
 
 #define GLITZ_CONTEXT_STACK_SIZE 16
 
-typedef void (*glitz_function_pointer_t) (void);
-
 typedef struct _glitz_gl_proc_address_list_t {
   
   /* core */
@@ -332,8 +330,25 @@
   void
   (*swap_buffers)              (void *drawable);
 
-  glitz_status_t
-  (*make_current_read)         (void *drawable);
+  glitz_context_t *
+  (*create_context)            (void                    *drawable,
+                                glitz_drawable_format_t *format);
+
+  void
+  (*destroy_context)           (void *context);
+
+  void
+  (*copy_context)              (void          *src,
+                                void          *dst,
+                                unsigned long mask);
+
+  void
+  (*make_current)              (void *context,
+                                void *drawable);
+
+  glitz_function_pointer_t
+  (*get_proc_address)          (void       *context,
+                                const char *name);
 
   glitz_gl_proc_address_list_t gl;
   
@@ -574,6 +589,16 @@
 #define GLITZ_GL_SURFACE(surface) \
   glitz_gl_proc_address_list_t *gl = &(surface)->drawable->backend->gl;
 
+struct _glitz_context {
+  glitz_drawable_t              *drawable;
+  glitz_surface_t               *surface;
+  int                           ref_count;
+  void                          *closure;
+  glitz_lose_current_function_t lose_current;
+  glitz_box_t                   scissor;
+  glitz_box_t                   viewport;
+};
+
 typedef struct _glitz_composite_op_t glitz_composite_op_t;
 
 typedef void (*glitz_combine_function_t) (glitz_composite_op_t *);
@@ -726,15 +751,15 @@
 extern void __internal_linkage
 glitz_surface_pop_current (glitz_surface_t *surface);
 
-extern glitz_status_t __internal_linkage
-glitz_surface_make_current_read (glitz_surface_t *surface);
-
 extern void __internal_linkage
 glitz_surface_damage (glitz_surface_t *surface,
                       glitz_box_t     *box,
                       int             what);
 
 extern void __internal_linkage
+glitz_surface_sync_drawable (glitz_surface_t *surface);
+
+extern void __internal_linkage
 glitz_surface_status_add (glitz_surface_t *surface,
                           int             flags);
 
@@ -833,6 +858,13 @@
                             glitz_framebuffer_t          *framebuffer,
                             glitz_texture_t              *texture);
 
+void
+_glitz_context_init (glitz_context_t  *context,
+                     glitz_drawable_t *drawable);
+
+void
+_glitz_context_fini (glitz_context_t *context);
+
 
 #define MAXSHORT SHRT_MAX
 #define MINSHORT SHRT_MIN
@@ -944,5 +976,15 @@
 slim_hidden_proto(glitz_set_multi_array)
 slim_hidden_proto(glitz_buffer_set_data)
 slim_hidden_proto(glitz_buffer_get_data)
+slim_hidden_proto(glitz_context_create)
+slim_hidden_proto(glitz_context_destroy)
+slim_hidden_proto(glitz_context_reference)
+slim_hidden_proto(glitz_context_copy)
+slim_hidden_proto(glitz_context_set_user_data)
+slim_hidden_proto(glitz_context_get_proc_address)
+slim_hidden_proto(glitz_context_make_current)
+slim_hidden_proto(glitz_context_set_surface)
+slim_hidden_proto(glitz_context_set_viewport)
+slim_hidden_proto(glitz_context_set_scissor)
 
 #endif /* GLITZINT_H_INCLUDED */




More information about the cairo-commit mailing list