[cairo-commit] glitz/src glitz.c, 1.32, 1.33 glitz.h, 1.30, 1.31 glitz_compose.c, 1.12, 1.13 glitz_context.c, 1.1, 1.2 glitz_surface.c, 1.28, 1.29 glitzint.h, 1.33, 1.34

David Reveman commit at pdx.freedesktop.org
Mon Jun 6 05:28:42 PDT 2005


Committed by: davidr

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

Modified Files:
	glitz.c glitz.h glitz_compose.c glitz_context.c 
	glitz_surface.c glitzint.h 
Log Message:
Remove temporary context functions and fix framebuffer object issues

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- glitz.c	12 Apr 2005 14:54:56 -0000	1.32
+++ glitz.c	6 Jun 2005 12:28:40 -0000	1.33
@@ -413,8 +413,6 @@
       
             glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
       
-            gl->disable (GLITZ_GL_SCISSOR_TEST);
-
             x_src += src->x;
             y_src += src->y;
 
@@ -440,6 +438,11 @@
                                           dst->attached->height -
                                           (dst->y + box.y2));
 
+                    gl->scissor (dst->x + box.x1,
+                                 dst->attached->height - (dst->y + box.y2),
+                                 box.x2 - box.x1,
+                                 box.y2 - box.y1);
+
                     gl->copy_pixels (x_src + (box.x1 - x_dst),
                                      src->attached->height -
                                      (y_src + (box.y2 - y_dst)),
@@ -453,8 +456,6 @@
                 
                 clip++;
             }
-
-            gl->enable (GLITZ_GL_SCISSOR_TEST);
         }
         else
         {

Index: glitz.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- glitz.h	12 Apr 2005 15:09:58 -0000	1.30
+++ glitz.h	6 Jun 2005 12:28:40 -0000	1.31
@@ -409,27 +409,11 @@
 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);
+glitz_context_bind_texture (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 */
 
 void

Index: glitz_compose.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_compose.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- glitz_compose.c	25 Jan 2005 19:50:26 -0000	1.12
+++ glitz_compose.c	6 Jun 2005 12:28:40 -0000	1.13
@@ -479,7 +479,6 @@
   op->type = GLITZ_COMBINE_TYPE_NA;
   op->combine = NULL;
   op->alpha_mask = _default_alpha_mask;
-  op->gl = &dst->drawable->backend->gl;
   op->src = src;
   op->mask = mask;
   op->dst = dst;
@@ -488,8 +487,17 @@
   op->per_component = 0;
   op->fp = 0;
 
-  feature_mask = dst->attached->backend->feature_mask;
-
+  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;

Index: glitz_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_context.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- glitz_context.c	13 Apr 2005 21:17:14 -0000	1.1
+++ glitz_context.c	6 Jun 2005 12:28:40 -0000	1.2
@@ -37,7 +37,6 @@
     
     context->ref_count    = 1;
     context->drawable     = drawable;
-    context->surface      = NULL;
     context->closure      = NULL;
     context->lose_current = NULL;
 }
@@ -46,8 +45,6 @@
 _glitz_context_fini (glitz_context_t *context)
 {
     glitz_drawable_destroy (context->drawable);
-    if (context->surface)
-        glitz_surface_destroy (context->surface);
 }
 
 glitz_context_t *
@@ -112,124 +109,19 @@
 void
 glitz_context_make_current (glitz_context_t *context)
 {
-    glitz_surface_t *surface = context->surface;
-
-    if (surface->attached)
-    {
-        glitz_box_t *scissor  = &context->scissor;
-        glitz_box_t *viewport = &context->viewport;
-        
-        GLITZ_GL_SURFACE (surface);
-
-        surface->attached->backend->make_current (context, surface->attached);
-
-        glitz_surface_sync_drawable (surface);
-
-        REGION_EMPTY (&surface->texture_damage);
-        REGION_INIT (&surface->texture_damage, &context->scissor);
-
-        gl->enable (GLITZ_GL_SCISSOR_TEST);
-
-        gl->scissor (surface->x + scissor->x1,
-                     surface->attached->height - surface->y - scissor->y2,
-                     scissor->x2 - scissor->x1,
-                     scissor->y2 - scissor->y1);
-
-        gl->viewport (surface->x + viewport->x1,
-                      surface->attached->height - surface->y - viewport->y2,
-                      viewport->x2 - viewport->x1,
-                      viewport->y2 - viewport->y1);
-
-        gl->draw_buffer (surface->buffer);
-    }
-    else if (surface->drawable->backend->feature_mask &
-             GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK)
-    {
-        surface->drawable->backend->make_current (context, surface->drawable);
-
-        if (!glitz_framebuffer_complete (&surface->drawable->backend->gl,
-                                         &surface->framebuffer,
-                                         &surface->texture))
-            glitz_surface_status_add (surface,
-                                      GLITZ_STATUS_NOT_SUPPORTED_MASK);
-    }
+    context->drawable->backend->make_current (context, context->drawable);
 }
 slim_hidden_def(glitz_context_make_current);
 
 void
-glitz_context_set_surface (glitz_context_t *context,
-                           glitz_surface_t *surface)
-{
-    glitz_surface_reference (surface);
-
-    if (context->surface)
-        glitz_surface_destroy (context->surface);
-
-    context->surface  = surface;
-    context->scissor  = surface->box;
-    context->viewport = surface->box;
-}
-slim_hidden_def(glitz_context_set_surface);
-
-void
-glitz_context_set_scissor (glitz_context_t *context,
-                           int             x,
-                           int             y,
-                           int             width,
-                           int             height)
-{
-    glitz_surface_t *surface = context->surface;
-    
-    GLITZ_GL_SURFACE (surface);
-
-    if (surface->attached)
-    {
-        glitz_box_t *scissor = &context->scissor;
-        
-        *scissor = surface->box;
-        if (x > 0)
-            scissor->x1 = x;
-        if (y > 0)
-            scissor->y2 -= y;
-        if (x + width < scissor->x2)
-            scissor->x2 = x + width;
-        if (y + height < scissor->y2)
-            scissor->y1 = scissor->y2 - y - height;
-
-        gl->scissor (surface->x + scissor->x1,
-                     surface->attached->height - surface->y - scissor->y2,
-                     scissor->x2 - scissor->x1,
-                     scissor->y2 - scissor->y1);
-    } else
-        gl->scissor (x, y, width, height);
-}
-slim_hidden_def(glitz_context_set_scissor);
-
-void
-glitz_context_set_viewport (glitz_context_t *context,
-                            int             x,
-                            int             y,
-                            int             width,
-                            int             height)
+glitz_context_bind_texture (glitz_context_t *context,
+                            glitz_surface_t *surface)
 {
-    glitz_surface_t *surface = context->surface;
+    glitz_gl_proc_address_list_t *gl = &context->drawable->backend->gl;
     
-    GLITZ_GL_SURFACE (surface);
-
-    if (surface->attached)
-    {
-        glitz_box_t *viewport = &context->viewport;
-        
-        viewport->x1 = x;
-        viewport->y1 = surface->box.y2 - y - height;
-        viewport->x2 = x + width;
-        viewport->y2 = surface->box.y2 - y;
-        
-        gl->viewport (surface->x + viewport->x1,
-                      surface->attached->height - surface->y - viewport->y2,
-                      viewport->x2 - viewport->x1,
-                      viewport->y2 - viewport->y1);
-    } else
-        gl->viewport (x, y, width, height);
+    if (!surface->texture.name)
+        gl->gen_textures (1, &surface->texture.name);
+  
+    gl->bind_texture (surface->texture.target, surface->texture.name);
 }
-slim_hidden_def(glitz_context_set_viewport);
+slim_hidden_def(glitz_context_bind_texture);

Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- glitz_surface.c	12 Apr 2005 14:54:56 -0000	1.28
+++ glitz_surface.c	6 Jun 2005 12:28:40 -0000	1.29
@@ -573,7 +573,7 @@
           if (surface->drawable->backend->feature_mask &
               GLITZ_FEATURE_FRAMEBUFFER_OBJECT_MASK)
           {
-              if (glitz_framebuffer_complete (&surface->attached->backend->gl,
+              if (glitz_framebuffer_complete (&surface->drawable->backend->gl,
                                               &surface->framebuffer,
                                               &surface->texture))
               {       

Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- glitzint.h	12 Apr 2005 14:54:56 -0000	1.33
+++ glitzint.h	6 Jun 2005 12:28:40 -0000	1.34
@@ -590,13 +590,10 @@
   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;
+  glitz_drawable_t              *drawable;
   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;
@@ -983,8 +980,6 @@
 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)
+slim_hidden_proto(glitz_context_bind_texture)
 
 #endif /* GLITZINT_H_INCLUDED */




More information about the cairo-commit mailing list