summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Reveman <davidr@novell.com>2004-05-30 15:59:54 +0000
committerDavid Reveman <davidr@novell.com>2004-05-30 15:59:54 +0000
commita5d65cb247e41b87397bb30e60298757016ddac1 (patch)
tree9afc14de8c8bd2f6ed7c77b4e20b12005056b62e
parente3c38094d367a8c169438d64da0ff8ec1b50fc37 (diff)
Updated glitz_texture_copy_surface
-rw-r--r--ChangeLog14
-rw-r--r--src/glitz.c16
-rw-r--r--src/glitz_agl_surface.c19
-rw-r--r--src/glitz_glx_surface.c16
-rw-r--r--src/glitz_texture.c32
-rw-r--r--src/glitzint.h9
6 files changed, 73 insertions, 33 deletions
diff --git a/ChangeLog b/ChangeLog
index ed2b72e..fd540e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
2004-05-30 David Reveman <c99drn@cs.umu.se>
+ * src/glitz.c (glitz_copy_area): Use new glitz_texture_copy_surface
+ function.
+
+ * src/glitz_agl_surface.c (_glitz_agl_surface_get_texture): Use
+ new glitz_texture_copy_surface function.
+
+ * src/glitz_glx_surface.c (_glitz_glx_surface_get_texture): Use
+ new glitz_texture_copy_surface function.
+
+ * src/glitzint.h: New parameters to glitz_texture_copy_surface.
+
+ * src/glitz_texture.c (glitz_texture_copy_surface): Made it more
+ flexible, this was required to make glitz_copy_area work correctly.
+
* src/glitz.c (glitz_copy_area): And another one.
2004-05-29 David Reveman <c99drn@cs.umu.se>
diff --git a/src/glitz.c b/src/glitz.c
index 1efe38f..8f68193 100644
--- a/src/glitz.c
+++ b/src/glitz.c
@@ -841,7 +841,6 @@ glitz_copy_area (glitz_surface_t *src,
int y_dst)
{
glitz_gl_proc_address_list_t *gl;
- glitz_bounding_box_t box;
int status;
if (SURFACE_PROGRAMMATIC (dst) || SURFACE_PROGRAMMATIC (src))
@@ -880,16 +879,13 @@ glitz_copy_area (glitz_surface_t *src,
if (width <= 0 || height <= 0)
return;
- box.x1 = x_dst;
- box.y1 = y_dst;
- box.x2 = box.x1 + width;
- box.y2 = box.y1 + height;
-
gl = dst->gl;
status = 0;
if (glitz_surface_try_push_current (dst,
GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
+ glitz_bounding_box_t box;
+
if (src != dst)
status = glitz_surface_make_current_read (src);
else
@@ -953,6 +949,11 @@ glitz_copy_area (glitz_surface_t *src,
}
}
+ box.x1 = x_dst;
+ box.y1 = y_dst;
+ box.x2 = box.x1 + width;
+ box.y2 = box.y1 + height;
+
glitz_surface_dirty (dst, &box);
glitz_surface_pop_current (dst);
@@ -962,7 +963,8 @@ glitz_copy_area (glitz_surface_t *src,
if (!status) {
if (glitz_surface_try_push_current (src,
GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
- glitz_texture_copy_surface (&dst->texture, src, &box, x_src, y_src);
+ glitz_texture_copy_surface (&dst->texture, src,
+ x_src, y_src, width, height, x_dst, y_dst);
status = 1;
}
glitz_surface_pop_current (src);
diff --git a/src/glitz_agl_surface.c b/src/glitz_agl_surface.c
index 4efc9f5..c1f8bb7 100644
--- a/src/glitz_agl_surface.c
+++ b/src/glitz_agl_surface.c
@@ -119,11 +119,22 @@ _glitz_agl_surface_get_texture (void *abstract_surface) {
}
return &surface->base.texture;
- } else
+ } else {
+ glitz_bounding_box_t copy_box;
+
+ copy_box.x1 = copy_box.y1 = 0;
+ copy_box.x2 = surface->base.width;
+ copy_box.y2 = surface->base.height;
+ glitz_intersect_bounding_box (&surface->base.dirty_box,
+ &copy_box, &copy_box);
glitz_texture_copy_surface (&surface->base.texture, &surface->base,
- &surface->base.dirty_box,
- surface->base.dirty_box.x1,
- surface->base.dirty_box.y1);
+ copy_box.x1,
+ copy_box.y1,
+ copy_box.x2 - copy_box.x1,
+ copy_box.y2 - copy_box.y1,
+ copy_box.x1,
+ copy_box.y1);
+ }
surface->base.hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
}
diff --git a/src/glitz_glx_surface.c b/src/glitz_glx_surface.c
index d4b115e..393053d 100644
--- a/src/glitz_glx_surface.c
+++ b/src/glitz_glx_surface.c
@@ -143,10 +143,20 @@ _glitz_glx_surface_get_texture (void *abstract_surface)
glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
if (surface->base.hint_mask & GLITZ_INT_HINT_DIRTY_MASK) {
+ glitz_bounding_box_t copy_box;
+
+ copy_box.x1 = copy_box.y1 = 0;
+ copy_box.x2 = surface->base.width;
+ copy_box.y2 = surface->base.height;
+ glitz_intersect_bounding_box (&surface->base.dirty_box,
+ &copy_box, &copy_box);
glitz_texture_copy_surface (&surface->base.texture, &surface->base,
- &surface->base.dirty_box,
- surface->base.dirty_box.x1,
- surface->base.dirty_box.y1);
+ copy_box.x1,
+ copy_box.y1,
+ copy_box.x2 - copy_box.x1,
+ copy_box.y2 - copy_box.y1,
+ copy_box.x1,
+ copy_box.y1);
surface->base.hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
}
diff --git a/src/glitz_texture.c b/src/glitz_texture.c
index 03ee54d..04db81c 100644
--- a/src/glitz_texture.c
+++ b/src/glitz_texture.c
@@ -213,11 +213,14 @@ glitz_texture_unbind (glitz_gl_proc_address_list_t *gl,
void
glitz_texture_copy_surface (glitz_texture_t *texture,
glitz_surface_t *surface,
- glitz_bounding_box_t *box,
- int x_src,
- int y_src)
+ int x_surface,
+ int y_surface,
+ int width,
+ int height,
+ int x_texture,
+ int y_texture)
{
- int x_dst, y_dst, width, height;
+ int tex_height;
glitz_surface_push_current (surface, GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
@@ -226,22 +229,19 @@ glitz_texture_copy_surface (glitz_texture_t *texture,
if (!texture->allocated)
_glitz_texture_allocate (surface->gl, texture);
- if (x_src < 0) x_src = 0;
- if (y_src < 0) y_src = 0;
-
- x_dst = (box->x1 > 0)? box->x1: 0;
- y_dst = (box->y1 > 0)? box->y1: 0;
- width = (box->x2 < (int) texture->width)?
- box->x2 - x_dst: (int) texture->width - x_dst;
- height = (box->x2 < (int) texture->height)?
- box->y2 - y_dst: (int) texture->height - y_dst;
-
if (surface->format->doublebuffer)
surface->gl->read_buffer (surface->read_buffer);
+
+ if (texture->target == GLITZ_GL_TEXTURE_2D)
+ tex_height = (int) ((double) texture->height * texture->texcoord_height);
+ else
+ tex_height = (int) texture->texcoord_height;
surface->gl->copy_tex_sub_image_2d (texture->target, 0,
- x_dst, y_dst,
- x_src, y_src,
+ x_texture,
+ tex_height - y_texture - height,
+ x_surface,
+ surface->height - y_surface - height,
width, height);
glitz_texture_unbind (surface->gl, texture);
diff --git a/src/glitzint.h b/src/glitzint.h
index 49c878c..db9628f 100644
--- a/src/glitzint.h
+++ b/src/glitzint.h
@@ -491,9 +491,12 @@ glitz_texture_unbind (glitz_gl_proc_address_list_t *gl,
void
glitz_texture_copy_surface (glitz_texture_t *texture,
glitz_surface_t *surface,
- glitz_bounding_box_t *box,
- int x_src,
- int y_src);
+ int x_surface,
+ int y_surface,
+ int width,
+ int height,
+ int x_texture,
+ int y_texture);
void
glitz_surface_init (glitz_surface_t *surface,