From cdb1fe6d9682616b1def52fa38b2dae623e2503f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 24 Aug 2009 08:03:17 -0700 Subject: [PATCH] glamor: Move setspans to a separate file. --- glamor/Makefile.am | 1 + glamor/glamor_core.c | 35 --------------------- glamor/glamor_priv.h | 4 +++ glamor/glamor_setspans.c | 67 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+), 35 deletions(-) create mode 100644 glamor/glamor_setspans.c diff --git a/glamor/Makefile.am b/glamor/Makefile.am index 43512f720..098aa37c0 100644 --- a/glamor/Makefile.am +++ b/glamor/Makefile.am @@ -20,6 +20,7 @@ libglamor_la_SOURCES = \ glamor_fillspans.c \ glamor_getspans.c \ glamor_putimage.c \ + glamor_setspans.c \ glamor_render.c \ glamor_tile.c \ glamor.h diff --git a/glamor/glamor_core.c b/glamor/glamor_core.c index 055df399a..38829de99 100644 --- a/glamor/glamor_core.c +++ b/glamor/glamor_core.c @@ -260,41 +260,6 @@ glamor_stipple(PixmapPtr pixmap, PixmapPtr stipple, glamor_solid_fail_region(pixmap, x, y, width, height); } -static void -glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src, - DDXPointPtr points, int *widths, int n, int sorted) -{ - PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable); - GLenum format, type; - int i; - - switch (drawable->depth) { - case 8: - format = GL_ALPHA; - type = GL_UNSIGNED_BYTE; - case 24: - case 32: - format = GL_BGRA; - type = GL_UNSIGNED_INT_8_8_8_8_REV; - break; - default: - ErrorF("Unknown setspans depth %d\n", drawable->depth); - return; - } - - if (!glamor_set_destination_pixmap(dest_pixmap)) - return; - for (i = 0; i < n; i++) { - glRasterPos2i(points[i].x - dest_pixmap->screen_x, - points[i].y - dest_pixmap->screen_y); - glDrawPixels(widths[i], - 1, - format, type, - src); - src += PixmapBytePad(widths[i], drawable->depth); - } -} - /** * glamor_poly_lines() checks if it can accelerate the lines as a group of * horizontal or vertical lines (rectangles), and uses existing rectangle fill diff --git a/glamor/glamor_priv.h b/glamor/glamor_priv.h index 5d47c2590..3929819e8 100644 --- a/glamor/glamor_priv.h +++ b/glamor/glamor_priv.h @@ -139,6 +139,10 @@ glamor_get_spans(DrawablePtr drawable, int nspans, char *dst_start); +/* glamor_setspans.c */ +void glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src, + DDXPointPtr points, int *widths, int n, int sorted); + /* glamor_putimage.c */ void glamor_put_image(DrawablePtr drawable, GCPtr gc, int depth, int x, int y, diff --git a/glamor/glamor_setspans.c b/glamor/glamor_setspans.c new file mode 100644 index 000000000..bf9c50818 --- /dev/null +++ b/glamor/glamor_setspans.c @@ -0,0 +1,67 @@ +/* + * Copyright © 2009 Intel Corporation + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + * Authors: + * Eric Anholt + * + */ + +#ifdef HAVE_DIX_CONFIG_H +#include +#endif + +#include "glamor_priv.h" + +void +glamor_set_spans(DrawablePtr drawable, GCPtr gc, char *src, + DDXPointPtr points, int *widths, int n, int sorted) +{ + PixmapPtr dest_pixmap = glamor_get_drawable_pixmap(drawable); + GLenum format, type; + int i; + + switch (drawable->depth) { + case 8: + format = GL_ALPHA; + type = GL_UNSIGNED_BYTE; + case 24: + case 32: + format = GL_BGRA; + type = GL_UNSIGNED_INT_8_8_8_8_REV; + break; + default: + ErrorF("Unknown setspans depth %d\n", drawable->depth); + return; + } + + if (!glamor_set_destination_pixmap(dest_pixmap)) + return; + for (i = 0; i < n; i++) { + glRasterPos2i(points[i].x - dest_pixmap->screen_x, + points[i].y - dest_pixmap->screen_y); + glDrawPixels(widths[i], + 1, + format, type, + src); + src += PixmapBytePad(widths[i], drawable->depth); + } +}