[cairo-commit] cairo/src cairo_glitz_surface.c,1.7,1.8
David Reveman
commit at pdx.freedesktop.org
Mon Oct 4 04:55:48 PDT 2004
Committed by: davidr
Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv2417/src
Modified Files:
cairo_glitz_surface.c
Log Message:
Do not use VBOs and PBOs for immediate mode drawing
Index: cairo_glitz_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_glitz_surface.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** cairo_glitz_surface.c 20 Sep 2004 05:11:04 -0000 1.7
--- cairo_glitz_surface.c 4 Oct 2004 11:55:46 -0000 1.8
***************
*** 101,105 ****
cairo_image_surface_t *image;
char *pixels;
! int width, height, rowstride, size;
cairo_format_masks_t format;
glitz_buffer_t *buffer;
--- 101,105 ----
cairo_image_surface_t *image;
char *pixels;
! int width, height;
cairo_format_masks_t format;
glitz_buffer_t *buffer;
***************
*** 137,142 ****
}
- rowstride = (((width * format.bpp) / 8) + 3) & -4;
-
pf.masks.bpp = format.bpp;
pf.masks.alpha_mask = format.alpha_mask;
--- 137,140 ----
***************
*** 146,159 ****
pf.xoffset = 0;
pf.skip_lines = 0;
! pf.bytes_per_line = rowstride;
pf.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
- size = height * rowstride;
! pixels = malloc (size);
if (!pixels)
return NULL;
! buffer = glitz_pixel_buffer_create (surface->surface, NULL, size,
! GLITZ_BUFFER_HINT_DYNAMIC_READ);
if (!buffer) {
free (pixels);
--- 144,155 ----
pf.xoffset = 0;
pf.skip_lines = 0;
! pf.bytes_per_line = (((width * format.bpp) / 8) + 3) & -4;
pf.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
! pixels = malloc (height * pf.bytes_per_line);
if (!pixels)
return NULL;
! buffer = glitz_buffer_create_for_data (pixels);
if (!buffer) {
free (pixels);
***************
*** 167,172 ****
buffer);
- glitz_buffer_get_data (buffer, 0, size, pixels);
-
glitz_buffer_destroy (buffer);
--- 163,166 ----
***************
*** 175,179 ****
&format,
width, height,
! rowstride);
_cairo_image_surface_assume_ownership_of_data (image);
--- 169,173 ----
&format,
width, height,
! pf.bytes_per_line);
_cairo_image_surface_assume_ownership_of_data (image);
***************
*** 193,198 ****
glitz_pixel_format_t pf;
pixman_format_t *format;
! int am, rm, gm, bm, y;
! unsigned char *data;
format = pixman_image_get_format (image->pixman_image);
--- 187,191 ----
glitz_pixel_format_t pf;
pixman_format_t *format;
! int am, rm, gm, bm;
format = pixman_image_get_format (image->pixman_image);
***************
*** 208,230 ****
pf.xoffset = 0;
pf.skip_lines = 0;
! pf.bytes_per_line = (((image->width * pf.masks.bpp) / 8) + 3) & -4;
! pf.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP;
! buffer = glitz_pixel_buffer_create (surface->surface,
! NULL,
! pf.bytes_per_line * image->height,
! GLITZ_BUFFER_HINT_STREAM_DRAW);
if (!buffer)
return CAIRO_STATUS_NO_MEMORY;
!
! data = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
!
! for (y = 0; y < image->height; y++)
! memcpy (&data[pf.bytes_per_line * (image->height - 1 - y)],
! &image->data[pf.bytes_per_line * y],
! pf.bytes_per_line);
!
! glitz_buffer_unmap (buffer);
!
glitz_set_pixels (surface->surface,
0, 0,
--- 201,211 ----
pf.xoffset = 0;
pf.skip_lines = 0;
! pf.bytes_per_line = image->stride;
! pf.scanline_order = GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN;
! buffer = glitz_buffer_create_for_data (image->data);
if (!buffer)
return CAIRO_STATUS_NO_MEMORY;
!
glitz_set_pixels (surface->surface,
0, 0,
***************
*** 232,236 ****
&pf,
buffer);
!
glitz_buffer_destroy (buffer);
--- 213,217 ----
&pf,
buffer);
!
glitz_buffer_destroy (buffer);
***************
*** 568,577 ****
if (op != CAIRO_OPERATOR_SRC) {
glitz_surface_t *solid;
! glitz_float_t *data;
glitz_buffer_t *buffer;
glitz_geometry_format_t gf;
cairo_int_status_t status;
! int width = 0;
! int height = 0;
gf.mode = GLITZ_GEOMETRY_MODE_DIRECT;
--- 549,558 ----
if (op != CAIRO_OPERATOR_SRC) {
glitz_surface_t *solid;
! glitz_float_t *vertices;
glitz_buffer_t *buffer;
glitz_geometry_format_t gf;
cairo_int_status_t status;
! int width, height;
! void *data;
gf.mode = GLITZ_GEOMETRY_MODE_DIRECT;
***************
*** 582,602 ****
gf.count = n_rects * 4;
! buffer =
! glitz_geometry_buffer_create (dst->surface, NULL,
! n_rects * 8 * sizeof (glitz_float_t),
! GLITZ_BUFFER_HINT_STREAM_DRAW);
! if (buffer == NULL)
return CAIRO_STATUS_NO_MEMORY;
!
! data = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
for (; n_rects; rects++, n_rects--) {
! *data++ = (glitz_float_t) rects->x;
! *data++ = (glitz_float_t) rects->y;
! *data++ = (glitz_float_t) (rects->x + rects->width);
! *data++ = (glitz_float_t) rects->y;
! *data++ = (glitz_float_t) (rects->x + rects->width);
! *data++ = (glitz_float_t) (rects->y + rects->height);
! *data++ = (glitz_float_t) rects->x;
! *data++ = (glitz_float_t) (rects->y + rects->height);
if ((rects->x + rects->width) > width)
--- 563,587 ----
gf.count = n_rects * 4;
! data = malloc (n_rects * 8 * sizeof (glitz_float_t));
! if (!data)
return CAIRO_STATUS_NO_MEMORY;
!
! buffer = glitz_buffer_create_for_data (data);
! if (buffer == NULL) {
! free (data);
! return CAIRO_STATUS_NO_MEMORY;
! }
!
! width = height = 0;
! vertices = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
for (; n_rects; rects++, n_rects--) {
! *vertices++ = (glitz_float_t) rects->x;
! *vertices++ = (glitz_float_t) rects->y;
! *vertices++ = (glitz_float_t) (rects->x + rects->width);
! *vertices++ = (glitz_float_t) rects->y;
! *vertices++ = (glitz_float_t) (rects->x + rects->width);
! *vertices++ = (glitz_float_t) (rects->y + rects->height);
! *vertices++ = (glitz_float_t) rects->x;
! *vertices++ = (glitz_float_t) (rects->y + rects->height);
if ((rects->x + rects->width) > width)
***************
*** 626,629 ****
--- 611,615 ----
glitz_surface_destroy (solid);
glitz_buffer_destroy (buffer);
+ free (data);
return status;
***************
*** 647,655 ****
cairo_glitz_surface_t *src = (cairo_glitz_surface_t *) generic_src;
glitz_surface_t *mask = NULL;
! glitz_float_t *data;
glitz_buffer_t *buffer;
glitz_geometry_format_t gf;
cairo_int_status_t status;
int x_dst, y_dst, x_rel, y_rel, width, height;
if (generic_src->backend != dst->base.backend)
--- 633,642 ----
cairo_glitz_surface_t *src = (cairo_glitz_surface_t *) generic_src;
glitz_surface_t *mask = NULL;
! glitz_float_t *vertices;
glitz_buffer_t *buffer;
glitz_geometry_format_t gf;
cairo_int_status_t status;
int x_dst, y_dst, x_rel, y_rel, width, height;
+ void *data;
if (generic_src->backend != dst->base.backend)
***************
*** 663,677 ****
gf.count = n_traps * 4;
! buffer =
! glitz_geometry_buffer_create (dst->surface, NULL,
! n_traps * 8 * sizeof (glitz_float_t),
! GLITZ_BUFFER_HINT_STREAM_DRAW);
! if (buffer == NULL)
return CAIRO_STATUS_NO_MEMORY;
x_dst = traps[0].left.p1.x >> 16;
y_dst = traps[0].left.p1.y >> 16;
! data = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
for (; n_traps; traps++, n_traps--) {
glitz_float_t top, bottom;
--- 650,667 ----
gf.count = n_traps * 4;
! data = malloc (n_traps * 8 * sizeof (glitz_float_t));
! if (!data)
return CAIRO_STATUS_NO_MEMORY;
+ buffer = glitz_buffer_create_for_data (data);
+ if (buffer == NULL) {
+ free (data);
+ return CAIRO_STATUS_NO_MEMORY;
+ }
+
x_dst = traps[0].left.p1.x >> 16;
y_dst = traps[0].left.p1.y >> 16;
! vertices = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
for (; n_traps; traps++, n_traps--) {
glitz_float_t top, bottom;
***************
*** 680,692 ****
bottom = GLITZ_FIXED_TO_FLOAT (traps->bottom);
! *data++ = GLITZ_FIXED_LINE_X_TO_FLOAT (traps->left, traps->top);
! *data++ = top;
! *data++ = GLITZ_FIXED_LINE_X_CEIL_TO_FLOAT (traps->right, traps->top);
! *data++ = top;
! *data++ =
GLITZ_FIXED_LINE_X_CEIL_TO_FLOAT (traps->right, traps->bottom);
! *data++ = bottom;
! *data++ = GLITZ_FIXED_LINE_X_TO_FLOAT (traps->left, traps->bottom);
! *data++ = bottom;
}
glitz_buffer_unmap (buffer);
--- 670,683 ----
bottom = GLITZ_FIXED_TO_FLOAT (traps->bottom);
! *vertices++ = GLITZ_FIXED_LINE_X_TO_FLOAT (traps->left, traps->top);
! *vertices++ = top;
! *vertices++ =
! GLITZ_FIXED_LINE_X_CEIL_TO_FLOAT (traps->right, traps->top);
! *vertices++ = top;
! *vertices++ =
GLITZ_FIXED_LINE_X_CEIL_TO_FLOAT (traps->right, traps->bottom);
! *vertices++ = bottom;
! *vertices++ = GLITZ_FIXED_LINE_X_TO_FLOAT (traps->left, traps->bottom);
! *vertices++ = bottom;
}
glitz_buffer_unmap (buffer);
***************
*** 729,732 ****
--- 720,724 ----
glitz_buffer_destroy (buffer);
+ free (data);
return status;
More information about the cairo-commit
mailing list