add surface prototypes
authorDana Jansens <danakj@orodu.net>
Mon, 26 May 2003 16:35:26 +0000 (16:35 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 26 May 2003 16:35:26 +0000 (16:35 +0000)
render2/render.h
render2/surface.c
render2/surface.h

index b034409381a8a1b2785b24a0d7a7193af886204e..1eb682ca7b9f5607442a2dc1ab8650d43839ac52 100644 (file)
@@ -110,6 +110,10 @@ enum RrSurfaceColorType {
     RR_SURFACE_PYRAMID
 };
 
+/*! Create a new RrSurface prototype that can't render. A prototype can be
+ copied to a new RrSurface that can render. */
+struct RrSurface *RrSurfaceNewProto(enum RrSurfaceType type,
+                                    int numtex);
 /*! Create a new top-level RrSurface for a Window. */
 struct RrSurface *RrSurfaceNew(struct RrInstance *inst,
                                enum RrSurfaceType type,
index 1620606e5d9fc2e48cad20a5c69a89ac17b6ed74..bd77dca993e29c83a1b3d8e63577bce26375b9d6 100644 (file)
@@ -21,6 +21,18 @@ static struct RrSurface *surface_new(enum RrSurfaceType type,
     return sur;
 }
 
+struct RrSurface *RrSurfaceNewProto(enum RrSurfaceType type,
+                                    int numtex)
+{
+    struct RrSurface *sur;
+
+    sur = surface_new(type, numtex);
+    sur->inst = inst;
+    sur->win = None;
+    sur->parent = NULL;
+    return sur;
+}
+
 struct RrSurface *RrSurfaceNew(struct RrInstance *inst,
                                enum RrSurfaceType type,
                                Window win,
@@ -63,6 +75,7 @@ static struct RrSurface *surface_copy(struct RrSurface *orig)
         break;
     case RR_SURFACE_NONPLANAR:
         assert(0);
+        break;
     }
     sur->ntextures = orig->ntextures;
     sur->texture = malloc(sizeof(struct RrTexture) * sur->ntextures);
index e6ea418b092d37c43432c5538d90635b53f9c81f..1a0ff756646dd0690270bf5159e88f726c2df7b0 100644 (file)
@@ -2,15 +2,7 @@
 #define __render_surface_h
 
 #include "render.h"
-
-union RrTextureData {
-    int foo;
-};
-
-struct RrTexture {
-    enum RrTextureType type;
-    union RrTextureData data;
-};
+#include "texture.h"
 
 struct RrPlanarSurface {
     enum RrSurfaceColorType colortype;
@@ -34,7 +26,13 @@ struct RrSurface {
     enum RrSurfaceType type;
     union RrSurfaceData data;
 
-    Window win; /* this can optionally be None if parent != NULL ... */
+    /* This member is created inside Render if parent != NULL, but is passed
+       in if parent == NULL and should not be destroyed!
+
+       Always check for this to be None before rendering it. Just skip by
+       (and assert) if it is None.
+    */
+    Window win; /* XXX this can optionally be None if parent != NULL ... */
 
     int ntextures;
     struct RrTexture *texture;