From adee31be18e20112c7da49675b93d37cc66ee263 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 20 Jun 2005 17:06:10 +0000 Subject: Add -head to CAIRO_VERSION after tagging with SNAPSHOT_0_5_1. --- ChangeLog | 5 +++++ configure.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 90daddbfb..6fd6e9a5e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-06-20 Carl Worth + + * configure.in: Add -head to CAIRO_VERSION after tagging with + SNAPSHOT_0_5_1. + 2005-06-20 Carl Worth * Makefile.am: Force distcheck to enable gtk-doc. diff --git a/configure.in b/configure.in index c2305de50..413391c2f 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_INIT(src/cairo.h) dnl =========================================================================== # Package version number, (as distinct from shared library version) -CAIRO_VERSION=0.5.1 +CAIRO_VERSION=0.5.1-head # libtool shared library version -- cgit v1.2.3 From 7283ba6d470950e0e49f33fc25f3358113dda51e Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 21 Jun 2005 09:54:58 +0000 Subject: allow building against < 10.3 SDK. --- ChangeLog | 4 ++++ src/cairo-atsui-font.c | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6fd6e9a5e..3d1ad2c6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-06-21 T Rowley + + * src/cairo-atsui-font.c: allow building against < 10.3 SDK. + 2005-06-20 Carl Worth * configure.in: Add -head to CAIRO_VERSION after tagging with diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index 5c7ddf54a..06b4ecb7d 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -38,7 +38,19 @@ #include "cairo-atsui.h" #include "cairoint.h" #include "cairo.h" +#if 0 #include +#endif + +/* + * FixedToFloat/FloatToFixed are 10.3+ SDK items - include definitions + * here so we can use older SDKs. + */ +#ifndef FixedToFloat +#define fixed1 ((Fixed) 0x00010000L) +#define FixedToFloat(a) ((float)(a) / fixed1) +#define FloatToFixed(a) ((Fixed)((float)(a) * fixed1)) +#endif typedef struct { cairo_scaled_font_t base; -- cgit v1.2.3 From b1130276d59a219e70d43dd1d199ddf391fa3330 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 21 Jun 2005 15:38:51 +0000 Subject: Split out font subsetting code from here, and put it here. --- ChangeLog | 7 + src/Makefile.am | 91 +++--- src/cairo-font-subset-private.h | 68 +++++ src/cairo-font-subset.c | 645 +++++++++++++++++++++++++++++++++++++++ src/cairo-pdf-surface.c | 657 ++-------------------------------------- 5 files changed, 784 insertions(+), 684 deletions(-) create mode 100644 src/cairo-font-subset-private.h create mode 100644 src/cairo-font-subset.c diff --git a/ChangeLog b/ChangeLog index 3d1ad2c6b..727f83fbd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-06-21 Kristian Høgsberg + + * src/cairo-pdf-surface.c: Split out font subsetting code from here, + + * src/cairo-font-subset-private.h: + * src/cairo-font-subset.c: and put it here. + 2005-06-21 T Rowley * src/cairo-atsui-font.c: allow building against < 10.3 SDK. diff --git a/src/Makefile.am b/src/Makefile.am index 8c624f247..68e4235e9 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,11 +2,13 @@ if CAIRO_HAS_PS_SURFACE libcairo_ps_headers = cairo-ps.h libcairo_ps_sources = cairo-ps-surface.c +libcairo_font_subset_sources = cairo-font-subset.c cairo-font-subset-private.h endif if CAIRO_HAS_PDF_SURFACE libcairo_pdf_headers = cairo-pdf.h libcairo_pdf_sources = cairo-pdf-surface.c +libcairo_font_subset_sources = cairo-font-subset.c cairo-font-subset-private.h endif if CAIRO_HAS_PNG_FUNCTIONS @@ -75,50 +77,51 @@ cairoinclude_HEADERS = \ lib_LTLIBRARIES = libcairo.la -libcairo_la_SOURCES = \ - cairo.c \ - cairo.h \ - cairo-private.h \ - cairo-arc.c \ - cairo-arc-private.h \ - cairo-array.c \ - cairo-cache.c \ - cairo-color.c \ - cairo-fixed.c \ - cairo-font.c \ - cairo-gstate.c \ - cairo-gstate-private.h \ - cairo-hull.c \ - cairo-image-surface.c \ - cairo-matrix.c \ - cairo-path.c \ - cairo-path-bounds.c \ - cairo-path-data.c \ - cairo-path-data-private.h \ - cairo-path-fill.c \ - cairo-path-fixed-private.h \ - cairo-path-stroke.c \ - cairo-pen.c \ - cairo-polygon.c \ - cairo-slope.c \ - cairo-spline.c \ - cairo-surface.c \ - cairo-traps.c \ - cairo-pattern.c \ - cairo-unicode.c \ - cairo-output-stream.c \ - cairo-wideint.c \ - cairo-wideint.h \ - $(libcairo_atsui_sources)\ - $(libcairo_ft_sources)\ - $(libcairo_ps_sources) \ - $(libcairo_pdf_sources) \ - $(libcairo_png_sources) \ - $(libcairo_xlib_sources)\ - $(libcairo_quartz_sources)\ - $(libcairo_xcb_sources) \ - $(libcairo_glitz_sources)\ - $(libcairo_win32_sources)\ +libcairo_la_SOURCES = \ + cairo.c \ + cairo.h \ + cairo-private.h \ + cairo-arc.c \ + cairo-arc-private.h \ + cairo-array.c \ + cairo-cache.c \ + cairo-color.c \ + cairo-fixed.c \ + cairo-font.c \ + cairo-gstate.c \ + cairo-gstate-private.h \ + cairo-hull.c \ + cairo-image-surface.c \ + cairo-matrix.c \ + cairo-path.c \ + cairo-path-bounds.c \ + cairo-path-data.c \ + cairo-path-data-private.h \ + cairo-path-fill.c \ + cairo-path-fixed-private.h \ + cairo-path-stroke.c \ + cairo-pen.c \ + cairo-polygon.c \ + cairo-slope.c \ + cairo-spline.c \ + cairo-surface.c \ + cairo-traps.c \ + cairo-pattern.c \ + cairo-unicode.c \ + cairo-output-stream.c \ + cairo-wideint.c \ + cairo-wideint.h \ + $(libcairo_atsui_sources) \ + $(libcairo_ft_sources) \ + $(libcairo_ps_sources) \ + $(libcairo_pdf_sources) \ + $(libcairo_font_subset_sources) \ + $(libcairo_png_sources) \ + $(libcairo_xlib_sources) \ + $(libcairo_quartz_sources) \ + $(libcairo_xcb_sources) \ + $(libcairo_glitz_sources) \ + $(libcairo_win32_sources) \ cairoint.h libcairo_la_LDFLAGS = -version-info @VERSION_INFO@ -no-undefined diff --git a/src/cairo-font-subset-private.h b/src/cairo-font-subset-private.h new file mode 100644 index 000000000..5b43f52db --- /dev/null +++ b/src/cairo-font-subset-private.h @@ -0,0 +1,68 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2004 Red Hat, Inc + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Red Hat, Inc. + * + * Contributor(s): + * Kristian Høgsberg + */ + +#include "cairoint.h" + +#ifndef CAIRO_FONT_SUBSET_PRIVATE_H +#define CAIRO_FONT_SUBSET_PRIVATE_H + +typedef struct cairo_font_subset_backend cairo_font_subset_backend_t; +typedef struct cairo_font_subset cairo_font_subset_t; +struct cairo_font_subset { + cairo_font_subset_backend_t *backend; + cairo_unscaled_font_t *unscaled_font; + unsigned int font_id; + char *base_font; + int num_glyphs; + int *widths; + long x_min, y_min, x_max, y_max; + long ascent, descent; +}; + + +cairo_private int +_cairo_font_subset_use_glyph (cairo_font_subset_t *font, int glyph); + +cairo_private cairo_status_t +_cairo_font_subset_generate (cairo_font_subset_t *font, + const char **data, unsigned long *length); + +cairo_private void +_cairo_font_subset_destroy (cairo_font_subset_t *font); + +cairo_private cairo_font_subset_t * +_cairo_font_subset_create (cairo_unscaled_font_t *unscaled_font); + +#endif /* CAIRO_FONT_SUBSET_PRIVATE_H */ diff --git a/src/cairo-font-subset.c b/src/cairo-font-subset.c new file mode 100644 index 000000000..2fac7f3e8 --- /dev/null +++ b/src/cairo-font-subset.c @@ -0,0 +1,645 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2004 Red Hat, Inc + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Red Hat, Inc. + * + * Contributor(s): + * Kristian Høgsberg + */ + +#include "cairoint.h" +#include "cairo-pdf.h" +/* XXX: Eventually, we need to handle other font backends */ +#include "cairo-font-subset-private.h" +#include "cairo-ft-private.h" + +#include +#include FT_FREETYPE_H +#include FT_OUTLINE_H +#include FT_TRUETYPE_TAGS_H +#include FT_TRUETYPE_TABLES_H + +typedef struct ft_subset_glyph ft_subset_glyph_t; +struct ft_subset_glyph { + int parent_index; + unsigned long location; +}; + +struct cairo_font_subset_backend { + int (*use_glyph) (void *abstract_font, + int glyph); + cairo_status_t (*generate) (void *abstract_font, + const char **data, + unsigned long *length); + void (*destroy) (void *abstract_font); +}; + +typedef struct cairo_pdf_ft_font cairo_pdf_ft_font_t; +struct cairo_pdf_ft_font { + cairo_font_subset_t base; + ft_subset_glyph_t *glyphs; + FT_Face face; + int checksum_index; + cairo_array_t output; + int *parent_to_subset; + cairo_status_t status; +}; + +#define ARRAY_LENGTH(a) ( (sizeof (a)) / (sizeof ((a)[0])) ) + +#define SFNT_VERSION 0x00010000 + +#ifdef WORDS_BIGENDIAN + +#define cpu_to_be16(v) (v) +#define be16_to_cpu(v) (v) +#define cpu_to_be32(v) (v) +#define be32_to_cpu(v) (v) + +#else + +static inline unsigned short +cpu_to_be16(unsigned short v) +{ + return (v << 8) | (v >> 8); +} + +static inline unsigned short +be16_to_cpu(unsigned short v) +{ + return cpu_to_be16 (v); +} + +static inline unsigned long +cpu_to_be32(unsigned long v) +{ + return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16); +} + +static inline unsigned long +be32_to_cpu(unsigned long v) +{ + return cpu_to_be32 (v); +} + +#endif + +static cairo_font_subset_backend_t cairo_pdf_ft_font_backend; + +int +_cairo_font_subset_use_glyph (cairo_font_subset_t *font, int glyph) +{ + return font->backend->use_glyph (font, glyph); +} + +cairo_status_t +_cairo_font_subset_generate (cairo_font_subset_t *font, + const char **data, unsigned long *length) +{ + return font->backend->generate (font, data, length); +} + +void +_cairo_font_subset_destroy (cairo_font_subset_t *font) +{ + font->backend->destroy (font); +} + +cairo_font_subset_t * +_cairo_font_subset_create (cairo_unscaled_font_t *unscaled_font) +{ + FT_Face face; + cairo_pdf_ft_font_t *font; + unsigned long size; + int i, j; + + face = _cairo_ft_unscaled_font_lock_face (unscaled_font); + + /* We currently only support freetype truetype fonts. */ + size = 0; + if (!FT_IS_SFNT (face) || + FT_Load_Sfnt_Table (face, TTAG_glyf, 0, NULL, &size) != 0) + return NULL; + + font = malloc (sizeof (cairo_pdf_ft_font_t)); + if (font == NULL) + return NULL; + + font->base.unscaled_font = unscaled_font; + _cairo_unscaled_font_reference (unscaled_font); + font->base.backend = &cairo_pdf_ft_font_backend; + + _cairo_array_init (&font->output, sizeof (char)); + if (_cairo_array_grow_by (&font->output, 4096) != CAIRO_STATUS_SUCCESS) + goto fail1; + + font->glyphs = calloc (face->num_glyphs + 1, sizeof (ft_subset_glyph_t)); + if (font->glyphs == NULL) + goto fail2; + + font->parent_to_subset = calloc (face->num_glyphs, sizeof (int)); + if (font->parent_to_subset == NULL) + goto fail3; + + font->base.num_glyphs = 1; + font->base.x_min = face->bbox.xMin; + font->base.y_min = face->bbox.yMin; + font->base.x_max = face->bbox.xMax; + font->base.y_max = face->bbox.yMax; + font->base.ascent = face->ascender; + font->base.descent = face->descender; + font->base.base_font = strdup (face->family_name); + if (font->base.base_font == NULL) + goto fail4; + + for (i = 0, j = 0; font->base.base_font[j]; j++) { + if (font->base.base_font[j] == ' ') + continue; + font->base.base_font[i++] = font->base.base_font[j]; + } + font->base.base_font[i] = '\0'; + + font->base.widths = calloc (face->num_glyphs, sizeof (int)); + if (font->base.widths == NULL) + goto fail5; + + _cairo_ft_unscaled_font_unlock_face (unscaled_font); + + font->status = CAIRO_STATUS_SUCCESS; + + return &font->base; + + fail5: + free (font->base.base_font); + fail4: + free (font->parent_to_subset); + fail3: + free (font->glyphs); + fail2: + _cairo_array_fini (&font->output); + fail1: + free (font); + return NULL; +} + +static void +cairo_pdf_ft_font_destroy (void *abstract_font) +{ + cairo_pdf_ft_font_t *font = abstract_font; + + _cairo_unscaled_font_destroy (font->base.unscaled_font); + free (font->base.base_font); + free (font->parent_to_subset); + free (font->glyphs); + _cairo_array_fini (&font->output); + free (font); +} + +static void * +cairo_pdf_ft_font_write (cairo_pdf_ft_font_t *font, + const void *data, size_t length) +{ + void *p; + + p = _cairo_array_append (&font->output, data, length); + if (p == NULL) + font->status = CAIRO_STATUS_NO_MEMORY; + + return p; +} + +static void +cairo_pdf_ft_font_write_be16 (cairo_pdf_ft_font_t *font, + unsigned short value) +{ + unsigned short be16_value; + + be16_value = cpu_to_be16 (value); + cairo_pdf_ft_font_write (font, &be16_value, sizeof be16_value); +} + +static void +cairo_pdf_ft_font_write_be32 (cairo_pdf_ft_font_t *font, unsigned long value) +{ + unsigned long be32_value; + + be32_value = cpu_to_be32 (value); + cairo_pdf_ft_font_write (font, &be32_value, sizeof be32_value); +} + +static unsigned long +cairo_pdf_ft_font_align_output (cairo_pdf_ft_font_t *font) +{ + int length, aligned; + static const char pad[4]; + + length = _cairo_array_num_elements (&font->output); + aligned = (length + 3) & ~3; + cairo_pdf_ft_font_write (font, pad, aligned - length); + + return aligned; +} + +static int +cairo_pdf_ft_font_write_cmap_table (cairo_pdf_ft_font_t *font, unsigned long tag) +{ + int i; + + cairo_pdf_ft_font_write_be16 (font, 0); + cairo_pdf_ft_font_write_be16 (font, 1); + + cairo_pdf_ft_font_write_be16 (font, 1); + cairo_pdf_ft_font_write_be16 (font, 0); + cairo_pdf_ft_font_write_be32 (font, 12); + + /* Output a format 6 encoding table. */ + + cairo_pdf_ft_font_write_be16 (font, 6); + cairo_pdf_ft_font_write_be16 (font, 10 + 2 * (font->base.num_glyphs - 1)); + cairo_pdf_ft_font_write_be16 (font, 0); + cairo_pdf_ft_font_write_be16 (font, 1); /* First glyph */ + cairo_pdf_ft_font_write_be16 (font, font->base.num_glyphs - 1); + for (i = 1; i < font->base.num_glyphs; i++) + cairo_pdf_ft_font_write_be16 (font, i); + + return font->status; +} + +static int +cairo_pdf_ft_font_write_generic_table (cairo_pdf_ft_font_t *font, + unsigned long tag) +{ + unsigned char *buffer; + unsigned long size; + + size = 0; + FT_Load_Sfnt_Table (font->face, tag, 0, NULL, &size); + buffer = cairo_pdf_ft_font_write (font, NULL, size); + FT_Load_Sfnt_Table (font->face, tag, 0, buffer, &size); + + return 0; +} + +static int +cairo_pdf_ft_font_write_glyf_table (cairo_pdf_ft_font_t *font, + unsigned long tag) +{ + unsigned long start_offset, index, size; + TT_Header *header; + unsigned long begin, end; + unsigned char *buffer; + int i; + union { + unsigned char *bytes; + unsigned short *short_offsets; + unsigned long *long_offsets; + } u; + + header = FT_Get_Sfnt_Table (font->face, ft_sfnt_head); + if (header->Index_To_Loc_Format == 0) + size = sizeof (short) * (font->face->num_glyphs + 1); + else + size = sizeof (long) * (font->face->num_glyphs + 1); + + u.bytes = malloc (size); + if (u.bytes == NULL) { + font->status = CAIRO_STATUS_NO_MEMORY; + return font->status; + } + FT_Load_Sfnt_Table (font->face, TTAG_loca, 0, u.bytes, &size); + + start_offset = _cairo_array_num_elements (&font->output); + for (i = 0; i < font->base.num_glyphs; i++) { + index = font->glyphs[i].parent_index; + if (header->Index_To_Loc_Format == 0) { + begin = be16_to_cpu (u.short_offsets[index]) * 2; + end = be16_to_cpu (u.short_offsets[index + 1]) * 2; + } + else { + begin = be32_to_cpu (u.long_offsets[index]); + end = be32_to_cpu (u.long_offsets[index + 1]); + } + + size = end - begin; + + font->glyphs[i].location = + cairo_pdf_ft_font_align_output (font) - start_offset; + buffer = cairo_pdf_ft_font_write (font, NULL, size); + if (buffer == NULL) + break; + FT_Load_Sfnt_Table (font->face, TTAG_glyf, begin, buffer, &size); + /* FIXME: remap composite glyphs */ + } + + font->glyphs[i].location = + cairo_pdf_ft_font_align_output (font) - start_offset; + + free (u.bytes); + + return font->status; +} + +static int +cairo_pdf_ft_font_write_head_table (cairo_pdf_ft_font_t *font, + unsigned long tag) +{ + TT_Header *head; + + head = FT_Get_Sfnt_Table (font->face, ft_sfnt_head); + + cairo_pdf_ft_font_write_be32 (font, head->Table_Version); + cairo_pdf_ft_font_write_be32 (font, head->Font_Revision); + + font->checksum_index = _cairo_array_num_elements (&font->output); + cairo_pdf_ft_font_write_be32 (font, 0); + cairo_pdf_ft_font_write_be32 (font, head->Magic_Number); + + cairo_pdf_ft_font_write_be16 (font, head->Flags); + cairo_pdf_ft_font_write_be16 (font, head->Units_Per_EM); + + cairo_pdf_ft_font_write_be32 (font, head->Created[0]); + cairo_pdf_ft_font_write_be32 (font, head->Created[1]); + cairo_pdf_ft_font_write_be32 (font, head->Modified[0]); + cairo_pdf_ft_font_write_be32 (font, head->Modified[1]); + + cairo_pdf_ft_font_write_be16 (font, head->xMin); + cairo_pdf_ft_font_write_be16 (font, head->yMin); + cairo_pdf_ft_font_write_be16 (font, head->xMax); + cairo_pdf_ft_font_write_be16 (font, head->yMax); + + cairo_pdf_ft_font_write_be16 (font, head->Mac_Style); + cairo_pdf_ft_font_write_be16 (font, head->Lowest_Rec_PPEM); + + cairo_pdf_ft_font_write_be16 (font, head->Font_Direction); + cairo_pdf_ft_font_write_be16 (font, head->Index_To_Loc_Format); + cairo_pdf_ft_font_write_be16 (font, head->Glyph_Data_Format); + + return font->status; +} + +static int cairo_pdf_ft_font_write_hhea_table (cairo_pdf_ft_font_t *font, unsigned long tag) +{ + TT_HoriHeader *hhea; + + hhea = FT_Get_Sfnt_Table (font->face, ft_sfnt_hhea); + + cairo_pdf_ft_font_write_be32 (font, hhea->Version); + cairo_pdf_ft_font_write_be16 (font, hhea->Ascender); + cairo_pdf_ft_font_write_be16 (font, hhea->Descender); + cairo_pdf_ft_font_write_be16 (font, hhea->Line_Gap); + + cairo_pdf_ft_font_write_be16 (font, hhea->advance_Width_Max); + + cairo_pdf_ft_font_write_be16 (font, hhea->min_Left_Side_Bearing); + cairo_pdf_ft_font_write_be16 (font, hhea->min_Right_Side_Bearing); + cairo_pdf_ft_font_write_be16 (font, hhea->xMax_Extent); + cairo_pdf_ft_font_write_be16 (font, hhea->caret_Slope_Rise); + cairo_pdf_ft_font_write_be16 (font, hhea->caret_Slope_Run); + cairo_pdf_ft_font_write_be16 (font, hhea->caret_Offset); + + cairo_pdf_ft_font_write_be16 (font, 0); + cairo_pdf_ft_font_write_be16 (font, 0); + cairo_pdf_ft_font_write_be16 (font, 0); + cairo_pdf_ft_font_write_be16 (font, 0); + + cairo_pdf_ft_font_write_be16 (font, hhea->metric_Data_Format); + cairo_pdf_ft_font_write_be16 (font, font->base.num_glyphs); + + return font->status; +} + +static int +cairo_pdf_ft_font_write_hmtx_table (cairo_pdf_ft_font_t *font, + unsigned long tag) +{ + unsigned long entry_size; + short *p; + int i; + + for (i = 0; i < font->base.num_glyphs; i++) { + entry_size = 2 * sizeof (short); + p = cairo_pdf_ft_font_write (font, NULL, entry_size); + FT_Load_Sfnt_Table (font->face, TTAG_hmtx, + font->glyphs[i].parent_index * entry_size, + (FT_Byte *) p, &entry_size); + font->base.widths[i] = be16_to_cpu (p[0]); + } + + return font->status; +} + +static int +cairo_pdf_ft_font_write_loca_table (cairo_pdf_ft_font_t *font, + unsigned long tag) +{ + int i; + TT_Header *header; + + header = FT_Get_Sfnt_Table (font->face, ft_sfnt_head); + + if (header->Index_To_Loc_Format == 0) { + for (i = 0; i < font->base.num_glyphs + 1; i++) + cairo_pdf_ft_font_write_be16 (font, font->glyphs[i].location / 2); + } + else { + for (i = 0; i < font->base.num_glyphs + 1; i++) + cairo_pdf_ft_font_write_be32 (font, font->glyphs[i].location); + } + + return font->status; +} + +static int +cairo_pdf_ft_font_write_maxp_table (cairo_pdf_ft_font_t *font, + unsigned long tag) +{ + TT_MaxProfile *maxp; + + maxp = FT_Get_Sfnt_Table (font->face, ft_sfnt_maxp); + + cairo_pdf_ft_font_write_be32 (font, maxp->version); + cairo_pdf_ft_font_write_be16 (font, font->base.num_glyphs); + cairo_pdf_ft_font_write_be16 (font, maxp->maxPoints); + cairo_pdf_ft_font_write_be16 (font, maxp->maxContours); + cairo_pdf_ft_font_write_be16 (font, maxp->maxCompositePoints); + cairo_pdf_ft_font_write_be16 (font, maxp->maxCompositeContours); + cairo_pdf_ft_font_write_be16 (font, maxp->maxZones); + cairo_pdf_ft_font_write_be16 (font, maxp->maxTwilightPoints); + cairo_pdf_ft_font_write_be16 (font, maxp->maxStorage); + cairo_pdf_ft_font_write_be16 (font, maxp->maxFunctionDefs); + cairo_pdf_ft_font_write_be16 (font, maxp->maxInstructionDefs); + cairo_pdf_ft_font_write_be16 (font, maxp->maxStackElements); + cairo_pdf_ft_font_write_be16 (font, maxp->maxSizeOfInstructions); + cairo_pdf_ft_font_write_be16 (font, maxp->maxComponentElements); + cairo_pdf_ft_font_write_be16 (font, maxp->maxComponentDepth); + + return font->status; +} + +typedef struct table table_t; +struct table { + unsigned long tag; + int (*write) (cairo_pdf_ft_font_t *font, unsigned long tag); +}; + +static const table_t truetype_tables[] = { + { TTAG_cmap, cairo_pdf_ft_font_write_cmap_table }, + { TTAG_cvt, cairo_pdf_ft_font_write_generic_table }, + { TTAG_fpgm, cairo_pdf_ft_font_write_generic_table }, + { TTAG_glyf, cairo_pdf_ft_font_write_glyf_table }, + { TTAG_head, cairo_pdf_ft_font_write_head_table }, + { TTAG_hhea, cairo_pdf_ft_font_write_hhea_table }, + { TTAG_hmtx, cairo_pdf_ft_font_write_hmtx_table }, + { TTAG_loca, cairo_pdf_ft_font_write_loca_table }, + { TTAG_maxp, cairo_pdf_ft_font_write_maxp_table }, + { TTAG_name, cairo_pdf_ft_font_write_generic_table }, + { TTAG_prep, cairo_pdf_ft_font_write_generic_table }, +}; + +static cairo_status_t +cairo_pdf_ft_font_write_offset_table (cairo_pdf_ft_font_t *font) +{ + unsigned short search_range, entry_selector, range_shift; + int num_tables; + + num_tables = ARRAY_LENGTH (truetype_tables); + search_range = 1; + entry_selector = 0; + while (search_range * 2 <= num_tables) { + search_range *= 2; + entry_selector++; + } + search_range *= 16; + range_shift = num_tables * 16 - search_range; + + cairo_pdf_ft_font_write_be32 (font, SFNT_VERSION); + cairo_pdf_ft_font_write_be16 (font, num_tables); + cairo_pdf_ft_font_write_be16 (font, search_range); + cairo_pdf_ft_font_write_be16 (font, entry_selector); + cairo_pdf_ft_font_write_be16 (font, range_shift); + + cairo_pdf_ft_font_write (font, NULL, ARRAY_LENGTH (truetype_tables) * 16); + + return font->status; +} + +static unsigned long +cairo_pdf_ft_font_calculate_checksum (cairo_pdf_ft_font_t *font, + unsigned long start, unsigned long end) +{ + unsigned long *padded_end; + unsigned long *p; + unsigned long checksum; + char *data; + + checksum = 0; + data = _cairo_array_index (&font->output, 0); + p = (unsigned long *) (data + start); + padded_end = (unsigned long *) (data + ((end + 3) & ~3)); + while (p < padded_end) + checksum += *p++; + + return checksum; +} + +static void +cairo_pdf_ft_font_update_entry (cairo_pdf_ft_font_t *font, int index, unsigned long tag, + unsigned long start, unsigned long end) +{ + unsigned long *entry; + + entry = _cairo_array_index (&font->output, 12 + 16 * index); + entry[0] = cpu_to_be32 (tag); + entry[1] = cpu_to_be32 (cairo_pdf_ft_font_calculate_checksum (font, start, end)); + entry[2] = cpu_to_be32 (start); + entry[3] = cpu_to_be32 (end - start); +} + +static cairo_status_t +cairo_pdf_ft_font_generate (void *abstract_font, + const char **data, unsigned long *length) +{ + cairo_pdf_ft_font_t *font = abstract_font; + unsigned long start, end, next, checksum, *checksum_location; + int i; + + font->face = _cairo_ft_unscaled_font_lock_face (font->base.unscaled_font); + + if (cairo_pdf_ft_font_write_offset_table (font)) + goto fail; + + start = cairo_pdf_ft_font_align_output (font); + end = start; + + end = 0; + for (i = 0; i < ARRAY_LENGTH (truetype_tables); i++) { + if (truetype_tables[i].write (font, truetype_tables[i].tag)) + goto fail; + + end = _cairo_array_num_elements (&font->output); + next = cairo_pdf_ft_font_align_output (font); + cairo_pdf_ft_font_update_entry (font, i, truetype_tables[i].tag, + start, end); + start = next; + } + + checksum = + 0xb1b0afba - cairo_pdf_ft_font_calculate_checksum (font, 0, end); + checksum_location = _cairo_array_index (&font->output, font->checksum_index); + *checksum_location = cpu_to_be32 (checksum); + + *data = _cairo_array_index (&font->output, 0); + *length = _cairo_array_num_elements (&font->output); + + fail: + _cairo_ft_unscaled_font_unlock_face (font->base.unscaled_font); + font->face = NULL; + + return font->status; +} + +static int +cairo_pdf_ft_font_use_glyph (void *abstract_font, int glyph) +{ + cairo_pdf_ft_font_t *font = abstract_font; + + if (font->parent_to_subset[glyph] == 0) { + font->parent_to_subset[glyph] = font->base.num_glyphs; + font->glyphs[font->base.num_glyphs].parent_index = glyph; + font->base.num_glyphs++; + } + + return font->parent_to_subset[glyph]; +} + +static cairo_font_subset_backend_t cairo_pdf_ft_font_backend = { + cairo_pdf_ft_font_use_glyph, + cairo_pdf_ft_font_generate, + cairo_pdf_ft_font_destroy +}; diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 3d65aa75e..34b79c4b6 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -36,15 +36,9 @@ #include "cairoint.h" #include "cairo-pdf.h" -/* XXX: Eventually, we need to handle other font backends */ +#include "cairo-font-subset-private.h" #include "cairo-ft-private.h" -#include -#include FT_FREETYPE_H -#include FT_OUTLINE_H -#include FT_TRUETYPE_TAGS_H -#include FT_TRUETYPE_TABLES_H - #include #include @@ -93,45 +87,6 @@ * instead of outputting the cm operator in every page. */ -typedef struct ft_subset_glyph ft_subset_glyph_t; -struct ft_subset_glyph { - int parent_index; - unsigned long location; -}; - -typedef struct cairo_pdf_font_backend cairo_pdf_font_backend_t; -struct cairo_pdf_font_backend { - int (*use_glyph) (void *abstract_font, - int glyph); - cairo_status_t (*generate) (void *abstract_font, - const char **data, - unsigned long *length); - void (*destroy) (void *abstract_font); -}; - -typedef struct cairo_pdf_font cairo_pdf_font_t; -struct cairo_pdf_font { - cairo_pdf_font_backend_t *backend; - cairo_unscaled_font_t *unscaled_font; - unsigned int font_id; - char *base_font; - int num_glyphs; - int *widths; - long x_min, y_min, x_max, y_max; - long ascent, descent; -}; - -typedef struct cairo_pdf_ft_font cairo_pdf_ft_font_t; -struct cairo_pdf_ft_font { - cairo_pdf_font_t base; - ft_subset_glyph_t *glyphs; - FT_Face face; - int checksum_index; - cairo_array_t output; - int *parent_to_subset; - cairo_status_t status; -}; - typedef struct cairo_pdf_object cairo_pdf_object_t; typedef struct cairo_pdf_resource cairo_pdf_resource_t; typedef struct cairo_pdf_stream cairo_pdf_stream_t; @@ -221,6 +176,9 @@ static cairo_pdf_stream_t * _cairo_pdf_document_open_stream (cairo_pdf_document_t *document, const char *fmt, ...); +static void +_cairo_pdf_document_close_stream (cairo_pdf_document_t *document); + static cairo_surface_t * _cairo_pdf_surface_create_for_document (cairo_pdf_document_t *document, double width, @@ -233,590 +191,6 @@ _cairo_pdf_surface_ensure_stream (cairo_pdf_surface_t *surface); static const cairo_surface_backend_t cairo_pdf_surface_backend; -/* Truetype font subsetting code */ - -#define ARRAY_LENGTH(a) ( (sizeof (a)) / (sizeof ((a)[0])) ) - -#define SFNT_VERSION 0x00010000 - -#ifdef WORDS_BIGENDIAN - -#define cpu_to_be16(v) (v) -#define be16_to_cpu(v) (v) -#define cpu_to_be32(v) (v) -#define be32_to_cpu(v) (v) - -#else - -static inline unsigned short -cpu_to_be16(unsigned short v) -{ - return (v << 8) | (v >> 8); -} - -static inline unsigned short -be16_to_cpu(unsigned short v) -{ - return cpu_to_be16 (v); -} - -static inline unsigned long -cpu_to_be32(unsigned long v) -{ - return (cpu_to_be16 (v) << 16) | cpu_to_be16 (v >> 16); -} - -static inline unsigned long -be32_to_cpu(unsigned long v) -{ - return cpu_to_be32 (v); -} - -#endif - -static cairo_pdf_font_backend_t cairo_pdf_ft_font_backend; - -static int -cairo_pdf_font_use_glyph (cairo_pdf_font_t *font, int glyph) -{ - return font->backend->use_glyph (font, glyph); -} - -static cairo_status_t -cairo_pdf_font_generate (cairo_pdf_font_t *font, - const char **data, unsigned long *length) -{ - return font->backend->generate (font, data, length); -} - -static void -cairo_pdf_font_destroy (cairo_pdf_font_t *font) -{ - if (font == NULL) - return; - - font->backend->destroy (font); -} - -static cairo_pdf_font_t * -cairo_pdf_ft_font_create (cairo_pdf_document_t *document, - cairo_unscaled_font_t *unscaled_font) -{ - FT_Face face; - cairo_pdf_ft_font_t *font; - unsigned long size; - int i, j; - - face = _cairo_ft_unscaled_font_lock_face (unscaled_font); - - /* We currently only support freetype truetype fonts. */ - size = 0; - if (!FT_IS_SFNT (face) || - FT_Load_Sfnt_Table (face, TTAG_glyf, 0, NULL, &size) != 0) - return NULL; - - font = malloc (sizeof (cairo_pdf_ft_font_t)); - if (font == NULL) - return NULL; - - font->base.unscaled_font = unscaled_font; - _cairo_unscaled_font_reference (unscaled_font); - font->base.backend = &cairo_pdf_ft_font_backend; - font->base.font_id = _cairo_pdf_document_new_object (document); - - _cairo_array_init (&font->output, sizeof (char)); - if (_cairo_array_grow_by (&font->output, 4096) != CAIRO_STATUS_SUCCESS) - goto fail1; - - font->glyphs = calloc (face->num_glyphs + 1, sizeof (ft_subset_glyph_t)); - if (font->glyphs == NULL) - goto fail2; - - font->parent_to_subset = calloc (face->num_glyphs, sizeof (int)); - if (font->parent_to_subset == NULL) - goto fail3; - - font->base.num_glyphs = 1; - font->base.x_min = face->bbox.xMin; - font->base.y_min = face->bbox.yMin; - font->base.x_max = face->bbox.xMax; - font->base.y_max = face->bbox.yMax; - font->base.ascent = face->ascender; - font->base.descent = face->descender; - font->base.base_font = strdup (face->family_name); - if (font->base.base_font == NULL) - goto fail4; - - for (i = 0, j = 0; font->base.base_font[j]; j++) { - if (font->base.base_font[j] == ' ') - continue; - font->base.base_font[i++] = font->base.base_font[j]; - } - font->base.base_font[i] = '\0'; - - font->base.widths = calloc (face->num_glyphs, sizeof (int)); - if (font->base.widths == NULL) - goto fail5; - - _cairo_ft_unscaled_font_unlock_face (unscaled_font); - - font->status = CAIRO_STATUS_SUCCESS; - - return &font->base; - - fail5: - free (font->base.base_font); - fail4: - free (font->parent_to_subset); - fail3: - free (font->glyphs); - fail2: - _cairo_array_fini (&font->output); - fail1: - free (font); - return NULL; -} - -static void -cairo_pdf_ft_font_destroy (void *abstract_font) -{ - cairo_pdf_ft_font_t *font = abstract_font; - - if (font == NULL) - return; - - _cairo_unscaled_font_destroy (font->base.unscaled_font); - free (font->base.base_font); - free (font->parent_to_subset); - free (font->glyphs); - _cairo_array_fini (&font->output); - free (font); -} - -static void * -cairo_pdf_ft_font_write (cairo_pdf_ft_font_t *font, - const void *data, size_t length) -{ - void *p; - - p = _cairo_array_append (&font->output, data, length); - if (p == NULL) - font->status = CAIRO_STATUS_NO_MEMORY; - - return p; -} - -static void -cairo_pdf_ft_font_write_be16 (cairo_pdf_ft_font_t *font, - unsigned short value) -{ - unsigned short be16_value; - - be16_value = cpu_to_be16 (value); - cairo_pdf_ft_font_write (font, &be16_value, sizeof be16_value); -} - -static void -cairo_pdf_ft_font_write_be32 (cairo_pdf_ft_font_t *font, unsigned long value) -{ - unsigned long be32_value; - - be32_value = cpu_to_be32 (value); - cairo_pdf_ft_font_write (font, &be32_value, sizeof be32_value); -} - -static unsigned long -cairo_pdf_ft_font_align_output (cairo_pdf_ft_font_t *font) -{ - int length, aligned; - static const char pad[4]; - - length = _cairo_array_num_elements (&font->output); - aligned = (length + 3) & ~3; - cairo_pdf_ft_font_write (font, pad, aligned - length); - - return aligned; -} - -static int -cairo_pdf_ft_font_write_cmap_table (cairo_pdf_ft_font_t *font, unsigned long tag) -{ - int i; - - cairo_pdf_ft_font_write_be16 (font, 0); - cairo_pdf_ft_font_write_be16 (font, 1); - - cairo_pdf_ft_font_write_be16 (font, 1); - cairo_pdf_ft_font_write_be16 (font, 0); - cairo_pdf_ft_font_write_be32 (font, 12); - - /* Output a format 6 encoding table. */ - - cairo_pdf_ft_font_write_be16 (font, 6); - cairo_pdf_ft_font_write_be16 (font, 10 + 2 * (font->base.num_glyphs - 1)); - cairo_pdf_ft_font_write_be16 (font, 0); - cairo_pdf_ft_font_write_be16 (font, 1); /* First glyph */ - cairo_pdf_ft_font_write_be16 (font, font->base.num_glyphs - 1); - for (i = 1; i < font->base.num_glyphs; i++) - cairo_pdf_ft_font_write_be16 (font, i); - - return font->status; -} - -static int -cairo_pdf_ft_font_write_generic_table (cairo_pdf_ft_font_t *font, - unsigned long tag) -{ - unsigned char *buffer; - unsigned long size; - - size = 0; - FT_Load_Sfnt_Table (font->face, tag, 0, NULL, &size); - buffer = cairo_pdf_ft_font_write (font, NULL, size); - FT_Load_Sfnt_Table (font->face, tag, 0, buffer, &size); - - return 0; -} - -static int -cairo_pdf_ft_font_write_glyf_table (cairo_pdf_ft_font_t *font, - unsigned long tag) -{ - unsigned long start_offset, index, size; - TT_Header *header; - unsigned long begin, end; - unsigned char *buffer; - int i; - union { - unsigned char *bytes; - unsigned short *short_offsets; - unsigned long *long_offsets; - } u; - - header = FT_Get_Sfnt_Table (font->face, ft_sfnt_head); - if (header->Index_To_Loc_Format == 0) - size = sizeof (short) * (font->face->num_glyphs + 1); - else - size = sizeof (long) * (font->face->num_glyphs + 1); - - u.bytes = malloc (size); - if (u.bytes == NULL) { - font->status = CAIRO_STATUS_NO_MEMORY; - return font->status; - } - FT_Load_Sfnt_Table (font->face, TTAG_loca, 0, u.bytes, &size); - - start_offset = _cairo_array_num_elements (&font->output); - for (i = 0; i < font->base.num_glyphs; i++) { - index = font->glyphs[i].parent_index; - if (header->Index_To_Loc_Format == 0) { - begin = be16_to_cpu (u.short_offsets[index]) * 2; - end = be16_to_cpu (u.short_offsets[index + 1]) * 2; - } else { - begin = be32_to_cpu (u.long_offsets[index]); - end = be32_to_cpu (u.long_offsets[index + 1]); - } - - size = end - begin; - - font->glyphs[i].location = - cairo_pdf_ft_font_align_output (font) - start_offset; - buffer = cairo_pdf_ft_font_write (font, NULL, size); - if (buffer == NULL) - break; - FT_Load_Sfnt_Table (font->face, TTAG_glyf, begin, buffer, &size); - /* FIXME: remap composite glyphs */ - } - - font->glyphs[i].location = - cairo_pdf_ft_font_align_output (font) - start_offset; - - free (u.bytes); - - return font->status; -} - -static int -cairo_pdf_ft_font_write_head_table (cairo_pdf_ft_font_t *font, - unsigned long tag) -{ - TT_Header *head; - - head = FT_Get_Sfnt_Table (font->face, ft_sfnt_head); - - cairo_pdf_ft_font_write_be32 (font, head->Table_Version); - cairo_pdf_ft_font_write_be32 (font, head->Font_Revision); - - font->checksum_index = _cairo_array_num_elements (&font->output); - cairo_pdf_ft_font_write_be32 (font, 0); - cairo_pdf_ft_font_write_be32 (font, head->Magic_Number); - - cairo_pdf_ft_font_write_be16 (font, head->Flags); - cairo_pdf_ft_font_write_be16 (font, head->Units_Per_EM); - - cairo_pdf_ft_font_write_be32 (font, head->Created[0]); - cairo_pdf_ft_font_write_be32 (font, head->Created[1]); - cairo_pdf_ft_font_write_be32 (font, head->Modified[0]); - cairo_pdf_ft_font_write_be32 (font, head->Modified[1]); - - cairo_pdf_ft_font_write_be16 (font, head->xMin); - cairo_pdf_ft_font_write_be16 (font, head->yMin); - cairo_pdf_ft_font_write_be16 (font, head->xMax); - cairo_pdf_ft_font_write_be16 (font, head->yMax); - - cairo_pdf_ft_font_write_be16 (font, head->Mac_Style); - cairo_pdf_ft_font_write_be16 (font, head->Lowest_Rec_PPEM); - - cairo_pdf_ft_font_write_be16 (font, head->Font_Direction); - cairo_pdf_ft_font_write_be16 (font, head->Index_To_Loc_Format); - cairo_pdf_ft_font_write_be16 (font, head->Glyph_Data_Format); - - return font->status; -} - -static int cairo_pdf_ft_font_write_hhea_table (cairo_pdf_ft_font_t *font, unsigned long tag) -{ - TT_HoriHeader *hhea; - - hhea = FT_Get_Sfnt_Table (font->face, ft_sfnt_hhea); - - cairo_pdf_ft_font_write_be32 (font, hhea->Version); - cairo_pdf_ft_font_write_be16 (font, hhea->Ascender); - cairo_pdf_ft_font_write_be16 (font, hhea->Descender); - cairo_pdf_ft_font_write_be16 (font, hhea->Line_Gap); - - cairo_pdf_ft_font_write_be16 (font, hhea->advance_Width_Max); - - cairo_pdf_ft_font_write_be16 (font, hhea->min_Left_Side_Bearing); - cairo_pdf_ft_font_write_be16 (font, hhea->min_Right_Side_Bearing); - cairo_pdf_ft_font_write_be16 (font, hhea->xMax_Extent); - cairo_pdf_ft_font_write_be16 (font, hhea->caret_Slope_Rise); - cairo_pdf_ft_font_write_be16 (font, hhea->caret_Slope_Run); - cairo_pdf_ft_font_write_be16 (font, hhea->caret_Offset); - - cairo_pdf_ft_font_write_be16 (font, 0); - cairo_pdf_ft_font_write_be16 (font, 0); - cairo_pdf_ft_font_write_be16 (font, 0); - cairo_pdf_ft_font_write_be16 (font, 0); - - cairo_pdf_ft_font_write_be16 (font, hhea->metric_Data_Format); - cairo_pdf_ft_font_write_be16 (font, font->base.num_glyphs); - - return font->status; -} - -static int -cairo_pdf_ft_font_write_hmtx_table (cairo_pdf_ft_font_t *font, - unsigned long tag) -{ - unsigned long entry_size; - short *p; - int i; - - for (i = 0; i < font->base.num_glyphs; i++) { - entry_size = 2 * sizeof (short); - p = cairo_pdf_ft_font_write (font, NULL, entry_size); - FT_Load_Sfnt_Table (font->face, TTAG_hmtx, - font->glyphs[i].parent_index * entry_size, - (FT_Byte *) p, &entry_size); - font->base.widths[i] = be16_to_cpu (p[0]); - } - - return font->status; -} - -static int -cairo_pdf_ft_font_write_loca_table (cairo_pdf_ft_font_t *font, - unsigned long tag) -{ - int i; - TT_Header *header; - - header = FT_Get_Sfnt_Table (font->face, ft_sfnt_head); - - if (header->Index_To_Loc_Format == 0) { - for (i = 0; i < font->base.num_glyphs + 1; i++) - cairo_pdf_ft_font_write_be16 (font, font->glyphs[i].location / 2); - } else { - for (i = 0; i < font->base.num_glyphs + 1; i++) - cairo_pdf_ft_font_write_be32 (font, font->glyphs[i].location); - } - - return font->status; -} - -static int -cairo_pdf_ft_font_write_maxp_table (cairo_pdf_ft_font_t *font, - unsigned long tag) -{ - TT_MaxProfile *maxp; - - maxp = FT_Get_Sfnt_Table (font->face, ft_sfnt_maxp); - - cairo_pdf_ft_font_write_be32 (font, maxp->version); - cairo_pdf_ft_font_write_be16 (font, font->base.num_glyphs); - cairo_pdf_ft_font_write_be16 (font, maxp->maxPoints); - cairo_pdf_ft_font_write_be16 (font, maxp->maxContours); - cairo_pdf_ft_font_write_be16 (font, maxp->maxCompositePoints); - cairo_pdf_ft_font_write_be16 (font, maxp->maxCompositeContours); - cairo_pdf_ft_font_write_be16 (font, maxp->maxZones); - cairo_pdf_ft_font_write_be16 (font, maxp->maxTwilightPoints); - cairo_pdf_ft_font_write_be16 (font, maxp->maxStorage); - cairo_pdf_ft_font_write_be16 (font, maxp->maxFunctionDefs); - cairo_pdf_ft_font_write_be16 (font, maxp->maxInstructionDefs); - cairo_pdf_ft_font_write_be16 (font, maxp->maxStackElements); - cairo_pdf_ft_font_write_be16 (font, maxp->maxSizeOfInstructions); - cairo_pdf_ft_font_write_be16 (font, maxp->maxComponentElements); - cairo_pdf_ft_font_write_be16 (font, maxp->maxComponentDepth); - - return font->status; -} - -typedef struct table table_t; -struct table { - unsigned long tag; - int (*write) (cairo_pdf_ft_font_t *font, unsigned long tag); -}; - -static const table_t truetype_tables[] = { - { TTAG_cmap, cairo_pdf_ft_font_write_cmap_table }, - { TTAG_cvt, cairo_pdf_ft_font_write_generic_table }, - { TTAG_fpgm, cairo_pdf_ft_font_write_generic_table }, - { TTAG_glyf, cairo_pdf_ft_font_write_glyf_table }, - { TTAG_head, cairo_pdf_ft_font_write_head_table }, - { TTAG_hhea, cairo_pdf_ft_font_write_hhea_table }, - { TTAG_hmtx, cairo_pdf_ft_font_write_hmtx_table }, - { TTAG_loca, cairo_pdf_ft_font_write_loca_table }, - { TTAG_maxp, cairo_pdf_ft_font_write_maxp_table }, - { TTAG_name, cairo_pdf_ft_font_write_generic_table }, - { TTAG_prep, cairo_pdf_ft_font_write_generic_table }, -}; - -static cairo_status_t -cairo_pdf_ft_font_write_offset_table (cairo_pdf_ft_font_t *font) -{ - unsigned short search_range, entry_selector, range_shift; - int num_tables; - - num_tables = ARRAY_LENGTH (truetype_tables); - search_range = 1; - entry_selector = 0; - while (search_range * 2 <= num_tables) { - search_range *= 2; - entry_selector++; - } - search_range *= 16; - range_shift = num_tables * 16 - search_range; - - cairo_pdf_ft_font_write_be32 (font, SFNT_VERSION); - cairo_pdf_ft_font_write_be16 (font, num_tables); - cairo_pdf_ft_font_write_be16 (font, search_range); - cairo_pdf_ft_font_write_be16 (font, entry_selector); - cairo_pdf_ft_font_write_be16 (font, range_shift); - - cairo_pdf_ft_font_write (font, NULL, ARRAY_LENGTH (truetype_tables) * 16); - - return font->status; -} - -static unsigned long -cairo_pdf_ft_font_calculate_checksum (cairo_pdf_ft_font_t *font, - unsigned long start, unsigned long end) -{ - unsigned long *padded_end; - unsigned long *p; - unsigned long checksum; - char *data; - - checksum = 0; - data = _cairo_array_index (&font->output, 0); - p = (unsigned long *) (data + start); - padded_end = (unsigned long *) (data + ((end + 3) & ~3)); - while (p < padded_end) - checksum += *p++; - - return checksum; -} - -static void -cairo_pdf_ft_font_update_entry (cairo_pdf_ft_font_t *font, int index, unsigned long tag, - unsigned long start, unsigned long end) -{ - unsigned long *entry; - - entry = _cairo_array_index (&font->output, 12 + 16 * index); - entry[0] = cpu_to_be32 (tag); - entry[1] = cpu_to_be32 (cairo_pdf_ft_font_calculate_checksum (font, start, end)); - entry[2] = cpu_to_be32 (start); - entry[3] = cpu_to_be32 (end - start); -} - -static cairo_status_t -cairo_pdf_ft_font_generate (void *abstract_font, - const char **data, unsigned long *length) -{ - cairo_pdf_ft_font_t *font = abstract_font; - unsigned long start, end, next, checksum; - unsigned long *checksum_location; - int i; - - font->face = _cairo_ft_unscaled_font_lock_face (font->base.unscaled_font); - - if (cairo_pdf_ft_font_write_offset_table (font)) - goto fail; - - start = cairo_pdf_ft_font_align_output (font); - end = start; - - end = 0; - for (i = 0; i < ARRAY_LENGTH (truetype_tables); i++) { - if (truetype_tables[i].write (font, truetype_tables[i].tag)) - goto fail; - - end = _cairo_array_num_elements (&font->output); - next = cairo_pdf_ft_font_align_output (font); - cairo_pdf_ft_font_update_entry (font, i, truetype_tables[i].tag, - start, end); - start = next; - } - - checksum = - 0xb1b0afba - cairo_pdf_ft_font_calculate_checksum (font, 0, end); - checksum_location = _cairo_array_index (&font->output, font->checksum_index); - *checksum_location = cpu_to_be32 (checksum); - - *data = _cairo_array_index (&font->output, 0); - *length = _cairo_array_num_elements (&font->output); - - fail: - _cairo_ft_unscaled_font_unlock_face (font->base.unscaled_font); - font->face = NULL; - - return font->status; -} - -static int -cairo_pdf_ft_font_use_glyph (void *abstract_font, int glyph) -{ - cairo_pdf_ft_font_t *font = abstract_font; - - if (font->parent_to_subset[glyph] == 0) { - font->parent_to_subset[glyph] = font->base.num_glyphs; - font->glyphs[font->base.num_glyphs].parent_index = glyph; - font->base.num_glyphs++; - } - - return font->parent_to_subset[glyph]; -} - -static cairo_pdf_font_backend_t cairo_pdf_ft_font_backend = { - cairo_pdf_ft_font_use_glyph, - cairo_pdf_ft_font_generate, - cairo_pdf_ft_font_destroy -}; - -/* PDF Generation */ - static unsigned int _cairo_pdf_document_new_object (cairo_pdf_document_t *document) { @@ -1851,14 +1225,15 @@ _cairo_pdf_surface_get_extents (void *abstract_surface, return CAIRO_STATUS_SUCCESS; } -static cairo_pdf_font_t * +static cairo_font_subset_t * _cairo_pdf_document_get_font (cairo_pdf_document_t *document, cairo_scaled_font_t *scaled_font) { cairo_unscaled_font_t *unscaled_font; - cairo_pdf_font_t *pdf_font; + cairo_font_subset_t *pdf_font; unsigned int num_fonts, i; + /* XXX Why is this an ft specific function? */ unscaled_font = _cairo_ft_scaled_font_get_unscaled_font (scaled_font); num_fonts = _cairo_array_num_elements (&document->fonts); @@ -1870,12 +1245,14 @@ _cairo_pdf_document_get_font (cairo_pdf_document_t *document, /* FIXME: Figure out here which font backend is in use and call * the appropriate constructor. */ - pdf_font = cairo_pdf_ft_font_create (document, unscaled_font); + pdf_font = _cairo_font_subset_create (unscaled_font); if (pdf_font == NULL) return NULL; + pdf_font->font_id = _cairo_pdf_document_new_object (document); + if (_cairo_array_append (&document->fonts, &pdf_font, 1) == NULL) { - cairo_pdf_font_destroy (pdf_font); + _cairo_font_subset_destroy (pdf_font); return NULL; } @@ -1899,7 +1276,7 @@ _cairo_pdf_surface_show_glyphs (cairo_scaled_font_t *scaled_font, cairo_pdf_surface_t *surface = abstract_surface; cairo_pdf_document_t *document = surface->document; cairo_output_stream_t *output = document->output_stream; - cairo_pdf_font_t *pdf_font; + cairo_font_subset_t *pdf_font; int i, index; pdf_font = _cairo_pdf_document_get_font (document, scaled_font); @@ -1912,7 +1289,7 @@ _cairo_pdf_surface_show_glyphs (cairo_scaled_font_t *scaled_font, "BT /res%u 1 Tf", pdf_font->font_id); for (i = 0; i < num_glyphs; i++) { - index = cairo_pdf_font_use_glyph (pdf_font, glyphs[i].index); + index = _cairo_font_subset_use_glyph (pdf_font, glyphs[i].index); _cairo_output_stream_printf (output, " %f %f %f %f %f %f Tm (\\%o) Tj", @@ -2036,7 +1413,7 @@ _cairo_pdf_document_create (cairo_output_stream_t *output_stream, document->pages_id = _cairo_pdf_document_new_object (document); - _cairo_array_init (&document->fonts, sizeof (cairo_pdf_font_t *)); + _cairo_array_init (&document->fonts, sizeof (cairo_font_subset_t *)); /* Document header */ _cairo_output_stream_printf (output_stream, @@ -2100,7 +1477,7 @@ static cairo_status_t _cairo_pdf_document_write_fonts (cairo_pdf_document_t *document) { cairo_output_stream_t *output = document->output_stream; - cairo_pdf_font_t *font; + cairo_font_subset_t *font; int num_fonts, i, j; const char *data; char *compressed; @@ -2112,7 +1489,7 @@ _cairo_pdf_document_write_fonts (cairo_pdf_document_t *document) for (i = 0; i < num_fonts; i++) { _cairo_array_copy_element (&document->fonts, i, &font); - status = cairo_pdf_font_generate (font, &data, &data_size); + status = _cairo_font_subset_generate (font, &data, &data_size); if (status) goto fail; @@ -2195,7 +1572,7 @@ _cairo_pdf_document_write_fonts (cairo_pdf_document_t *document) "endobj\r\n"); fail: - cairo_pdf_ft_font_destroy (font); + _cairo_font_subset_destroy (font); } return status; -- cgit v1.2.3 From 687f3d78d6b1fe1fb03980c70537bea331bbcf28 Mon Sep 17 00:00:00 2001 From: Øyvind Kolås Date: Wed, 22 Jun 2005 09:49:48 +0000 Subject: minor whitespace and spellfix --- ChangeLog | 4 ++++ doc/public/language-bindings.xml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 727f83fbd..d9394cc1b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-06-22 Øyvind Kolås + + * doc/public/language-bindings.xml: spelling and whitespace fix. + 2005-06-21 Kristian Høgsberg * src/cairo-pdf-surface.c: Split out font subsetting code from here, diff --git a/doc/public/language-bindings.xml b/doc/public/language-bindings.xml index 1b999d82f..b0ee8e879 100644 --- a/doc/public/language-bindings.xml +++ b/doc/public/language-bindings.xml @@ -418,7 +418,7 @@ public void writeToPNG (OutputStream stream) throws IOException; Constructors, rather than - returningNULL on out-of-memory failure, + returning NULL on out-of-memory failure, return a special singleton object on which all operations do nothing. Retrieving the status of the singleton object returns CAIRO_STATUS_NO_MEMORY @@ -534,7 +534,7 @@ cairo_pattern_t Like patterns, surfaces, which use only the cairo_surface_t - type in the C API should be broken up into a heirarchy of types + type in the C API should be broken up into a hierarchy of types in a language binding. -- cgit v1.2.3 From b04b434db189904b108ab5167e61a286ea8225d2 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 22 Jun 2005 17:09:08 +0000 Subject: Update ROADMAP with some comments on 0.5.2. Add documentation for cairo_set_source_surface and fix some typos in other documentation blocks. --- ChangeLog | 6 ++++++ ROADMAP | 16 ++++++++-------- src/cairo.c | 29 ++++++++++++++++++++++++++--- 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9394cc1b..910b6f3f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-06-22 Carl Worth + + * ROADMAP: Update ROADMAP with some comments on 0.5.2. + + * src/cairo.c: + 2005-06-22 Øyvind Kolås * doc/public/language-bindings.xml: spelling and whitespace fix. diff --git a/ROADMAP b/ROADMAP index 3dfdd3335..99ed440cc 100644 --- a/ROADMAP +++ b/ROADMAP @@ -1,8 +1,9 @@ -Here are some quick notes as far as a cairo roadmap goes. +cairo 0.5.2 +=========== + Get tor to sign off that the win32 stuff is up to snuff + glyph path patch reviewed and committed -See also the TODO file for a different view, (less organized, but -often in more detail, particularly for the API Shakeup work in -progress). + Fix the BadMatch error introduced between 0.5.0 and 0.5.1 cairo 1.0 release requirements ============================== @@ -15,11 +16,11 @@ Implementation work I2. Real PostScript/PDF fallbacks (cairo_meta_surface_t) Difficulty: hard - Status: otaylor has drafted a plan or two on the list + Status: krh has a patch that cworth has reviewed. Next version + should land. API Issues (more detail in TODO file) ------------------------------------- - ✓A1. Add cairo_paint Difficulty: moderate or moderate to minor Dependencies: much easier after [I1]. needs some cleanups from [A4] @@ -33,8 +34,7 @@ API Issues (more detail in TODO file) Difficulty: easy to hard (depending on how sophisticated an implementation is acceptable, and whether the cairo_meta_surface_t mentioned in [I2] is done) - Status: cworth sent API proposal to the list - (still some unresolved API issues) + Status: cworth has a posted a preliminary patch (still some open questions) ✓A4. Make set_source consistent Difficulty: easy diff --git a/src/cairo.c b/src/cairo.c index 73dfc2cdd..76e4bf4ba 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -404,6 +404,29 @@ cairo_set_source_rgba (cairo_t *cr, _cairo_set_source_solid (cr, &color); } +/** + * cairo_set_source_surface: + * @cr: a cairo context + * @surface: a surface to be used to set the source pattern + * @x: User-space X coordinate for surface origin + * @y: User-space Y coordinate for surface origin + * + * This is a convenience function for creating a pattern from @surface + * and setting it as the source in @cr with cairo_set_source(). + * + * The @x and @y parameters give the user-space coordinate at which + * the surface origin should appear. (The surface origin is its + * upper-left corner before any transformation has been applied.) The + * @x and @y patterns are negated and then set as translation values + * in the pattern matrix. + * + * Other than the initial translation pattern matrix, as described + * above, all other pattern attributes, (such as its extend mode), are + * set to the default values as in cairo_pattern_create_for_surface. + * The resulting pattern can be queried with cairo_get_source() so + * that these attributes can be modified if desired, (eg. to create a + * repeating pattern with cairo_pattern_set_extend()). + **/ void cairo_set_source_surface (cairo_t *cr, cairo_surface_t *surface, @@ -655,7 +678,7 @@ cairo_set_miter_limit (cairo_t *cr, double limit) * @tx: amount to translate in the X direction * @ty: amount to translate in the Y direction * - * Modifies the current transformation matrix (CTM) by tanslating the + * Modifies the current transformation matrix (CTM) by translating the * user-space origin by (@tx, @ty). This offset is interpreted as a * user-space coordinate according to the CTM in place before the new * call to cairo_translate. In other words, the translation of the @@ -1538,7 +1561,7 @@ cairo_fill_extents (cairo_t *cr, * * Calling cairo_clip() can only make the clip region smaller, never * larger. But the current clip is part of the graphics state, so a - * tempoarary restriction of the clip region can be achieved by + * temporary restriction of the clip region can be achieved by * calling cairo_clip() within a cairo_save()/cairo_restore() * pair. The only other means of increasing the size of the clip * region is cairo_reset_clip(). @@ -1568,7 +1591,7 @@ cairo_clip (cairo_t *cr) * * Calling cairo_clip() can only make the clip region smaller, never * larger. But the current clip is part of the graphics state, so a - * tempoarary restriction of the clip region can be achieved by + * temporary restriction of the clip region can be achieved by * calling cairo_clip() within a cairo_save()/cairo_restore() * pair. The only other means of increasing the size of the clip * region is cairo_reset_clip(). -- cgit v1.2.3 From 03c7b6aa7a5d2b97b7f892296f2a46ae56dde5b2 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 22 Jun 2005 22:12:09 +0000 Subject: Add link to BadMatch bug. --- ChangeLog | 6 ++++-- ROADMAP | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 910b6f3f3..83cff49c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,8 +1,10 @@ 2005-06-22 Carl Worth * ROADMAP: Update ROADMAP with some comments on 0.5.2. - - * src/cairo.c: + Add link to BadMatch bug. + + * src/cairo.c: Add documentation for cairo_set_source_surface and + fix some typos in other documentation blocks. 2005-06-22 Øyvind Kolås diff --git a/ROADMAP b/ROADMAP index 99ed440cc..c889f7d40 100644 --- a/ROADMAP +++ b/ROADMAP @@ -3,7 +3,8 @@ cairo 0.5.2 Get tor to sign off that the win32 stuff is up to snuff glyph path patch reviewed and committed - Fix the BadMatch error introduced between 0.5.0 and 0.5.1 + Fix the BadMatch error introduced between 0.5.0 and 0.5.1: + https://bugs.freedesktop.org/show_bug.cgi?id=3604 cairo 1.0 release requirements ============================== -- cgit v1.2.3 From 3b20ab66b89527c25c1fbfff8ed1ff672196520f Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 23 Jun 2005 12:45:38 +0000 Subject: Add workaround for Render's overlapping source/dest bug to the 0.5.2 roadmap. --- ChangeLog | 5 +++++ ROADMAP | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/ChangeLog b/ChangeLog index 83cff49c3..aa21d93f4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-06-23 Carl Worth + + * ROADMAP: Add workaround for Render's overlapping source/dest bug + to the 0.5.2 roadmap. + 2005-06-22 Carl Worth * ROADMAP: Update ROADMAP with some comments on 0.5.2. diff --git a/ROADMAP b/ROADMAP index c889f7d40..8767ea474 100644 --- a/ROADMAP +++ b/ROADMAP @@ -6,6 +6,10 @@ cairo 0.5.2 Fix the BadMatch error introduced between 0.5.0 and 0.5.1: https://bugs.freedesktop.org/show_bug.cgi?id=3604 + Add a workaround for Render's overlapping source/dest bug + Use XCopyArea when possible (integer translation) + Otherwise make a copy of the source + cairo 1.0 release requirements ============================== -- cgit v1.2.3 From ff27263f3968d8f97534ce218bfde0392908cf6c Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 23 Jun 2005 12:58:49 +0000 Subject: Only unpremultiply ARGB32 data. Call png_write_info() *before* we set up the write conversion... it doesn't work after. --- ChangeLog | 6 ++++++ src/cairo-png.c | 47 ++++++++++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index aa21d93f4..a319478a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-05-17 Owen Taylor + + * src/cairo-png.c (write_png): Only unpremultiply ARGB32 data. + Call png_write_info() *before* we set up the write conversion... + it doesn't work after. + 2005-06-23 Carl Worth * ROADMAP: Add workaround for Render's overlapping source/dest bug diff --git a/src/cairo-png.c b/src/cairo-png.c index d7297848d..1385bea04 100644 --- a/src/cairo-png.c +++ b/src/cairo-png.c @@ -38,6 +38,7 @@ #include #include "cairoint.h" +/* Unpremultiplies data and converts native endian ARGB => RGBA bytes */ static void unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data) { @@ -53,14 +54,33 @@ unpremultiply_data (png_structp png, png_row_infop row_info, png_bytep data) if (alpha == 0) { b[0] = b[1] = b[2] = b[3] = 0; } else { - b[0] = (((pixel & 0x0000ff) >> 0) * 255 + alpha / 2) / alpha; + b[0] = (((pixel & 0xff0000) >> 16) * 255 + alpha / 2) / alpha; b[1] = (((pixel & 0x00ff00) >> 8) * 255 + alpha / 2) / alpha; - b[2] = (((pixel & 0xff0000) >> 16) * 255 + alpha / 2) / alpha; + b[2] = (((pixel & 0x0000ff) >> 0) * 255 + alpha / 2) / alpha; b[3] = alpha; } } } +/* Converts native endian xRGB => RGBx bytes */ +static void +convert_data_to_bytes (png_structp png, png_row_infop row_info, png_bytep data) +{ + int i; + + for (i = 0; i < row_info->rowbytes; i += 4) { + uint8_t *b = &data[i]; + uint32_t pixel; + + memcpy (&pixel, b, sizeof (uint32_t)); + + b[0] = (pixel & 0xff0000) >> 16; + b[1] = (pixel & 0x00ff00) >> 8; + b[2] = (pixel & 0x0000ff) >> 0; + b[3] = 0; + } +} + static cairo_status_t write_png (cairo_surface_t *surface, png_rw_ptr write_func, @@ -153,14 +173,19 @@ write_png (cairo_surface_t *surface, png_convert_from_time_t (&pt, time (NULL)); png_set_tIME (png, info, &pt); - png_set_write_user_transform_fn (png, unpremultiply_data); - if (image->format == CAIRO_FORMAT_ARGB32 || - image->format == CAIRO_FORMAT_RGB24) - png_set_bgr (png); + /* We have to call png_write_info() before setting up the write + * transformation, since it stores data internally in 'png' + * that is needed for the write transformation functions to work. + */ + png_write_info (png, info); + + if (image->format == CAIRO_FORMAT_ARGB32) + png_set_write_user_transform_fn (png, unpremultiply_data); + else if (image->format == CAIRO_FORMAT_RGB24) + png_set_write_user_transform_fn (png, convert_data_to_bytes); if (image->format == CAIRO_FORMAT_RGB24) png_set_filler (png, 0, PNG_FILLER_AFTER); - - png_write_info (png, info); + png_write_image (png, rows); png_write_end (png, info); @@ -262,6 +287,7 @@ cairo_surface_write_to_png_stream (cairo_surface_t *surface, return write_png (surface, stream_write_func, &png_closure); } +/* Premultiplies data and converts RGBA bytes => native endian */ static void premultiply_data (png_structp png, png_row_infop row_info, @@ -271,9 +297,9 @@ premultiply_data (png_structp png, for (i = 0; i < row_info->rowbytes; i += 4) { uint8_t *base = &data[i]; - uint8_t blue = base[0]; + uint8_t red = base[0]; uint8_t green = base[1]; - uint8_t red = base[2]; + uint8_t blue = base[2]; uint8_t alpha = base[3]; uint32_t p; @@ -352,7 +378,6 @@ read_png (png_rw_ptr read_func, if (interlace != PNG_INTERLACE_NONE) png_set_interlace_handling (png); - png_set_bgr (png); png_set_filler (png, 0xff, PNG_FILLER_AFTER); png_set_read_user_transform_fn (png, premultiply_data); -- cgit v1.2.3 From 609ef32bfa13c09d3a6de5c6631458109445eda0 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Thu, 23 Jun 2005 13:05:07 +0000 Subject: Improve last ChangeLog entry a bit --- ChangeLog | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a319478a0..0fc287a0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2005-05-17 Owen Taylor - * src/cairo-png.c (write_png): Only unpremultiply ARGB32 data. + * src/cairo-png.c (write_png): Only unpremultiply ARGB32 data, + do a simpler conversion for RGB24 data (fixes #2297) Call png_write_info() *before* we set up the write conversion... it doesn't work after. -- cgit v1.2.3 From adeff84bc2eba19bb3f667297e594a1ef86ae2a9 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 23 Jun 2005 15:52:37 +0000 Subject: Add ARGB text to 1.0 roadmap. --- ChangeLog | 4 ++++ ROADMAP | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0fc287a0a..32d3905fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-06-23 Carl Worth + + * ROADMAP: Add ARGB text to 1.0 roadmap. + 2005-05-17 Owen Taylor * src/cairo-png.c (write_png): Only unpremultiply ARGB32 data, diff --git a/ROADMAP b/ROADMAP index 8767ea474..602e48c99 100644 --- a/ROADMAP +++ b/ROADMAP @@ -24,6 +24,8 @@ Implementation work Status: krh has a patch that cworth has reviewed. Next version should land. + I3. Add support for sub-pixel (ARGB) rendering of text. + API Issues (more detail in TODO file) ------------------------------------- ✓A1. Add cairo_paint -- cgit v1.2.3 From 81ec18369736888bea6d4d79d0de6ed00e8ca802 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 23 Jun 2005 19:30:12 +0000 Subject: Start the xserver/fb -> libpixman merging with a copy optimization. --- pixman/ChangeLog | 7 +++++++ pixman/src/icblt.c | 26 +++++++++++++++++++++++++- pixman/src/icint.h | 1 + 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index e619314c4..293bd66ec 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,10 @@ +2005-06-23 Jeff Muizelaar + + * src/icint.h: + * src/icblt.c: (IcBlt): + Start the xserver/fb -> libpixman merging with a copy + optimization. + 2005-05-26 Keith Packard * src/iccompose.c: (IcFetch_transform), (IcFetcha_transform), diff --git a/pixman/src/icblt.c b/pixman/src/icblt.c index a48d1ef78..f8062f886 100644 --- a/pixman/src/icblt.c +++ b/pixman/src/icblt.c @@ -63,7 +63,31 @@ IcBlt (pixman_bits_t *srcLine, int destInvarient; int startbyte, endbyte; IcDeclareMergeRop (); - + + /* are we just copying multiples of 8 bits? if so, run, forrest, run! + the memcpy()'s should be pluggable ala mplayer|xine - perhaps we can get + one of the above to give up their code for us. + */ + if((pm==IC_ALLONES) && (alu==GXcopy) && !reverse && (srcX&7)==0 && (dstX&7)==0 && (width&7)==0) + { + uint8_t *isrc=(uint8_t *)srcLine; + uint8_t *idst=(uint8_t *)dstLine; + int sstride=srcStride*sizeof(pixman_bits_t); + int dstride=dstStride*sizeof(pixman_bits_t); + int j; + width>>=3; + isrc+=(srcX>>3); + idst+=(dstX>>3); + if(!upsidedown) + for(j=0;j=0;j--) + memcpy(idst+j*dstride, isrc+j*sstride, width); + + return; + } + #ifdef IC_24BIT if (bpp == 24 && !IcCheck24Pix (pm)) { diff --git a/pixman/src/icint.h b/pixman/src/icint.h index a31ddf444..9b8233645 100644 --- a/pixman/src/icint.h +++ b/pixman/src/icint.h @@ -61,6 +61,7 @@ typedef struct _IcPoint { typedef unsigned int Mask; +#define GXcopy 0x3 #define GXor 0x7 #define ClipByChildren 0 #define PolyEdgeSharp 0 -- cgit v1.2.3 From aa07c01cb5d1f0c41067ee005b6db4481d5d8b58 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 23 Jun 2005 19:33:34 +0000 Subject: more merging: 630. Fix incorrect datatype for the pixmap width in fbCompositeSrcAdd_8000x8000(), and add some small optimisations (#A.1423, Keith Packard). --- pixman/ChangeLog | 12 +++++++++++- pixman/src/ic.c | 36 ++++++++++++++++++++++-------------- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index 293bd66ec..850388d2d 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,4 +1,14 @@ -2005-06-23 Jeff Muizelaar +2005-06-23 Jeff Muizelaar + + * src/ic.c: (pixman_compositeSrcAdd_8000x8000), + (pixman_compositeSrcAdd_8888x8888): + more merging: + + 630. Fix incorrect datatype for the pixmap width in + fbCompositeSrcAdd_8000x8000(), and add some small optimisations + (#A.1423, Keith Packard). + +2005-06-23 Jeff Muizelaar * src/icint.h: * src/icblt.c: (IcBlt): diff --git a/pixman/src/ic.c b/pixman/src/ic.c index 231fb57db..9ed02b244 100644 --- a/pixman/src/ic.c +++ b/pixman/src/ic.c @@ -681,13 +681,17 @@ pixman_compositeSrcAdd_8000x8000 (pixman_operator_t op, while (w--) { s = *src++; - if (s != 0xff) + if (s) { - d = *dst; - t = d + s; - s = t | (0 - (t >> 8)); + if (s != 0xff) + { + d = *dst; + t = d + s; + s = t | (0 - (t >> 8)); + } + *dst = s; } - *dst++ = s; + dst++; } } } @@ -728,19 +732,23 @@ pixman_compositeSrcAdd_8888x8888 (pixman_operator_t op, while (w--) { s = *src++; - if (s != 0xffffffff) + if (s) { - d = *dst; - if (d) + if (s != 0xffffffff) { - m = IcAdd(s,d,0,t); - n = IcAdd(s,d,8,t); - o = IcAdd(s,d,16,t); - p = IcAdd(s,d,24,t); - s = m|n|o|p; + d = *dst; + if (d) + { + m = IcAdd(s,d,0,t); + n = IcAdd(s,d,8,t); + o = IcAdd(s,d,16,t); + p = IcAdd(s,d,24,t); + s = m|n|o|p; + } } + *dst = s; } - *dst++ = s; + dst++; } } } -- cgit v1.2.3 From 373e7f68b1c076eab08f2bc6b249dae4e8ac9bf4 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 23 Jun 2005 19:35:45 +0000 Subject: s/pixman_bits_t/FbBits/s --- pixman/ChangeLog | 31 ++++++++++++++ pixman/src/ic.c | 14 +++--- pixman/src/icblt.c | 80 +++++++++++++++++----------------- pixman/src/icbltone.c | 44 +++++++++---------- pixman/src/iccompose.c | 114 ++++++++++++++++++++++++------------------------- pixman/src/icimage.c | 6 +-- pixman/src/icstipple.c | 8 ++-- 7 files changed, 164 insertions(+), 133 deletions(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index 850388d2d..e437caed8 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,34 @@ +2005-06-23 Jeff Muizelaar + + * src/ic.c: (pixman_compositeSrcAdd_1000x1000), + (pixman_compositeSolidMask_nx1xn): + * src/icblt.c: (IcBlt), (IcBlt24Line), (IcBlt24), (IcBltOdd), + (IcBltOdd24), (IcSetBltOdd), (IcBltStip): + * src/icbltone.c: (IcBltOne), (IcBltOne24): + * src/iccompose.c: (IcFetch_a8r8g8b8), (IcFetch_x8r8g8b8), + (IcFetch_a8b8g8r8), (IcFetch_x8b8g8r8), (IcFetch_r8g8b8), + (IcFetch_b8g8r8), (IcFetch_r5g6b5), (IcFetch_b5g6r5), + (IcFetch_a1r5g5b5), (IcFetch_x1r5g5b5), (IcFetch_a1b5g5r5), + (IcFetch_x1b5g5r5), (IcFetch_a4r4g4b4), (IcFetch_x4r4g4b4), + (IcFetch_a4b4g4r4), (IcFetch_x4b4g4r4), (IcFetch_a8), + (IcFetcha_a8), (IcFetch_r3g3b2), (IcFetch_b2g3r3), + (IcFetch_a2r2g2b2), (IcFetch_a4), (IcFetcha_a4), (IcFetch_r1g2b1), + (IcFetch_b1g2r1), (IcFetch_a1r1g1b1), (IcFetch_a1b1g1r1), + (IcFetcha_a1), (IcFetch_a1), (IcStore_a8r8g8b8), + (IcStore_x8r8g8b8), (IcStore_a8b8g8r8), (IcStore_x8b8g8r8), + (IcStore_r8g8b8), (IcStore_b8g8r8), (IcStore_r5g6b5), + (IcStore_b5g6r5), (IcStore_a1r5g5b5), (IcStore_x1r5g5b5), + (IcStore_a1b5g5r5), (IcStore_x1b5g5r5), (IcStore_a4r4g4b4), + (IcStore_x4r4g4b4), (IcStore_a4b4g4r4), (IcStore_x4b4g4r4), + (IcStore_a8), (IcStore_r3g3b2), (IcStore_b2g3r3), + (IcStore_a2r2g2b2), (IcStore_a4), (IcStore_r1g2b1), + (IcStore_b1g2r1), (IcStore_a1r1g1b1), (IcStore_a1b1g1r1), + (IcStore_a1), (IcBuildCompositeOperand): + * src/icimage.c: (pixman_image_create_for_data): + * src/icstipple.c: (IcTransparentSpan): + + s/pixman_bits_t/FbBits/s + 2005-06-23 Jeff Muizelaar * src/ic.c: (pixman_compositeSrcAdd_8000x8000), diff --git a/pixman/src/ic.c b/pixman/src/ic.c index 9ed02b244..6faaf5417 100644 --- a/pixman/src/ic.c +++ b/pixman/src/ic.c @@ -21,7 +21,7 @@ * Author: Keith Packard, SuSE, Inc. */ -#include "icint.h" +#include "pixman-xserver-compat.h" #define cvt8888to0565(s) ((((s) >> 3) & 0x001f) | \ (((s) >> 5) & 0x07e0) | \ @@ -92,7 +92,7 @@ IcIn (uint32_t x, uint8_t y) } #define IcComposeGetSolid(image, bits) { \ - pixman_bits_t *__bits__; \ + FbBits *__bits__; \ IcStride __stride__; \ int __bpp__; \ int __xoff__,__yoff__; \ @@ -118,13 +118,13 @@ IcIn (uint32_t x, uint8_t y) } #define IcComposeGetStart(image,x,y,type,stride,line,mul) {\ - pixman_bits_t *__bits__; \ + FbBits *__bits__; \ IcStride __stride__; \ int __bpp__; \ int __xoff__,__yoff__; \ \ IcGetPixels((image)->pixels,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ - (stride) = __stride__ * sizeof (pixman_bits_t) / sizeof (type); \ + (stride) = __stride__ * sizeof (FbBits) / sizeof (type); \ (line) = ((type *) __bits__) + (stride) * ((y) - __yoff__) + (mul) * ((x) - __xoff__); \ } @@ -767,7 +767,7 @@ pixman_compositeSrcAdd_1000x1000 (pixman_operator_t op, uint16_t width, uint16_t height) { - pixman_bits_t *dstBits, *srcBits; + FbBits *dstBits, *srcBits; IcStride dstStride, srcStride; int dstBpp, srcBpp; int dstXoff, dstYoff; @@ -810,13 +810,13 @@ pixman_compositeSolidMask_nx1xn (pixman_operator_t op, uint16_t width, uint16_t height) { - pixman_bits_t *dstBits; + FbBits *dstBits; IcStip *maskBits; IcStride dstStride, maskStride; int dstBpp, maskBpp; int dstXoff, dstYoff; int maskXoff, maskYoff; - pixman_bits_t src; + FbBits src; IcComposeGetSolid(iSrc, src); diff --git a/pixman/src/icblt.c b/pixman/src/icblt.c index f8062f886..02c6bfc39 100644 --- a/pixman/src/icblt.c +++ b/pixman/src/icblt.c @@ -22,7 +22,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include "icint.h" +#include "pixman-xserver-compat.h" #define InitializeShifts(sx,dx,ls,rs) { \ if (sx != dx) { \ @@ -37,11 +37,11 @@ } void -IcBlt (pixman_bits_t *srcLine, +IcBlt (FbBits *srcLine, IcStride srcStride, int srcX, - pixman_bits_t *dstLine, + FbBits *dstLine, IcStride dstStride, int dstX, @@ -49,16 +49,16 @@ IcBlt (pixman_bits_t *srcLine, int height, int alu, - pixman_bits_t pm, + FbBits pm, int bpp, int reverse, int upsidedown) { - pixman_bits_t *src, *dst; + FbBits *src, *dst; int leftShift, rightShift; - pixman_bits_t startmask, endmask; - pixman_bits_t bits, bits1; + FbBits startmask, endmask; + FbBits bits, bits1; int n, nmiddle; int destInvarient; int startbyte, endbyte; @@ -72,8 +72,8 @@ IcBlt (pixman_bits_t *srcLine, { uint8_t *isrc=(uint8_t *)srcLine; uint8_t *idst=(uint8_t *)dstLine; - int sstride=srcStride*sizeof(pixman_bits_t); - int dstride=dstStride*sizeof(pixman_bits_t); + int sstride=srcStride*sizeof(FbBits); + int dstride=dstStride*sizeof(FbBits); int j; width>>=3; isrc+=(srcX>>3); @@ -178,7 +178,7 @@ IcBlt (pixman_bits_t *srcLine, */ if (_ca2 + 1 == 0 && _cx2 == 0) { - pixman_bits_t t1, t2, t3, t4; + FbBits t1, t2, t3, t4; while (n >= 4) { t1 = *src++; @@ -350,32 +350,32 @@ getPixel (char *src, int x) #endif static void -IcBlt24Line (pixman_bits_t *src, +IcBlt24Line (FbBits *src, int srcX, - pixman_bits_t *dst, + FbBits *dst, int dstX, int width, int alu, - pixman_bits_t pm, + FbBits pm, int reverse) { #ifdef DEBUG_BLT24 char *origDst = (char *) dst; - pixman_bits_t *origLine = dst + ((dstX >> IC_SHIFT) - 1); + FbBits *origLine = dst + ((dstX >> IC_SHIFT) - 1); int origNlw = ((width + IC_MASK) >> IC_SHIFT) + 3; int origX = dstX / 24; #endif int leftShift, rightShift; - pixman_bits_t startmask, endmask; + FbBits startmask, endmask; int n; - pixman_bits_t bits, bits1; - pixman_bits_t mask; + FbBits bits, bits1; + FbBits mask; int rot; IcDeclareMergeRop (); @@ -564,11 +564,11 @@ IcBlt24Line (pixman_bits_t *src, } void -IcBlt24 (pixman_bits_t *srcLine, +IcBlt24 (FbBits *srcLine, IcStride srcStride, int srcX, - pixman_bits_t *dstLine, + FbBits *dstLine, IcStride dstStride, int dstX, @@ -576,7 +576,7 @@ IcBlt24 (pixman_bits_t *srcLine, int height, int alu, - pixman_bits_t pm, + FbBits pm, int reverse, int upsidedown) @@ -608,13 +608,13 @@ IcBlt24 (pixman_bits_t *srcLine, */ void -IcBltOdd (pixman_bits_t *srcLine, +IcBltOdd (FbBits *srcLine, IcStride srcStrideEven, IcStride srcStrideOdd, int srcXEven, int srcXOdd, - pixman_bits_t *dstLine, + FbBits *dstLine, IcStride dstStrideEven, IcStride dstStrideOdd, int dstXEven, @@ -624,26 +624,26 @@ IcBltOdd (pixman_bits_t *srcLine, int height, int alu, - pixman_bits_t pm, + FbBits pm, int bpp) { - pixman_bits_t *src; + FbBits *src; int leftShiftEven, rightShiftEven; - pixman_bits_t startmaskEven, endmaskEven; + FbBits startmaskEven, endmaskEven; int nmiddleEven; - pixman_bits_t *dst; + FbBits *dst; int leftShiftOdd, rightShiftOdd; - pixman_bits_t startmaskOdd, endmaskOdd; + FbBits startmaskOdd, endmaskOdd; int nmiddleOdd; int leftShift, rightShift; - pixman_bits_t startmask, endmask; + FbBits startmask, endmask; int nmiddle; int srcX, dstX; - pixman_bits_t bits, bits1; + FbBits bits, bits1; int n; int destInvarient; @@ -781,13 +781,13 @@ IcBltOdd (pixman_bits_t *srcLine, #ifdef IC_24BIT void -IcBltOdd24 (pixman_bits_t *srcLine, +IcBltOdd24 (FbBits *srcLine, IcStride srcStrideEven, IcStride srcStrideOdd, int srcXEven, int srcXOdd, - pixman_bits_t *dstLine, + FbBits *dstLine, IcStride dstStrideEven, IcStride dstStrideOdd, int dstXEven, @@ -797,7 +797,7 @@ IcBltOdd24 (pixman_bits_t *srcLine, int height, int alu, - pixman_bits_t pm) + FbBits pm) { int even = 1; @@ -833,7 +833,7 @@ void IcSetBltOdd (IcStip *stip, IcStride stipStride, int srcX, - pixman_bits_t **bits, + FbBits **bits, IcStride *strideEven, IcStride *strideOdd, int *srcXEven, @@ -851,7 +851,7 @@ IcSetBltOdd (IcStip *stip, */ strideAdjust = stipStride & (IC_MASK >> IC_STIP_SHIFT); - *bits = (pixman_bits_t *) ((char *) stip - srcAdjust); + *bits = (FbBits *) ((char *) stip - srcAdjust); if (srcAdjust) { *strideEven = IcStipStrideToBitsStride (stipStride + 1); @@ -873,18 +873,18 @@ IcSetBltOdd (IcStip *stip, void IcBltStip (IcStip *src, - IcStride srcStride, /* in IcStip units, not pixman_bits_t units */ + IcStride srcStride, /* in IcStip units, not FbBits units */ int srcX, IcStip *dst, - IcStride dstStride, /* in IcStip units, not pixman_bits_t units */ + IcStride dstStride, /* in IcStip units, not FbBits units */ int dstX, int width, int height, int alu, - pixman_bits_t pm, + FbBits pm, int bpp) { #if IC_STIP_SHIFT != IC_SHIFT @@ -895,7 +895,7 @@ IcBltStip (IcStip *src, IcStride dstStrideEven, dstStrideOdd; int srcXEven, srcXOdd; int dstXEven, dstXOdd; - pixman_bits_t *s, *d; + FbBits *s, *d; int sx, dx; src += srcX >> IC_STIP_SHIFT; @@ -939,9 +939,9 @@ IcBltStip (IcStip *src, else #endif { - IcBlt ((pixman_bits_t *) src, IcStipStrideToBitsStride (srcStride), + IcBlt ((FbBits *) src, IcStipStrideToBitsStride (srcStride), srcX, - (pixman_bits_t *) dst, IcStipStrideToBitsStride (dstStride), + (FbBits *) dst, IcStipStrideToBitsStride (dstStride), dstX, width, height, alu, pm, bpp, 0, 0); diff --git a/pixman/src/icbltone.c b/pixman/src/icbltone.c index 7d1fd5ff6..6f0502460 100644 --- a/pixman/src/icbltone.c +++ b/pixman/src/icbltone.c @@ -22,7 +22,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include "icint.h" +#include "pixman-xserver-compat.h" /* * Example: srcX = 13 dstX = 8 (IC unit 32 dstBpp 8) @@ -138,27 +138,27 @@ void IcBltOne (IcStip *src, IcStride srcStride, /* IcStip units per scanline */ int srcX, /* bit position of source */ - pixman_bits_t *dst, - IcStride dstStride, /* pixman_bits_t units per scanline */ + FbBits *dst, + IcStride dstStride, /* FbBits units per scanline */ int dstX, /* bit position of dest */ int dstBpp, /* bits per destination unit */ int width, /* width in bits of destination */ int height, /* height in scanlines */ - pixman_bits_t fgand, /* rrop values */ - pixman_bits_t fgxor, - pixman_bits_t bgand, - pixman_bits_t bgxor) + FbBits fgand, /* rrop values */ + FbBits fgxor, + FbBits bgand, + FbBits bgxor) { - const pixman_bits_t *icbits; - int pixelsPerDst; /* dst pixels per pixman_bits_t */ + const FbBits *icbits; + int pixelsPerDst; /* dst pixels per FbBits */ int unitsPerSrc; /* src patterns per IcStip */ int leftShift, rightShift; /* align source with dest */ - pixman_bits_t startmask, endmask; /* dest scanline masks */ + FbBits startmask, endmask; /* dest scanline masks */ IcStip bits=0, bitsLeft, bitsRight;/* source bits */ IcStip left; - pixman_bits_t mask; + FbBits mask; int nDst; /* dest longwords (w.o. end) */ int w; int n, nmiddle; @@ -184,7 +184,7 @@ IcBltOne (IcStip *src, #endif /* - * Number of destination units in pixman_bits_t == number of stipple pixels + * Number of destination units in FbBits == number of stipple pixels * used each time */ pixelsPerDst = IC_UNIT / dstBpp; @@ -202,7 +202,7 @@ IcBltOne (IcStip *src, transparent = 1; /* - * Adjust source and dest to nearest pixman_bits_t boundary + * Adjust source and dest to nearest FbBits boundary */ src += srcX >> IC_STIP_SHIFT; dst += dstX >> IC_SHIFT; @@ -455,7 +455,7 @@ IcBltOne (IcStip *src, #define IcStip24New(rot) (2 + (rot != 0)) #define IcStip24Len 4 -static const pixman_bits_t icStipple24Bits[3][1 << IcStip24Len] = { +static const FbBits icStipple24Bits[3][1 << IcStip24Len] = { /* rotate 0 */ { C4_24( 0, 0), C4_24( 1, 0), C4_24( 2, 0), C4_24( 3, 0), @@ -493,7 +493,7 @@ static const pixman_bits_t icStipple24Bits[3][1 << IcStip24Len] = { #define IcStip24New(rot) (1 + (rot == 8)) #endif -static const pixman_bits_t icStipple24Bits[3][1 << IcStip24Len] = { +static const FbBits icStipple24Bits[3][1 << IcStip24Len] = { /* rotate 0 */ { C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0), @@ -571,21 +571,21 @@ void IcBltOne24 (IcStip *srcLine, IcStride srcStride, /* IcStip units per scanline */ int srcX, /* bit position of source */ - pixman_bits_t *dst, - IcStride dstStride, /* pixman_bits_t units per scanline */ + FbBits *dst, + IcStride dstStride, /* FbBits units per scanline */ int dstX, /* bit position of dest */ int dstBpp, /* bits per destination unit */ int width, /* width in bits of destination */ int height, /* height in scanlines */ - pixman_bits_t fgand, /* rrop values */ - pixman_bits_t fgxor, - pixman_bits_t bgand, - pixman_bits_t bgxor) + FbBits fgand, /* rrop values */ + FbBits fgxor, + FbBits bgand, + FbBits bgxor) { IcStip *src; - pixman_bits_t leftMask, rightMask, mask; + FbBits leftMask, rightMask, mask; int nlMiddle, nl; IcStip stip, bits; int remain; diff --git a/pixman/src/iccompose.c b/pixman/src/iccompose.c index 84c48017d..9de33b850 100644 --- a/pixman/src/iccompose.c +++ b/pixman/src/iccompose.c @@ -21,7 +21,7 @@ */ -#include "icint.h" +#include "pixman-xserver-compat.h" /* * General purpose compositing code optimized for minimal memory @@ -1514,21 +1514,21 @@ static IcCombineFunc const IcCombineFuncC[] = { static uint32_t IcFetch_a8r8g8b8 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; return ((uint32_t *)line)[offset >> 5]; } static uint32_t IcFetch_x8r8g8b8 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; return ((uint32_t *)line)[offset >> 5] | 0xff000000; } static uint32_t IcFetch_a8b8g8r8 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; return ((pixel & 0xff000000) | @@ -1540,7 +1540,7 @@ IcFetch_a8b8g8r8 (pixman_compositeOperand *op) static uint32_t IcFetch_x8b8g8r8 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; return ((0xff000000) | @@ -1552,7 +1552,7 @@ IcFetch_x8b8g8r8 (pixman_compositeOperand *op) static uint32_t IcFetch_r8g8b8 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | @@ -1570,7 +1570,7 @@ IcFetch_r8g8b8 (pixman_compositeOperand *op) static uint32_t IcFetch_b8g8r8 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | @@ -1588,7 +1588,7 @@ IcFetch_b8g8r8 (pixman_compositeOperand *op) static uint32_t IcFetch_r5g6b5 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; uint32_t r,g,b; @@ -1601,7 +1601,7 @@ IcFetch_r5g6b5 (pixman_compositeOperand *op) static uint32_t IcFetch_b5g6r5 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; uint32_t r,g,b; @@ -1614,7 +1614,7 @@ IcFetch_b5g6r5 (pixman_compositeOperand *op) static uint32_t IcFetch_a1r5g5b5 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; uint32_t a,r,g,b; @@ -1628,7 +1628,7 @@ IcFetch_a1r5g5b5 (pixman_compositeOperand *op) static uint32_t IcFetch_x1r5g5b5 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; uint32_t r,g,b; @@ -1641,7 +1641,7 @@ IcFetch_x1r5g5b5 (pixman_compositeOperand *op) static uint32_t IcFetch_a1b5g5r5 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; uint32_t a,r,g,b; @@ -1655,7 +1655,7 @@ IcFetch_a1b5g5r5 (pixman_compositeOperand *op) static uint32_t IcFetch_x1b5g5r5 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; uint32_t r,g,b; @@ -1668,7 +1668,7 @@ IcFetch_x1b5g5r5 (pixman_compositeOperand *op) static uint32_t IcFetch_a4r4g4b4 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; uint32_t a,r,g,b; @@ -1682,7 +1682,7 @@ IcFetch_a4r4g4b4 (pixman_compositeOperand *op) static uint32_t IcFetch_x4r4g4b4 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; uint32_t r,g,b; @@ -1695,7 +1695,7 @@ IcFetch_x4r4g4b4 (pixman_compositeOperand *op) static uint32_t IcFetch_a4b4g4r4 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; uint32_t a,r,g,b; @@ -1709,7 +1709,7 @@ IcFetch_a4b4g4r4 (pixman_compositeOperand *op) static uint32_t IcFetch_x4b4g4r4 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; uint32_t r,g,b; @@ -1722,7 +1722,7 @@ IcFetch_x4b4g4r4 (pixman_compositeOperand *op) static uint32_t IcFetch_a8 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; return pixel << 24; @@ -1731,7 +1731,7 @@ IcFetch_a8 (pixman_compositeOperand *op) static uint32_t IcFetcha_a8 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; pixel |= pixel << 8; @@ -1742,7 +1742,7 @@ IcFetcha_a8 (pixman_compositeOperand *op) static uint32_t IcFetch_r3g3b2 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; uint32_t r,g,b; @@ -1758,7 +1758,7 @@ IcFetch_r3g3b2 (pixman_compositeOperand *op) static uint32_t IcFetch_b2g3r3 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; uint32_t r,g,b; @@ -1776,7 +1776,7 @@ IcFetch_b2g3r3 (pixman_compositeOperand *op) static uint32_t IcFetch_a2r2g2b2 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; uint32_t a,r,g,b; @@ -1797,7 +1797,7 @@ IcFetch_a2r2g2b2 (pixman_compositeOperand *op) static uint32_t IcFetch_a4 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); pixel |= pixel << 4; @@ -1807,7 +1807,7 @@ IcFetch_a4 (pixman_compositeOperand *op) static uint32_t IcFetcha_a4 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); pixel |= pixel << 4; @@ -1819,7 +1819,7 @@ IcFetcha_a4 (pixman_compositeOperand *op) static uint32_t IcFetch_r1g2b1 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); uint32_t r,g,b; @@ -1832,7 +1832,7 @@ IcFetch_r1g2b1 (pixman_compositeOperand *op) static uint32_t IcFetch_b1g2r1 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); uint32_t r,g,b; @@ -1845,7 +1845,7 @@ IcFetch_b1g2r1 (pixman_compositeOperand *op) static uint32_t IcFetch_a1r1g1b1 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); uint32_t a,r,g,b; @@ -1859,7 +1859,7 @@ IcFetch_a1r1g1b1 (pixman_compositeOperand *op) static uint32_t IcFetch_a1b1g1r1 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); uint32_t a,r,g,b; @@ -1873,7 +1873,7 @@ IcFetch_a1b1g1r1 (pixman_compositeOperand *op) static uint32_t IcFetcha_a1 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; uint32_t a; #if BITMAP_BIT_ORDER == MSBFirst @@ -1893,7 +1893,7 @@ IcFetcha_a1 (pixman_compositeOperand *op) static uint32_t IcFetch_a1 (pixman_compositeOperand *op) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; uint32_t a; #if BITMAP_BIT_ORDER == MSBFirst @@ -1918,21 +1918,21 @@ IcFetch_a1 (pixman_compositeOperand *op) static void IcStore_a8r8g8b8 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; ((uint32_t *)line)[offset >> 5] = value; } static void IcStore_x8r8g8b8 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; ((uint32_t *)line)[offset >> 5] = value & 0xffffff; } static void IcStore_a8b8g8r8 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; Splita(value); ((uint32_t *)line)[offset >> 5] = a << 24 | b << 16 | g << 8 | r; } @@ -1940,7 +1940,7 @@ IcStore_a8b8g8r8 (pixman_compositeOperand *op, uint32_t value) static void IcStore_x8b8g8r8 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; Split(value); ((uint32_t *)line)[offset >> 5] = b << 16 | g << 8 | r; } @@ -1948,7 +1948,7 @@ IcStore_x8b8g8r8 (pixman_compositeOperand *op, uint32_t value) static void IcStore_r8g8b8 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); Split(value); #if IMAGE_BYTE_ORDER == MSBFirst @@ -1965,7 +1965,7 @@ IcStore_r8g8b8 (pixman_compositeOperand *op, uint32_t value) static void IcStore_b8g8r8 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); Split(value); #if IMAGE_BYTE_ORDER == MSBFirst @@ -1982,7 +1982,7 @@ IcStore_b8g8r8 (pixman_compositeOperand *op, uint32_t value) static void IcStore_r5g6b5 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); Split(value); *pixel = (((r << 8) & 0xf800) | @@ -1993,7 +1993,7 @@ IcStore_r5g6b5 (pixman_compositeOperand *op, uint32_t value) static void IcStore_b5g6r5 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); Split(value); *pixel = (((b << 8) & 0xf800) | @@ -2004,7 +2004,7 @@ IcStore_b5g6r5 (pixman_compositeOperand *op, uint32_t value) static void IcStore_a1r5g5b5 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); Splita(value); *pixel = (((a << 8) & 0x8000) | @@ -2016,7 +2016,7 @@ IcStore_a1r5g5b5 (pixman_compositeOperand *op, uint32_t value) static void IcStore_x1r5g5b5 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); Split(value); *pixel = (((r << 7) & 0x7c00) | @@ -2027,7 +2027,7 @@ IcStore_x1r5g5b5 (pixman_compositeOperand *op, uint32_t value) static void IcStore_a1b5g5r5 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); Splita(value); *pixel = (((a << 8) & 0x8000) | @@ -2039,7 +2039,7 @@ IcStore_a1b5g5r5 (pixman_compositeOperand *op, uint32_t value) static void IcStore_x1b5g5r5 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); Split(value); *pixel = (((b << 7) & 0x7c00) | @@ -2050,7 +2050,7 @@ IcStore_x1b5g5r5 (pixman_compositeOperand *op, uint32_t value) static void IcStore_a4r4g4b4 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); Splita(value); *pixel = (((a << 8) & 0xf000) | @@ -2062,7 +2062,7 @@ IcStore_a4r4g4b4 (pixman_compositeOperand *op, uint32_t value) static void IcStore_x4r4g4b4 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); Split(value); *pixel = (((r << 4) & 0x0f00) | @@ -2073,7 +2073,7 @@ IcStore_x4r4g4b4 (pixman_compositeOperand *op, uint32_t value) static void IcStore_a4b4g4r4 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); Splita(value); *pixel = (((a << 8) & 0xf000) | @@ -2085,7 +2085,7 @@ IcStore_a4b4g4r4 (pixman_compositeOperand *op, uint32_t value) static void IcStore_x4b4g4r4 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); Split(value); *pixel = (((b << 4) & 0x0f00) | @@ -2096,7 +2096,7 @@ IcStore_x4b4g4r4 (pixman_compositeOperand *op, uint32_t value) static void IcStore_a8 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); *pixel = value >> 24; } @@ -2104,7 +2104,7 @@ IcStore_a8 (pixman_compositeOperand *op, uint32_t value) static void IcStore_r3g3b2 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); Split(value); *pixel = (((r ) & 0xe0) | @@ -2115,7 +2115,7 @@ IcStore_r3g3b2 (pixman_compositeOperand *op, uint32_t value) static void IcStore_b2g3r3 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); Split(value); *pixel = (((b ) & 0xe0) | @@ -2126,7 +2126,7 @@ IcStore_b2g3r3 (pixman_compositeOperand *op, uint32_t value) static void IcStore_a2r2g2b2 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); Splita(value); *pixel = (((a ) & 0xc0) | @@ -2149,14 +2149,14 @@ IcStore_a2r2g2b2 (pixman_compositeOperand *op, uint32_t value) static void IcStore_a4 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; Store4(line,offset,value>>28); } static void IcStore_r1g2b1 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; Split(value); @@ -2169,7 +2169,7 @@ IcStore_r1g2b1 (pixman_compositeOperand *op, uint32_t value) static void IcStore_b1g2r1 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; Split(value); @@ -2182,7 +2182,7 @@ IcStore_b1g2r1 (pixman_compositeOperand *op, uint32_t value) static void IcStore_a1r1g1b1 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; Splita(value); pixel = (((a >> 4) & 0x8) | @@ -2195,7 +2195,7 @@ IcStore_a1r1g1b1 (pixman_compositeOperand *op, uint32_t value) static void IcStore_a1b1g1r1 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; Splita(value); pixel = (((a >> 4) & 0x8) | @@ -2208,7 +2208,7 @@ IcStore_a1b1g1r1 (pixman_compositeOperand *op, uint32_t value) static void IcStore_a1 (pixman_compositeOperand *op, uint32_t value) { - pixman_bits_t *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; + FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t *pixel = ((uint32_t *) line) + (offset >> 5); uint32_t mask = IcStipMask(offset & 0x1f, 1); @@ -2618,7 +2618,7 @@ IcBuildCompositeOperand (pixman_image_t *image, for (i = 0; i < NumAccessMap; i++) if (icAccessMap[i].format_code == image->format_code) { - pixman_bits_t *bits; + FbBits *bits; IcStride stride; int bpp; diff --git a/pixman/src/icimage.c b/pixman/src/icimage.c index 7f5b9ef89..33539fdec 100644 --- a/pixman/src/icimage.c +++ b/pixman/src/icimage.c @@ -21,7 +21,7 @@ * Author: Keith Packard, SuSE, Inc. */ -#include "icint.h" +#include "pixman-xserver-compat.h" pixman_image_t * pixman_image_create (pixman_format_t *format, @@ -48,7 +48,7 @@ pixman_image_create (pixman_format_t *format, slim_hidden_def(pixman_image_create); pixman_image_t * -pixman_image_create_for_data (pixman_bits_t *data, pixman_format_t *format, int width, int height, int bpp, int stride) +pixman_image_create_for_data (FbBits *data, pixman_format_t *format, int width, int height, int bpp, int stride) { pixman_image_t *image; IcPixels *pixels; @@ -245,7 +245,7 @@ pixman_image_get_format (pixman_image_t *image) return &image->image_format; } -pixman_bits_t * +FbBits * pixman_image_get_data (pixman_image_t *image) { return image->pixels->data; diff --git a/pixman/src/icstipple.c b/pixman/src/icstipple.c index 121bbaa86..cde49c466 100644 --- a/pixman/src/icstipple.c +++ b/pixman/src/icstipple.c @@ -22,7 +22,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include "icint.h" +#include "pixman-xserver-compat.h" #ifndef ICNOPIXADDR /* @@ -55,9 +55,9 @@ */ void -IcTransparentSpan (pixman_bits_t *dst, - pixman_bits_t stip, - pixman_bits_t fgxor, +IcTransparentSpan (FbBits *dst, + FbBits stip, + FbBits fgxor, int n) { IcStip s; -- cgit v1.2.3 From e77d9776ae5217e9317209815b3195366a84f70f Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 23 Jun 2005 19:39:12 +0000 Subject: s/pixman_compositeOperand/FbCompositeOperand/g. --- pixman/ChangeLog | 59 ++++++ pixman/src/iccompose.c | 552 ++++++++++++++++++++++++------------------------- pixman/src/icimage.h | 20 +- 3 files changed, 345 insertions(+), 286 deletions(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index e437caed8..fccc42215 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,62 @@ +2005-06-23 Jeff Muizelaar + + * src/iccompose.c: (IcCombineMaskU), (IcCombineMaskC), + (IcCombineMaskValueC), (IcCombineMaskAlphaU), + (IcCombineMaskAlphaC), (IcCombineClear), (IcCombineSrcU), + (IcCombineSrcC), (IcCombineDst), (IcCombineOverU), + (IcCombineOverC), (IcCombineOverReverseU), (IcCombineOverReverseC), + (IcCombineInU), (IcCombineInC), (IcCombineInReverseU), + (IcCombineInReverseC), (IcCombineOutU), (IcCombineOutC), + (IcCombineOutReverseU), (IcCombineOutReverseC), (IcCombineAtopU), + (IcCombineAtopC), (IcCombineAtopReverseU), (IcCombineAtopReverseC), + (IcCombineXorU), (IcCombineXorC), (IcCombineAddU), (IcCombineAddC), + (IcCombineDisjointGeneralU), (IcCombineDisjointGeneralC), + (IcCombineDisjointOverU), (IcCombineDisjointOverC), + (IcCombineDisjointOverReverseU), (IcCombineDisjointOverReverseC), + (IcCombineDisjointInU), (IcCombineDisjointInC), + (IcCombineDisjointInReverseU), (IcCombineDisjointInReverseC), + (IcCombineDisjointOutU), (IcCombineDisjointOutC), + (IcCombineDisjointOutReverseU), (IcCombineDisjointOutReverseC), + (IcCombineDisjointAtopU), (IcCombineDisjointAtopC), + (IcCombineDisjointAtopReverseU), (IcCombineDisjointAtopReverseC), + (IcCombineDisjointXorU), (IcCombineDisjointXorC), + (IcCombineConjointGeneralU), (IcCombineConjointGeneralC), + (IcCombineConjointOverU), (IcCombineConjointOverC), + (IcCombineConjointOverReverseU), (IcCombineConjointOverReverseC), + (IcCombineConjointInU), (IcCombineConjointInC), + (IcCombineConjointInReverseU), (IcCombineConjointInReverseC), + (IcCombineConjointOutU), (IcCombineConjointOutC), + (IcCombineConjointOutReverseU), (IcCombineConjointOutReverseC), + (IcCombineConjointAtopU), (IcCombineConjointAtopC), + (IcCombineConjointAtopReverseU), (IcCombineConjointAtopReverseC), + (IcCombineConjointXorU), (IcCombineConjointXorC), + (IcFetch_a8r8g8b8), (IcFetch_x8r8g8b8), (IcFetch_a8b8g8r8), + (IcFetch_x8b8g8r8), (IcFetch_r8g8b8), (IcFetch_b8g8r8), + (IcFetch_r5g6b5), (IcFetch_b5g6r5), (IcFetch_a1r5g5b5), + (IcFetch_x1r5g5b5), (IcFetch_a1b5g5r5), (IcFetch_x1b5g5r5), + (IcFetch_a4r4g4b4), (IcFetch_x4r4g4b4), (IcFetch_a4b4g4r4), + (IcFetch_x4b4g4r4), (IcFetch_a8), (IcFetcha_a8), (IcFetch_r3g3b2), + (IcFetch_b2g3r3), (IcFetch_a2r2g2b2), (IcFetch_a4), (IcFetcha_a4), + (IcFetch_r1g2b1), (IcFetch_b1g2r1), (IcFetch_a1r1g1b1), + (IcFetch_a1b1g1r1), (IcFetcha_a1), (IcFetch_a1), + (IcStore_a8r8g8b8), (IcStore_x8r8g8b8), (IcStore_a8b8g8r8), + (IcStore_x8b8g8r8), (IcStore_r8g8b8), (IcStore_b8g8r8), + (IcStore_r5g6b5), (IcStore_b5g6r5), (IcStore_a1r5g5b5), + (IcStore_x1r5g5b5), (IcStore_a1b5g5r5), (IcStore_x1b5g5r5), + (IcStore_a4r4g4b4), (IcStore_x4r4g4b4), (IcStore_a4b4g4r4), + (IcStore_x4b4g4r4), (IcStore_a8), (IcStore_r3g3b2), + (IcStore_b2g3r3), (IcStore_a2r2g2b2), (IcStore_a4), + (IcStore_r1g2b1), (IcStore_b1g2r1), (IcStore_a1r1g1b1), + (IcStore_a1b1g1r1), (IcStore_a1), (IcFetch_external), + (IcFetcha_external), (IcStore_external), (IcFetch_transform), + (IcFetcha_transform), (IcStepOver), (IcStepDown), (IcSet), + (IcStepOver_external), (IcStepDown_external), (IcSet_external), + (IcStepOver_transform), (IcStepDown_transform), (IcSet_transform), + (IcBuildCompositeOperand), (pixman_compositeGeneral): + * src/icimage.h: + + s/pixman_compositeOperand/FbCompositeOperand/g. + 2005-06-23 Jeff Muizelaar * src/ic.c: (pixman_compositeSrcAdd_1000x1000), diff --git a/pixman/src/iccompose.c b/pixman/src/iccompose.c index 9de33b850..9cf79cc71 100644 --- a/pixman/src/iccompose.c +++ b/pixman/src/iccompose.c @@ -36,8 +36,8 @@ */ static uint32_t -IcCombineMaskU (pixman_compositeOperand *src, - pixman_compositeOperand *msk) +IcCombineMaskU (FbCompositeOperand *src, + FbCompositeOperand *msk) { uint32_t x; uint16_t a; @@ -63,8 +63,8 @@ IcCombineMaskU (pixman_compositeOperand *src, } static IcCompSrc -IcCombineMaskC (pixman_compositeOperand *src, - pixman_compositeOperand *msk) +IcCombineMaskC (FbCompositeOperand *src, + FbCompositeOperand *msk) { IcCompSrc s; uint32_t x; @@ -118,8 +118,8 @@ IcCombineMaskC (pixman_compositeOperand *src, } static uint32_t -IcCombineMaskValueC (pixman_compositeOperand *src, - pixman_compositeOperand *msk) +IcCombineMaskValueC (FbCompositeOperand *src, + FbCompositeOperand *msk) { uint32_t x; uint32_t a; @@ -150,8 +150,8 @@ IcCombineMaskValueC (pixman_compositeOperand *src, * Combine src and mask using IN, generating only the alpha component */ static uint32_t -IcCombineMaskAlphaU (pixman_compositeOperand *src, - pixman_compositeOperand *msk) +IcCombineMaskAlphaU (FbCompositeOperand *src, + FbCompositeOperand *msk) { uint32_t x; uint16_t a; @@ -172,8 +172,8 @@ IcCombineMaskAlphaU (pixman_compositeOperand *src, } static uint32_t -IcCombineMaskAlphaC (pixman_compositeOperand *src, - pixman_compositeOperand *msk) +IcCombineMaskAlphaC (FbCompositeOperand *src, + FbCompositeOperand *msk) { uint32_t x; uint32_t a; @@ -202,41 +202,41 @@ IcCombineMaskAlphaC (pixman_compositeOperand *src, * All of the composing functions */ static void -IcCombineClear (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineClear (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { (*dst->store) (dst, 0); } static void -IcCombineSrcU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineSrcU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { (*dst->store) (dst, IcCombineMaskU (src, msk)); } static void -IcCombineSrcC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineSrcC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { (*dst->store) (dst, IcCombineMaskValueC (src, msk)); } static void -IcCombineDst (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDst (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { /* noop */ } static void -IcCombineOverU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineOverU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t a; @@ -261,9 +261,9 @@ IcCombineOverU (pixman_compositeOperand *src, } static void -IcCombineOverC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineOverC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCompSrc cs; uint32_t s, d; @@ -290,9 +290,9 @@ IcCombineOverC (pixman_compositeOperand *src, } static void -IcCombineOverReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineOverReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t a; @@ -317,9 +317,9 @@ IcCombineOverReverseU (pixman_compositeOperand *src, } static void -IcCombineOverReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineOverReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint32_t a; @@ -344,9 +344,9 @@ IcCombineOverReverseC (pixman_compositeOperand *src, } static void -IcCombineInU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineInU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t a; @@ -372,9 +372,9 @@ IcCombineInU (pixman_compositeOperand *src, } static void -IcCombineInC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineInC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t a; @@ -400,9 +400,9 @@ IcCombineInC (pixman_compositeOperand *src, } static void -IcCombineInReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineInReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t a; @@ -428,9 +428,9 @@ IcCombineInReverseU (pixman_compositeOperand *src, } static void -IcCombineInReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineInReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint32_t a; @@ -456,9 +456,9 @@ IcCombineInReverseC (pixman_compositeOperand *src, } static void -IcCombineOutU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineOutU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t a; @@ -484,9 +484,9 @@ IcCombineOutU (pixman_compositeOperand *src, } static void -IcCombineOutC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineOutC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t a; @@ -512,9 +512,9 @@ IcCombineOutC (pixman_compositeOperand *src, } static void -IcCombineOutReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineOutReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t a; @@ -540,9 +540,9 @@ IcCombineOutReverseU (pixman_compositeOperand *src, } static void -IcCombineOutReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineOutReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint32_t a; @@ -568,9 +568,9 @@ IcCombineOutReverseC (pixman_compositeOperand *src, } static void -IcCombineAtopU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineAtopU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t ad, as; @@ -589,9 +589,9 @@ IcCombineAtopU (pixman_compositeOperand *src, } static void -IcCombineAtopC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineAtopC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCompSrc cs; uint32_t s, d; @@ -613,9 +613,9 @@ IcCombineAtopC (pixman_compositeOperand *src, } static void -IcCombineAtopReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineAtopReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t ad, as; @@ -634,9 +634,9 @@ IcCombineAtopReverseU (pixman_compositeOperand *src, } static void -IcCombineAtopReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineAtopReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCompSrc cs; uint32_t s, d, ad; @@ -657,9 +657,9 @@ IcCombineAtopReverseC (pixman_compositeOperand *src, } static void -IcCombineXorU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineXorU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t ad, as; @@ -678,9 +678,9 @@ IcCombineXorU (pixman_compositeOperand *src, } static void -IcCombineXorC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineXorC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCompSrc cs; uint32_t s, d, ad; @@ -701,9 +701,9 @@ IcCombineXorC (pixman_compositeOperand *src, } static void -IcCombineAddU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineAddU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t t; @@ -727,9 +727,9 @@ IcCombineAddU (pixman_compositeOperand *src, } static void -IcCombineAddC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineAddC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t t; @@ -818,9 +818,9 @@ IcCombineDisjointInPart (uint8_t a, uint8_t b) } static void -IcCombineDisjointGeneralU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst, +IcCombineDisjointGeneralU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst, uint8_t combine) { uint32_t s, d; @@ -872,9 +872,9 @@ IcCombineDisjointGeneralU (pixman_compositeOperand *src, } static void -IcCombineDisjointGeneralC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst, +IcCombineDisjointGeneralC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst, uint8_t combine) { IcCompSrc cs; @@ -938,9 +938,9 @@ IcCombineDisjointGeneralC (pixman_compositeOperand *src, } static void -IcCombineDisjointOverU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointOverU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { uint32_t s, d; uint16_t a; @@ -966,137 +966,137 @@ IcCombineDisjointOverU (pixman_compositeOperand *src, } static void -IcCombineDisjointOverC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointOverC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralC (src, msk, dst, CombineAOver); } static void -IcCombineDisjointOverReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointOverReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralU (src, msk, dst, CombineBOver); } static void -IcCombineDisjointOverReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointOverReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralC (src, msk, dst, CombineBOver); } static void -IcCombineDisjointInU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointInU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralU (src, msk, dst, CombineAIn); } static void -IcCombineDisjointInC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointInC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralC (src, msk, dst, CombineAIn); } static void -IcCombineDisjointInReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointInReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralU (src, msk, dst, CombineBIn); } static void -IcCombineDisjointInReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointInReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralC (src, msk, dst, CombineBIn); } static void -IcCombineDisjointOutU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointOutU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralU (src, msk, dst, CombineAOut); } static void -IcCombineDisjointOutC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointOutC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralC (src, msk, dst, CombineAOut); } static void -IcCombineDisjointOutReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointOutReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralU (src, msk, dst, CombineBOut); } static void -IcCombineDisjointOutReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointOutReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralC (src, msk, dst, CombineBOut); } static void -IcCombineDisjointAtopU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointAtopU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralU (src, msk, dst, CombineAAtop); } static void -IcCombineDisjointAtopC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointAtopC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralC (src, msk, dst, CombineAAtop); } static void -IcCombineDisjointAtopReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointAtopReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralU (src, msk, dst, CombineBAtop); } static void -IcCombineDisjointAtopReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointAtopReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralC (src, msk, dst, CombineBAtop); } static void -IcCombineDisjointXorU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointXorU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralU (src, msk, dst, CombineXor); } static void -IcCombineDisjointXorC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineDisjointXorC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineDisjointGeneralC (src, msk, dst, CombineXor); } @@ -1127,9 +1127,9 @@ IcCombineConjointInPart (uint8_t a, uint8_t b) } static void -IcCombineConjointGeneralU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst, +IcCombineConjointGeneralU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst, uint8_t combine) { uint32_t s, d; @@ -1181,9 +1181,9 @@ IcCombineConjointGeneralU (pixman_compositeOperand *src, } static void -IcCombineConjointGeneralC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst, +IcCombineConjointGeneralC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst, uint8_t combine) { IcCompSrc cs; @@ -1247,9 +1247,9 @@ IcCombineConjointGeneralC (pixman_compositeOperand *src, } static void -IcCombineConjointOverU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointOverU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralU (src, msk, dst, CombineAOver); /* @@ -1278,137 +1278,137 @@ IcCombineConjointOverU (pixman_compositeOperand *src, } static void -IcCombineConjointOverC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointOverC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralC (src, msk, dst, CombineAOver); } static void -IcCombineConjointOverReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointOverReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralU (src, msk, dst, CombineBOver); } static void -IcCombineConjointOverReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointOverReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralC (src, msk, dst, CombineBOver); } static void -IcCombineConjointInU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointInU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralU (src, msk, dst, CombineAIn); } static void -IcCombineConjointInC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointInC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralC (src, msk, dst, CombineAIn); } static void -IcCombineConjointInReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointInReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralU (src, msk, dst, CombineBIn); } static void -IcCombineConjointInReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointInReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralC (src, msk, dst, CombineBIn); } static void -IcCombineConjointOutU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointOutU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralU (src, msk, dst, CombineAOut); } static void -IcCombineConjointOutC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointOutC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralC (src, msk, dst, CombineAOut); } static void -IcCombineConjointOutReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointOutReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralU (src, msk, dst, CombineBOut); } static void -IcCombineConjointOutReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointOutReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralC (src, msk, dst, CombineBOut); } static void -IcCombineConjointAtopU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointAtopU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralU (src, msk, dst, CombineAAtop); } static void -IcCombineConjointAtopC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointAtopC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralC (src, msk, dst, CombineAAtop); } static void -IcCombineConjointAtopReverseU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointAtopReverseU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralU (src, msk, dst, CombineBAtop); } static void -IcCombineConjointAtopReverseC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointAtopReverseC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralC (src, msk, dst, CombineBAtop); } static void -IcCombineConjointXorU (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointXorU (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralU (src, msk, dst, CombineXor); } static void -IcCombineConjointXorC (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst) +IcCombineConjointXorC (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst) { IcCombineConjointGeneralC (src, msk, dst, CombineXor); } @@ -1512,21 +1512,21 @@ static IcCombineFunc const IcCombineFuncC[] = { */ static uint32_t -IcFetch_a8r8g8b8 (pixman_compositeOperand *op) +IcFetch_a8r8g8b8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; return ((uint32_t *)line)[offset >> 5]; } static uint32_t -IcFetch_x8r8g8b8 (pixman_compositeOperand *op) +IcFetch_x8r8g8b8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; return ((uint32_t *)line)[offset >> 5] | 0xff000000; } static uint32_t -IcFetch_a8b8g8r8 (pixman_compositeOperand *op) +IcFetch_a8b8g8r8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; @@ -1538,7 +1538,7 @@ IcFetch_a8b8g8r8 (pixman_compositeOperand *op) } static uint32_t -IcFetch_x8b8g8r8 (pixman_compositeOperand *op) +IcFetch_x8b8g8r8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; @@ -1550,7 +1550,7 @@ IcFetch_x8b8g8r8 (pixman_compositeOperand *op) } static uint32_t -IcFetch_r8g8b8 (pixman_compositeOperand *op) +IcFetch_r8g8b8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -1568,7 +1568,7 @@ IcFetch_r8g8b8 (pixman_compositeOperand *op) } static uint32_t -IcFetch_b8g8r8 (pixman_compositeOperand *op) +IcFetch_b8g8r8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -1586,7 +1586,7 @@ IcFetch_b8g8r8 (pixman_compositeOperand *op) } static uint32_t -IcFetch_r5g6b5 (pixman_compositeOperand *op) +IcFetch_r5g6b5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1599,7 +1599,7 @@ IcFetch_r5g6b5 (pixman_compositeOperand *op) } static uint32_t -IcFetch_b5g6r5 (pixman_compositeOperand *op) +IcFetch_b5g6r5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1612,7 +1612,7 @@ IcFetch_b5g6r5 (pixman_compositeOperand *op) } static uint32_t -IcFetch_a1r5g5b5 (pixman_compositeOperand *op) +IcFetch_a1r5g5b5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1626,7 +1626,7 @@ IcFetch_a1r5g5b5 (pixman_compositeOperand *op) } static uint32_t -IcFetch_x1r5g5b5 (pixman_compositeOperand *op) +IcFetch_x1r5g5b5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1639,7 +1639,7 @@ IcFetch_x1r5g5b5 (pixman_compositeOperand *op) } static uint32_t -IcFetch_a1b5g5r5 (pixman_compositeOperand *op) +IcFetch_a1b5g5r5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1653,7 +1653,7 @@ IcFetch_a1b5g5r5 (pixman_compositeOperand *op) } static uint32_t -IcFetch_x1b5g5r5 (pixman_compositeOperand *op) +IcFetch_x1b5g5r5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1666,7 +1666,7 @@ IcFetch_x1b5g5r5 (pixman_compositeOperand *op) } static uint32_t -IcFetch_a4r4g4b4 (pixman_compositeOperand *op) +IcFetch_a4r4g4b4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1680,7 +1680,7 @@ IcFetch_a4r4g4b4 (pixman_compositeOperand *op) } static uint32_t -IcFetch_x4r4g4b4 (pixman_compositeOperand *op) +IcFetch_x4r4g4b4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1693,7 +1693,7 @@ IcFetch_x4r4g4b4 (pixman_compositeOperand *op) } static uint32_t -IcFetch_a4b4g4r4 (pixman_compositeOperand *op) +IcFetch_a4b4g4r4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1707,7 +1707,7 @@ IcFetch_a4b4g4r4 (pixman_compositeOperand *op) } static uint32_t -IcFetch_x4b4g4r4 (pixman_compositeOperand *op) +IcFetch_x4b4g4r4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1720,7 +1720,7 @@ IcFetch_x4b4g4r4 (pixman_compositeOperand *op) } static uint32_t -IcFetch_a8 (pixman_compositeOperand *op) +IcFetch_a8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; @@ -1729,7 +1729,7 @@ IcFetch_a8 (pixman_compositeOperand *op) } static uint32_t -IcFetcha_a8 (pixman_compositeOperand *op) +IcFetcha_a8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; @@ -1740,7 +1740,7 @@ IcFetcha_a8 (pixman_compositeOperand *op) } static uint32_t -IcFetch_r3g3b2 (pixman_compositeOperand *op) +IcFetch_r3g3b2 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; @@ -1756,7 +1756,7 @@ IcFetch_r3g3b2 (pixman_compositeOperand *op) } static uint32_t -IcFetch_b2g3r3 (pixman_compositeOperand *op) +IcFetch_b2g3r3 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; @@ -1774,7 +1774,7 @@ IcFetch_b2g3r3 (pixman_compositeOperand *op) } static uint32_t -IcFetch_a2r2g2b2 (pixman_compositeOperand *op) +IcFetch_a2r2g2b2 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; @@ -1795,7 +1795,7 @@ IcFetch_a2r2g2b2 (pixman_compositeOperand *op) #endif static uint32_t -IcFetch_a4 (pixman_compositeOperand *op) +IcFetch_a4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1805,7 +1805,7 @@ IcFetch_a4 (pixman_compositeOperand *op) } static uint32_t -IcFetcha_a4 (pixman_compositeOperand *op) +IcFetcha_a4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1817,7 +1817,7 @@ IcFetcha_a4 (pixman_compositeOperand *op) } static uint32_t -IcFetch_r1g2b1 (pixman_compositeOperand *op) +IcFetch_r1g2b1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1830,7 +1830,7 @@ IcFetch_r1g2b1 (pixman_compositeOperand *op) } static uint32_t -IcFetch_b1g2r1 (pixman_compositeOperand *op) +IcFetch_b1g2r1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1843,7 +1843,7 @@ IcFetch_b1g2r1 (pixman_compositeOperand *op) } static uint32_t -IcFetch_a1r1g1b1 (pixman_compositeOperand *op) +IcFetch_a1r1g1b1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1857,7 +1857,7 @@ IcFetch_a1r1g1b1 (pixman_compositeOperand *op) } static uint32_t -IcFetch_a1b1g1r1 (pixman_compositeOperand *op) +IcFetch_a1b1g1r1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1871,7 +1871,7 @@ IcFetch_a1b1g1r1 (pixman_compositeOperand *op) } static uint32_t -IcFetcha_a1 (pixman_compositeOperand *op) +IcFetcha_a1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; @@ -1891,7 +1891,7 @@ IcFetcha_a1 (pixman_compositeOperand *op) } static uint32_t -IcFetch_a1 (pixman_compositeOperand *op) +IcFetch_a1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; @@ -1916,21 +1916,21 @@ IcFetch_a1 (pixman_compositeOperand *op) #define Split(v) uint32_t r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff static void -IcStore_a8r8g8b8 (pixman_compositeOperand *op, uint32_t value) +IcStore_a8r8g8b8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; ((uint32_t *)line)[offset >> 5] = value; } static void -IcStore_x8r8g8b8 (pixman_compositeOperand *op, uint32_t value) +IcStore_x8r8g8b8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; ((uint32_t *)line)[offset >> 5] = value & 0xffffff; } static void -IcStore_a8b8g8r8 (pixman_compositeOperand *op, uint32_t value) +IcStore_a8b8g8r8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; Splita(value); @@ -1938,7 +1938,7 @@ IcStore_a8b8g8r8 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_x8b8g8r8 (pixman_compositeOperand *op, uint32_t value) +IcStore_x8b8g8r8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; Split(value); @@ -1946,7 +1946,7 @@ IcStore_x8b8g8r8 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_r8g8b8 (pixman_compositeOperand *op, uint32_t value) +IcStore_r8g8b8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -1963,7 +1963,7 @@ IcStore_r8g8b8 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_b8g8r8 (pixman_compositeOperand *op, uint32_t value) +IcStore_b8g8r8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -1980,7 +1980,7 @@ IcStore_b8g8r8 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_r5g6b5 (pixman_compositeOperand *op, uint32_t value) +IcStore_r5g6b5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -1991,7 +1991,7 @@ IcStore_r5g6b5 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_b5g6r5 (pixman_compositeOperand *op, uint32_t value) +IcStore_b5g6r5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2002,7 +2002,7 @@ IcStore_b5g6r5 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_a1r5g5b5 (pixman_compositeOperand *op, uint32_t value) +IcStore_a1r5g5b5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2014,7 +2014,7 @@ IcStore_a1r5g5b5 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_x1r5g5b5 (pixman_compositeOperand *op, uint32_t value) +IcStore_x1r5g5b5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2025,7 +2025,7 @@ IcStore_x1r5g5b5 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_a1b5g5r5 (pixman_compositeOperand *op, uint32_t value) +IcStore_a1b5g5r5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2037,7 +2037,7 @@ IcStore_a1b5g5r5 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_x1b5g5r5 (pixman_compositeOperand *op, uint32_t value) +IcStore_x1b5g5r5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2048,7 +2048,7 @@ IcStore_x1b5g5r5 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_a4r4g4b4 (pixman_compositeOperand *op, uint32_t value) +IcStore_a4r4g4b4 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2060,7 +2060,7 @@ IcStore_a4r4g4b4 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_x4r4g4b4 (pixman_compositeOperand *op, uint32_t value) +IcStore_x4r4g4b4 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2071,7 +2071,7 @@ IcStore_x4r4g4b4 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_a4b4g4r4 (pixman_compositeOperand *op, uint32_t value) +IcStore_a4b4g4r4 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2083,7 +2083,7 @@ IcStore_a4b4g4r4 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_x4b4g4r4 (pixman_compositeOperand *op, uint32_t value) +IcStore_x4b4g4r4 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2094,7 +2094,7 @@ IcStore_x4b4g4r4 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_a8 (pixman_compositeOperand *op, uint32_t value) +IcStore_a8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -2102,7 +2102,7 @@ IcStore_a8 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_r3g3b2 (pixman_compositeOperand *op, uint32_t value) +IcStore_r3g3b2 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -2113,7 +2113,7 @@ IcStore_r3g3b2 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_b2g3r3 (pixman_compositeOperand *op, uint32_t value) +IcStore_b2g3r3 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -2124,7 +2124,7 @@ IcStore_b2g3r3 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_a2r2g2b2 (pixman_compositeOperand *op, uint32_t value) +IcStore_a2r2g2b2 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -2147,14 +2147,14 @@ IcStore_a2r2g2b2 (pixman_compositeOperand *op, uint32_t value) #endif static void -IcStore_a4 (pixman_compositeOperand *op, uint32_t value) +IcStore_a4 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; Store4(line,offset,value>>28); } static void -IcStore_r1g2b1 (pixman_compositeOperand *op, uint32_t value) +IcStore_r1g2b1 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; @@ -2167,7 +2167,7 @@ IcStore_r1g2b1 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_b1g2r1 (pixman_compositeOperand *op, uint32_t value) +IcStore_b1g2r1 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; @@ -2180,7 +2180,7 @@ IcStore_b1g2r1 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_a1r1g1b1 (pixman_compositeOperand *op, uint32_t value) +IcStore_a1r1g1b1 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; @@ -2193,7 +2193,7 @@ IcStore_a1r1g1b1 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_a1b1g1r1 (pixman_compositeOperand *op, uint32_t value) +IcStore_a1b1g1r1 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; @@ -2206,7 +2206,7 @@ IcStore_a1b1g1r1 (pixman_compositeOperand *op, uint32_t value) } static void -IcStore_a1 (pixman_compositeOperand *op, uint32_t value) +IcStore_a1 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t *pixel = ((uint32_t *) line) + (offset >> 5); @@ -2217,7 +2217,7 @@ IcStore_a1 (pixman_compositeOperand *op, uint32_t value) } static uint32_t -IcFetch_external (pixman_compositeOperand *op) +IcFetch_external (FbCompositeOperand *op) { uint32_t rgb = (*op[1].fetch) (&op[1]); uint32_t a = (*op[2].fetch) (&op[2]); @@ -2227,20 +2227,20 @@ IcFetch_external (pixman_compositeOperand *op) static uint32_t -IcFetcha_external (pixman_compositeOperand *op) +IcFetcha_external (FbCompositeOperand *op) { return (*op[2].fetch) (&op[2]); } static void -IcStore_external (pixman_compositeOperand *op, uint32_t value) +IcStore_external (FbCompositeOperand *op, uint32_t value) { (*op[1].store) (&op[1], value | 0xff000000); (*op[2].store) (&op[2], value & 0xff000000); } static uint32_t -IcFetch_transform (pixman_compositeOperand *op) +IcFetch_transform (FbCompositeOperand *op) { pixman_vector_t v; int x, y; @@ -2339,7 +2339,7 @@ IcFetch_transform (pixman_compositeOperand *op) } static uint32_t -IcFetcha_transform (pixman_compositeOperand *op) +IcFetcha_transform (FbCompositeOperand *op) { pixman_vector_t v; int x, y; @@ -2483,41 +2483,41 @@ static IcAccessMap const icAccessMap[] = { #define NumAccessMap (sizeof icAccessMap / sizeof icAccessMap[0]) static void -IcStepOver (pixman_compositeOperand *op) +IcStepOver (FbCompositeOperand *op) { op->u.drawable.offset += op->u.drawable.bpp; } static void -IcStepDown (pixman_compositeOperand *op) +IcStepDown (FbCompositeOperand *op) { op->u.drawable.line += op->u.drawable.stride; op->u.drawable.offset = op->u.drawable.start_offset; } static void -IcSet (pixman_compositeOperand *op, int x, int y) +IcSet (FbCompositeOperand *op, int x, int y) { op->u.drawable.line = op->u.drawable.top_line + y * op->u.drawable.stride; op->u.drawable.offset = op->u.drawable.left_offset + x * op->u.drawable.bpp; } static void -IcStepOver_external (pixman_compositeOperand *op) +IcStepOver_external (FbCompositeOperand *op) { (*op[1].over) (&op[1]); (*op[2].over) (&op[2]); } static void -IcStepDown_external (pixman_compositeOperand *op) +IcStepDown_external (FbCompositeOperand *op) { (*op[1].down) (&op[1]); (*op[2].down) (&op[2]); } static void -IcSet_external (pixman_compositeOperand *op, int x, int y) +IcSet_external (FbCompositeOperand *op, int x, int y) { (*op[1].set) (&op[1], x, y); (*op[2].set) (&op[2], @@ -2526,20 +2526,20 @@ IcSet_external (pixman_compositeOperand *op, int x, int y) } static void -IcStepOver_transform (pixman_compositeOperand *op) +IcStepOver_transform (FbCompositeOperand *op) { op->u.transform.x++; } static void -IcStepDown_transform (pixman_compositeOperand *op) +IcStepDown_transform (FbCompositeOperand *op) { op->u.transform.y++; op->u.transform.x = op->u.transform.start_x; } static void -IcSet_transform (pixman_compositeOperand *op, int x, int y) +IcSet_transform (FbCompositeOperand *op, int x, int y) { op->u.transform.x = x - op->u.transform.left_x; op->u.transform.y = y - op->u.transform.top_y; @@ -2548,7 +2548,7 @@ IcSet_transform (pixman_compositeOperand *op, int x, int y) int IcBuildCompositeOperand (pixman_image_t *image, - pixman_compositeOperand op[4], + FbCompositeOperand op[4], int16_t x, int16_t y, int transform, @@ -2678,10 +2678,10 @@ pixman_compositeGeneral (pixman_operator_t op, uint16_t width, uint16_t height) { - pixman_compositeOperand src[4],msk[4],dst[4],*pmsk; - pixman_compositeOperand *srcPict, *srcAlpha; - pixman_compositeOperand *dstPict, *dstAlpha; - pixman_compositeOperand *mskPict = 0, *mskAlpha = 0; + FbCompositeOperand src[4],msk[4],dst[4],*pmsk; + FbCompositeOperand *srcPict, *srcAlpha; + FbCompositeOperand *dstPict, *dstAlpha; + FbCompositeOperand *mskPict = 0, *mskAlpha = 0; IcCombineFunc f; int w; diff --git a/pixman/src/icimage.h b/pixman/src/icimage.h index afbff2ca0..b9ff070d7 100644 --- a/pixman/src/icimage.h +++ b/pixman/src/icimage.h @@ -245,15 +245,15 @@ typedef void (*CompositeFunc) (pixman_operator_t op, uint16_t width, uint16_t height); -typedef struct _pixman_compositeOperand pixman_compositeOperand; +typedef struct _FbCompositeOperand FbCompositeOperand; -typedef uint32_t (*pixman_compositeFetch)(pixman_compositeOperand *op); -typedef void (*pixman_compositeStore) (pixman_compositeOperand *op, uint32_t value); +typedef uint32_t (*pixman_compositeFetch)(FbCompositeOperand *op); +typedef void (*pixman_compositeStore) (FbCompositeOperand *op, uint32_t value); -typedef void (*pixman_compositeStep) (pixman_compositeOperand *op); -typedef void (*pixman_compositeSet) (pixman_compositeOperand *op, int x, int y); +typedef void (*pixman_compositeStep) (FbCompositeOperand *op); +typedef void (*pixman_compositeSet) (FbCompositeOperand *op, int x, int y); -struct _pixman_compositeOperand { +struct _FbCompositeOperand { union { struct { pixman_bits_t *top_line; @@ -295,9 +295,9 @@ struct _pixman_compositeOperand { pixman_region16_t *src_clip; }; -typedef void (*IcCombineFunc) (pixman_compositeOperand *src, - pixman_compositeOperand *msk, - pixman_compositeOperand *dst); +typedef void (*IcCombineFunc) (FbCompositeOperand *src, + FbCompositeOperand *msk, + FbCompositeOperand *dst); typedef struct _IcAccessMap { uint32_t format_code; @@ -315,7 +315,7 @@ typedef struct _IcCompSrc { pixman_private int IcBuildCompositeOperand (pixman_image_t *image, - pixman_compositeOperand op[4], + FbCompositeOperand op[4], int16_t x, int16_t y, int transform, -- cgit v1.2.3 From 81fa936fd2153e62411a5fbd3e8e5a43bc493d74 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Thu, 23 Jun 2005 19:41:07 +0000 Subject: s/IcCombine/fbCombine/ --- pixman/ChangeLog | 31 ++++++ pixman/src/iccompose.c | 272 ++++++++++++++++++++++++------------------------- 2 files changed, 167 insertions(+), 136 deletions(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index fccc42215..afd2bddfb 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,34 @@ +2005-06-23 Jeff Muizelaar + + * src/iccompose.c: (fbCombineClear), (fbCombineSrcU), + (fbCombineSrcC), (fbCombineDst), (fbCombineOverU), + (fbCombineOverC), (fbCombineOverReverseU), (fbCombineOverReverseC), + (fbCombineInU), (fbCombineInC), (fbCombineInReverseU), + (fbCombineInReverseC), (fbCombineOutU), (fbCombineOutC), + (fbCombineOutReverseU), (fbCombineOutReverseC), (fbCombineAtopU), + (fbCombineAtopC), (fbCombineAtopReverseU), (fbCombineAtopReverseC), + (fbCombineXorU), (fbCombineXorC), (fbCombineAddU), (fbCombineAddC), + (fbCombineDisjointOverU), (fbCombineDisjointOverC), + (fbCombineDisjointOverReverseU), (fbCombineDisjointOverReverseC), + (fbCombineDisjointInU), (fbCombineDisjointInC), + (fbCombineDisjointInReverseU), (fbCombineDisjointInReverseC), + (fbCombineDisjointOutU), (fbCombineDisjointOutC), + (fbCombineDisjointOutReverseU), (fbCombineDisjointOutReverseC), + (fbCombineDisjointAtopU), (fbCombineDisjointAtopC), + (fbCombineDisjointAtopReverseU), (fbCombineDisjointAtopReverseC), + (fbCombineDisjointXorU), (fbCombineDisjointXorC), + (fbCombineConjointOverU), (fbCombineConjointOverC), + (fbCombineConjointOverReverseU), (fbCombineConjointOverReverseC), + (fbCombineConjointInU), (fbCombineConjointInC), + (fbCombineConjointInReverseU), (fbCombineConjointInReverseC), + (fbCombineConjointOutU), (fbCombineConjointOutC), + (fbCombineConjointOutReverseU), (fbCombineConjointOutReverseC), + (fbCombineConjointAtopU), (fbCombineConjointAtopC), + (fbCombineConjointAtopReverseU), (fbCombineConjointAtopReverseC), + (fbCombineConjointXorU), (fbCombineConjointXorC): + + s/IcCombine/fbCombine/ + 2005-06-23 Jeff Muizelaar * src/iccompose.c: (IcCombineMaskU), (IcCombineMaskC), diff --git a/pixman/src/iccompose.c b/pixman/src/iccompose.c index 9cf79cc71..d6d64650b 100644 --- a/pixman/src/iccompose.c +++ b/pixman/src/iccompose.c @@ -202,7 +202,7 @@ IcCombineMaskAlphaC (FbCompositeOperand *src, * All of the composing functions */ static void -IcCombineClear (FbCompositeOperand *src, +fbCombineClear (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -210,7 +210,7 @@ IcCombineClear (FbCompositeOperand *src, } static void -IcCombineSrcU (FbCompositeOperand *src, +fbCombineSrcU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -218,7 +218,7 @@ IcCombineSrcU (FbCompositeOperand *src, } static void -IcCombineSrcC (FbCompositeOperand *src, +fbCombineSrcC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -226,7 +226,7 @@ IcCombineSrcC (FbCompositeOperand *src, } static void -IcCombineDst (FbCompositeOperand *src, +fbCombineDst (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -234,7 +234,7 @@ IcCombineDst (FbCompositeOperand *src, } static void -IcCombineOverU (FbCompositeOperand *src, +fbCombineOverU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -261,7 +261,7 @@ IcCombineOverU (FbCompositeOperand *src, } static void -IcCombineOverC (FbCompositeOperand *src, +fbCombineOverC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -290,7 +290,7 @@ IcCombineOverC (FbCompositeOperand *src, } static void -IcCombineOverReverseU (FbCompositeOperand *src, +fbCombineOverReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -317,7 +317,7 @@ IcCombineOverReverseU (FbCompositeOperand *src, } static void -IcCombineOverReverseC (FbCompositeOperand *src, +fbCombineOverReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -344,7 +344,7 @@ IcCombineOverReverseC (FbCompositeOperand *src, } static void -IcCombineInU (FbCompositeOperand *src, +fbCombineInU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -372,7 +372,7 @@ IcCombineInU (FbCompositeOperand *src, } static void -IcCombineInC (FbCompositeOperand *src, +fbCombineInC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -400,7 +400,7 @@ IcCombineInC (FbCompositeOperand *src, } static void -IcCombineInReverseU (FbCompositeOperand *src, +fbCombineInReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -428,7 +428,7 @@ IcCombineInReverseU (FbCompositeOperand *src, } static void -IcCombineInReverseC (FbCompositeOperand *src, +fbCombineInReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -456,7 +456,7 @@ IcCombineInReverseC (FbCompositeOperand *src, } static void -IcCombineOutU (FbCompositeOperand *src, +fbCombineOutU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -484,7 +484,7 @@ IcCombineOutU (FbCompositeOperand *src, } static void -IcCombineOutC (FbCompositeOperand *src, +fbCombineOutC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -512,7 +512,7 @@ IcCombineOutC (FbCompositeOperand *src, } static void -IcCombineOutReverseU (FbCompositeOperand *src, +fbCombineOutReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -540,7 +540,7 @@ IcCombineOutReverseU (FbCompositeOperand *src, } static void -IcCombineOutReverseC (FbCompositeOperand *src, +fbCombineOutReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -568,7 +568,7 @@ IcCombineOutReverseC (FbCompositeOperand *src, } static void -IcCombineAtopU (FbCompositeOperand *src, +fbCombineAtopU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -589,7 +589,7 @@ IcCombineAtopU (FbCompositeOperand *src, } static void -IcCombineAtopC (FbCompositeOperand *src, +fbCombineAtopC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -613,7 +613,7 @@ IcCombineAtopC (FbCompositeOperand *src, } static void -IcCombineAtopReverseU (FbCompositeOperand *src, +fbCombineAtopReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -634,7 +634,7 @@ IcCombineAtopReverseU (FbCompositeOperand *src, } static void -IcCombineAtopReverseC (FbCompositeOperand *src, +fbCombineAtopReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -657,7 +657,7 @@ IcCombineAtopReverseC (FbCompositeOperand *src, } static void -IcCombineXorU (FbCompositeOperand *src, +fbCombineXorU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -678,7 +678,7 @@ IcCombineXorU (FbCompositeOperand *src, } static void -IcCombineXorC (FbCompositeOperand *src, +fbCombineXorC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -701,7 +701,7 @@ IcCombineXorC (FbCompositeOperand *src, } static void -IcCombineAddU (FbCompositeOperand *src, +fbCombineAddU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -727,7 +727,7 @@ IcCombineAddU (FbCompositeOperand *src, } static void -IcCombineAddC (FbCompositeOperand *src, +fbCombineAddC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -938,7 +938,7 @@ IcCombineDisjointGeneralC (FbCompositeOperand *src, } static void -IcCombineDisjointOverU (FbCompositeOperand *src, +fbCombineDisjointOverU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -966,7 +966,7 @@ IcCombineDisjointOverU (FbCompositeOperand *src, } static void -IcCombineDisjointOverC (FbCompositeOperand *src, +fbCombineDisjointOverC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -974,7 +974,7 @@ IcCombineDisjointOverC (FbCompositeOperand *src, } static void -IcCombineDisjointOverReverseU (FbCompositeOperand *src, +fbCombineDisjointOverReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -982,7 +982,7 @@ IcCombineDisjointOverReverseU (FbCompositeOperand *src, } static void -IcCombineDisjointOverReverseC (FbCompositeOperand *src, +fbCombineDisjointOverReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -990,7 +990,7 @@ IcCombineDisjointOverReverseC (FbCompositeOperand *src, } static void -IcCombineDisjointInU (FbCompositeOperand *src, +fbCombineDisjointInU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -998,7 +998,7 @@ IcCombineDisjointInU (FbCompositeOperand *src, } static void -IcCombineDisjointInC (FbCompositeOperand *src, +fbCombineDisjointInC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1006,7 +1006,7 @@ IcCombineDisjointInC (FbCompositeOperand *src, } static void -IcCombineDisjointInReverseU (FbCompositeOperand *src, +fbCombineDisjointInReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1014,7 +1014,7 @@ IcCombineDisjointInReverseU (FbCompositeOperand *src, } static void -IcCombineDisjointInReverseC (FbCompositeOperand *src, +fbCombineDisjointInReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1022,7 +1022,7 @@ IcCombineDisjointInReverseC (FbCompositeOperand *src, } static void -IcCombineDisjointOutU (FbCompositeOperand *src, +fbCombineDisjointOutU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1030,7 +1030,7 @@ IcCombineDisjointOutU (FbCompositeOperand *src, } static void -IcCombineDisjointOutC (FbCompositeOperand *src, +fbCombineDisjointOutC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1038,7 +1038,7 @@ IcCombineDisjointOutC (FbCompositeOperand *src, } static void -IcCombineDisjointOutReverseU (FbCompositeOperand *src, +fbCombineDisjointOutReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1046,7 +1046,7 @@ IcCombineDisjointOutReverseU (FbCompositeOperand *src, } static void -IcCombineDisjointOutReverseC (FbCompositeOperand *src, +fbCombineDisjointOutReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1054,7 +1054,7 @@ IcCombineDisjointOutReverseC (FbCompositeOperand *src, } static void -IcCombineDisjointAtopU (FbCompositeOperand *src, +fbCombineDisjointAtopU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1062,7 +1062,7 @@ IcCombineDisjointAtopU (FbCompositeOperand *src, } static void -IcCombineDisjointAtopC (FbCompositeOperand *src, +fbCombineDisjointAtopC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1070,7 +1070,7 @@ IcCombineDisjointAtopC (FbCompositeOperand *src, } static void -IcCombineDisjointAtopReverseU (FbCompositeOperand *src, +fbCombineDisjointAtopReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1078,7 +1078,7 @@ IcCombineDisjointAtopReverseU (FbCompositeOperand *src, } static void -IcCombineDisjointAtopReverseC (FbCompositeOperand *src, +fbCombineDisjointAtopReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1086,7 +1086,7 @@ IcCombineDisjointAtopReverseC (FbCompositeOperand *src, } static void -IcCombineDisjointXorU (FbCompositeOperand *src, +fbCombineDisjointXorU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1094,7 +1094,7 @@ IcCombineDisjointXorU (FbCompositeOperand *src, } static void -IcCombineDisjointXorC (FbCompositeOperand *src, +fbCombineDisjointXorC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1247,7 +1247,7 @@ IcCombineConjointGeneralC (FbCompositeOperand *src, } static void -IcCombineConjointOverU (FbCompositeOperand *src, +fbCombineConjointOverU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1278,7 +1278,7 @@ IcCombineConjointOverU (FbCompositeOperand *src, } static void -IcCombineConjointOverC (FbCompositeOperand *src, +fbCombineConjointOverC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1286,7 +1286,7 @@ IcCombineConjointOverC (FbCompositeOperand *src, } static void -IcCombineConjointOverReverseU (FbCompositeOperand *src, +fbCombineConjointOverReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1294,7 +1294,7 @@ IcCombineConjointOverReverseU (FbCompositeOperand *src, } static void -IcCombineConjointOverReverseC (FbCompositeOperand *src, +fbCombineConjointOverReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1302,7 +1302,7 @@ IcCombineConjointOverReverseC (FbCompositeOperand *src, } static void -IcCombineConjointInU (FbCompositeOperand *src, +fbCombineConjointInU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1310,7 +1310,7 @@ IcCombineConjointInU (FbCompositeOperand *src, } static void -IcCombineConjointInC (FbCompositeOperand *src, +fbCombineConjointInC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1318,7 +1318,7 @@ IcCombineConjointInC (FbCompositeOperand *src, } static void -IcCombineConjointInReverseU (FbCompositeOperand *src, +fbCombineConjointInReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1326,7 +1326,7 @@ IcCombineConjointInReverseU (FbCompositeOperand *src, } static void -IcCombineConjointInReverseC (FbCompositeOperand *src, +fbCombineConjointInReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1334,7 +1334,7 @@ IcCombineConjointInReverseC (FbCompositeOperand *src, } static void -IcCombineConjointOutU (FbCompositeOperand *src, +fbCombineConjointOutU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1342,7 +1342,7 @@ IcCombineConjointOutU (FbCompositeOperand *src, } static void -IcCombineConjointOutC (FbCompositeOperand *src, +fbCombineConjointOutC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1350,7 +1350,7 @@ IcCombineConjointOutC (FbCompositeOperand *src, } static void -IcCombineConjointOutReverseU (FbCompositeOperand *src, +fbCombineConjointOutReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1358,7 +1358,7 @@ IcCombineConjointOutReverseU (FbCompositeOperand *src, } static void -IcCombineConjointOutReverseC (FbCompositeOperand *src, +fbCombineConjointOutReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1366,7 +1366,7 @@ IcCombineConjointOutReverseC (FbCompositeOperand *src, } static void -IcCombineConjointAtopU (FbCompositeOperand *src, +fbCombineConjointAtopU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1374,7 +1374,7 @@ IcCombineConjointAtopU (FbCompositeOperand *src, } static void -IcCombineConjointAtopC (FbCompositeOperand *src, +fbCombineConjointAtopC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1382,7 +1382,7 @@ IcCombineConjointAtopC (FbCompositeOperand *src, } static void -IcCombineConjointAtopReverseU (FbCompositeOperand *src, +fbCombineConjointAtopReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1390,7 +1390,7 @@ IcCombineConjointAtopReverseU (FbCompositeOperand *src, } static void -IcCombineConjointAtopReverseC (FbCompositeOperand *src, +fbCombineConjointAtopReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1398,7 +1398,7 @@ IcCombineConjointAtopReverseC (FbCompositeOperand *src, } static void -IcCombineConjointXorU (FbCompositeOperand *src, +fbCombineConjointXorU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1406,7 +1406,7 @@ IcCombineConjointXorU (FbCompositeOperand *src, } static void -IcCombineConjointXorC (FbCompositeOperand *src, +fbCombineConjointXorC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { @@ -1414,97 +1414,97 @@ IcCombineConjointXorC (FbCompositeOperand *src, } static IcCombineFunc const IcCombineFuncU[] = { - IcCombineClear, - IcCombineSrcU, - IcCombineDst, - IcCombineOverU, - IcCombineOverReverseU, - IcCombineInU, - IcCombineInReverseU, - IcCombineOutU, - IcCombineOutReverseU, - IcCombineAtopU, - IcCombineAtopReverseU, - IcCombineXorU, - IcCombineAddU, - IcCombineDisjointOverU, /* Saturate */ + fbCombineClear, + fbCombineSrcU, + fbCombineDst, + fbCombineOverU, + fbCombineOverReverseU, + fbCombineInU, + fbCombineInReverseU, + fbCombineOutU, + fbCombineOutReverseU, + fbCombineAtopU, + fbCombineAtopReverseU, + fbCombineXorU, + fbCombineAddU, + fbCombineDisjointOverU, /* Saturate */ 0, 0, - IcCombineClear, - IcCombineSrcU, - IcCombineDst, - IcCombineDisjointOverU, - IcCombineDisjointOverReverseU, - IcCombineDisjointInU, - IcCombineDisjointInReverseU, - IcCombineDisjointOutU, - IcCombineDisjointOutReverseU, - IcCombineDisjointAtopU, - IcCombineDisjointAtopReverseU, - IcCombineDisjointXorU, + fbCombineClear, + fbCombineSrcU, + fbCombineDst, + fbCombineDisjointOverU, + fbCombineDisjointOverReverseU, + fbCombineDisjointInU, + fbCombineDisjointInReverseU, + fbCombineDisjointOutU, + fbCombineDisjointOutReverseU, + fbCombineDisjointAtopU, + fbCombineDisjointAtopReverseU, + fbCombineDisjointXorU, 0, 0, 0, 0, - IcCombineClear, - IcCombineSrcU, - IcCombineDst, - IcCombineConjointOverU, - IcCombineConjointOverReverseU, - IcCombineConjointInU, - IcCombineConjointInReverseU, - IcCombineConjointOutU, - IcCombineConjointOutReverseU, - IcCombineConjointAtopU, - IcCombineConjointAtopReverseU, - IcCombineConjointXorU, + fbCombineClear, + fbCombineSrcU, + fbCombineDst, + fbCombineConjointOverU, + fbCombineConjointOverReverseU, + fbCombineConjointInU, + fbCombineConjointInReverseU, + fbCombineConjointOutU, + fbCombineConjointOutReverseU, + fbCombineConjointAtopU, + fbCombineConjointAtopReverseU, + fbCombineConjointXorU, }; static IcCombineFunc const IcCombineFuncC[] = { - IcCombineClear, - IcCombineSrcC, - IcCombineDst, - IcCombineOverC, - IcCombineOverReverseC, - IcCombineInC, - IcCombineInReverseC, - IcCombineOutC, - IcCombineOutReverseC, - IcCombineAtopC, - IcCombineAtopReverseC, - IcCombineXorC, - IcCombineAddC, - IcCombineDisjointOverC, /* Saturate */ + fbCombineClear, + fbCombineSrcC, + fbCombineDst, + fbCombineOverC, + fbCombineOverReverseC, + fbCombineInC, + fbCombineInReverseC, + fbCombineOutC, + fbCombineOutReverseC, + fbCombineAtopC, + fbCombineAtopReverseC, + fbCombineXorC, + fbCombineAddC, + fbCombineDisjointOverC, /* Saturate */ 0, 0, - IcCombineClear, /* 0x10 */ - IcCombineSrcC, - IcCombineDst, - IcCombineDisjointOverC, - IcCombineDisjointOverReverseC, - IcCombineDisjointInC, - IcCombineDisjointInReverseC, - IcCombineDisjointOutC, - IcCombineDisjointOutReverseC, - IcCombineDisjointAtopC, - IcCombineDisjointAtopReverseC, - IcCombineDisjointXorC, /* 0x1b */ + fbCombineClear, /* 0x10 */ + fbCombineSrcC, + fbCombineDst, + fbCombineDisjointOverC, + fbCombineDisjointOverReverseC, + fbCombineDisjointInC, + fbCombineDisjointInReverseC, + fbCombineDisjointOutC, + fbCombineDisjointOutReverseC, + fbCombineDisjointAtopC, + fbCombineDisjointAtopReverseC, + fbCombineDisjointXorC, /* 0x1b */ 0, 0, 0, 0, - IcCombineClear, - IcCombineSrcC, - IcCombineDst, - IcCombineConjointOverC, - IcCombineConjointOverReverseC, - IcCombineConjointInC, - IcCombineConjointInReverseC, - IcCombineConjointOutC, - IcCombineConjointOutReverseC, - IcCombineConjointAtopC, - IcCombineConjointAtopReverseC, - IcCombineConjointXorC, + fbCombineClear, + fbCombineSrcC, + fbCombineDst, + fbCombineConjointOverC, + fbCombineConjointOverReverseC, + fbCombineConjointInC, + fbCombineConjointInReverseC, + fbCombineConjointOutC, + fbCombineConjointOutReverseC, + fbCombineConjointAtopC, + fbCombineConjointAtopReverseC, + fbCombineConjointXorC, }; /* -- cgit v1.2.3 From 87008a44d3043e48376cb3bee3702226ec5bcac7 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 24 Jun 2005 15:06:40 +0000 Subject: Handle rendering bitmap glyphslots as well as outline glyphslots. When setting the scale for a non-scalable font, use the nearest available size (FreeType won't set the glyph metrics otherwise.) --- ChangeLog | 9 ++ src/cairo-ft-font.c | 269 ++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 218 insertions(+), 60 deletions(-) diff --git a/ChangeLog b/ChangeLog index 32d3905fe..37e846da7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-06-24 Owen Taylor + + * src/cairo-ft-font.c (_render_glyph_bitmap): Handle rendering + bitmap glyphslots as well as outline glyphslots. + + * src/cairo-ft-font.c (_ft_unscaled_font_set_scale): When setting + the scale for a non-scalable font, use the nearest available + size (FreeType won't set the glyph metrics otherwise.) + 2005-06-23 Carl Worth * ROADMAP: Add ARGB text to 1.0 roadmap. diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 63f51a51c..de9178614 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -34,6 +34,8 @@ * Owen Taylor */ +#include + #include "cairo-ft-private.h" #include @@ -448,6 +450,7 @@ _ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled, { ft_font_transform_t sf; FT_Matrix mat; + FT_UInt pixel_width, pixel_height; assert (unscaled->face != NULL); @@ -472,10 +475,29 @@ _ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled, mat.yy = DOUBLE_TO_16_16(sf.shape[1][1]); FT_Set_Transform(unscaled->face, &mat, NULL); - - FT_Set_Pixel_Sizes(unscaled->face, - (FT_UInt) sf.x_scale, - (FT_UInt) sf.y_scale); + + if ((unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) != 0) { + pixel_width = sf.x_scale; + pixel_height = sf.y_scale; + } else { + double min_distance = DBL_MAX; + int i; + + pixel_width = pixel_height = 0; + + for (i = 0; i < unscaled->face->num_fixed_sizes; i++) { + double size = unscaled->face->available_sizes[i].y_ppem / 64.; + double distance = fabs (size - sf.y_scale); + + if (distance <= min_distance) { + min_distance = distance; + pixel_width = unscaled->face->available_sizes[i].x_ppem >> 6; + pixel_height = unscaled->face->available_sizes[i].y_ppem >> 6; + } + } + } + + FT_Set_Pixel_Sizes (unscaled->face, pixel_width, pixel_height); } static void @@ -515,59 +537,32 @@ _cairo_ft_unscaled_font_destroy (void *abstract_font) } } -static cairo_status_t -_cairo_ft_unscaled_font_create_glyph (void *abstract_font, - cairo_image_glyph_cache_entry_t *val) +/* Converts an outline FT_GlyphSlot into an image + * + * This could go through _render_glyph_bitmap as well, letting + * FreeType convert the outline to a bitmap, but doing it ourselves + * has two minor advantages: first, we save a copy of the bitmap + * buffer: we can directly use the buffer that FreeType renders + * into. + * + * Second, it may help when we add support for subpixel + * rendering: the Xft code does it this way. (Keith thinks that + * it may also be possible to get the subpixel rendering with + * FT_Render_Glyph: something worth looking into in more detail + * when we add subpixel support. If so, we may want to eliminate + * this version of the code path entirely. + */ +static cairo_status_t +_render_glyph_outline (FT_Face face, + cairo_image_glyph_cache_entry_t *val) { - ft_unscaled_font_t *unscaled = abstract_font; - FT_GlyphSlot glyphslot; + FT_GlyphSlot glyphslot = face->glyph; + FT_Outline *outline = &glyphslot->outline; unsigned int width, height, stride; - FT_Face face; - FT_Outline *outline; - FT_BBox cbox; FT_Bitmap bitmap; - FT_Glyph_Metrics *metrics; + FT_BBox cbox; cairo_status_t status = CAIRO_STATUS_SUCCESS; - face = _ft_unscaled_font_lock_face (unscaled); - if (!face) - return CAIRO_STATUS_NO_MEMORY; - - glyphslot = face->glyph; - metrics = &glyphslot->metrics; - - _ft_unscaled_font_set_scale (unscaled, &val->key.scale); - - if (FT_Load_Glyph (face, val->key.index, val->key.flags) != 0) { - status = CAIRO_STATUS_NO_MEMORY; - goto FAIL; - } - - /* - * Note: the font's coordinate system is upside down from ours, so the - * Y coordinates of the bearing and advance need to be negated. - * - * Scale metrics back to glyph space from the scaled glyph space returned - * by FreeType - */ - - val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) / unscaled->x_scale; - val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY) / unscaled->y_scale; - - val->extents.width = DOUBLE_FROM_26_6 (metrics->width) / unscaled->x_scale; - val->extents.height = DOUBLE_FROM_26_6 (metrics->height) / unscaled->y_scale; - - /* - * use untransformed advance values - * XXX uses horizontal advance only at present; - should provide FT_LOAD_VERTICAL_LAYOUT - */ - - val->extents.x_advance = DOUBLE_FROM_26_6 (face->glyph->metrics.horiAdvance) / unscaled->x_scale; - val->extents.y_advance = 0 / unscaled->y_scale; - - outline = &glyphslot->outline; - FT_Outline_Get_CBox (outline, &cbox); cbox.xMin &= -64; @@ -583,7 +578,7 @@ _cairo_ft_unscaled_font_create_glyph (void *abstract_ val->image = NULL; } else { - bitmap.pixel_mode = ft_pixel_mode_grays; + bitmap.pixel_mode = FT_PIXEL_MODE_GRAY; bitmap.num_grays = 256; bitmap.width = width; bitmap.rows = height; @@ -591,16 +586,14 @@ _cairo_ft_unscaled_font_create_glyph (void *abstract_ bitmap.buffer = calloc (1, stride * height); if (bitmap.buffer == NULL) { - status = CAIRO_STATUS_NO_MEMORY; - goto FAIL; + return CAIRO_STATUS_NO_MEMORY; } FT_Outline_Translate (outline, -cbox.xMin, -cbox.yMin); if (FT_Outline_Get_Bitmap (glyphslot->library, outline, &bitmap) != 0) { free (bitmap.buffer); - status = CAIRO_STATUS_NO_MEMORY; - goto FAIL; + return CAIRO_STATUS_NO_MEMORY; } val->image = (cairo_image_surface_t *) @@ -609,8 +602,7 @@ _cairo_ft_unscaled_font_create_glyph (void *abstract_ width, height, stride); if (val->image == NULL) { free (bitmap.buffer); - status = CAIRO_STATUS_NO_MEMORY; - goto FAIL; + return CAIRO_STATUS_NO_MEMORY; } _cairo_image_surface_assume_ownership_of_data (val->image); @@ -625,10 +617,167 @@ _cairo_ft_unscaled_font_create_glyph (void *abstract_ val->size.height = (unsigned short) height; val->size.x = (short) (cbox.xMin >> 6); val->size.y = - (short) (cbox.yMax >> 6); + + return status; +} + +/* Converts a bitmap (or other) FT_GlyphSlot into an image + * + * This could go through _render_glyph_bitmap as well, letting + * FreeType convert the outline to a bitmap, but doing it ourselves + * has two minor advantages: first, we save a copy of the bitmap + * buffer: we can directly use the buffer that FreeType renders + * into. + * + * Second, it may help when we add support for subpixel + * rendering: the Xft code does it this way. (Keith thinks that + * it may also be possible to get the subpixel rendering with + * FT_Render_Glyph: something worth looking into in more detail + * when we add subpixel support. If so, we may want to eliminate + * this version of the code path entirely. + */ +static cairo_status_t +_render_glyph_bitmap (FT_Face face, + cairo_image_glyph_cache_entry_t *val) +{ + FT_GlyphSlot glyphslot = face->glyph; + FT_Bitmap *bitmap; + cairo_status_t status = CAIRO_STATUS_SUCCESS; + int width, height, stride; + unsigned char *data; + FT_Error error; + int i, j; + + /* According to the FreeType docs, glyphslot->format could be + * something other than FT_GLYPH_FORMAT_OUTLINE or + * FT_GLYPH_FORMAT_BITMAP. Calling FT_Render_Glyph gives FreeType + * the opportunity to convert such to + * bitmap. FT_GLYPH_FORMAT_COMPOSITE will not be encountered since + * we avoid the FT_LOAD_NO_RECURSE flag. + */ + error = FT_Render_Glyph (glyphslot, FT_RENDER_MODE_NORMAL); + if (error) + return CAIRO_STATUS_NO_MEMORY; + + bitmap = &glyphslot->bitmap; + + width = bitmap->width; + height = bitmap->rows; + + if (width * height == 0) { + val->image = NULL; + } else { + switch (bitmap->pixel_mode) { + case FT_PIXEL_MODE_MONO: + stride = (width + 3) & ~3; + data = calloc (stride * height, 1); + if (!data) + return CAIRO_STATUS_NO_MEMORY; + for (j = 0; j < height; j++) { + const unsigned char *p = bitmap->buffer + j * bitmap->pitch; + unsigned char *q = data + j * stride; + for (i = 0; i < width; i++) { + /* FreeType bitmaps are always stored MSB */ + unsigned char byte = p[i >> 3]; + unsigned char bit = 1 << (7 - (i % 8)); + + if (byte & bit) + q[i] = 0xff; + } + } + break; + case FT_PIXEL_MODE_GRAY: + stride = bitmap->pitch; + data = malloc (stride * height); + if (!data) + return CAIRO_STATUS_NO_MEMORY; + memcpy (data, bitmap->buffer, stride * height); + break; + case FT_PIXEL_MODE_GRAY2: + case FT_PIXEL_MODE_GRAY4: + /* These could be triggered by very rare types of TrueType fonts */ + case FT_PIXEL_MODE_LCD: + case FT_PIXEL_MODE_LCD_V: + /* These should never be triggered unless we ask for them */ + default: + return CAIRO_STATUS_NO_MEMORY; + } + + val->image = (cairo_image_surface_t *) + cairo_image_surface_create_for_data (data, + CAIRO_FORMAT_A8, + width, height, stride); + if (val->image == NULL) { + free (data); + return CAIRO_STATUS_NO_MEMORY; + } + + _cairo_image_surface_assume_ownership_of_data (val->image); + } + + val->size.width = width; + val->size.height = height; + val->size.x = - glyphslot->bitmap_left; + val->size.y = - glyphslot->bitmap_top; + + return status; +} + +static cairo_status_t +_cairo_ft_unscaled_font_create_glyph (void *abstract_font, + cairo_image_glyph_cache_entry_t *val) +{ + ft_unscaled_font_t *unscaled = abstract_font; + FT_GlyphSlot glyphslot; + FT_Face face; + FT_Glyph_Metrics *metrics; + cairo_status_t status = CAIRO_STATUS_SUCCESS; + + face = _ft_unscaled_font_lock_face (unscaled); + if (!face) + return CAIRO_STATUS_NO_MEMORY; + +( glyphslot = face->glyph; + metrics = &glyphslot->metrics; + + _ft_unscaled_font_set_scale (unscaled, &val->key.scale); + + if (FT_Load_Glyph (face, val->key.index, val->key.flags) != 0) { + status = CAIRO_STATUS_NO_MEMORY; + goto FAIL; + } + + /* + * Note: the font's coordinate system is upside down from ours, so the + * Y coordinates of the bearing and advance need to be negated. + * + * Scale metrics back to glyph space from the scaled glyph space returned + * by FreeType + */ + + val->extents.x_bearing = DOUBLE_FROM_26_6 (metrics->horiBearingX) / unscaled->x_scale; + val->extents.y_bearing = -DOUBLE_FROM_26_6 (metrics->horiBearingY) / unscaled->y_scale; + + val->extents.width = DOUBLE_FROM_26_6 (metrics->width) / unscaled->x_scale; + val->extents.height = DOUBLE_FROM_26_6 (metrics->height) / unscaled->y_scale; + + /* + * use untransformed advance values + * XXX uses horizontal advance only at present; + should provide FT_LOAD_VERTICAL_LAYOUT + */ + + val->extents.x_advance = DOUBLE_FROM_26_6 (face->glyph->metrics.horiAdvance) / unscaled->x_scale; + val->extents.y_advance = 0 / unscaled->y_scale; + + if (glyphslot->format == FT_GLYPH_FORMAT_OUTLINE) + status = _render_glyph_outline (face, val); + else + status = _render_glyph_bitmap (face, val); FAIL: _ft_unscaled_font_unlock_face (unscaled); - + return status; } -- cgit v1.2.3 From 05e2ffa00ad672d33f1c204237f54a006f2e5c94 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 24 Jun 2005 15:09:41 +0000 Subject: Prefer descriptive variable names over single-character names. Remove unneeded XGlpyhInfo field from glyphset_cache_entry_t. --- ChangeLog | 12 +++++ src/cairo-xlib-surface.c | 135 +++++++++++++++++++++++------------------------ 2 files changed, 78 insertions(+), 69 deletions(-) diff --git a/ChangeLog b/ChangeLog index 37e846da7..081949029 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-06-24 Carl Worth + + * src/cairo-xlib-surface.c: (_xlib_glyphset_cache_create_entry), + (_glyphset_cache_entry_reference), + (_xlib_glyphset_cache_destroy_entry), (_get_glyphset_cache), + (_cairo_xlib_surface_show_glyphs32), + (_cairo_xlib_surface_show_glyphs16), + (_cairo_xlib_surface_show_glyphs8), + (_cairo_xlib_surface_show_glyphs): Prefer descriptive variable + names over single-character names. Remove unneeded XGlpyhInfo + field from glyphset_cache_entry_t. + 2005-06-24 Owen Taylor * src/cairo-ft-font.c (_render_glyph_bitmap): Handle rendering diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index f06d409e2..399527738 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -1510,7 +1510,6 @@ typedef struct glyphset_cache { typedef struct { cairo_glyph_cache_key_t key; Glyph glyph; - XGlyphInfo info; int refcount; } glyphset_cache_entry_t; @@ -1520,26 +1519,26 @@ _next_xlib_glyph (glyphset_cache_t *cache) return ++(cache->counter); } - static cairo_status_t -_xlib_glyphset_cache_create_entry (void *cache, - void *key, +_xlib_glyphset_cache_create_entry (void *abstract_cache, + void *abstract_key, void **return_entry) { - glyphset_cache_t *g = (glyphset_cache_t *) cache; - cairo_glyph_cache_key_t *k = (cairo_glyph_cache_key_t *)key; - glyphset_cache_entry_t *v; + glyphset_cache_t *cache = abstract_cache; + cairo_glyph_cache_key_t *key = abstract_key; + glyphset_cache_entry_t *entry; + XGlyphInfo glyph_info; cairo_status_t status; cairo_cache_t *im_cache; cairo_image_glyph_cache_entry_t *im; - v = malloc (sizeof (glyphset_cache_entry_t)); + entry = malloc (sizeof (glyphset_cache_entry_t)); _cairo_lock_global_image_glyph_cache (); im_cache = _cairo_get_global_image_glyph_cache (); - if (g == NULL || v == NULL || im_cache == NULL) { + if (cache == NULL || entry == NULL || im_cache == NULL) { _cairo_unlock_global_image_glyph_cache (); return CAIRO_STATUS_NO_MEMORY; } @@ -1550,14 +1549,14 @@ _xlib_glyphset_cache_create_entry (void *cache, return CAIRO_STATUS_NO_MEMORY; } - v->refcount = 1; - v->key = *k; - _cairo_unscaled_font_reference (v->key.unscaled); + entry->refcount = 1; + entry->key = *key; + _cairo_unscaled_font_reference (entry->key.unscaled); - v->glyph = _next_xlib_glyph (g); + entry->glyph = _next_xlib_glyph (cache); - v->info.width = im->image ? im->image->stride : im->size.width; - v->info.height = im->size.height; + glyph_info.width = im->image ? im->image->stride : im->size.width; + glyph_info.height = im->size.height; /* * Most of the font rendering system thinks of glyph tiles as having @@ -1595,26 +1594,26 @@ _xlib_glyphset_cache_create_entry (void *cache, * sitting around for x and y. */ - v->info.x = -im->size.x; - v->info.y = -im->size.y; - v->info.xOff = 0; - v->info.yOff = 0; + glyph_info.x = -im->size.x; + glyph_info.y = -im->size.y; + glyph_info.xOff = 0; + glyph_info.yOff = 0; - XRenderAddGlyphs (g->display, g->glyphset, - &(v->glyph), &(v->info), 1, + XRenderAddGlyphs (cache->display, cache->glyphset, + &(entry->glyph), &(glyph_info), 1, im->image ? (char *) im->image->data : NULL, - im->image ? v->info.height * v->info.width : 0); + im->image ? glyph_info.height * glyph_info.width : 0); - v->key.base.memory = im->image ? im->image->width * im->image->stride : 0; - *return_entry = v; + entry->key.base.memory = im->image ? im->image->width * im->image->stride : 0; + *return_entry = entry; _cairo_unlock_global_image_glyph_cache (); return CAIRO_STATUS_SUCCESS; } static void -_glyphset_cache_entry_reference (glyphset_cache_entry_t *e) +_glyphset_cache_entry_reference (glyphset_cache_entry_t *entry) { - e->refcount++; + entry->refcount++; } static void @@ -1624,20 +1623,18 @@ _xlib_glyphset_cache_destroy_cache (void *cache) } static void -_xlib_glyphset_cache_destroy_entry (void *cache, void *entry) +_xlib_glyphset_cache_destroy_entry (void *abstract_cache, + void *abstract_entry) { - glyphset_cache_t *g; - glyphset_cache_entry_t *v; - - g = (glyphset_cache_t *) cache; - v = (glyphset_cache_entry_t *) entry; + glyphset_cache_t *cache = cache; + glyphset_cache_entry_t *entry = abstract_entry; - if (--v->refcount > 0) + if (--entry->refcount > 0) return; - _cairo_unscaled_font_destroy (v->key.unscaled); - XRenderFreeGlyphs (g->display, g->glyphset, &(v->glyph), 1); - free (v); + _cairo_unscaled_font_destroy (entry->key.unscaled); + XRenderFreeGlyphs (cache->display, cache->glyphset, &(entry->glyph), 1); + free (entry); } static const cairo_cache_backend_t _xlib_glyphset_cache_backend = { @@ -1672,35 +1669,35 @@ _get_glyphset_cache (Display *d) * displays. So we just do a linear scan. */ - glyphset_cache_t *g; + glyphset_cache_t *cache; - for (g = _xlib_glyphset_caches; g != NULL; g = g->next) { - if (g->display == d) - return g; + for (cache = _xlib_glyphset_caches; cache != NULL; cache = cache->next) { + if (cache->display == d) + return cache; } - g = malloc (sizeof (glyphset_cache_t)); - if (g == NULL) + cache = malloc (sizeof (glyphset_cache_t)); + if (cache == NULL) goto ERR; - g->counter = 0; - g->display = d; - g->a8_pict_format = XRenderFindStandardFormat (d, PictStandardA8); - if (g->a8_pict_format == NULL) + cache->counter = 0; + cache->display = d; + cache->a8_pict_format = XRenderFindStandardFormat (d, PictStandardA8); + if (cache->a8_pict_format == NULL) goto ERR; - if (_cairo_cache_init (&g->base, + if (_cairo_cache_init (&cache->base, &_xlib_glyphset_cache_backend, CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT)) goto FREE_GLYPHSET_CACHE; - g->glyphset = XRenderCreateGlyphSet (d, g->a8_pict_format); - g->next = _xlib_glyphset_caches; - _xlib_glyphset_caches = g; - return g; + cache->glyphset = XRenderCreateGlyphSet (d, cache->a8_pict_format); + cache->next = _xlib_glyphset_caches; + _xlib_glyphset_caches = cache; + return cache; FREE_GLYPHSET_CACHE: - free (g); + free (cache); ERR: return NULL; @@ -1711,7 +1708,7 @@ _get_glyphset_cache (Display *d) static cairo_status_t _cairo_xlib_surface_show_glyphs32 (cairo_scaled_font_t *scaled_font, cairo_operator_t operator, - glyphset_cache_t *g, + glyphset_cache_t *cache, cairo_glyph_cache_key_t *key, cairo_xlib_surface_t *src, cairo_xlib_surface_t *self, @@ -1751,7 +1748,7 @@ _cairo_xlib_surface_show_glyphs32 (cairo_scaled_font_t *scaled_font, chars[i] = entries[i]->glyph; elts[i].chars = &(chars[i]); elts[i].nchars = 1; - elts[i].glyphset = g->glyphset; + elts[i].glyphset = cache->glyphset; thisX = (int) floor (glyphs[i].x + 0.5); thisY = (int) floor (glyphs[i].y + 0.5); elts[i].xOff = thisX - lastX; @@ -1764,7 +1761,7 @@ _cairo_xlib_surface_show_glyphs32 (cairo_scaled_font_t *scaled_font, _render_operator (operator), src->src_picture, self->dst_picture, - g->a8_pict_format, + cache->a8_pict_format, source_x, source_y, 0, 0, elts, num_glyphs); @@ -1788,7 +1785,7 @@ _cairo_xlib_surface_show_glyphs32 (cairo_scaled_font_t *scaled_font, static cairo_status_t _cairo_xlib_surface_show_glyphs16 (cairo_scaled_font_t *scaled_font, cairo_operator_t operator, - glyphset_cache_t *g, + glyphset_cache_t *cache, cairo_glyph_cache_key_t *key, cairo_xlib_surface_t *src, cairo_xlib_surface_t *self, @@ -1828,7 +1825,7 @@ _cairo_xlib_surface_show_glyphs16 (cairo_scaled_font_t *scaled_font, chars[i] = entries[i]->glyph; elts[i].chars = &(chars[i]); elts[i].nchars = 1; - elts[i].glyphset = g->glyphset; + elts[i].glyphset = cache->glyphset; thisX = (int) floor (glyphs[i].x + 0.5); thisY = (int) floor (glyphs[i].y + 0.5); elts[i].xOff = thisX - lastX; @@ -1841,7 +1838,7 @@ _cairo_xlib_surface_show_glyphs16 (cairo_scaled_font_t *scaled_font, _render_operator (operator), src->src_picture, self->dst_picture, - g->a8_pict_format, + cache->a8_pict_format, source_x, source_y, 0, 0, elts, num_glyphs); @@ -1864,7 +1861,7 @@ _cairo_xlib_surface_show_glyphs16 (cairo_scaled_font_t *scaled_font, static cairo_status_t _cairo_xlib_surface_show_glyphs8 (cairo_scaled_font_t *scaled_font, cairo_operator_t operator, - glyphset_cache_t *g, + glyphset_cache_t *cache, cairo_glyph_cache_key_t *key, cairo_xlib_surface_t *src, cairo_xlib_surface_t *self, @@ -1904,7 +1901,7 @@ _cairo_xlib_surface_show_glyphs8 (cairo_scaled_font_t *scaled_font, chars[i] = entries[i]->glyph; elts[i].chars = &(chars[i]); elts[i].nchars = 1; - elts[i].glyphset = g->glyphset; + elts[i].glyphset = cache->glyphset; thisX = (int) floor (glyphs[i].x + 0.5); thisY = (int) floor (glyphs[i].y + 0.5); elts[i].xOff = thisX - lastX; @@ -1917,7 +1914,7 @@ _cairo_xlib_surface_show_glyphs8 (cairo_scaled_font_t *scaled_font, _render_operator (operator), src->src_picture, self->dst_picture, - g->a8_pict_format, + cache->a8_pict_format, source_x, source_y, 0, 0, elts, num_glyphs); @@ -1957,7 +1954,7 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, unsigned int elt_size; cairo_xlib_surface_t *self = abstract_surface; cairo_xlib_surface_t *src; - glyphset_cache_t *g; + glyphset_cache_t *cache; cairo_glyph_cache_key_t key; glyphset_cache_entry_t **entries; glyphset_cache_entry_t *stack_entries [N_STACK_BUF]; @@ -1999,8 +1996,8 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, } _lock_xlib_glyphset_caches (); - g = _get_glyphset_cache (self->dpy); - if (g == NULL) + cache = _get_glyphset_cache (self->dpy); + if (cache == NULL) goto UNLOCK; /* Work out the index size to use. */ @@ -2009,7 +2006,7 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, for (i = 0; i < num_glyphs; ++i) { key.index = glyphs[i].index; - status = _cairo_cache_lookup (&g->base, &key, (void **) (&entries[i]), NULL); + status = _cairo_cache_lookup (&cache->base, &key, (void **) (&entries[i]), NULL); if (status != CAIRO_STATUS_SUCCESS || entries[i] == NULL) goto UNLOCK; @@ -2035,28 +2032,28 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, _cairo_xlib_surface_ensure_dst_picture (self); if (elt_size == 8) { - status = _cairo_xlib_surface_show_glyphs8 (scaled_font, operator, g, &key, src, self, + status = _cairo_xlib_surface_show_glyphs8 (scaled_font, operator, cache, &key, src, self, source_x + attributes.x_offset, source_y + attributes.y_offset, glyphs, entries, num_glyphs); } else if (elt_size == 16) { - status = _cairo_xlib_surface_show_glyphs16 (scaled_font, operator, g, &key, src, self, + status = _cairo_xlib_surface_show_glyphs16 (scaled_font, operator, cache, &key, src, self, source_x + attributes.x_offset, source_y + attributes.y_offset, glyphs, entries, num_glyphs); } else { - status = _cairo_xlib_surface_show_glyphs32 (scaled_font, operator, g, &key, src, self, + status = _cairo_xlib_surface_show_glyphs32 (scaled_font, operator, cache, &key, src, self, source_x + attributes.x_offset, source_y + attributes.y_offset, glyphs, entries, num_glyphs); } for (i = 0; i < num_glyphs; ++i) - _xlib_glyphset_cache_destroy_entry (g, entries[i]); + _xlib_glyphset_cache_destroy_entry (cache, entries[i]); UNLOCK: _unlock_xlib_glyphset_caches (); -- cgit v1.2.3 From d469cc18eb21f69f8546f1d35ea44509c6eac329 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 24 Jun 2005 15:14:31 +0000 Subject: Remove stray character. --- ChangeLog | 5 +++++ src/cairo-ft-font.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 081949029..b5e05463a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-06-24 Carl Worth + + * src/cairo-ft-font.c: (_cairo_ft_unscaled_font_create_glyph): + Remove stray character. + 2005-06-24 Carl Worth * src/cairo-xlib-surface.c: (_xlib_glyphset_cache_create_entry), diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index de9178614..3aea02d77 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -737,7 +737,7 @@ _cairo_ft_unscaled_font_create_glyph (void *abstract_ if (!face) return CAIRO_STATUS_NO_MEMORY; -( glyphslot = face->glyph; + glyphslot = face->glyph; metrics = &glyphslot->metrics; _ft_unscaled_font_set_scale (unscaled, &val->key.scale); -- cgit v1.2.3 From 43e3e7eeff6ff0f9fc0b161f70dfa0f5071a087e Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Fri, 24 Jun 2005 18:21:15 +0000 Subject: s/IC_/FB_/g dd #define FB_BITS IC_BITS so that FB_BITS get defined early enough --- pixman/ChangeLog | 18 ++++ pixman/src/ic.c | 4 +- pixman/src/icblt.c | 106 +++++++++++------------ pixman/src/icbltone.c | 76 ++++++++--------- pixman/src/icint.h | 168 ++++++++++++++++++------------------- pixman/src/icpixels.c | 6 +- pixman/src/icrop.h | 4 +- pixman/src/icstipple.c | 6 +- pixman/src/icutil.c | 16 ++-- pixman/src/pixman-xserver-compat.h | 2 + pixman/src/pixman.h | 3 +- 11 files changed, 215 insertions(+), 194 deletions(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index afd2bddfb..49e1c6886 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,21 @@ +2005-06-24 Jeff Muizelaar + + * src/ic.c: (pixman_compositeSrcAdd_1000x1000), + (pixman_compositeSolidMask_nx1xn): + * src/icblt.c: (IcBlt), (IcBlt24Line), (IcBltOdd), (IcSetBltOdd), + (IcBltStip): + * src/icbltone.c: (IcBltOne), (IcBltOne24): + * src/icint.h: + * src/icpixels.c: (IcPixelsCreate): + * src/icrop.h: + * src/icstipple.c: (IcTransparentSpan): + * src/icutil.c: (IcReplicatePixel): + * src/pixman-xserver-compat.h: + s/IC_/FB_/g + + * src/pixman.h: + add #define FB_BITS IC_BITS so that FB_BITS get defined early enough + 2005-06-23 Jeff Muizelaar * src/iccompose.c: (fbCombineClear), (fbCombineSrcU), diff --git a/pixman/src/ic.c b/pixman/src/ic.c index 6faaf5417..c55da1c9a 100644 --- a/pixman/src/ic.c +++ b/pixman/src/ic.c @@ -789,7 +789,7 @@ pixman_compositeSrcAdd_1000x1000 (pixman_operator_t op, height, GXor, - IC_ALLONES, + FB_ALLONES, srcBpp, 0, @@ -856,7 +856,7 @@ pixman_compositeSolidMask_nx1xn (pixman_operator_t op, 0x0, src, - IC_ALLONES, + FB_ALLONES, 0x0); } diff --git a/pixman/src/icblt.c b/pixman/src/icblt.c index 02c6bfc39..f34abb941 100644 --- a/pixman/src/icblt.c +++ b/pixman/src/icblt.c @@ -28,10 +28,10 @@ if (sx != dx) { \ if (sx > dx) { \ ls = sx - dx; \ - rs = IC_UNIT - ls; \ + rs = FB_UNIT - ls; \ } else { \ rs = dx - sx; \ - ls = IC_UNIT - rs; \ + ls = FB_UNIT - rs; \ } \ } \ } @@ -68,7 +68,7 @@ IcBlt (FbBits *srcLine, the memcpy()'s should be pluggable ala mplayer|xine - perhaps we can get one of the above to give up their code for us. */ - if((pm==IC_ALLONES) && (alu==GXcopy) && !reverse && (srcX&7)==0 && (dstX&7)==0 && (width&7)==0) + if((pm==FB_ALLONES) && (alu==GXcopy) && !reverse && (srcX&7)==0 && (dstX&7)==0 && (width&7)==0) { uint8_t *isrc=(uint8_t *)srcLine; uint8_t *idst=(uint8_t *)dstLine; @@ -88,7 +88,7 @@ IcBlt (FbBits *srcLine, return; } -#ifdef IC_24BIT +#ifdef FB_24BIT if (bpp == 24 && !IcCheck24Pix (pm)) { IcBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX, @@ -109,17 +109,17 @@ IcBlt (FbBits *srcLine, nmiddle, endmask, endbyte); if (reverse) { - srcLine += ((srcX + width - 1) >> IC_SHIFT) + 1; - dstLine += ((dstX + width - 1) >> IC_SHIFT) + 1; - srcX = (srcX + width - 1) & IC_MASK; - dstX = (dstX + width - 1) & IC_MASK; + srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1; + dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1; + srcX = (srcX + width - 1) & FB_MASK; + dstX = (dstX + width - 1) & FB_MASK; } else { - srcLine += srcX >> IC_SHIFT; - dstLine += dstX >> IC_SHIFT; - srcX &= IC_MASK; - dstX &= IC_MASK; + srcLine += srcX >> FB_SHIFT; + dstLine += dstX >> FB_SHIFT; + srcX &= FB_MASK; + dstX &= FB_MASK; } if (srcX == dstX) { @@ -218,12 +218,12 @@ IcBlt (FbBits *srcLine, if (srcX > dstX) { leftShift = srcX - dstX; - rightShift = IC_UNIT - leftShift; + rightShift = FB_UNIT - leftShift; } else { rightShift = dstX - srcX; - leftShift = IC_UNIT - rightShift; + leftShift = FB_UNIT - rightShift; } while (height--) { @@ -333,7 +333,7 @@ IcBlt (FbBits *srcLine, } } -#ifdef IC_24BIT +#ifdef FB_24BIT #undef DEBUG_BLT24 #ifdef DEBUG_BLT24 @@ -365,8 +365,8 @@ IcBlt24Line (FbBits *src, { #ifdef DEBUG_BLT24 char *origDst = (char *) dst; - FbBits *origLine = dst + ((dstX >> IC_SHIFT) - 1); - int origNlw = ((width + IC_MASK) >> IC_SHIFT) + 3; + FbBits *origLine = dst + ((dstX >> FB_SHIFT) - 1); + int origNlw = ((width + FB_MASK) >> FB_SHIFT) + 3; int origX = dstX / 24; #endif @@ -380,29 +380,29 @@ IcBlt24Line (FbBits *src, int rot; IcDeclareMergeRop (); - IcInitializeMergeRop (alu, IC_ALLONES); + IcInitializeMergeRop (alu, FB_ALLONES); IcMaskBits(dstX, width, startmask, n, endmask); #ifdef DEBUG_BLT24 ErrorF ("dstX %d width %d reverse %d\n", dstX, width, reverse); #endif if (reverse) { - src += ((srcX + width - 1) >> IC_SHIFT) + 1; - dst += ((dstX + width - 1) >> IC_SHIFT) + 1; - rot = IcFirst24Rot (((dstX + width - 8) & IC_MASK)); + src += ((srcX + width - 1) >> FB_SHIFT) + 1; + dst += ((dstX + width - 1) >> FB_SHIFT) + 1; + rot = IcFirst24Rot (((dstX + width - 8) & FB_MASK)); rot = IcPrev24Rot(rot); #ifdef DEBUG_BLT24 - ErrorF ("dstX + width - 8: %d rot: %d\n", (dstX + width - 8) & IC_MASK, rot); + ErrorF ("dstX + width - 8: %d rot: %d\n", (dstX + width - 8) & FB_MASK, rot); #endif - srcX = (srcX + width - 1) & IC_MASK; - dstX = (dstX + width - 1) & IC_MASK; + srcX = (srcX + width - 1) & FB_MASK; + dstX = (dstX + width - 1) & FB_MASK; } else { - src += srcX >> IC_SHIFT; - dst += dstX >> IC_SHIFT; - srcX &= IC_MASK; - dstX &= IC_MASK; + src += srcX >> FB_SHIFT; + dst += dstX >> FB_SHIFT; + srcX &= FB_MASK; + dstX &= FB_MASK; rot = IcFirst24Rot (dstX); #ifdef DEBUG_BLT24 ErrorF ("dstX: %d rot: %d\n", dstX, rot); @@ -465,12 +465,12 @@ IcBlt24Line (FbBits *src, if (srcX > dstX) { leftShift = srcX - dstX; - rightShift = IC_UNIT - leftShift; + rightShift = FB_UNIT - leftShift; } else { rightShift = dstX - srcX; - leftShift = IC_UNIT - rightShift; + leftShift = FB_UNIT - rightShift; } bits1 = 0; @@ -598,12 +598,12 @@ IcBlt24 (FbBits *srcLine, ErrorF ("\n"); #endif } -#endif /* IC_24BIT */ +#endif /* FB_24BIT */ -#if IC_SHIFT == IC_STIP_SHIFT + 1 +#if FB_SHIFT == FB_STIP_SHIFT + 1 /* - * Could be generalized to IC_SHIFT > IC_STIP_SHIFT + 1 by + * Could be generalized to FB_SHIFT > FB_STIP_SHIFT + 1 by * creating an ring of values stepped through for each line */ @@ -653,12 +653,12 @@ IcBltOdd (FbBits *srcLine, IcInitializeMergeRop (alu, pm); destInvarient = IcDestInvarientMergeRop(); - srcLine += srcXEven >> IC_SHIFT; - dstLine += dstXEven >> IC_SHIFT; - srcXEven &= IC_MASK; - dstXEven &= IC_MASK; - srcXOdd &= IC_MASK; - dstXOdd &= IC_MASK; + srcLine += srcXEven >> FB_SHIFT; + dstLine += dstXEven >> FB_SHIFT; + srcXEven &= FB_MASK; + dstXEven &= FB_MASK; + srcXOdd &= FB_MASK; + dstXOdd &= FB_MASK; IcMaskBits(dstXEven, width, startmaskEven, nmiddleEven, endmaskEven); IcMaskBits(dstXOdd, width, startmaskOdd, nmiddleOdd, endmaskOdd); @@ -779,7 +779,7 @@ IcBltOdd (FbBits *srcLine, } } -#ifdef IC_24BIT +#ifdef FB_24BIT void IcBltOdd24 (FbBits *srcLine, IcStride srcStrideEven, @@ -828,7 +828,7 @@ IcBltOdd24 (FbBits *srcLine, #endif -#if IC_STIP_SHIFT != IC_SHIFT +#if FB_STIP_SHIFT != FB_SHIFT void IcSetBltOdd (IcStip *stip, IcStride stipStride, @@ -845,11 +845,11 @@ IcSetBltOdd (IcStip *stip, /* * bytes needed to align source */ - srcAdjust = (((int) stip) & (IC_MASK >> 3)); + srcAdjust = (((int) stip) & (FB_MASK >> 3)); /* * IcStip units needed to align stride */ - strideAdjust = stipStride & (IC_MASK >> IC_STIP_SHIFT); + strideAdjust = stipStride & (FB_MASK >> FB_STIP_SHIFT); *bits = (FbBits *) ((char *) stip - srcAdjust); if (srcAdjust) @@ -858,7 +858,7 @@ IcSetBltOdd (IcStip *stip, *strideOdd = IcStipStrideToBitsStride (stipStride); *srcXEven = srcX + (srcAdjust << 3); - *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << IC_STIP_SHIFT); + *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << FB_STIP_SHIFT); } else { @@ -866,7 +866,7 @@ IcSetBltOdd (IcStip *stip, *strideOdd = IcStipStrideToBitsStride (stipStride + 1); *srcXEven = srcX; - *srcXOdd = srcX + (strideAdjust << IC_STIP_SHIFT); + *srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT); } } #endif @@ -887,9 +887,9 @@ IcBltStip (IcStip *src, FbBits pm, int bpp) { -#if IC_STIP_SHIFT != IC_SHIFT - if (IC_STIP_ODDSTRIDE(srcStride) || IC_STIP_ODDPTR(src) || - IC_STIP_ODDSTRIDE(dstStride) || IC_STIP_ODDPTR(dst)) +#if FB_STIP_SHIFT != FB_SHIFT + if (FB_STIP_ODDSTRIDE(srcStride) || FB_STIP_ODDPTR(src) || + FB_STIP_ODDSTRIDE(dstStride) || FB_STIP_ODDPTR(dst)) { IcStride srcStrideEven, srcStrideOdd; IcStride dstStrideEven, dstStrideOdd; @@ -898,10 +898,10 @@ IcBltStip (IcStip *src, FbBits *s, *d; int sx, dx; - src += srcX >> IC_STIP_SHIFT; - srcX &= IC_STIP_MASK; - dst += dstX >> IC_STIP_SHIFT; - dstX &= IC_STIP_MASK; + src += srcX >> FB_STIP_SHIFT; + srcX &= FB_STIP_MASK; + dst += dstX >> FB_STIP_SHIFT; + dstX &= FB_STIP_MASK; IcSetBltOdd (src, srcStride, srcX, &s, @@ -913,7 +913,7 @@ IcBltStip (IcStip *src, &dstStrideEven, &dstStrideOdd, &dstXEven, &dstXOdd); -#ifdef IC_24BIT +#ifdef FB_24BIT if (bpp == 24 && !IcCheck24Pix (pm)) { IcBltOdd24 (s, srcStrideEven, srcStrideOdd, diff --git a/pixman/src/icbltone.c b/pixman/src/icbltone.c index 6f0502460..a584a1bf1 100644 --- a/pixman/src/icbltone.c +++ b/pixman/src/icbltone.c @@ -25,7 +25,7 @@ #include "pixman-xserver-compat.h" /* - * Example: srcX = 13 dstX = 8 (IC unit 32 dstBpp 8) + * Example: srcX = 13 dstX = 8 (FB unit 32 dstBpp 8) * * **** **** **** **** **** **** **** **** * ^ @@ -34,7 +34,7 @@ * leftShift = 12 * rightShift = 20 * - * Example: srcX = 0 dstX = 8 (IC unit 32 dstBpp 8) + * Example: srcX = 0 dstX = 8 (FB unit 32 dstBpp 8) * * **** **** **** **** **** **** **** **** * ^ @@ -55,7 +55,7 @@ bits = *src++; \ } -#ifndef ICNOPIXADDR +#ifndef FBNOPIXADDR #define LaneCases1(n,a) case n: (void)IcLaneCase(n,a); break #define LaneCases2(n,a) LaneCases1(n,a); LaneCases1(n+1,a) @@ -67,15 +67,15 @@ #define LaneCases128(n,a) LaneCases64(n,a); LaneCases64(n+64,a) #define LaneCases256(n,a) LaneCases128(n,a); LaneCases128(n+128,a) -#if IC_SHIFT == 6 +#if FB_SHIFT == 6 #define LaneCases(a) LaneCases256(0,a) #endif -#if IC_SHIFT == 5 +#if FB_SHIFT == 5 #define LaneCases(a) LaneCases16(0,a) #endif -#if IC_SHIFT == 6 +#if FB_SHIFT == 6 static uint8_t const Ic8Lane[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, @@ -105,7 +105,7 @@ static uint8_t const Ic32Lane[16] = { }; #endif -#if IC_SHIFT == 5 +#if FB_SHIFT == 5 static uint8_t const Ic8Lane[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; @@ -167,12 +167,12 @@ IcBltOne (IcStip *src, int transparent; /* accelerate 0 nop */ int srcinc; /* source units consumed */ int endNeedsLoad = 0; /* need load for endmask */ -#ifndef ICNOPIXADDR +#ifndef FBNOPIXADDR const uint8_t *IcLane; #endif int startbyte, endbyte; -#ifdef IC_24BIT +#ifdef FB_24BIT if (dstBpp == 24) { IcBltOne24 (src, srcStride, srcX, @@ -187,27 +187,27 @@ IcBltOne (IcStip *src, * Number of destination units in FbBits == number of stipple pixels * used each time */ - pixelsPerDst = IC_UNIT / dstBpp; + pixelsPerDst = FB_UNIT / dstBpp; /* * Number of source stipple patterns in IcStip */ - unitsPerSrc = IC_STIP_UNIT / pixelsPerDst; + unitsPerSrc = FB_STIP_UNIT / pixelsPerDst; copy = 0; transparent = 0; if (bgand == 0 && fgand == 0) copy = 1; - else if (bgand == IC_ALLONES && bgxor == 0) + else if (bgand == FB_ALLONES && bgxor == 0) transparent = 1; /* * Adjust source and dest to nearest FbBits boundary */ - src += srcX >> IC_STIP_SHIFT; - dst += dstX >> IC_SHIFT; - srcX &= IC_STIP_MASK; - dstX &= IC_MASK; + src += srcX >> FB_STIP_SHIFT; + dst += dstX >> FB_SHIFT; + srcX &= FB_STIP_MASK; + dstX &= FB_MASK; IcMaskBitsBytes(dstX, width, copy, startmask, startbyte, nmiddle, endmask, endbyte); @@ -223,12 +223,12 @@ IcBltOne (IcStip *src, if (srcX >= dstS) { leftShift = srcX - dstS; - rightShift = IC_STIP_UNIT - leftShift; + rightShift = FB_STIP_UNIT - leftShift; } else { rightShift = dstS - srcX; - leftShift = IC_STIP_UNIT - rightShift; + leftShift = FB_STIP_UNIT - rightShift; } /* * Get pointer to stipple mask array for this depth @@ -236,7 +236,7 @@ IcBltOne (IcStip *src, icbits = 0; /* unused */ if (pixelsPerDst <= 8) icbits = IcStippleTable(pixelsPerDst); -#ifndef ICNOPIXADDR +#ifndef FBNOPIXADDR IcLane = 0; if (transparent && fgand == 0 && dstBpp >= 8) IcLane = IcLaneTable(dstBpp); @@ -294,13 +294,13 @@ IcBltOne (IcStip *src, */ if (startmask) { -#if IC_UNIT > 32 +#if FB_UNIT > 32 if (pixelsPerDst == 16) mask = IcStipple16Bits(IcLeftStipBits(bits,16)); else #endif mask = icbits[IcLeftStipBits(bits,pixelsPerDst)]; -#ifndef ICNOPIXADDR +#ifndef FBNOPIXADDR if (IcLane) { IcTransparentSpan (dst, mask & startmask, fgxor, 1); @@ -328,7 +328,7 @@ IcBltOne (IcStip *src, { while (n--) { -#if IC_UNIT > 32 +#if FB_UNIT > 32 if (pixelsPerDst == 16) mask = IcStipple16Bits(IcLeftStipBits(bits,16)); else @@ -341,7 +341,7 @@ IcBltOne (IcStip *src, } else { -#ifndef ICNOPIXADDR +#ifndef FBNOPIXADDR if (IcLane) { while (bits && n) @@ -392,13 +392,13 @@ IcBltOne (IcStip *src, { LoadBits; } -#if IC_UNIT > 32 +#if FB_UNIT > 32 if (pixelsPerDst == 16) mask = IcStipple16Bits(IcLeftStipBits(bits,16)); else #endif mask = icbits[IcLeftStipBits(bits,pixelsPerDst)]; -#ifndef ICNOPIXADDR +#ifndef FBNOPIXADDR if (IcLane) { IcTransparentSpan (dst, mask & endmask, fgxor, 1); @@ -417,7 +417,7 @@ IcBltOne (IcStip *src, } } -#ifdef IC_24BIT +#ifdef FB_24BIT /* * Crufty macros to initialize the mask array, most of this @@ -432,9 +432,9 @@ IcBltOne (IcStip *src, #define Mask24Neg(x,r) (Mask24Pos(x,r) < 0 ? -Mask24Pos(x,r) : 0) #define Mask24Check(x,r) (Mask24Pos(x,r) < 0 ? 0 : \ - Mask24Pos(x,r) >= IC_UNIT ? 0 : Mask24Pos(x,r)) + Mask24Pos(x,r) >= FB_UNIT ? 0 : Mask24Pos(x,r)) -#define Mask24(x,r) (Mask24Pos(x,r) < IC_UNIT ? \ +#define Mask24(x,r) (Mask24Pos(x,r) < FB_UNIT ? \ (Mask24Pos(x,r) < 0 ? \ 0xffffff >> Mask24Neg (x,r) : \ 0xffffff << Mask24Check(x,r)) : 0) @@ -442,10 +442,10 @@ IcBltOne (IcStip *src, #define SelMask24(b,n,r) ((((b) >> n) & 1) * Mask24(n,r)) /* - * Untested for MSBFirst or IC_UNIT == 32 + * Untested for MSBFirst or FB_UNIT == 32 */ -#if IC_UNIT == 64 +#if FB_UNIT == 64 #define C4_24(b,r) \ (SelMask24(b,0,r) | \ SelMask24(b,1,r) | \ @@ -481,7 +481,7 @@ static const FbBits icStipple24Bits[3][1 << IcStip24Len] = { #endif -#if IC_UNIT == 32 +#if FB_UNIT == 32 #define C2_24(b,r) \ (SelMask24(b,0,r) | \ SelMask24(b,1,r)) @@ -537,7 +537,7 @@ static const FbBits icStipple24Bits[3][1 << IcStip24Len] = { __len = (len) - remain; \ stip = IcMergePartStip24Bits(stip, IcLeftStipBits(bits, __len), \ remain, __len); \ - remain = IC_STIP_UNIT; \ + remain = FB_STIP_UNIT; \ } \ bits = IcStipLeft (bits, __len); \ remain -= __len; \ @@ -545,7 +545,7 @@ static const FbBits icStipple24Bits[3][1 << IcStip24Len] = { #define IcInitStipBits(offset,len,stip) {\ bits = IcStipLeft (*src++,offset); \ - remain = IC_STIP_UNIT - offset; \ + remain = FB_STIP_UNIT - offset; \ IcFirstStipBits(len,stip); \ stip = IcMergeStip24Bits (0, stip, len); \ } @@ -594,10 +594,10 @@ IcBltOne24 (IcStip *srcLine, int rot0, rot; int nDst; - srcLine += srcX >> IC_STIP_SHIFT; - dst += dstX >> IC_SHIFT; - srcX &= IC_STIP_MASK; - dstX &= IC_MASK; + srcLine += srcX >> FB_STIP_SHIFT; + dst += dstX >> FB_SHIFT; + srcX &= FB_STIP_MASK; + dstX &= FB_MASK; rot0 = IcFirst24Rot (dstX); IcMaskBits (dstX, width, leftMask, nlMiddle, rightMask); @@ -652,7 +652,7 @@ IcBltOne24 (IcStip *srcLine, } } /* transparent copy */ - else if (bgand == IC_ALLONES && bgxor == 0 && fgand == 0) + else if (bgand == FB_ALLONES && bgxor == 0 && fgand == 0) { while (height--) { diff --git a/pixman/src/icint.h b/pixman/src/icint.h index 9b8233645..59a7aba44 100644 --- a/pixman/src/icint.h +++ b/pixman/src/icint.h @@ -106,14 +106,14 @@ typedef unsigned int Mask; drop quite a bit of it. Once the real ic code starts to come together I can probably figure out what is not needed here. */ -#define IC_UNIT (1 << IC_SHIFT) -#define IC_HALFUNIT (1 << (IC_SHIFT-1)) -#define IC_MASK (IC_UNIT - 1) -#define IC_ALLONES ((pixman_bits_t) -1) +#define FB_UNIT (1 << FB_SHIFT) +#define FB_HALFUNIT (1 << (FB_SHIFT-1)) +#define FB_MASK (FB_UNIT - 1) +#define FB_ALLONES ((pixman_bits_t) -1) /* whether to bother to include 24bpp support */ #ifndef ICNO24BIT -#define IC_24BIT +#define FB_24BIT #endif /* @@ -121,36 +121,36 @@ typedef unsigned int Mask; * windows with 32bpp image format for application compatibility */ -#ifdef IC_24BIT +#ifdef FB_24BIT #ifndef ICNO24_32 -#define IC_24_32BIT +#define FB_24_32BIT #endif #endif -#define IC_STIP_SHIFT LOG2_BITMAP_PAD -#define IC_STIP_UNIT (1 << IC_STIP_SHIFT) -#define IC_STIP_MASK (IC_STIP_UNIT - 1) -#define IC_STIP_ALLONES ((IcStip) -1) +#define FB_STIP_SHIFT LOG2_BITMAP_PAD +#define FB_STIP_UNIT (1 << FB_STIP_SHIFT) +#define FB_STIP_MASK (FB_STIP_UNIT - 1) +#define FB_STIP_ALLONES ((IcStip) -1) -#define IC_STIP_ODDSTRIDE(s) (((s) & (IC_MASK >> IC_STIP_SHIFT)) != 0) -#define IC_STIP_ODDPTR(p) ((((long) (p)) & (IC_MASK >> 3)) != 0) +#define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0) +#define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0) -#define IcStipStrideToBitsStride(s) (((s) >> (IC_SHIFT - IC_STIP_SHIFT))) -#define IcBitsStrideToStipStride(s) (((s) << (IC_SHIFT - IC_STIP_SHIFT))) +#define IcStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT))) +#define IcBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT))) -#define IcFullMask(n) ((n) == IC_UNIT ? IC_ALLONES : ((((pixman_bits_t) 1) << n) - 1)) +#define IcFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((pixman_bits_t) 1) << n) - 1)) typedef uint32_t IcStip; typedef int IcStride; -#ifdef IC_DEBUG +#ifdef FB_DEBUG extern void IcValidateDrawable(DrawablePtr d); extern void IcInitializeDrawable(DrawablePtr d); extern void IcSetBits (IcStip *bits, int stride, IcStip data); -#define IC_HEAD_BITS (IcStip) (0xbaadf00d) -#define IC_TAIL_BITS (IcStip) (0xbaddf0ad) +#define FB_HEAD_BITS (IcStip) (0xbaadf00d) +#define FB_TAIL_BITS (IcStip) (0xbaddf0ad) #else #define IcValidateDrawable(d) #define fdInitializeDrawable(d) @@ -166,8 +166,8 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); #else #define IcScrLeft(x,n) ((x) << (n)) #define IcScrRight(x,n) ((x) >> (n)) -/* #define IcLeftBits(x,n) ((x) >> (IC_UNIT - (n))) */ -#define IcLeftStipBits(x,n) ((x) >> (IC_STIP_UNIT - (n))) +/* #define IcLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */ +#define IcLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n))) #define IcStipMoveLsb(x,s,n) (x) #define IcPatternOffsetBits (sizeof (pixman_bits_t) - 1) #endif @@ -175,27 +175,27 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); #define IcStipLeft(x,n) IcScrLeft(x,n) #define IcStipRight(x,n) IcScrRight(x,n) -#define IcRotLeft(x,n) IcScrLeft(x,n) | (n ? IcScrRight(x,IC_UNIT-n) : 0) -#define IcRotRight(x,n) IcScrRight(x,n) | (n ? IcScrLeft(x,IC_UNIT-n) : 0) +#define IcRotLeft(x,n) IcScrLeft(x,n) | (n ? IcScrRight(x,FB_UNIT-n) : 0) +#define IcRotRight(x,n) IcScrRight(x,n) | (n ? IcScrLeft(x,FB_UNIT-n) : 0) -#define IcRotStipLeft(x,n) IcStipLeft(x,n) | (n ? IcStipRight(x,IC_STIP_UNIT-n) : 0) -#define IcRotStipRight(x,n) IcStipRight(x,n) | (n ? IcStipLeft(x,IC_STIP_UNIT-n) : 0) +#define IcRotStipLeft(x,n) IcStipLeft(x,n) | (n ? IcStipRight(x,FB_STIP_UNIT-n) : 0) +#define IcRotStipRight(x,n) IcStipRight(x,n) | (n ? IcStipLeft(x,FB_STIP_UNIT-n) : 0) -#define IcLeftMask(x) ( ((x) & IC_MASK) ? \ - IcScrRight(IC_ALLONES,(x) & IC_MASK) : 0) -#define IcRightMask(x) ( ((IC_UNIT - (x)) & IC_MASK) ? \ - IcScrLeft(IC_ALLONES,(IC_UNIT - (x)) & IC_MASK) : 0) +#define IcLeftMask(x) ( ((x) & FB_MASK) ? \ + IcScrRight(FB_ALLONES,(x) & FB_MASK) : 0) +#define IcRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \ + IcScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0) -#define IcLeftStipMask(x) ( ((x) & IC_STIP_MASK) ? \ - IcStipRight(IC_STIP_ALLONES,(x) & IC_STIP_MASK) : 0) -#define IcRightStipMask(x) ( ((IC_STIP_UNIT - (x)) & IC_STIP_MASK) ? \ - IcScrLeft(IC_STIP_ALLONES,(IC_STIP_UNIT - (x)) & IC_STIP_MASK) : 0) +#define IcLeftStipMask(x) ( ((x) & FB_STIP_MASK) ? \ + IcStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) : 0) +#define IcRightStipMask(x) ( ((FB_STIP_UNIT - (x)) & FB_STIP_MASK) ? \ + IcScrLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - (x)) & FB_STIP_MASK) : 0) -#define IcBitsMask(x,w) (IcScrRight(IC_ALLONES,(x) & IC_MASK) & \ - IcScrLeft(IC_ALLONES,(IC_UNIT - ((x) + (w))) & IC_MASK)) +#define IcBitsMask(x,w) (IcScrRight(FB_ALLONES,(x) & FB_MASK) & \ + IcScrLeft(FB_ALLONES,(FB_UNIT - ((x) + (w))) & FB_MASK)) -#define IcStipMask(x,w) (IcStipRight(IC_STIP_ALLONES,(x) & IC_STIP_MASK) & \ - IcStipLeft(IC_STIP_ALLONES,(IC_STIP_UNIT - ((x)+(w))) & IC_STIP_MASK)) +#define IcStipMask(x,w) (IcStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \ + IcStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK)) #define IcMaskBits(x,w,l,n,r) { \ @@ -203,14 +203,14 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); r = IcRightMask((x)+n); \ l = IcLeftMask(x); \ if (l) { \ - n -= IC_UNIT - ((x) & IC_MASK); \ + n -= FB_UNIT - ((x) & FB_MASK); \ if (n < 0) { \ n = 0; \ l &= r; \ r = 0; \ } \ } \ - n >>= IC_SHIFT; \ + n >>= FB_SHIFT; \ } #ifdef ICNOPIXADDR @@ -243,7 +243,7 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); if (r) { \ /* compute right byte length */ \ if ((copy) && (((x) + n) & 7) == 0) { \ - rb = (((x) + n) & IC_MASK) >> 3; \ + rb = (((x) + n) & FB_MASK) >> 3; \ } else { \ rb = IcByteMaskInvalid; \ } \ @@ -252,18 +252,18 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); if (l) { \ /* compute left byte length */ \ if ((copy) && ((x) & 7) == 0) { \ - lb = ((x) & IC_MASK) >> 3; \ + lb = ((x) & FB_MASK) >> 3; \ } else { \ lb = IcByteMaskInvalid; \ } \ /* subtract out the portion painted by leftMask */ \ - n -= IC_UNIT - ((x) & IC_MASK); \ + n -= FB_UNIT - ((x) & FB_MASK); \ if (n < 0) { \ if (lb != IcByteMaskInvalid) { \ if (rb == IcByteMaskInvalid) { \ lb = IcByteMaskInvalid; \ } else if (rb) { \ - lb |= (rb - lb) << (IC_SHIFT - 3); \ + lb |= (rb - lb) << (FB_SHIFT - 3); \ rb = 0; \ } \ } \ @@ -272,33 +272,33 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); r = 0; \ }\ } \ - n >>= IC_SHIFT; \ + n >>= FB_SHIFT; \ } -#if IC_SHIFT == 6 +#if FB_SHIFT == 6 #define IcDoLeftMaskByteRRop6Cases(dst,xor) \ - case (sizeof (pixman_bits_t) - 7) | (1 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 7) | (1 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 7) | (2 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 7) | (2 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint8_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 7) | (3 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 7) | (3 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 7) | (4 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 7) | (4 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 7) | (5 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 7) | (5 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 7) | (6 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 7) | (6 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ @@ -309,21 +309,21 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 6) | (1 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 6) | (1 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint8_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 6) | (2 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 6) | (2 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 6) | (3 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 6) | (3 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 6) | (4 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 6) | (4 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 6) | (5 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 6) | (5 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ @@ -332,18 +332,18 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 5) | (1 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 5) | (1 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 5) | (2 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 5) | (2 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 5) | (3 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 5) | (3 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 5) | (4 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 5) | (4 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ @@ -352,13 +352,13 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); IcStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 4) | (1 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 4) | (1 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 4) | (2 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 4) | (2 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 4) | (3 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 4) | (3 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ break; \ @@ -391,14 +391,14 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); #define IcDoLeftMaskByteRRop(dst,lb,l,and,xor) { \ switch (lb) { \ IcDoLeftMaskByteRRop6Cases(dst,xor) \ - case (sizeof (pixman_bits_t) - 3) | (1 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 3) | (1 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 3,uint8_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 3) | (2 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 3) | (2 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 3,uint8_t,xor); \ IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ break; \ - case (sizeof (pixman_bits_t) - 2) | (1 << (IC_SHIFT - 3)): \ + case (sizeof (pixman_bits_t) - 2) | (1 << (FB_SHIFT - 3)): \ IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ break; \ case sizeof (pixman_bits_t) - 3: \ @@ -440,14 +440,14 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); r = IcRightStipMask((x)+n); \ l = IcLeftStipMask(x); \ if (l) { \ - n -= IC_STIP_UNIT - ((x) & IC_STIP_MASK); \ + n -= FB_STIP_UNIT - ((x) & FB_STIP_MASK); \ if (n < 0) { \ n = 0; \ l &= r; \ r = 0; \ } \ } \ - n >>= IC_STIP_SHIFT; \ + n >>= FB_STIP_SHIFT; \ } /* @@ -479,11 +479,11 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); ((void)IcLaneCase4((n)&15,a,o), \ IcLaneCase4((n)>>4,a,(o)+4))) -#if IC_SHIFT == 6 +#if FB_SHIFT == 6 #define IcLaneCase(n,a) IcLaneCase8(n,(uint8_t *) (a),0) #endif -#if IC_SHIFT == 5 +#if FB_SHIFT == 5 #define IcLaneCase(n,a) IcLaneCase4(n,(uint8_t *) (a),0) #endif @@ -491,14 +491,14 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); #define IcRot24(p,b) (IcScrRight(p,b) | IcScrLeft(p,24-(b))) #define IcRot24Stip(p,b) (IcStipRight(p,b) | IcStipLeft(p,24-(b))) -/* step a filled pixel value to the next/previous IC_UNIT alignment */ -#define IcNext24Pix(p) (IcRot24(p,(24-IC_UNIT%24))) -#define IcPrev24Pix(p) (IcRot24(p,IC_UNIT%24)) -#define IcNext24Stip(p) (IcRot24(p,(24-IC_STIP_UNIT%24))) -#define IcPrev24Stip(p) (IcRot24(p,IC_STIP_UNIT%24)) +/* step a filled pixel value to the next/previous FB_UNIT alignment */ +#define IcNext24Pix(p) (IcRot24(p,(24-FB_UNIT%24))) +#define IcPrev24Pix(p) (IcRot24(p,FB_UNIT%24)) +#define IcNext24Stip(p) (IcRot24(p,(24-FB_STIP_UNIT%24))) +#define IcPrev24Stip(p) (IcRot24(p,FB_STIP_UNIT%24)) /* step a rotation value to the next/previous rotation value */ -#if IC_UNIT == 64 +#if FB_UNIT == 64 #define IcNext24Rot(r) ((r) == 16 ? 0 : (r) + 8) #define IcPrev24Rot(r) ((r) == 0 ? 16 : (r) - 8) @@ -510,7 +510,7 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); #endif -#if IC_UNIT == 32 +#if FB_UNIT == 32 #define IcNext24Rot(r) ((r) == 0 ? 16 : (r) - 8) #define IcPrev24Rot(r) ((r) == 16 ? 0 : (r) + 8) @@ -543,7 +543,7 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); (yoff) = icpixels->y; \ } -#ifdef IC_OLD_SCREEN +#ifdef FB_OLD_SCREEN #define BitsPerPixel(d) (\ ((1 << PixmapWidthPaddingInfo[d].padBytesLog2) * 8 / \ (PixmapWidthPaddingInfo[d].padRoundUp+1))) @@ -551,14 +551,14 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); #define IcPowerOfTwo(w) (((w) & ((w) - 1)) == 0) /* - * Accelerated tiles are power of 2 width <= IC_UNIT + * Accelerated tiles are power of 2 width <= FB_UNIT */ -#define IcEvenTile(w) ((w) <= IC_UNIT && IcPowerOfTwo(w)) +#define IcEvenTile(w) ((w) <= FB_UNIT && IcPowerOfTwo(w)) /* - * Accelerated stipples are power of 2 width and <= IC_UNIT/dstBpp + * Accelerated stipples are power of 2 width and <= FB_UNIT/dstBpp * with dstBpp a power of 2 as well */ -#define IcEvenStip(w,bpp) ((w) * (bpp) <= IC_UNIT && IcPowerOfTwo(w) && IcPowerOfTwo(bpp)) +#define IcEvenStip(w,bpp) ((w) * (bpp) <= FB_UNIT && IcPowerOfTwo(w) && IcPowerOfTwo(bpp)) /* * icblt.c @@ -636,7 +636,7 @@ IcBltOne (IcStip *src, pixman_bits_t bgand, pixman_bits_t bgxor); -#ifdef IC_24BIT +#ifdef FB_24BIT pixman_private void IcBltOne24 (IcStip *src, IcStride srcStride, /* IcStip units per scanline */ @@ -793,7 +793,7 @@ fbRasterizeTrapezoid (pixman_image_t *pMask, # define _IcOnes(mask) __builtin_popcountl((mask) & 0xffffffff) # endif #else -# define ICINT_NEED_IC_ONES +# define ICINT_NEED_FB_ONES int _IcOnes(unsigned long mask); #endif diff --git a/pixman/src/icpixels.c b/pixman/src/icpixels.c index 494dada30..8aa373c3a 100644 --- a/pixman/src/icpixels.c +++ b/pixman/src/icpixels.c @@ -1,5 +1,5 @@ /* - * $Id: icpixels.c,v 1.7 2005-03-02 15:43:33 cworth Exp $ + * $Id: icpixels.c,v 1.8 2005-06-25 01:21:16 jrmuizel Exp $ * * Copyright © 1998 Keith Packard * @@ -22,7 +22,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include "icint.h" +#include "pixman-xserver-compat.h" static void IcPixelsInit (IcPixels *pixels, pixman_bits_t *buf, int width, int height, int depth, int bpp, int stride); @@ -59,7 +59,7 @@ IcPixelsCreate (int width, int height, int depth) unsigned int base; bpp = pixman_bits_per_pixel (depth); - stride = ((width * bpp + IC_MASK) >> IC_SHIFT) * sizeof (pixman_bits_t); + stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (pixman_bits_t); buf_size = height * stride; base = sizeof (IcPixels); adjust = 0; diff --git a/pixman/src/icrop.h b/pixman/src/icrop.h index 7ea81f158..334bd4bd3 100644 --- a/pixman/src/icrop.h +++ b/pixman/src/icrop.h @@ -43,7 +43,7 @@ extern const IcMergeRopRec IcMergeRopBits[16] pixman_private; _cx2 = _bits->cx2 & pm; \ } -#define IcDestInvarientRop(alu,pm) ((pm) == IC_ALLONES && \ +#define IcDestInvarientRop(alu,pm) ((pm) == FB_ALLONES && \ (((alu) >> 1 & 5) == ((alu) & 5))) #define IcDestInvarientMergeRop() (_ca1 == 0 && _cx1 == 0) @@ -100,7 +100,7 @@ extern const IcMergeRopRec IcMergeRopBits[16] pixman_private; /* half of table */ extern const pixman_bits_t icStipple16Bits[256] pixman_private; #define IcStipple16Bits(b) \ - (icStipple16Bits[(b)&0xff] | icStipple16Bits[(b) >> 8] << IC_HALFUNIT) + (icStipple16Bits[(b)&0xff] | icStipple16Bits[(b) >> 8] << FB_HALFUNIT) pixman_private const pixman_bits_t * IcStippleTable(int bits); diff --git a/pixman/src/icstipple.c b/pixman/src/icstipple.c index cde49c466..dbde65b1f 100644 --- a/pixman/src/icstipple.c +++ b/pixman/src/icstipple.c @@ -42,11 +42,11 @@ #define LaneCases128(c,a) LaneCases64(c,a); LaneCases64(c+64,a) #define LaneCases256(c,a) LaneCases128(c,a); LaneCases128(c+128,a) -#if IC_SHIFT == 6 +#if FB_SHIFT == 6 #define LaneCases(a) LaneCases256(0,a) #endif -#if IC_SHIFT == 5 +#if FB_SHIFT == 5 #define LaneCases(a) LaneCases16(0,a) #endif @@ -66,7 +66,7 @@ IcTransparentSpan (FbBits *dst, s |= ((IcStip) (stip >> 8) & 0x02); s |= ((IcStip) (stip >> 16) & 0x04); s |= ((IcStip) (stip >> 24) & 0x08); -#if IC_SHIFT > 5 +#if FB_SHIFT > 5 s |= ((IcStip) (stip >> 32) & 0x10); s |= ((IcStip) (stip >> 40) & 0x20); s |= ((IcStip) (stip >> 48) & 0x40); diff --git a/pixman/src/icutil.c b/pixman/src/icutil.c index 549217000..2e04b7106 100644 --- a/pixman/src/icutil.c +++ b/pixman/src/icutil.c @@ -22,7 +22,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include "icint.h" +#include "pixman-xserver-compat.h" pixman_bits_t IcReplicatePixel (Pixel p, int bpp) @@ -30,7 +30,7 @@ IcReplicatePixel (Pixel p, int bpp) pixman_bits_t b = p; b &= IcFullMask (bpp); - while (bpp < IC_UNIT) + while (bpp < FB_UNIT) { b |= b << bpp; bpp <<= 1; @@ -39,7 +39,7 @@ IcReplicatePixel (Pixel p, int bpp) } #define O 0 -#define I IC_ALLONES +#define I FB_ALLONES const IcMergeRopRec IcMergeRopBits[16] = { { O,O,O,O }, /* clear 0x0 0 */ @@ -65,8 +65,8 @@ const IcMergeRopRec IcMergeRopBits[16] = { * as bitorder == byteorder. IC doesn't handle the case * where these differ */ -#define BitsMask(x,w) ((IC_ALLONES << ((x) & IC_MASK)) & \ - (IC_ALLONES >> ((IC_UNIT - ((x) + (w))) & IC_MASK))) +#define BitsMask(x,w) ((FB_ALLONES << ((x) & FB_MASK)) & \ + (FB_ALLONES >> ((FB_UNIT - ((x) + (w))) & FB_MASK))) #define Mask(x,w) BitsMask((x)*(w),(w)) @@ -96,7 +96,7 @@ const IcMergeRopRec IcMergeRopBits[16] = { SelMask(b,6,w) | \ SelMask(b,7,w)) -#if IC_UNIT == 16 +#if FB_UNIT == 16 #define icStipple16Bits 0 #define icStipple8Bits 0 static const pixman_bits_t icStipple4Bits[16] = { @@ -110,7 +110,7 @@ static const pixman_bits_t icStipple1Bits[2] = { C1( 0,16), C1( 1,16), }; #endif -#if IC_UNIT == 32 +#if FB_UNIT == 32 #define icStipple16Bits 0 static const pixman_bits_t icStipple8Bits[256] = { C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4), @@ -168,7 +168,7 @@ static const pixman_bits_t icStipple1Bits[2] = { C1( 0,32), C1( 1,32), }; #endif -#if IC_UNIT == 64 +#if FB_UNIT == 64 const pixman_bits_t icStipple16Bits[256] = { C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4), C8( 6,4), C8( 7,4), C8( 8,4), C8( 9,4), C8( 10,4), C8( 11,4), diff --git a/pixman/src/pixman-xserver-compat.h b/pixman/src/pixman-xserver-compat.h index 6ee83737a..3050b6d59 100644 --- a/pixman/src/pixman-xserver-compat.h +++ b/pixman/src/pixman-xserver-compat.h @@ -68,9 +68,11 @@ typedef pixman_trapezoid_t xTrapezoid; typedef pixman_triangle_t xTriangle; #define RENDER 1 +/* #define FB_SHIFT IC_SHIFT #define FB_MASK IC_MASK #define FB_ALLONES IC_ALLONES +*/ #define FbMaskBits IcMaskBits /* XXX: We changed some function and field names which makes for some diff --git a/pixman/src/pixman.h b/pixman/src/pixman.h index c94584fbc..2b41e86ab 100644 --- a/pixman/src/pixman.h +++ b/pixman/src/pixman.h @@ -54,7 +54,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -/* $Id: pixman.h,v 1.20 2005-05-18 16:25:54 cworth Exp $ */ +/* $Id: pixman.h,v 1.21 2005-06-25 01:21:16 jrmuizel Exp $ */ /* libic.h */ @@ -272,6 +272,7 @@ pixman_image_create (pixman_format_t *format, */ #ifndef IC_SHIFT #define IC_SHIFT 5 +#define FB_SHIFT IC_SHIFT typedef uint32_t pixman_bits_t; #endif -- cgit v1.2.3 From 42fc090745c8d262b8348b9f7a6c204e9a9b2379 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Fri, 24 Jun 2005 18:28:19 +0000 Subject: selective s/Ic/fb/g. I took out the list of functions because it was ridiculously long. --- pixman/ChangeLog | 16 ++ pixman/src/ic.c | 96 +++++----- pixman/src/icblt.c | 34 ++-- pixman/src/icbltone.c | 96 +++++----- pixman/src/iccompose.c | 466 ++++++++++++++++++++++++------------------------- pixman/src/icimage.h | 2 +- pixman/src/icint.h | 30 ++-- pixman/src/icrop.h | 26 +-- pixman/src/icstipple.c | 2 +- pixman/src/icutil.c | 42 ++--- 10 files changed, 413 insertions(+), 397 deletions(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index 49e1c6886..1e69c7ab4 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,19 @@ +2005-06-24 Jeff Muizelaar + + * src/ic.c: + * src/icblt.c: + * src/icbltone.c: + * src/iccompose.c: + * src/icimage.h: + * src/icint.h: + * src/icrop.h: + * src/icstipple.c: + * src/icutil.c: + + selective s/Ic/fb/g. + + I took out the list of functions because it was ridiculously long. + 2005-06-24 Jeff Muizelaar * src/ic.c: (pixman_compositeSrcAdd_1000x1000), diff --git a/pixman/src/ic.c b/pixman/src/ic.c index c55da1c9a..7ccb3539c 100644 --- a/pixman/src/ic.c +++ b/pixman/src/ic.c @@ -51,7 +51,7 @@ #endif static uint32_t -IcOver (uint32_t x, uint32_t y) +fbOver (uint32_t x, uint32_t y) { uint16_t a = ~x >> 24; uint16_t t; @@ -65,7 +65,7 @@ IcOver (uint32_t x, uint32_t y) } static uint32_t -IcOver24 (uint32_t x, uint32_t y) +fbOver24 (uint32_t x, uint32_t y) { uint16_t a = ~x >> 24; uint16_t t; @@ -78,7 +78,7 @@ IcOver24 (uint32_t x, uint32_t y) } static uint32_t -IcIn (uint32_t x, uint8_t y) +fbIn (uint32_t x, uint8_t y) { uint16_t a = y; uint16_t t; @@ -91,7 +91,7 @@ IcIn (uint32_t x, uint8_t y) return m|n|o|p; } -#define IcComposeGetSolid(image, bits) { \ +#define fbComposeGetSolid(image, bits) { \ FbBits *__bits__; \ IcStride __stride__; \ int __bpp__; \ @@ -117,7 +117,7 @@ IcIn (uint32_t x, uint8_t y) (bits) |= 0xff000000; \ } -#define IcComposeGetStart(image,x,y,type,stride,line,mul) {\ +#define fbComposeGetStart(image,x,y,type,stride,line,mul) {\ FbBits *__bits__; \ IcStride __stride__; \ int __bpp__; \ @@ -154,15 +154,15 @@ pixman_compositeSolidMask_nx8x8888 (pixman_operator_t op, IcStride dstStride, maskStride; uint16_t w; - IcComposeGetSolid(iSrc, src); + fbComposeGetSolid(iSrc, src); dstMask = IcFullMask (iDst->pixels->depth); srca = src >> 24; if (src == 0) return; - IcComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); - IcComposeGetStart (iMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); + fbComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); + fbComposeGetStart (iMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); while (height--) { @@ -180,12 +180,12 @@ pixman_compositeSolidMask_nx8x8888 (pixman_operator_t op, if (srca == 0xff) *dst = src & dstMask; else - *dst = IcOver (src, *dst) & dstMask; + *dst = fbOver (src, *dst) & dstMask; } else if (m) { - d = IcIn (src, m); - *dst = IcOver (d, *dst) & dstMask; + d = fbIn (src, m); + *dst = fbOver (d, *dst) & dstMask; } dst++; } @@ -213,15 +213,15 @@ pixman_compositeSolidMask_nx8888x8888C (pixman_operator_t op, uint16_t w; uint32_t m, n, o, p; - IcComposeGetSolid(iSrc, src); + fbComposeGetSolid(iSrc, src); dstMask = IcFullMask (iDst->pixels->depth); srca = src >> 24; if (src == 0) return; - IcComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); - IcComposeGetStart (iMask, xMask, yMask, uint32_t, maskStride, maskLine, 1); + fbComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); + fbComposeGetStart (iMask, xMask, yMask, uint32_t, maskStride, maskLine, 1); while (height--) { @@ -239,7 +239,7 @@ pixman_compositeSolidMask_nx8888x8888C (pixman_operator_t op, if (srca == 0xff) *dst = src & dstMask; else - *dst = IcOver (src, *dst) & dstMask; + *dst = fbOver (src, *dst) & dstMask; } else if (ma) { @@ -286,14 +286,14 @@ pixman_compositeSolidMask_nx8x0888 (pixman_operator_t op, IcStride dstStride, maskStride; uint16_t w; - IcComposeGetSolid(iSrc, src); + fbComposeGetSolid(iSrc, src); srca = src >> 24; if (src == 0) return; - IcComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 3); - IcComposeGetStart (iMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); + fbComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 3); + fbComposeGetStart (iMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); while (height--) { @@ -313,13 +313,13 @@ pixman_compositeSolidMask_nx8x0888 (pixman_operator_t op, else { d = Fetch24(dst); - d = IcOver24 (src, d); + d = fbOver24 (src, d); } Store24(dst,d); } else if (m) { - d = IcOver24 (IcIn(src,m), Fetch24(dst)); + d = fbOver24 (fbIn(src,m), Fetch24(dst)); Store24(dst,d); } dst += 3; @@ -348,14 +348,14 @@ pixman_compositeSolidMask_nx8x0565 (pixman_operator_t op, IcStride dstStride, maskStride; uint16_t w; - IcComposeGetSolid(iSrc, src); + fbComposeGetSolid(iSrc, src); srca = src >> 24; if (src == 0) return; - IcComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); - IcComposeGetStart (iMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); + fbComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); + fbComposeGetStart (iMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); while (height--) { @@ -375,14 +375,14 @@ pixman_compositeSolidMask_nx8x0565 (pixman_operator_t op, else { d = *dst; - d = IcOver24 (src, cvt0565to8888(d)); + d = fbOver24 (src, cvt0565to8888(d)); } *dst = cvt8888to0565(d); } else if (m) { d = *dst; - d = IcOver24 (IcIn(src,m), cvt0565to8888(d)); + d = fbOver24 (fbIn(src,m), cvt0565to8888(d)); *dst = cvt8888to0565(d); } dst++; @@ -413,7 +413,7 @@ pixman_compositeSolidMask_nx8888x0565C (pixman_operator_t op, uint16_t w; uint32_t m, n, o; - IcComposeGetSolid(iSrc, src); + fbComposeGetSolid(iSrc, src); srca = src >> 24; if (src == 0) @@ -421,8 +421,8 @@ pixman_compositeSolidMask_nx8888x0565C (pixman_operator_t op, src16 = cvt8888to0565(src); - IcComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); - IcComposeGetStart (iMask, xMask, yMask, uint32_t, maskStride, maskLine, 1); + fbComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); + fbComposeGetStart (iMask, xMask, yMask, uint32_t, maskStride, maskLine, 1); while (height--) { @@ -444,7 +444,7 @@ pixman_compositeSolidMask_nx8888x0565C (pixman_operator_t op, else { d = *dst; - d = IcOver24 (src, cvt0565to8888(d)); + d = fbOver24 (src, cvt0565to8888(d)); *dst = cvt8888to0565(d); } } @@ -483,8 +483,8 @@ pixman_compositeSrc_8888x8888 (pixman_operator_t op, uint8_t a; uint16_t w; - IcComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); - IcComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); + fbComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); + fbComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); dstMask = IcFullMask (iDst->pixels->depth); @@ -503,7 +503,7 @@ pixman_compositeSrc_8888x8888 (pixman_operator_t op, if (a == 0xff) *dst = s & dstMask; else if (a) - *dst = IcOver (s, *dst) & dstMask; + *dst = fbOver (s, *dst) & dstMask; dst++; } } @@ -530,8 +530,8 @@ pixman_compositeSrc_8888x0888 (pixman_operator_t op, IcStride dstStride, srcStride; uint16_t w; - IcComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 3); - IcComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); + fbComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 3); + fbComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); while (height--) { @@ -550,7 +550,7 @@ pixman_compositeSrc_8888x0888 (pixman_operator_t op, if (a == 0xff) d = s; else - d = IcOver24 (s, Fetch24(dst)); + d = fbOver24 (s, Fetch24(dst)); Store24(dst,d); } dst += 3; @@ -579,8 +579,8 @@ pixman_compositeSrc_8888x0565 (pixman_operator_t op, IcStride dstStride, srcStride; uint16_t w; - IcComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - IcComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); + fbComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); + fbComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); while (height--) { @@ -601,7 +601,7 @@ pixman_compositeSrc_8888x0565 (pixman_operator_t op, else { d = *dst; - d = IcOver24 (s, cvt0565to8888(d)); + d = fbOver24 (s, cvt0565to8888(d)); } *dst = cvt8888to0565(d); } @@ -629,9 +629,9 @@ pixman_compositeSrc_0565x0565 (pixman_operator_t op, IcStride dstStride, srcStride; uint16_t w; - IcComposeGetStart (iSrc, xSrc, ySrc, uint16_t, srcStride, srcLine, 1); + fbComposeGetStart (iSrc, xSrc, ySrc, uint16_t, srcStride, srcLine, 1); - IcComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); + fbComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); while (height--) { @@ -667,8 +667,8 @@ pixman_compositeSrcAdd_8000x8000 (pixman_operator_t op, uint8_t s, d; uint16_t t; - IcComposeGetStart (iSrc, xSrc, ySrc, uint8_t, srcStride, srcLine, 1); - IcComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); + fbComposeGetStart (iSrc, xSrc, ySrc, uint8_t, srcStride, srcLine, 1); + fbComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); while (height--) { @@ -718,8 +718,8 @@ pixman_compositeSrcAdd_8888x8888 (pixman_operator_t op, uint16_t t; uint32_t m,n,o,p; - IcComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - IcComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); + fbComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); + fbComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); while (height--) { @@ -777,7 +777,7 @@ pixman_compositeSrcAdd_1000x1000 (pixman_operator_t op, IcGetPixels(iDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff); - IcBlt (srcBits + srcStride * (ySrc + srcYoff), + fbBlt (srcBits + srcStride * (ySrc + srcYoff), srcStride, xSrc + srcXoff, @@ -818,7 +818,7 @@ pixman_compositeSolidMask_nx1xn (pixman_operator_t op, int maskXoff, maskYoff; FbBits src; - IcComposeGetSolid(iSrc, src); + fbComposeGetSolid(iSrc, src); if ((src & 0xff000000) != 0xff000000) { @@ -840,9 +840,9 @@ pixman_compositeSolidMask_nx1xn (pixman_operator_t op, break; } - src = IcReplicatePixel (src, dstBpp); + src = fbReplicatePixel (src, dstBpp); - IcBltOne (maskBits + maskStride * (yMask + maskYoff), + fbBltOne (maskBits + maskStride * (yMask + maskYoff), maskStride, xMask + maskXoff, diff --git a/pixman/src/icblt.c b/pixman/src/icblt.c index f34abb941..2fc536350 100644 --- a/pixman/src/icblt.c +++ b/pixman/src/icblt.c @@ -37,7 +37,7 @@ } void -IcBlt (FbBits *srcLine, +fbBlt (FbBits *srcLine, IcStride srcStride, int srcX, @@ -91,7 +91,7 @@ IcBlt (FbBits *srcLine, #ifdef FB_24BIT if (bpp == 24 && !IcCheck24Pix (pm)) { - IcBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX, + fbBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX, width, height, alu, pm, reverse, upsidedown); return; } @@ -173,7 +173,7 @@ IcBlt (FbBits *srcLine, #if 0 /* * This provides some speedup on screen->screen blts - * over the PCI bus, usually about 10%. But Ic + * over the PCI bus, usually about 10%. But fb * isn't usually used for this operation... */ if (_ca2 + 1 == 0 && _cx2 == 0) @@ -350,7 +350,7 @@ getPixel (char *src, int x) #endif static void -IcBlt24Line (FbBits *src, +fbBlt24Line (FbBits *src, int srcX, FbBits *dst, @@ -564,7 +564,7 @@ IcBlt24Line (FbBits *src, } void -IcBlt24 (FbBits *srcLine, +fbBlt24 (FbBits *srcLine, IcStride srcStride, int srcX, @@ -590,7 +590,7 @@ IcBlt24 (FbBits *srcLine, } while (height--) { - IcBlt24Line (srcLine, srcX, dstLine, dstX, width, alu, pm, reverse); + fbBlt24Line (srcLine, srcX, dstLine, dstX, width, alu, pm, reverse); srcLine += srcStride; dstLine += dstStride; } @@ -608,7 +608,7 @@ IcBlt24 (FbBits *srcLine, */ void -IcBltOdd (FbBits *srcLine, +fbBltOdd (FbBits *srcLine, IcStride srcStrideEven, IcStride srcStrideOdd, int srcXEven, @@ -781,7 +781,7 @@ IcBltOdd (FbBits *srcLine, #ifdef FB_24BIT void -IcBltOdd24 (FbBits *srcLine, +fbBltOdd24 (FbBits *srcLine, IcStride srcStrideEven, IcStride srcStrideOdd, int srcXEven, @@ -805,7 +805,7 @@ IcBltOdd24 (FbBits *srcLine, { if (even) { - IcBlt24Line (srcLine, srcXEven, dstLine, dstXEven, + fbBlt24Line (srcLine, srcXEven, dstLine, dstXEven, width, alu, pm, 0); srcLine += srcStrideEven; dstLine += dstStrideEven; @@ -813,7 +813,7 @@ IcBltOdd24 (FbBits *srcLine, } else { - IcBlt24Line (srcLine, srcXOdd, dstLine, dstXOdd, + fbBlt24Line (srcLine, srcXOdd, dstLine, dstXOdd, width, alu, pm, 0); srcLine += srcStrideOdd; dstLine += dstStrideOdd; @@ -830,7 +830,7 @@ IcBltOdd24 (FbBits *srcLine, #if FB_STIP_SHIFT != FB_SHIFT void -IcSetBltOdd (IcStip *stip, +fbSetBltOdd (IcStip *stip, IcStride stipStride, int srcX, FbBits **bits, @@ -872,7 +872,7 @@ IcSetBltOdd (IcStip *stip, #endif void -IcBltStip (IcStip *src, +fbBltStip (IcStip *src, IcStride srcStride, /* in IcStip units, not FbBits units */ int srcX, @@ -903,12 +903,12 @@ IcBltStip (IcStip *src, dst += dstX >> FB_STIP_SHIFT; dstX &= FB_STIP_MASK; - IcSetBltOdd (src, srcStride, srcX, + fbSetBltOdd (src, srcStride, srcX, &s, &srcStrideEven, &srcStrideOdd, &srcXEven, &srcXOdd); - IcSetBltOdd (dst, dstStride, dstX, + fbSetBltOdd (dst, dstStride, dstX, &d, &dstStrideEven, &dstStrideOdd, &dstXEven, &dstXOdd); @@ -916,7 +916,7 @@ IcBltStip (IcStip *src, #ifdef FB_24BIT if (bpp == 24 && !IcCheck24Pix (pm)) { - IcBltOdd24 (s, srcStrideEven, srcStrideOdd, + fbBltOdd24 (s, srcStrideEven, srcStrideOdd, srcXEven, srcXOdd, d, dstStrideEven, dstStrideOdd, @@ -927,7 +927,7 @@ IcBltStip (IcStip *src, else #endif { - IcBltOdd (s, srcStrideEven, srcStrideOdd, + fbBltOdd (s, srcStrideEven, srcStrideOdd, srcXEven, srcXOdd, d, dstStrideEven, dstStrideOdd, @@ -939,7 +939,7 @@ IcBltStip (IcStip *src, else #endif { - IcBlt ((FbBits *) src, IcStipStrideToBitsStride (srcStride), + fbBlt ((FbBits *) src, IcStipStrideToBitsStride (srcStride), srcX, (FbBits *) dst, IcStipStrideToBitsStride (dstStride), dstX, diff --git a/pixman/src/icbltone.c b/pixman/src/icbltone.c index a584a1bf1..f0fa80b7f 100644 --- a/pixman/src/icbltone.c +++ b/pixman/src/icbltone.c @@ -76,7 +76,7 @@ #endif #if FB_SHIFT == 6 -static uint8_t const Ic8Lane[256] = { +static uint8_t const fb8Lane[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, @@ -93,49 +93,49 @@ static uint8_t const Ic8Lane[256] = { 242, 243, 244,245,246,247,248,249,250,251,252,253,254,255, }; -static uint8_t const Ic16Lane[256] = { +static uint8_t const fb16Lane[256] = { 0x00, 0x03, 0x0c, 0x0f, 0x30, 0x33, 0x3c, 0x3f, 0xc0, 0xc3, 0xcc, 0xcf, 0xf0, 0xf3, 0xfc, 0xff, }; -static uint8_t const Ic32Lane[16] = { +static uint8_t const fb32Lane[16] = { 0x00, 0x0f, 0xf0, 0xff, }; #endif #if FB_SHIFT == 5 -static uint8_t const Ic8Lane[16] = { +static uint8_t const fb8Lane[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; -static uint8_t const Ic16Lane[16] = { +static uint8_t const fb16Lane[16] = { 0, 3, 12, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -static uint8_t const Ic32Lane[16] = { +static uint8_t const fb32Lane[16] = { 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; #endif static const uint8_t * -IcLaneTable(int bpp) +fbLaneTable(int bpp) { switch (bpp) { case 8: - return Ic8Lane; + return fb8Lane; case 16: - return Ic16Lane; + return fb16Lane; case 32: - return Ic32Lane; + return fb32Lane; } return 0; } #endif void -IcBltOne (IcStip *src, +fbBltOne (IcStip *src, IcStride srcStride, /* IcStip units per scanline */ int srcX, /* bit position of source */ FbBits *dst, @@ -168,14 +168,14 @@ IcBltOne (IcStip *src, int srcinc; /* source units consumed */ int endNeedsLoad = 0; /* need load for endmask */ #ifndef FBNOPIXADDR - const uint8_t *IcLane; + const uint8_t *fbLane; #endif int startbyte, endbyte; #ifdef FB_24BIT if (dstBpp == 24) { - IcBltOne24 (src, srcStride, srcX, + fbBltOne24 (src, srcStride, srcX, dst, dstStride, dstX, dstBpp, width, height, fgand, fgxor, bgand, bgxor); @@ -235,11 +235,11 @@ IcBltOne (IcStip *src, */ icbits = 0; /* unused */ if (pixelsPerDst <= 8) - icbits = IcStippleTable(pixelsPerDst); + icbits = fbStippleTable(pixelsPerDst); #ifndef FBNOPIXADDR - IcLane = 0; + fbLane = 0; if (transparent && fgand == 0 && dstBpp >= 8) - IcLane = IcLaneTable(dstBpp); + fbLane = fbLaneTable(dstBpp); #endif /* @@ -301,9 +301,9 @@ IcBltOne (IcStip *src, #endif mask = icbits[IcLeftStipBits(bits,pixelsPerDst)]; #ifndef FBNOPIXADDR - if (IcLane) + if (fbLane) { - IcTransparentSpan (dst, mask & startmask, fgxor, 1); + fbTransparentSpan (dst, mask & startmask, fgxor, 1); } else #endif @@ -342,11 +342,11 @@ IcBltOne (IcStip *src, else { #ifndef FBNOPIXADDR - if (IcLane) + if (fbLane) { while (bits && n) { - switch (IcLane[IcLeftStipBits(bits,pixelsPerDst)]) { + switch (fbLane[IcLeftStipBits(bits,pixelsPerDst)]) { LaneCases((uint8_t *) dst); } bits = IcStipLeft(bits,pixelsPerDst); @@ -399,9 +399,9 @@ IcBltOne (IcStip *src, #endif mask = icbits[IcLeftStipBits(bits,pixelsPerDst)]; #ifndef FBNOPIXADDR - if (IcLane) + if (fbLane) { - IcTransparentSpan (dst, mask & endmask, fgxor, 1); + fbTransparentSpan (dst, mask & endmask, fgxor, 1); } else #endif @@ -455,7 +455,7 @@ IcBltOne (IcStip *src, #define IcStip24New(rot) (2 + (rot != 0)) #define IcStip24Len 4 -static const FbBits icStipple24Bits[3][1 << IcStip24Len] = { +static const FbBits fbStipple24Bits[3][1 << IcStip24Len] = { /* rotate 0 */ { C4_24( 0, 0), C4_24( 1, 0), C4_24( 2, 0), C4_24( 3, 0), @@ -493,7 +493,7 @@ static const FbBits icStipple24Bits[3][1 << IcStip24Len] = { #define IcStip24New(rot) (1 + (rot == 8)) #endif -static const FbBits icStipple24Bits[3][1 << IcStip24Len] = { +static const FbBits fbStipple24Bits[3][1 << IcStip24Len] = { /* rotate 0 */ { C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0), @@ -527,7 +527,7 @@ static const FbBits icStipple24Bits[3][1 << IcStip24Len] = { #endif -#define IcFirstStipBits(len,stip) {\ +#define fbFirstStipBits(len,stip) {\ int __len = (len); \ if (len <= remain) { \ stip = IcLeftStipBits(bits, len); \ @@ -543,17 +543,17 @@ static const FbBits icStipple24Bits[3][1 << IcStip24Len] = { remain -= __len; \ } -#define IcInitStipBits(offset,len,stip) {\ +#define fbInitStipBits(offset,len,stip) {\ bits = IcStipLeft (*src++,offset); \ remain = FB_STIP_UNIT - offset; \ - IcFirstStipBits(len,stip); \ + fbFirstStipBits(len,stip); \ stip = IcMergeStip24Bits (0, stip, len); \ } -#define IcNextStipBits(rot,stip) {\ +#define fbNextStipBits(rot,stip) {\ int __new = IcStip24New(rot); \ IcStip __right; \ - IcFirstStipBits(__new, __right); \ + fbFirstStipBits(__new, __right); \ stip = IcMergeStip24Bits (stip, __right, __new); \ rot = IcNext24Rot (rot); \ } @@ -568,7 +568,7 @@ static const FbBits icStipple24Bits[3][1 << IcStip24Len] = { * and text */ void -IcBltOne24 (IcStip *srcLine, +fbBltOne24 (IcStip *srcLine, IcStride srcStride, /* IcStip units per scanline */ int srcX, /* bit position of source */ FbBits *dst, @@ -618,30 +618,30 @@ IcBltOne24 (IcStip *srcLine, rot = rot0; src = srcLine; srcLine += srcStride; - IcInitStipBits (srcX,firstlen, stip); + fbInitStipBits (srcX,firstlen, stip); if (leftMask) { - mask = icStipple24Bits[rot >> 3][stip]; + mask = fbStipple24Bits[rot >> 3][stip]; *dst = (*dst & ~leftMask) | (IcOpaqueStipple (mask, IcRot24(fgxor, rot), IcRot24(bgxor, rot)) & leftMask); dst++; - IcNextStipBits(rot,stip); + fbNextStipBits(rot,stip); } nl = nlMiddle; while (nl--) { - mask = icStipple24Bits[rot>>3][stip]; + mask = fbStipple24Bits[rot>>3][stip]; *dst = IcOpaqueStipple (mask, IcRot24(fgxor, rot), IcRot24(bgxor, rot)); dst++; - IcNextStipBits(rot,stip); + fbNextStipBits(rot,stip); } if (rightMask) { - mask = icStipple24Bits[rot >> 3][stip]; + mask = fbStipple24Bits[rot >> 3][stip]; *dst = (*dst & ~rightMask) | (IcOpaqueStipple (mask, IcRot24(fgxor, rot), IcRot24(bgxor, rot)) @@ -659,33 +659,33 @@ IcBltOne24 (IcStip *srcLine, rot = rot0; src = srcLine; srcLine += srcStride; - IcInitStipBits (srcX, firstlen, stip); + fbInitStipBits (srcX, firstlen, stip); if (leftMask) { if (stip) { - mask = icStipple24Bits[rot >> 3][stip] & leftMask; + mask = fbStipple24Bits[rot >> 3][stip] & leftMask; *dst = (*dst & ~mask) | (IcRot24(fgxor, rot) & mask); } dst++; - IcNextStipBits (rot, stip); + fbNextStipBits (rot, stip); } nl = nlMiddle; while (nl--) { if (stip) { - mask = icStipple24Bits[rot>>3][stip]; + mask = fbStipple24Bits[rot>>3][stip]; *dst = (*dst & ~mask) | (IcRot24(fgxor,rot) & mask); } dst++; - IcNextStipBits (rot, stip); + fbNextStipBits (rot, stip); } if (rightMask) { if (stip) { - mask = icStipple24Bits[rot >> 3][stip] & rightMask; + mask = fbStipple24Bits[rot >> 3][stip] & rightMask; *dst = (*dst & ~mask) | (IcRot24(fgxor, rot) & mask); } } @@ -699,10 +699,10 @@ IcBltOne24 (IcStip *srcLine, rot = rot0; src = srcLine; srcLine += srcStride; - IcInitStipBits (srcX, firstlen, stip); + fbInitStipBits (srcX, firstlen, stip); if (leftMask) { - mask = icStipple24Bits[rot >> 3][stip]; + mask = fbStipple24Bits[rot >> 3][stip]; *dst = IcStippleRRopMask (*dst, mask, IcRot24(fgand, rot), IcRot24(fgxor, rot), @@ -710,23 +710,23 @@ IcBltOne24 (IcStip *srcLine, IcRot24(bgxor, rot), leftMask); dst++; - IcNextStipBits(rot,stip); + fbNextStipBits(rot,stip); } nl = nlMiddle; while (nl--) { - mask = icStipple24Bits[rot >> 3][stip]; + mask = fbStipple24Bits[rot >> 3][stip]; *dst = IcStippleRRop (*dst, mask, IcRot24(fgand, rot), IcRot24(fgxor, rot), IcRot24(bgand, rot), IcRot24(bgxor, rot)); dst++; - IcNextStipBits(rot,stip); + fbNextStipBits(rot,stip); } if (rightMask) { - mask = icStipple24Bits[rot >> 3][stip]; + mask = fbStipple24Bits[rot >> 3][stip]; *dst = IcStippleRRopMask (*dst, mask, IcRot24(fgand, rot), IcRot24(fgxor, rot), diff --git a/pixman/src/iccompose.c b/pixman/src/iccompose.c index d6d64650b..7394c3822 100644 --- a/pixman/src/iccompose.c +++ b/pixman/src/iccompose.c @@ -36,7 +36,7 @@ */ static uint32_t -IcCombineMaskU (FbCompositeOperand *src, +fbCombineMaskU (FbCompositeOperand *src, FbCompositeOperand *msk) { uint32_t x; @@ -63,7 +63,7 @@ IcCombineMaskU (FbCompositeOperand *src, } static IcCompSrc -IcCombineMaskC (FbCompositeOperand *src, +fbCombineMaskC (FbCompositeOperand *src, FbCompositeOperand *msk) { IcCompSrc s; @@ -118,7 +118,7 @@ IcCombineMaskC (FbCompositeOperand *src, } static uint32_t -IcCombineMaskValueC (FbCompositeOperand *src, +fbCombineMaskValueC (FbCompositeOperand *src, FbCompositeOperand *msk) { uint32_t x; @@ -150,7 +150,7 @@ IcCombineMaskValueC (FbCompositeOperand *src, * Combine src and mask using IN, generating only the alpha component */ static uint32_t -IcCombineMaskAlphaU (FbCompositeOperand *src, +fbCombineMaskAlphaU (FbCompositeOperand *src, FbCompositeOperand *msk) { uint32_t x; @@ -172,7 +172,7 @@ IcCombineMaskAlphaU (FbCompositeOperand *src, } static uint32_t -IcCombineMaskAlphaC (FbCompositeOperand *src, +fbCombineMaskAlphaC (FbCompositeOperand *src, FbCompositeOperand *msk) { uint32_t x; @@ -214,7 +214,7 @@ fbCombineSrcU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - (*dst->store) (dst, IcCombineMaskU (src, msk)); + (*dst->store) (dst, fbCombineMaskU (src, msk)); } static void @@ -222,7 +222,7 @@ fbCombineSrcC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - (*dst->store) (dst, IcCombineMaskValueC (src, msk)); + (*dst->store) (dst, fbCombineMaskValueC (src, msk)); } static void @@ -243,7 +243,7 @@ fbCombineOverU (FbCompositeOperand *src, uint16_t t; uint32_t m,n,o,p; - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); a = ~s >> 24; if (a != 0xff) { @@ -271,7 +271,7 @@ fbCombineOverC (FbCompositeOperand *src, uint16_t t; uint32_t m,n,o,p; - cs = IcCombineMaskC (src, msk); + cs = fbCombineMaskC (src, msk); s = cs.value; a = ~cs.alpha; if (a != 0xffffffff) @@ -303,7 +303,7 @@ fbCombineOverReverseU (FbCompositeOperand *src, a = ~d >> 24; if (a) { - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); if (a != 0xff) { m = IcOverU(d,s,0,a,t); @@ -330,7 +330,7 @@ fbCombineOverReverseC (FbCompositeOperand *src, a = ~d >> 24; if (a) { - s = IcCombineMaskValueC (src, msk); + s = fbCombineMaskValueC (src, msk); if (a != 0xff) { m = IcOverU(d,s,0,a,t); @@ -358,7 +358,7 @@ fbCombineInU (FbCompositeOperand *src, s = 0; if (a) { - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); if (a != 0xff) { m = IcInU(s,0,a,t); @@ -386,7 +386,7 @@ fbCombineInC (FbCompositeOperand *src, s = 0; if (a) { - s = IcCombineMaskValueC (src, msk); + s = fbCombineMaskValueC (src, msk); if (a != 0xff) { m = IcInU(s,0,a,t); @@ -409,7 +409,7 @@ fbCombineInReverseU (FbCompositeOperand *src, uint16_t t; uint32_t m,n,o,p; - s = IcCombineMaskAlphaU (src, msk); + s = fbCombineMaskAlphaU (src, msk); a = s >> 24; if (a != 0xff) { @@ -437,7 +437,7 @@ fbCombineInReverseC (FbCompositeOperand *src, uint16_t t; uint32_t m,n,o,p; - s = IcCombineMaskAlphaC (src, msk); + s = fbCombineMaskAlphaC (src, msk); a = s; if (a != 0xffffffff) { @@ -470,7 +470,7 @@ fbCombineOutU (FbCompositeOperand *src, s = 0; if (a) { - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); if (a != 0xff) { m = IcInU(s,0,a,t); @@ -498,7 +498,7 @@ fbCombineOutC (FbCompositeOperand *src, s = 0; if (a) { - s = IcCombineMaskValueC (src, msk); + s = fbCombineMaskValueC (src, msk); if (a != 0xff) { m = IcInU(s,0,a,t); @@ -521,7 +521,7 @@ fbCombineOutReverseU (FbCompositeOperand *src, uint16_t t; uint32_t m,n,o,p; - s = IcCombineMaskAlphaU (src, msk); + s = fbCombineMaskAlphaU (src, msk); a = ~s >> 24; if (a != 0xff) { @@ -549,7 +549,7 @@ fbCombineOutReverseC (FbCompositeOperand *src, uint16_t t; uint32_t m,n,o,p; - s = IcCombineMaskAlphaC (src, msk); + s = fbCombineMaskAlphaC (src, msk); a = ~s; if (a != 0xffffffff) { @@ -577,7 +577,7 @@ fbCombineAtopU (FbCompositeOperand *src, uint16_t t,u,v; uint32_t m,n,o,p; - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); d = (*dst->fetch) (dst); ad = ~s >> 24; as = d >> 24; @@ -600,7 +600,7 @@ fbCombineAtopC (FbCompositeOperand *src, uint16_t t, u, v; uint32_t m,n,o,p; - cs = IcCombineMaskC (src, msk); + cs = fbCombineMaskC (src, msk); d = (*dst->fetch) (dst); s = cs.value; ad = cs.alpha; @@ -622,7 +622,7 @@ fbCombineAtopReverseU (FbCompositeOperand *src, uint16_t t, u, v; uint32_t m,n,o,p; - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); d = (*dst->fetch) (dst); ad = s >> 24; as = ~d >> 24; @@ -644,7 +644,7 @@ fbCombineAtopReverseC (FbCompositeOperand *src, uint16_t t, u, v; uint32_t m,n,o,p; - cs = IcCombineMaskC (src, msk); + cs = fbCombineMaskC (src, msk); d = (*dst->fetch) (dst); s = cs.value; ad = cs.alpha; @@ -666,7 +666,7 @@ fbCombineXorU (FbCompositeOperand *src, uint16_t t, u, v; uint32_t m,n,o,p; - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); d = (*dst->fetch) (dst); ad = ~s >> 24; as = ~d >> 24; @@ -688,7 +688,7 @@ fbCombineXorC (FbCompositeOperand *src, uint16_t t, u, v; uint32_t m,n,o,p; - cs = IcCombineMaskC (src, msk); + cs = fbCombineMaskC (src, msk); d = (*dst->fetch) (dst); s = cs.value; ad = ~cs.alpha; @@ -709,7 +709,7 @@ fbCombineAddU (FbCompositeOperand *src, uint16_t t; uint32_t m,n,o,p; - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); if (s == ~0) (*dst->store) (dst, s); else @@ -735,7 +735,7 @@ fbCombineAddC (FbCompositeOperand *src, uint16_t t; uint32_t m,n,o,p; - s = IcCombineMaskValueC (src, msk); + s = fbCombineMaskValueC (src, msk); if (s == ~0) (*dst->store) (dst, s); else @@ -793,7 +793,7 @@ fbCombineAddC (FbCompositeOperand *src, /* portion covered by a but not b */ static uint8_t -IcCombineDisjointOutPart (uint8_t a, uint8_t b) +fbCombineDisjointOutPart (uint8_t a, uint8_t b) { /* min (1, (1-b) / a) */ @@ -805,7 +805,7 @@ IcCombineDisjointOutPart (uint8_t a, uint8_t b) /* portion covered by both a and b */ static uint8_t -IcCombineDisjointInPart (uint8_t a, uint8_t b) +fbCombineDisjointInPart (uint8_t a, uint8_t b) { /* max (1-(1-b)/a,0) */ /* = - min ((1-b)/a - 1, 0) */ @@ -818,7 +818,7 @@ IcCombineDisjointInPart (uint8_t a, uint8_t b) } static void -IcCombineDisjointGeneralU (FbCompositeOperand *src, +fbCombineDisjointGeneralU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst, uint8_t combine) @@ -828,7 +828,7 @@ IcCombineDisjointGeneralU (FbCompositeOperand *src, uint16_t Fa, Fb, t, u, v; uint8_t sa, da; - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); sa = s >> 24; d = (*dst->fetch) (dst); @@ -839,10 +839,10 @@ IcCombineDisjointGeneralU (FbCompositeOperand *src, Fa = 0; break; case CombineAOut: - Fa = IcCombineDisjointOutPart (sa, da); + Fa = fbCombineDisjointOutPart (sa, da); break; case CombineAIn: - Fa = IcCombineDisjointInPart (sa, da); + Fa = fbCombineDisjointInPart (sa, da); break; case CombineA: Fa = 0xff; @@ -854,10 +854,10 @@ IcCombineDisjointGeneralU (FbCompositeOperand *src, Fb = 0; break; case CombineBOut: - Fb = IcCombineDisjointOutPart (da, sa); + Fb = fbCombineDisjointOutPart (da, sa); break; case CombineBIn: - Fb = IcCombineDisjointInPart (da, sa); + Fb = fbCombineDisjointInPart (da, sa); break; case CombineB: Fb = 0xff; @@ -872,7 +872,7 @@ IcCombineDisjointGeneralU (FbCompositeOperand *src, } static void -IcCombineDisjointGeneralC (FbCompositeOperand *src, +fbCombineDisjointGeneralC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst, uint8_t combine) @@ -885,7 +885,7 @@ IcCombineDisjointGeneralC (FbCompositeOperand *src, uint32_t sa; uint8_t da; - cs = IcCombineMaskC (src, msk); + cs = fbCombineMaskC (src, msk); s = cs.value; sa = cs.alpha; @@ -897,17 +897,17 @@ IcCombineDisjointGeneralC (FbCompositeOperand *src, Fa = 0; break; case CombineAOut: - m = IcCombineDisjointOutPart ((uint8_t) (sa >> 0), da); - n = IcCombineDisjointOutPart ((uint8_t) (sa >> 8), da) << 8; - o = IcCombineDisjointOutPart ((uint8_t) (sa >> 16), da) << 16; - p = IcCombineDisjointOutPart ((uint8_t) (sa >> 24), da) << 24; + m = fbCombineDisjointOutPart ((uint8_t) (sa >> 0), da); + n = fbCombineDisjointOutPart ((uint8_t) (sa >> 8), da) << 8; + o = fbCombineDisjointOutPart ((uint8_t) (sa >> 16), da) << 16; + p = fbCombineDisjointOutPart ((uint8_t) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineAIn: - m = IcCombineDisjointOutPart ((uint8_t) (sa >> 0), da); - n = IcCombineDisjointOutPart ((uint8_t) (sa >> 8), da) << 8; - o = IcCombineDisjointOutPart ((uint8_t) (sa >> 16), da) << 16; - p = IcCombineDisjointOutPart ((uint8_t) (sa >> 24), da) << 24; + m = fbCombineDisjointOutPart ((uint8_t) (sa >> 0), da); + n = fbCombineDisjointOutPart ((uint8_t) (sa >> 8), da) << 8; + o = fbCombineDisjointOutPart ((uint8_t) (sa >> 16), da) << 16; + p = fbCombineDisjointOutPart ((uint8_t) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineA: @@ -920,10 +920,10 @@ IcCombineDisjointGeneralC (FbCompositeOperand *src, Fb = 0; break; case CombineBOut: - Fb = IcCombineDisjointOutPart (da, sa); + Fb = fbCombineDisjointOutPart (da, sa); break; case CombineBIn: - Fb = IcCombineDisjointInPart (da, sa); + Fb = fbCombineDisjointInPart (da, sa); break; case CombineB: Fb = 0xff; @@ -947,14 +947,14 @@ fbCombineDisjointOverU (FbCompositeOperand *src, uint16_t t; uint32_t m,n,o,p; - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); a = s >> 24; if (a != 0x00) { if (a != 0xff) { d = (*dst->fetch) (dst); - a = IcCombineDisjointOutPart (d >> 24, a); + a = fbCombineDisjointOutPart (d >> 24, a); m = IcOverU(s,d,0,a,t); n = IcOverU(s,d,8,a,t); o = IcOverU(s,d,16,a,t); @@ -970,7 +970,7 @@ fbCombineDisjointOverC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralC (src, msk, dst, CombineAOver); + fbCombineDisjointGeneralC (src, msk, dst, CombineAOver); } static void @@ -978,7 +978,7 @@ fbCombineDisjointOverReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralU (src, msk, dst, CombineBOver); + fbCombineDisjointGeneralU (src, msk, dst, CombineBOver); } static void @@ -986,7 +986,7 @@ fbCombineDisjointOverReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralC (src, msk, dst, CombineBOver); + fbCombineDisjointGeneralC (src, msk, dst, CombineBOver); } static void @@ -994,7 +994,7 @@ fbCombineDisjointInU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralU (src, msk, dst, CombineAIn); + fbCombineDisjointGeneralU (src, msk, dst, CombineAIn); } static void @@ -1002,7 +1002,7 @@ fbCombineDisjointInC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralC (src, msk, dst, CombineAIn); + fbCombineDisjointGeneralC (src, msk, dst, CombineAIn); } static void @@ -1010,7 +1010,7 @@ fbCombineDisjointInReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralU (src, msk, dst, CombineBIn); + fbCombineDisjointGeneralU (src, msk, dst, CombineBIn); } static void @@ -1018,7 +1018,7 @@ fbCombineDisjointInReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralC (src, msk, dst, CombineBIn); + fbCombineDisjointGeneralC (src, msk, dst, CombineBIn); } static void @@ -1026,7 +1026,7 @@ fbCombineDisjointOutU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralU (src, msk, dst, CombineAOut); + fbCombineDisjointGeneralU (src, msk, dst, CombineAOut); } static void @@ -1034,7 +1034,7 @@ fbCombineDisjointOutC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralC (src, msk, dst, CombineAOut); + fbCombineDisjointGeneralC (src, msk, dst, CombineAOut); } static void @@ -1042,7 +1042,7 @@ fbCombineDisjointOutReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralU (src, msk, dst, CombineBOut); + fbCombineDisjointGeneralU (src, msk, dst, CombineBOut); } static void @@ -1050,7 +1050,7 @@ fbCombineDisjointOutReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralC (src, msk, dst, CombineBOut); + fbCombineDisjointGeneralC (src, msk, dst, CombineBOut); } static void @@ -1058,7 +1058,7 @@ fbCombineDisjointAtopU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralU (src, msk, dst, CombineAAtop); + fbCombineDisjointGeneralU (src, msk, dst, CombineAAtop); } static void @@ -1066,7 +1066,7 @@ fbCombineDisjointAtopC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralC (src, msk, dst, CombineAAtop); + fbCombineDisjointGeneralC (src, msk, dst, CombineAAtop); } static void @@ -1074,7 +1074,7 @@ fbCombineDisjointAtopReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralU (src, msk, dst, CombineBAtop); + fbCombineDisjointGeneralU (src, msk, dst, CombineBAtop); } static void @@ -1082,7 +1082,7 @@ fbCombineDisjointAtopReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralC (src, msk, dst, CombineBAtop); + fbCombineDisjointGeneralC (src, msk, dst, CombineBAtop); } static void @@ -1090,7 +1090,7 @@ fbCombineDisjointXorU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralU (src, msk, dst, CombineXor); + fbCombineDisjointGeneralU (src, msk, dst, CombineXor); } static void @@ -1098,12 +1098,12 @@ fbCombineDisjointXorC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineDisjointGeneralC (src, msk, dst, CombineXor); + fbCombineDisjointGeneralC (src, msk, dst, CombineXor); } /* portion covered by a but not b */ static uint8_t -IcCombineConjointOutPart (uint8_t a, uint8_t b) +fbCombineConjointOutPart (uint8_t a, uint8_t b) { /* max (1-b/a,0) */ /* = 1-min(b/a,1) */ @@ -1117,7 +1117,7 @@ IcCombineConjointOutPart (uint8_t a, uint8_t b) /* portion covered by both a and b */ static uint8_t -IcCombineConjointInPart (uint8_t a, uint8_t b) +fbCombineConjointInPart (uint8_t a, uint8_t b) { /* min (1,b/a) */ @@ -1127,7 +1127,7 @@ IcCombineConjointInPart (uint8_t a, uint8_t b) } static void -IcCombineConjointGeneralU (FbCompositeOperand *src, +fbCombineConjointGeneralU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst, uint8_t combine) @@ -1137,7 +1137,7 @@ IcCombineConjointGeneralU (FbCompositeOperand *src, uint16_t Fa, Fb, t, u, v; uint8_t sa, da; - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); sa = s >> 24; d = (*dst->fetch) (dst); @@ -1148,10 +1148,10 @@ IcCombineConjointGeneralU (FbCompositeOperand *src, Fa = 0; break; case CombineAOut: - Fa = IcCombineConjointOutPart (sa, da); + Fa = fbCombineConjointOutPart (sa, da); break; case CombineAIn: - Fa = IcCombineConjointInPart (sa, da); + Fa = fbCombineConjointInPart (sa, da); break; case CombineA: Fa = 0xff; @@ -1163,10 +1163,10 @@ IcCombineConjointGeneralU (FbCompositeOperand *src, Fb = 0; break; case CombineBOut: - Fb = IcCombineConjointOutPart (da, sa); + Fb = fbCombineConjointOutPart (da, sa); break; case CombineBIn: - Fb = IcCombineConjointInPart (da, sa); + Fb = fbCombineConjointInPart (da, sa); break; case CombineB: Fb = 0xff; @@ -1181,7 +1181,7 @@ IcCombineConjointGeneralU (FbCompositeOperand *src, } static void -IcCombineConjointGeneralC (FbCompositeOperand *src, +fbCombineConjointGeneralC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst, uint8_t combine) @@ -1194,7 +1194,7 @@ IcCombineConjointGeneralC (FbCompositeOperand *src, uint32_t sa; uint8_t da; - cs = IcCombineMaskC (src, msk); + cs = fbCombineMaskC (src, msk); s = cs.value; sa = cs.alpha; @@ -1206,17 +1206,17 @@ IcCombineConjointGeneralC (FbCompositeOperand *src, Fa = 0; break; case CombineAOut: - m = IcCombineConjointOutPart ((uint8_t) (sa >> 0), da); - n = IcCombineConjointOutPart ((uint8_t) (sa >> 8), da) << 8; - o = IcCombineConjointOutPart ((uint8_t) (sa >> 16), da) << 16; - p = IcCombineConjointOutPart ((uint8_t) (sa >> 24), da) << 24; + m = fbCombineConjointOutPart ((uint8_t) (sa >> 0), da); + n = fbCombineConjointOutPart ((uint8_t) (sa >> 8), da) << 8; + o = fbCombineConjointOutPart ((uint8_t) (sa >> 16), da) << 16; + p = fbCombineConjointOutPart ((uint8_t) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineAIn: - m = IcCombineConjointOutPart ((uint8_t) (sa >> 0), da); - n = IcCombineConjointOutPart ((uint8_t) (sa >> 8), da) << 8; - o = IcCombineConjointOutPart ((uint8_t) (sa >> 16), da) << 16; - p = IcCombineConjointOutPart ((uint8_t) (sa >> 24), da) << 24; + m = fbCombineConjointOutPart ((uint8_t) (sa >> 0), da); + n = fbCombineConjointOutPart ((uint8_t) (sa >> 8), da) << 8; + o = fbCombineConjointOutPart ((uint8_t) (sa >> 16), da) << 16; + p = fbCombineConjointOutPart ((uint8_t) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineA: @@ -1229,10 +1229,10 @@ IcCombineConjointGeneralC (FbCompositeOperand *src, Fb = 0; break; case CombineBOut: - Fb = IcCombineConjointOutPart (da, sa); + Fb = fbCombineConjointOutPart (da, sa); break; case CombineBIn: - Fb = IcCombineConjointInPart (da, sa); + Fb = fbCombineConjointInPart (da, sa); break; case CombineB: Fb = 0xff; @@ -1251,21 +1251,21 @@ fbCombineConjointOverU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralU (src, msk, dst, CombineAOver); + fbCombineConjointGeneralU (src, msk, dst, CombineAOver); /* uint32_t s, d; uint16_t a; uint16_t t; uint32_t m,n,o,p; - s = IcCombineMaskU (src, msk); + s = fbCombineMaskU (src, msk); a = s >> 24; if (a != 0x00) { if (a != 0xff) { d = (*dst->fetch) (dst); - a = IcCombineConjointOutPart (d >> 24, a); + a = fbCombineConjointOutPart (d >> 24, a); m = IcOverU(s,d,0,a,t); n = IcOverU(s,d,8,a,t); o = IcOverU(s,d,16,a,t); @@ -1282,7 +1282,7 @@ fbCombineConjointOverC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralC (src, msk, dst, CombineAOver); + fbCombineConjointGeneralC (src, msk, dst, CombineAOver); } static void @@ -1290,7 +1290,7 @@ fbCombineConjointOverReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralU (src, msk, dst, CombineBOver); + fbCombineConjointGeneralU (src, msk, dst, CombineBOver); } static void @@ -1298,7 +1298,7 @@ fbCombineConjointOverReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralC (src, msk, dst, CombineBOver); + fbCombineConjointGeneralC (src, msk, dst, CombineBOver); } static void @@ -1306,7 +1306,7 @@ fbCombineConjointInU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralU (src, msk, dst, CombineAIn); + fbCombineConjointGeneralU (src, msk, dst, CombineAIn); } static void @@ -1314,7 +1314,7 @@ fbCombineConjointInC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralC (src, msk, dst, CombineAIn); + fbCombineConjointGeneralC (src, msk, dst, CombineAIn); } static void @@ -1322,7 +1322,7 @@ fbCombineConjointInReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralU (src, msk, dst, CombineBIn); + fbCombineConjointGeneralU (src, msk, dst, CombineBIn); } static void @@ -1330,7 +1330,7 @@ fbCombineConjointInReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralC (src, msk, dst, CombineBIn); + fbCombineConjointGeneralC (src, msk, dst, CombineBIn); } static void @@ -1338,7 +1338,7 @@ fbCombineConjointOutU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralU (src, msk, dst, CombineAOut); + fbCombineConjointGeneralU (src, msk, dst, CombineAOut); } static void @@ -1346,7 +1346,7 @@ fbCombineConjointOutC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralC (src, msk, dst, CombineAOut); + fbCombineConjointGeneralC (src, msk, dst, CombineAOut); } static void @@ -1354,7 +1354,7 @@ fbCombineConjointOutReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralU (src, msk, dst, CombineBOut); + fbCombineConjointGeneralU (src, msk, dst, CombineBOut); } static void @@ -1362,7 +1362,7 @@ fbCombineConjointOutReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralC (src, msk, dst, CombineBOut); + fbCombineConjointGeneralC (src, msk, dst, CombineBOut); } static void @@ -1370,7 +1370,7 @@ fbCombineConjointAtopU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralU (src, msk, dst, CombineAAtop); + fbCombineConjointGeneralU (src, msk, dst, CombineAAtop); } static void @@ -1378,7 +1378,7 @@ fbCombineConjointAtopC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralC (src, msk, dst, CombineAAtop); + fbCombineConjointGeneralC (src, msk, dst, CombineAAtop); } static void @@ -1386,7 +1386,7 @@ fbCombineConjointAtopReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralU (src, msk, dst, CombineBAtop); + fbCombineConjointGeneralU (src, msk, dst, CombineBAtop); } static void @@ -1394,7 +1394,7 @@ fbCombineConjointAtopReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralC (src, msk, dst, CombineBAtop); + fbCombineConjointGeneralC (src, msk, dst, CombineBAtop); } static void @@ -1402,7 +1402,7 @@ fbCombineConjointXorU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralU (src, msk, dst, CombineXor); + fbCombineConjointGeneralU (src, msk, dst, CombineXor); } static void @@ -1410,10 +1410,10 @@ fbCombineConjointXorC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCombineConjointGeneralC (src, msk, dst, CombineXor); + fbCombineConjointGeneralC (src, msk, dst, CombineXor); } -static IcCombineFunc const IcCombineFuncU[] = { +static IcCombineFunc const fbCombineFuncU[] = { fbCombineClear, fbCombineSrcU, fbCombineDst, @@ -1460,7 +1460,7 @@ static IcCombineFunc const IcCombineFuncU[] = { fbCombineConjointXorU, }; -static IcCombineFunc const IcCombineFuncC[] = { +static IcCombineFunc const fbCombineFuncC[] = { fbCombineClear, fbCombineSrcC, fbCombineDst, @@ -1512,21 +1512,21 @@ static IcCombineFunc const IcCombineFuncC[] = { */ static uint32_t -IcFetch_a8r8g8b8 (FbCompositeOperand *op) +fbFetch_a8r8g8b8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; return ((uint32_t *)line)[offset >> 5]; } static uint32_t -IcFetch_x8r8g8b8 (FbCompositeOperand *op) +fbFetch_x8r8g8b8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; return ((uint32_t *)line)[offset >> 5] | 0xff000000; } static uint32_t -IcFetch_a8b8g8r8 (FbCompositeOperand *op) +fbFetch_a8b8g8r8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; @@ -1538,7 +1538,7 @@ IcFetch_a8b8g8r8 (FbCompositeOperand *op) } static uint32_t -IcFetch_x8b8g8r8 (FbCompositeOperand *op) +fbFetch_x8b8g8r8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; @@ -1550,7 +1550,7 @@ IcFetch_x8b8g8r8 (FbCompositeOperand *op) } static uint32_t -IcFetch_r8g8b8 (FbCompositeOperand *op) +fbFetch_r8g8b8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -1568,7 +1568,7 @@ IcFetch_r8g8b8 (FbCompositeOperand *op) } static uint32_t -IcFetch_b8g8r8 (FbCompositeOperand *op) +fbFetch_b8g8r8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -1586,7 +1586,7 @@ IcFetch_b8g8r8 (FbCompositeOperand *op) } static uint32_t -IcFetch_r5g6b5 (FbCompositeOperand *op) +fbFetch_r5g6b5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1599,7 +1599,7 @@ IcFetch_r5g6b5 (FbCompositeOperand *op) } static uint32_t -IcFetch_b5g6r5 (FbCompositeOperand *op) +fbFetch_b5g6r5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1612,7 +1612,7 @@ IcFetch_b5g6r5 (FbCompositeOperand *op) } static uint32_t -IcFetch_a1r5g5b5 (FbCompositeOperand *op) +fbFetch_a1r5g5b5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1626,7 +1626,7 @@ IcFetch_a1r5g5b5 (FbCompositeOperand *op) } static uint32_t -IcFetch_x1r5g5b5 (FbCompositeOperand *op) +fbFetch_x1r5g5b5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1639,7 +1639,7 @@ IcFetch_x1r5g5b5 (FbCompositeOperand *op) } static uint32_t -IcFetch_a1b5g5r5 (FbCompositeOperand *op) +fbFetch_a1b5g5r5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1653,7 +1653,7 @@ IcFetch_a1b5g5r5 (FbCompositeOperand *op) } static uint32_t -IcFetch_x1b5g5r5 (FbCompositeOperand *op) +fbFetch_x1b5g5r5 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1666,7 +1666,7 @@ IcFetch_x1b5g5r5 (FbCompositeOperand *op) } static uint32_t -IcFetch_a4r4g4b4 (FbCompositeOperand *op) +fbFetch_a4r4g4b4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1680,7 +1680,7 @@ IcFetch_a4r4g4b4 (FbCompositeOperand *op) } static uint32_t -IcFetch_x4r4g4b4 (FbCompositeOperand *op) +fbFetch_x4r4g4b4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1693,7 +1693,7 @@ IcFetch_x4r4g4b4 (FbCompositeOperand *op) } static uint32_t -IcFetch_a4b4g4r4 (FbCompositeOperand *op) +fbFetch_a4b4g4r4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1707,7 +1707,7 @@ IcFetch_a4b4g4r4 (FbCompositeOperand *op) } static uint32_t -IcFetch_x4b4g4r4 (FbCompositeOperand *op) +fbFetch_x4b4g4r4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint16_t *) line)[offset >> 4]; @@ -1720,7 +1720,7 @@ IcFetch_x4b4g4r4 (FbCompositeOperand *op) } static uint32_t -IcFetch_a8 (FbCompositeOperand *op) +fbFetch_a8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; @@ -1729,7 +1729,7 @@ IcFetch_a8 (FbCompositeOperand *op) } static uint32_t -IcFetcha_a8 (FbCompositeOperand *op) +fbFetcha_a8 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; @@ -1740,7 +1740,7 @@ IcFetcha_a8 (FbCompositeOperand *op) } static uint32_t -IcFetch_r3g3b2 (FbCompositeOperand *op) +fbFetch_r3g3b2 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; @@ -1756,7 +1756,7 @@ IcFetch_r3g3b2 (FbCompositeOperand *op) } static uint32_t -IcFetch_b2g3r3 (FbCompositeOperand *op) +fbFetch_b2g3r3 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; @@ -1774,7 +1774,7 @@ IcFetch_b2g3r3 (FbCompositeOperand *op) } static uint32_t -IcFetch_a2r2g2b2 (FbCompositeOperand *op) +fbFetch_a2r2g2b2 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint8_t *) line)[offset>>3]; @@ -1795,7 +1795,7 @@ IcFetch_a2r2g2b2 (FbCompositeOperand *op) #endif static uint32_t -IcFetch_a4 (FbCompositeOperand *op) +fbFetch_a4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1805,7 +1805,7 @@ IcFetch_a4 (FbCompositeOperand *op) } static uint32_t -IcFetcha_a4 (FbCompositeOperand *op) +fbFetcha_a4 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1817,7 +1817,7 @@ IcFetcha_a4 (FbCompositeOperand *op) } static uint32_t -IcFetch_r1g2b1 (FbCompositeOperand *op) +fbFetch_r1g2b1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1830,7 +1830,7 @@ IcFetch_r1g2b1 (FbCompositeOperand *op) } static uint32_t -IcFetch_b1g2r1 (FbCompositeOperand *op) +fbFetch_b1g2r1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1843,7 +1843,7 @@ IcFetch_b1g2r1 (FbCompositeOperand *op) } static uint32_t -IcFetch_a1r1g1b1 (FbCompositeOperand *op) +fbFetch_a1r1g1b1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1857,7 +1857,7 @@ IcFetch_a1r1g1b1 (FbCompositeOperand *op) } static uint32_t -IcFetch_a1b1g1r1 (FbCompositeOperand *op) +fbFetch_a1b1g1r1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = Fetch4(line, offset); @@ -1871,7 +1871,7 @@ IcFetch_a1b1g1r1 (FbCompositeOperand *op) } static uint32_t -IcFetcha_a1 (FbCompositeOperand *op) +fbFetcha_a1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; @@ -1891,7 +1891,7 @@ IcFetcha_a1 (FbCompositeOperand *op) } static uint32_t -IcFetch_a1 (FbCompositeOperand *op) +fbFetch_a1 (FbCompositeOperand *op) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel = ((uint32_t *)line)[offset >> 5]; @@ -1916,21 +1916,21 @@ IcFetch_a1 (FbCompositeOperand *op) #define Split(v) uint32_t r = ((v) >> 16) & 0xff, g = ((v) >> 8) & 0xff, b = (v) & 0xff static void -IcStore_a8r8g8b8 (FbCompositeOperand *op, uint32_t value) +fbStore_a8r8g8b8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; ((uint32_t *)line)[offset >> 5] = value; } static void -IcStore_x8r8g8b8 (FbCompositeOperand *op, uint32_t value) +fbStore_x8r8g8b8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; ((uint32_t *)line)[offset >> 5] = value & 0xffffff; } static void -IcStore_a8b8g8r8 (FbCompositeOperand *op, uint32_t value) +fbStore_a8b8g8r8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; Splita(value); @@ -1938,7 +1938,7 @@ IcStore_a8b8g8r8 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_x8b8g8r8 (FbCompositeOperand *op, uint32_t value) +fbStore_x8b8g8r8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; Split(value); @@ -1946,7 +1946,7 @@ IcStore_x8b8g8r8 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_r8g8b8 (FbCompositeOperand *op, uint32_t value) +fbStore_r8g8b8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -1963,7 +1963,7 @@ IcStore_r8g8b8 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_b8g8r8 (FbCompositeOperand *op, uint32_t value) +fbStore_b8g8r8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -1980,7 +1980,7 @@ IcStore_b8g8r8 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_r5g6b5 (FbCompositeOperand *op, uint32_t value) +fbStore_r5g6b5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -1991,7 +1991,7 @@ IcStore_r5g6b5 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_b5g6r5 (FbCompositeOperand *op, uint32_t value) +fbStore_b5g6r5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2002,7 +2002,7 @@ IcStore_b5g6r5 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_a1r5g5b5 (FbCompositeOperand *op, uint32_t value) +fbStore_a1r5g5b5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2014,7 +2014,7 @@ IcStore_a1r5g5b5 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_x1r5g5b5 (FbCompositeOperand *op, uint32_t value) +fbStore_x1r5g5b5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2025,7 +2025,7 @@ IcStore_x1r5g5b5 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_a1b5g5r5 (FbCompositeOperand *op, uint32_t value) +fbStore_a1b5g5r5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2037,7 +2037,7 @@ IcStore_a1b5g5r5 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_x1b5g5r5 (FbCompositeOperand *op, uint32_t value) +fbStore_x1b5g5r5 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2048,7 +2048,7 @@ IcStore_x1b5g5r5 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_a4r4g4b4 (FbCompositeOperand *op, uint32_t value) +fbStore_a4r4g4b4 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2060,7 +2060,7 @@ IcStore_a4r4g4b4 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_x4r4g4b4 (FbCompositeOperand *op, uint32_t value) +fbStore_x4r4g4b4 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2071,7 +2071,7 @@ IcStore_x4r4g4b4 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_a4b4g4r4 (FbCompositeOperand *op, uint32_t value) +fbStore_a4b4g4r4 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2083,7 +2083,7 @@ IcStore_a4b4g4r4 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_x4b4g4r4 (FbCompositeOperand *op, uint32_t value) +fbStore_x4b4g4r4 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint16_t *pixel = ((uint16_t *) line) + (offset >> 4); @@ -2094,7 +2094,7 @@ IcStore_x4b4g4r4 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_a8 (FbCompositeOperand *op, uint32_t value) +fbStore_a8 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -2102,7 +2102,7 @@ IcStore_a8 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_r3g3b2 (FbCompositeOperand *op, uint32_t value) +fbStore_r3g3b2 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -2113,7 +2113,7 @@ IcStore_r3g3b2 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_b2g3r3 (FbCompositeOperand *op, uint32_t value) +fbStore_b2g3r3 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -2124,7 +2124,7 @@ IcStore_b2g3r3 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_a2r2g2b2 (FbCompositeOperand *op, uint32_t value) +fbStore_a2r2g2b2 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); @@ -2147,14 +2147,14 @@ IcStore_a2r2g2b2 (FbCompositeOperand *op, uint32_t value) #endif static void -IcStore_a4 (FbCompositeOperand *op, uint32_t value) +fbStore_a4 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; Store4(line,offset,value>>28); } static void -IcStore_r1g2b1 (FbCompositeOperand *op, uint32_t value) +fbStore_r1g2b1 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; @@ -2167,7 +2167,7 @@ IcStore_r1g2b1 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_b1g2r1 (FbCompositeOperand *op, uint32_t value) +fbStore_b1g2r1 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; @@ -2180,7 +2180,7 @@ IcStore_b1g2r1 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_a1r1g1b1 (FbCompositeOperand *op, uint32_t value) +fbStore_a1r1g1b1 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; @@ -2193,7 +2193,7 @@ IcStore_a1r1g1b1 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_a1b1g1r1 (FbCompositeOperand *op, uint32_t value) +fbStore_a1b1g1r1 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t pixel; @@ -2206,7 +2206,7 @@ IcStore_a1b1g1r1 (FbCompositeOperand *op, uint32_t value) } static void -IcStore_a1 (FbCompositeOperand *op, uint32_t value) +fbStore_a1 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t *pixel = ((uint32_t *) line) + (offset >> 5); @@ -2217,7 +2217,7 @@ IcStore_a1 (FbCompositeOperand *op, uint32_t value) } static uint32_t -IcFetch_external (FbCompositeOperand *op) +fbFetch_external (FbCompositeOperand *op) { uint32_t rgb = (*op[1].fetch) (&op[1]); uint32_t a = (*op[2].fetch) (&op[2]); @@ -2227,20 +2227,20 @@ IcFetch_external (FbCompositeOperand *op) static uint32_t -IcFetcha_external (FbCompositeOperand *op) +fbFetcha_external (FbCompositeOperand *op) { return (*op[2].fetch) (&op[2]); } static void -IcStore_external (FbCompositeOperand *op, uint32_t value) +fbStore_external (FbCompositeOperand *op, uint32_t value) { (*op[1].store) (&op[1], value | 0xff000000); (*op[2].store) (&op[2], value & 0xff000000); } static uint32_t -IcFetch_transform (FbCompositeOperand *op) +fbFetch_transform (FbCompositeOperand *op) { pixman_vector_t v; int x, y; @@ -2339,7 +2339,7 @@ IcFetch_transform (FbCompositeOperand *op) } static uint32_t -IcFetcha_transform (FbCompositeOperand *op) +fbFetcha_transform (FbCompositeOperand *op) { pixman_vector_t v; int x, y; @@ -2440,84 +2440,84 @@ IcFetcha_transform (FbCompositeOperand *op) return bits; } -static IcAccessMap const icAccessMap[] = { +static IcAccessMap const fbAccessMap[] = { /* 32bpp formats */ - { PICT_a8r8g8b8, IcFetch_a8r8g8b8, IcFetch_a8r8g8b8, IcStore_a8r8g8b8 }, - { PICT_x8r8g8b8, IcFetch_x8r8g8b8, IcFetch_x8r8g8b8, IcStore_x8r8g8b8 }, - { PICT_a8b8g8r8, IcFetch_a8b8g8r8, IcFetch_a8b8g8r8, IcStore_a8b8g8r8 }, - { PICT_x8b8g8r8, IcFetch_x8b8g8r8, IcFetch_x8b8g8r8, IcStore_x8b8g8r8 }, + { PICT_a8r8g8b8, fbFetch_a8r8g8b8, fbFetch_a8r8g8b8, fbStore_a8r8g8b8 }, + { PICT_x8r8g8b8, fbFetch_x8r8g8b8, fbFetch_x8r8g8b8, fbStore_x8r8g8b8 }, + { PICT_a8b8g8r8, fbFetch_a8b8g8r8, fbFetch_a8b8g8r8, fbStore_a8b8g8r8 }, + { PICT_x8b8g8r8, fbFetch_x8b8g8r8, fbFetch_x8b8g8r8, fbStore_x8b8g8r8 }, /* 24bpp formats */ - { PICT_r8g8b8, IcFetch_r8g8b8, IcFetch_r8g8b8, IcStore_r8g8b8 }, - { PICT_b8g8r8, IcFetch_b8g8r8, IcFetch_b8g8r8, IcStore_b8g8r8 }, + { PICT_r8g8b8, fbFetch_r8g8b8, fbFetch_r8g8b8, fbStore_r8g8b8 }, + { PICT_b8g8r8, fbFetch_b8g8r8, fbFetch_b8g8r8, fbStore_b8g8r8 }, /* 16bpp formats */ - { PICT_r5g6b5, IcFetch_r5g6b5, IcFetch_r5g6b5, IcStore_r5g6b5 }, - { PICT_b5g6r5, IcFetch_b5g6r5, IcFetch_b5g6r5, IcStore_b5g6r5 }, - - { PICT_a1r5g5b5, IcFetch_a1r5g5b5, IcFetch_a1r5g5b5, IcStore_a1r5g5b5 }, - { PICT_x1r5g5b5, IcFetch_x1r5g5b5, IcFetch_x1r5g5b5, IcStore_x1r5g5b5 }, - { PICT_a1b5g5r5, IcFetch_a1b5g5r5, IcFetch_a1b5g5r5, IcStore_a1b5g5r5 }, - { PICT_x1b5g5r5, IcFetch_x1b5g5r5, IcFetch_x1b5g5r5, IcStore_x1b5g5r5 }, - { PICT_a4r4g4b4, IcFetch_a4r4g4b4, IcFetch_a4r4g4b4, IcStore_a4r4g4b4 }, - { PICT_x4r4g4b4, IcFetch_x4r4g4b4, IcFetch_x4r4g4b4, IcStore_x4r4g4b4 }, - { PICT_a4b4g4r4, IcFetch_a4b4g4r4, IcFetch_a4b4g4r4, IcStore_a4b4g4r4 }, - { PICT_x4b4g4r4, IcFetch_x4b4g4r4, IcFetch_x4b4g4r4, IcStore_x4b4g4r4 }, + { PICT_r5g6b5, fbFetch_r5g6b5, fbFetch_r5g6b5, fbStore_r5g6b5 }, + { PICT_b5g6r5, fbFetch_b5g6r5, fbFetch_b5g6r5, fbStore_b5g6r5 }, + + { PICT_a1r5g5b5, fbFetch_a1r5g5b5, fbFetch_a1r5g5b5, fbStore_a1r5g5b5 }, + { PICT_x1r5g5b5, fbFetch_x1r5g5b5, fbFetch_x1r5g5b5, fbStore_x1r5g5b5 }, + { PICT_a1b5g5r5, fbFetch_a1b5g5r5, fbFetch_a1b5g5r5, fbStore_a1b5g5r5 }, + { PICT_x1b5g5r5, fbFetch_x1b5g5r5, fbFetch_x1b5g5r5, fbStore_x1b5g5r5 }, + { PICT_a4r4g4b4, fbFetch_a4r4g4b4, fbFetch_a4r4g4b4, fbStore_a4r4g4b4 }, + { PICT_x4r4g4b4, fbFetch_x4r4g4b4, fbFetch_x4r4g4b4, fbStore_x4r4g4b4 }, + { PICT_a4b4g4r4, fbFetch_a4b4g4r4, fbFetch_a4b4g4r4, fbStore_a4b4g4r4 }, + { PICT_x4b4g4r4, fbFetch_x4b4g4r4, fbFetch_x4b4g4r4, fbStore_x4b4g4r4 }, /* 8bpp formats */ - { PICT_a8, IcFetch_a8, IcFetcha_a8, IcStore_a8 }, - { PICT_r3g3b2, IcFetch_r3g3b2, IcFetch_r3g3b2, IcStore_r3g3b2 }, - { PICT_b2g3r3, IcFetch_b2g3r3, IcFetch_b2g3r3, IcStore_b2g3r3 }, - { PICT_a2r2g2b2, IcFetch_a2r2g2b2, IcFetch_a2r2g2b2, IcStore_a2r2g2b2 }, + { PICT_a8, fbFetch_a8, fbFetcha_a8, fbStore_a8 }, + { PICT_r3g3b2, fbFetch_r3g3b2, fbFetch_r3g3b2, fbStore_r3g3b2 }, + { PICT_b2g3r3, fbFetch_b2g3r3, fbFetch_b2g3r3, fbStore_b2g3r3 }, + { PICT_a2r2g2b2, fbFetch_a2r2g2b2, fbFetch_a2r2g2b2, fbStore_a2r2g2b2 }, /* 4bpp formats */ - { PICT_a4, IcFetch_a4, IcFetcha_a4, IcStore_a4 }, - { PICT_r1g2b1, IcFetch_r1g2b1, IcFetch_r1g2b1, IcStore_r1g2b1 }, - { PICT_b1g2r1, IcFetch_b1g2r1, IcFetch_b1g2r1, IcStore_b1g2r1 }, - { PICT_a1r1g1b1, IcFetch_a1r1g1b1, IcFetch_a1r1g1b1, IcStore_a1r1g1b1 }, - { PICT_a1b1g1r1, IcFetch_a1b1g1r1, IcFetch_a1b1g1r1, IcStore_a1b1g1r1 }, + { PICT_a4, fbFetch_a4, fbFetcha_a4, fbStore_a4 }, + { PICT_r1g2b1, fbFetch_r1g2b1, fbFetch_r1g2b1, fbStore_r1g2b1 }, + { PICT_b1g2r1, fbFetch_b1g2r1, fbFetch_b1g2r1, fbStore_b1g2r1 }, + { PICT_a1r1g1b1, fbFetch_a1r1g1b1, fbFetch_a1r1g1b1, fbStore_a1r1g1b1 }, + { PICT_a1b1g1r1, fbFetch_a1b1g1r1, fbFetch_a1b1g1r1, fbStore_a1b1g1r1 }, /* 1bpp formats */ - { PICT_a1, IcFetch_a1, IcFetcha_a1, IcStore_a1 }, + { PICT_a1, fbFetch_a1, fbFetcha_a1, fbStore_a1 }, }; -#define NumAccessMap (sizeof icAccessMap / sizeof icAccessMap[0]) +#define NumAccessMap (sizeof fbAccessMap / sizeof fbAccessMap[0]) static void -IcStepOver (FbCompositeOperand *op) +fbStepOver (FbCompositeOperand *op) { op->u.drawable.offset += op->u.drawable.bpp; } static void -IcStepDown (FbCompositeOperand *op) +fbStepDown (FbCompositeOperand *op) { op->u.drawable.line += op->u.drawable.stride; op->u.drawable.offset = op->u.drawable.start_offset; } static void -IcSet (FbCompositeOperand *op, int x, int y) +fbSet (FbCompositeOperand *op, int x, int y) { op->u.drawable.line = op->u.drawable.top_line + y * op->u.drawable.stride; op->u.drawable.offset = op->u.drawable.left_offset + x * op->u.drawable.bpp; } static void -IcStepOver_external (FbCompositeOperand *op) +fbStepOver_external (FbCompositeOperand *op) { (*op[1].over) (&op[1]); (*op[2].over) (&op[2]); } static void -IcStepDown_external (FbCompositeOperand *op) +fbStepDown_external (FbCompositeOperand *op) { (*op[1].down) (&op[1]); (*op[2].down) (&op[2]); } static void -IcSet_external (FbCompositeOperand *op, int x, int y) +fbSet_external (FbCompositeOperand *op, int x, int y) { (*op[1].set) (&op[1], x, y); (*op[2].set) (&op[2], @@ -2526,20 +2526,20 @@ IcSet_external (FbCompositeOperand *op, int x, int y) } static void -IcStepOver_transform (FbCompositeOperand *op) +fbStepOver_transform (FbCompositeOperand *op) { op->u.transform.x++; } static void -IcStepDown_transform (FbCompositeOperand *op) +fbStepDown_transform (FbCompositeOperand *op) { op->u.transform.y++; op->u.transform.x = op->u.transform.start_x; } static void -IcSet_transform (FbCompositeOperand *op, int x, int y) +fbSet_transform (FbCompositeOperand *op, int x, int y) { op->u.transform.x = x - op->u.transform.left_x; op->u.transform.y = y - op->u.transform.top_y; @@ -2547,7 +2547,7 @@ IcSet_transform (FbCompositeOperand *op, int x, int y) int -IcBuildCompositeOperand (pixman_image_t *image, +fbBuildCompositeOperand (pixman_image_t *image, FbCompositeOperand op[4], int16_t x, int16_t y, @@ -2557,7 +2557,7 @@ IcBuildCompositeOperand (pixman_image_t *image, /* Check for transform */ if (transform && image->transform) { - if (!IcBuildCompositeOperand (image, &op[1], 0, 0, 0, alpha)) + if (!fbBuildCompositeOperand (image, &op[1], 0, 0, 0, alpha)) return 0; op->u.transform.top_y = image->pixels->y; @@ -2572,12 +2572,12 @@ IcBuildCompositeOperand (pixman_image_t *image, op->u.transform.width = image->pixels->width; op->u.transform.height = image->pixels->height; - op->fetch = IcFetch_transform; - op->fetcha = IcFetcha_transform; + op->fetch = fbFetch_transform; + op->fetcha = fbFetcha_transform; op->store = 0; - op->over = IcStepOver_transform; - op->down = IcStepDown_transform; - op->set = IcSet_transform; + op->over = fbStepOver_transform; + op->down = fbStepDown_transform; + op->set = fbSet_transform; op->src_clip = op[1].src_clip; op->dst_clip = op[1].dst_clip; @@ -2587,9 +2587,9 @@ IcBuildCompositeOperand (pixman_image_t *image, /* Check for external alpha */ else if (alpha && image->alphaMap) { - if (!IcBuildCompositeOperand (image, &op[1], x, y, 0, 0)) + if (!fbBuildCompositeOperand (image, &op[1], x, y, 0, 0)) return 0; - if (!IcBuildCompositeOperand (image->alphaMap, &op[2], + if (!fbBuildCompositeOperand (image->alphaMap, &op[2], x - image->alphaOrigin.x, y - image->alphaOrigin.y, 0, 0)) @@ -2597,12 +2597,12 @@ IcBuildCompositeOperand (pixman_image_t *image, op->u.external.alpha_dx = image->alphaOrigin.x; op->u.external.alpha_dy = image->alphaOrigin.y; - op->fetch = IcFetch_external; - op->fetcha = IcFetcha_external; - op->store = IcStore_external; - op->over = IcStepOver_external; - op->down = IcStepDown_external; - op->set = IcSet_external; + op->fetch = fbFetch_external; + op->fetcha = fbFetcha_external; + op->store = fbStore_external; + op->over = fbStepOver_external; + op->down = fbStepDown_external; + op->set = fbSet_external; op->src_clip = op[1].dst_clip; op->dst_clip = op[1].dst_clip; @@ -2616,18 +2616,18 @@ IcBuildCompositeOperand (pixman_image_t *image, int xoff, yoff; for (i = 0; i < NumAccessMap; i++) - if (icAccessMap[i].format_code == image->format_code) + if (fbAccessMap[i].format_code == image->format_code) { FbBits *bits; IcStride stride; int bpp; - op->fetch = icAccessMap[i].fetch; - op->fetcha = icAccessMap[i].fetcha; - op->store = icAccessMap[i].store; - op->over = IcStepOver; - op->down = IcStepDown; - op->set = IcSet; + op->fetch = fbAccessMap[i].fetch; + op->fetcha = fbAccessMap[i].fetcha; + op->store = fbAccessMap[i].store; + op->over = fbStepOver; + op->down = fbStepDown; + op->set = fbSet; op->dst_clip = image->pCompositeClip; if (image->compositeClipSource) @@ -2685,9 +2685,9 @@ pixman_compositeGeneral (pixman_operator_t op, IcCombineFunc f; int w; - if (!IcBuildCompositeOperand (iSrc, src, xSrc, ySrc, 1, 1)) + if (!fbBuildCompositeOperand (iSrc, src, xSrc, ySrc, 1, 1)) return; - if (!IcBuildCompositeOperand (iDst, dst, xDst, yDst, 0, 1)) + if (!fbBuildCompositeOperand (iDst, dst, xDst, yDst, 0, 1)) return; if (iSrc->alphaMap) { @@ -2709,14 +2709,14 @@ pixman_compositeGeneral (pixman_operator_t op, dstPict = &dst[0]; dstAlpha = 0; } - f = IcCombineFuncU[op]; + f = fbCombineFuncU[op]; if (iMask) { - if (!IcBuildCompositeOperand (iMask, msk, xMask, yMask, 1, 1)) + if (!fbBuildCompositeOperand (iMask, msk, xMask, yMask, 1, 1)) return; pmsk = msk; if (iMask->componentAlpha) - f = IcCombineFuncC[op]; + f = fbCombineFuncC[op]; if (iMask->alphaMap) { mskPict = &msk[1]; diff --git a/pixman/src/icimage.h b/pixman/src/icimage.h index b9ff070d7..ef61b2be8 100644 --- a/pixman/src/icimage.h +++ b/pixman/src/icimage.h @@ -314,7 +314,7 @@ typedef struct _IcCompSrc { } IcCompSrc; pixman_private int -IcBuildCompositeOperand (pixman_image_t *image, +fbBuildCompositeOperand (pixman_image_t *image, FbCompositeOperand op[4], int16_t x, int16_t y, diff --git a/pixman/src/icint.h b/pixman/src/icint.h index 59a7aba44..87eb5caaa 100644 --- a/pixman/src/icint.h +++ b/pixman/src/icint.h @@ -146,13 +146,13 @@ typedef int IcStride; #ifdef FB_DEBUG -extern void IcValidateDrawable(DrawablePtr d); -extern void IcInitializeDrawable(DrawablePtr d); -extern void IcSetBits (IcStip *bits, int stride, IcStip data); +extern void fbValidateDrawable(DrawablePtr d); +extern void fbInitializeDrawable(DrawablePtr d); +extern void fbSetBits (IcStip *bits, int stride, IcStip data); #define FB_HEAD_BITS (IcStip) (0xbaadf00d) #define FB_TAIL_BITS (IcStip) (0xbaddf0ad) #else -#define IcValidateDrawable(d) +#define fbValidateDrawable(d) #define fdInitializeDrawable(d) #endif @@ -553,7 +553,7 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); /* * Accelerated tiles are power of 2 width <= FB_UNIT */ -#define IcEvenTile(w) ((w) <= FB_UNIT && IcPowerOfTwo(w)) +#define fbEvenTile(w) ((w) <= FB_UNIT && IcPowerOfTwo(w)) /* * Accelerated stipples are power of 2 width and <= FB_UNIT/dstBpp * with dstBpp a power of 2 as well @@ -564,7 +564,7 @@ extern void IcSetBits (IcStip *bits, int stride, IcStip data); * icblt.c */ pixman_private void -IcBlt (pixman_bits_t *src, +fbBlt (pixman_bits_t *src, IcStride srcStride, int srcX, @@ -583,7 +583,7 @@ IcBlt (pixman_bits_t *src, int upsidedown); pixman_private void -IcBlt24 (pixman_bits_t *srcLine, +fbBlt24 (pixman_bits_t *srcLine, IcStride srcStride, int srcX, @@ -601,7 +601,7 @@ IcBlt24 (pixman_bits_t *srcLine, int upsidedown); pixman_private void -IcBltStip (IcStip *src, +fbBltStip (IcStip *src, IcStride srcStride, /* in IcStip units, not pixman_bits_t units */ int srcX, @@ -620,7 +620,7 @@ IcBltStip (IcStip *src, * icbltone.c */ pixman_private void -IcBltOne (IcStip *src, +fbBltOne (IcStip *src, IcStride srcStride, int srcX, pixman_bits_t *dst, @@ -638,7 +638,7 @@ IcBltOne (IcStip *src, #ifdef FB_24BIT pixman_private void -IcBltOne24 (IcStip *src, +fbBltOne24 (IcStip *src, IcStride srcStride, /* IcStip units per scanline */ int srcX, /* bit position of source */ pixman_bits_t *dst, @@ -660,13 +660,13 @@ IcBltOne24 (IcStip *src, */ pixman_private void -IcTransparentSpan (pixman_bits_t *dst, +fbTransparentSpan (pixman_bits_t *dst, pixman_bits_t stip, pixman_bits_t fgxor, int n); pixman_private void -IcEvenStipple (pixman_bits_t *dst, +fbEvenStipple (pixman_bits_t *dst, IcStride dstStride, int dstX, int dstBpp, @@ -687,7 +687,7 @@ IcEvenStipple (pixman_bits_t *dst, int yRot); pixman_private void -IcOddStipple (pixman_bits_t *dst, +fbOddStipple (pixman_bits_t *dst, IcStride dstStride, int dstX, int dstBpp, @@ -709,7 +709,7 @@ IcOddStipple (pixman_bits_t *dst, int yRot); pixman_private void -IcStipple (pixman_bits_t *dst, +fbStipple (pixman_bits_t *dst, IcStride dstStride, int dstX, int dstBpp, @@ -758,7 +758,7 @@ typedef uint32_t Pixel; /* icutil.c */ pixman_private pixman_bits_t -IcReplicatePixel (Pixel p, int bpp); +fbReplicatePixel (Pixel p, int bpp); /* fbtrap.c */ diff --git a/pixman/src/icrop.h b/pixman/src/icrop.h index 334bd4bd3..964eb9295 100644 --- a/pixman/src/icrop.h +++ b/pixman/src/icrop.h @@ -76,34 +76,34 @@ extern const IcMergeRopRec IcMergeRopBits[16] pixman_private; /* * Take a single bit (0 or 1) and generate a full mask */ -#define IcFillFromBit(b,t) (~((t) ((b) & 1)-1)) +#define fbFillFromBit(b,t) (~((t) ((b) & 1)-1)) -#define IcXorT(rop,fg,pm,t) ((((fg) & IcFillFromBit((rop) >> 1,t)) | \ - (~(fg) & IcFillFromBit((rop) >> 3,t))) & (pm)) +#define fbXorT(rop,fg,pm,t) ((((fg) & fbFillFromBit((rop) >> 1,t)) | \ + (~(fg) & fbFillFromBit((rop) >> 3,t))) & (pm)) -#define IcAndT(rop,fg,pm,t) ((((fg) & IcFillFromBit (rop ^ (rop>>1),t)) | \ - (~(fg) & IcFillFromBit((rop>>2) ^ (rop>>3),t))) | \ +#define fbAndT(rop,fg,pm,t) ((((fg) & fbFillFromBit (rop ^ (rop>>1),t)) | \ + (~(fg) & fbFillFromBit((rop>>2) ^ (rop>>3),t))) | \ ~(pm)) -#define IcXor(rop,fg,pm) IcXorT(rop,fg,pm,pixman_bits_t) +#define fbXor(rop,fg,pm) fbXorT(rop,fg,pm,pixman_bits_t) -#define IcAnd(rop,fg,pm) IcAndT(rop,fg,pm,pixman_bits_t) +#define fbAnd(rop,fg,pm) fbAndT(rop,fg,pm,pixman_bits_t) -#define IcXorStip(rop,fg,pm) IcXorT(rop,fg,pm,IcStip) +#define fbXorStip(rop,fg,pm) fbXorT(rop,fg,pm,IcStip) -#define IcAndStip(rop,fg,pm) IcAndT(rop,fg,pm,IcStip) +#define fbAndStip(rop,fg,pm) fbAndT(rop,fg,pm,IcStip) /* * Stippling operations; */ /* half of table */ -extern const pixman_bits_t icStipple16Bits[256] pixman_private; -#define IcStipple16Bits(b) \ - (icStipple16Bits[(b)&0xff] | icStipple16Bits[(b) >> 8] << FB_HALFUNIT) +extern const pixman_bits_t fbStipple16Bits[256] pixman_private; +#define FbStipple16Bits(b) \ + (fbStipple16Bits[(b)&0xff] | fbStipple16Bits[(b) >> 8] << FB_HALFUNIT) pixman_private const pixman_bits_t * -IcStippleTable(int bits); +fbStippleTable(int bits); #define IcStippleRRop(dst, b, fa, fx, ba, bx) \ (IcDoRRop(dst, fa, fx) & b) | (IcDoRRop(dst, ba, bx) & ~b) diff --git a/pixman/src/icstipple.c b/pixman/src/icstipple.c index dbde65b1f..2f3776c1c 100644 --- a/pixman/src/icstipple.c +++ b/pixman/src/icstipple.c @@ -55,7 +55,7 @@ */ void -IcTransparentSpan (FbBits *dst, +fbTransparentSpan (FbBits *dst, FbBits stip, FbBits fgxor, int n) diff --git a/pixman/src/icutil.c b/pixman/src/icutil.c index 2e04b7106..a2259d0bf 100644 --- a/pixman/src/icutil.c +++ b/pixman/src/icutil.c @@ -25,7 +25,7 @@ #include "pixman-xserver-compat.h" pixman_bits_t -IcReplicatePixel (Pixel p, int bpp) +fbReplicatePixel (Pixel p, int bpp) { pixman_bits_t b = p; @@ -97,22 +97,22 @@ const IcMergeRopRec IcMergeRopBits[16] = { SelMask(b,7,w)) #if FB_UNIT == 16 -#define icStipple16Bits 0 -#define icStipple8Bits 0 -static const pixman_bits_t icStipple4Bits[16] = { +#define fbStipple16Bits 0 +#define fbStipple8Bits 0 +static const pixman_bits_t fbStipple4Bits[16] = { C4( 0,4), C4( 1,4), C4( 2,4), C4( 3,4), C4( 4,4), C4( 5,4), C4( 6,4), C4( 7,4), C4( 8,4), C4( 9,4), C4( 10,4), C4( 11,4), C4( 12,4), C4( 13,4), C4( 14,4), C4( 15,4),}; -static const pixman_bits_t icStipple2Bits[4] = { +static const pixman_bits_t fbStipple2Bits[4] = { C2( 0,8), C2( 1,8), C2( 2,8), C2( 3,8), }; -static const pixman_bits_t icStipple1Bits[2] = { +static const pixman_bits_t fbStipple1Bits[2] = { C1( 0,16), C1( 1,16), }; #endif #if FB_UNIT == 32 -#define icStipple16Bits 0 -static const pixman_bits_t icStipple8Bits[256] = { +#define fbStipple16Bits 0 +static const pixman_bits_t fbStipple8Bits[256] = { C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4), C8( 6,4), C8( 7,4), C8( 8,4), C8( 9,4), C8( 10,4), C8( 11,4), C8( 12,4), C8( 13,4), C8( 14,4), C8( 15,4), C8( 16,4), C8( 17,4), @@ -157,19 +157,19 @@ static const pixman_bits_t icStipple8Bits[256] = { C8(246,4), C8(247,4), C8(248,4), C8(249,4), C8(250,4), C8(251,4), C8(252,4), C8(253,4), C8(254,4), C8(255,4), }; -static const pixman_bits_t icStipple4Bits[16] = { +static const pixman_bits_t fbStipple4Bits[16] = { C4( 0,8), C4( 1,8), C4( 2,8), C4( 3,8), C4( 4,8), C4( 5,8), C4( 6,8), C4( 7,8), C4( 8,8), C4( 9,8), C4( 10,8), C4( 11,8), C4( 12,8), C4( 13,8), C4( 14,8), C4( 15,8),}; -static const pixman_bits_t icStipple2Bits[4] = { +static const pixman_bits_t fbStipple2Bits[4] = { C2( 0,16), C2( 1,16), C2( 2,16), C2( 3,16), }; -static const pixman_bits_t icStipple1Bits[2] = { +static const pixman_bits_t fbStipple1Bits[2] = { C1( 0,32), C1( 1,32), }; #endif #if FB_UNIT == 64 -const pixman_bits_t icStipple16Bits[256] = { +const pixman_bits_t fbStipple16Bits[256] = { C8( 0,4), C8( 1,4), C8( 2,4), C8( 3,4), C8( 4,4), C8( 5,4), C8( 6,4), C8( 7,4), C8( 8,4), C8( 9,4), C8( 10,4), C8( 11,4), C8( 12,4), C8( 13,4), C8( 14,4), C8( 15,4), C8( 16,4), C8( 17,4), @@ -214,7 +214,7 @@ const pixman_bits_t icStipple16Bits[256] = { C8(246,4), C8(247,4), C8(248,4), C8(249,4), C8(250,4), C8(251,4), C8(252,4), C8(253,4), C8(254,4), C8(255,4), }; -static const pixman_bits_t icStipple8Bits[256] = { +static const pixman_bits_t fbStipple8Bits[256] = { C8( 0,8), C8( 1,8), C8( 2,8), C8( 3,8), C8( 4,8), C8( 5,8), C8( 6,8), C8( 7,8), C8( 8,8), C8( 9,8), C8( 10,8), C8( 11,8), C8( 12,8), C8( 13,8), C8( 14,8), C8( 15,8), C8( 16,8), C8( 17,8), @@ -259,28 +259,28 @@ static const pixman_bits_t icStipple8Bits[256] = { C8(246,8), C8(247,8), C8(248,8), C8(249,8), C8(250,8), C8(251,8), C8(252,8), C8(253,8), C8(254,8), C8(255,8), }; -static const pixman_bits_t icStipple4Bits[16] = { +static const pixman_bits_t fbStipple4Bits[16] = { C4( 0,16), C4( 1,16), C4( 2,16), C4( 3,16), C4( 4,16), C4( 5,16), C4( 6,16), C4( 7,16), C4( 8,16), C4( 9,16), C4( 10,16), C4( 11,16), C4( 12,16), C4( 13,16), C4( 14,16), C4( 15,16),}; -static const pixman_bits_t icStipple2Bits[4] = { +static const pixman_bits_t fbStipple2Bits[4] = { C2( 0,32), C2( 1,32), C2( 2,32), C2( 3,32), }; -#define icStipple1Bits 0 +#define fbStipple1Bits 0 #endif const pixman_bits_t * -IcStippleTable(int bits) +fbStippleTable(int bits) { switch (bits) { case 1: - return icStipple1Bits; + return fbStipple1Bits; case 2: - return icStipple2Bits; + return fbStipple2Bits; case 4: - return icStipple4Bits; + return fbStipple4Bits; case 8: - return icStipple8Bits; + return fbStipple8Bits; } return 0; } -- cgit v1.2.3 From 64d5b34a9843e63d36c605abe7cdd56bacabccee Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Fri, 24 Jun 2005 20:13:19 +0000 Subject: s/Ic/Fb/g This gets read of most of the [Ii][cC]'s the rest will probably dealt with on a case by case basis. trimmed function list again. --- pixman/ChangeLog | 26 +++ pixman/src/ic.c | 108 +++++----- pixman/src/icblt.c | 268 +++++++++++------------ pixman/src/icbltone.c | 174 +++++++-------- pixman/src/iccolor.c | 20 +- pixman/src/iccompose.c | 288 ++++++++++++------------- pixman/src/icformat.c | 10 +- pixman/src/icimage.c | 36 ++-- pixman/src/icimage.h | 70 +++--- pixman/src/icint.h | 426 ++++++++++++++++++------------------- pixman/src/icpixels.c | 28 +-- pixman/src/icrect.c | 6 +- pixman/src/icrop.h | 66 +++--- pixman/src/icstipple.c | 20 +- pixman/src/ictrap.c | 6 +- pixman/src/ictri.c | 20 +- pixman/src/icutil.c | 4 +- pixman/src/pixman-xserver-compat.h | 2 +- 18 files changed, 802 insertions(+), 776 deletions(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index 1e69c7ab4..972f15cc0 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,29 @@ +2005-06-24 Jeff Muizelaar + + * src/ic.c: + * src/icblt.c: + * src/icbltone.c: + * src/iccolor.c: + * src/iccompose.c: + * src/icformat.c: + * src/icimage.c: + * src/icimage.h: + * src/icint.h: + * src/icpixels.c: + * src/icrect.c: + * src/icrop.h: + * src/icstipple.c: + * src/ictrap.c: + * src/ictri.c: + * src/icutil.c: + * src/pixman-xserver-compat.h: + + s/Ic/Fb/g + This gets read of most of the [Ii][cC]'s the rest will probably dealt + with on a case by case basis. + + trimmed function list again. + 2005-06-24 Jeff Muizelaar * src/ic.c: diff --git a/pixman/src/ic.c b/pixman/src/ic.c index 7ccb3539c..b8d636c10 100644 --- a/pixman/src/ic.c +++ b/pixman/src/ic.c @@ -57,10 +57,10 @@ fbOver (uint32_t x, uint32_t y) uint16_t t; uint32_t m,n,o,p; - m = IcOverU(x,y,0,a,t); - n = IcOverU(x,y,8,a,t); - o = IcOverU(x,y,16,a,t); - p = IcOverU(x,y,24,a,t); + m = FbOverU(x,y,0,a,t); + n = FbOverU(x,y,8,a,t); + o = FbOverU(x,y,16,a,t); + p = FbOverU(x,y,24,a,t); return m|n|o|p; } @@ -71,9 +71,9 @@ fbOver24 (uint32_t x, uint32_t y) uint16_t t; uint32_t m,n,o; - m = IcOverU(x,y,0,a,t); - n = IcOverU(x,y,8,a,t); - o = IcOverU(x,y,16,a,t); + m = FbOverU(x,y,0,a,t); + n = FbOverU(x,y,8,a,t); + o = FbOverU(x,y,16,a,t); return m|n|o; } @@ -84,20 +84,20 @@ fbIn (uint32_t x, uint8_t y) uint16_t t; uint32_t m,n,o,p; - m = IcInU(x,0,a,t); - n = IcInU(x,8,a,t); - o = IcInU(x,16,a,t); - p = IcInU(x,24,a,t); + m = FbInU(x,0,a,t); + n = FbInU(x,8,a,t); + o = FbInU(x,16,a,t); + p = FbInU(x,24,a,t); return m|n|o|p; } #define fbComposeGetSolid(image, bits) { \ FbBits *__bits__; \ - IcStride __stride__; \ + FbStride __stride__; \ int __bpp__; \ int __xoff__,__yoff__; \ \ - IcGetPixels((image)->pixels,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ + FbGetPixels((image)->pixels,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ switch (__bpp__) { \ case 32: \ (bits) = *(uint32_t *) __bits__; \ @@ -119,11 +119,11 @@ fbIn (uint32_t x, uint8_t y) #define fbComposeGetStart(image,x,y,type,stride,line,mul) {\ FbBits *__bits__; \ - IcStride __stride__; \ + FbStride __stride__; \ int __bpp__; \ int __xoff__,__yoff__; \ \ - IcGetPixels((image)->pixels,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ + FbGetPixels((image)->pixels,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ (stride) = __stride__ * sizeof (FbBits) / sizeof (type); \ (line) = ((type *) __bits__) + (stride) * ((y) - __yoff__) + (mul) * ((x) - __xoff__); \ } @@ -151,12 +151,12 @@ pixman_compositeSolidMask_nx8x8888 (pixman_operator_t op, uint32_t src, srca; uint32_t *dstLine, *dst, d, dstMask; uint8_t *maskLine, *mask, m; - IcStride dstStride, maskStride; + FbStride dstStride, maskStride; uint16_t w; fbComposeGetSolid(iSrc, src); - dstMask = IcFullMask (iDst->pixels->depth); + dstMask = FbFullMask (iDst->pixels->depth); srca = src >> 24; if (src == 0) return; @@ -209,13 +209,13 @@ pixman_compositeSolidMask_nx8888x8888C (pixman_operator_t op, uint32_t src, srca; uint32_t *dstLine, *dst, d, dstMask; uint32_t *maskLine, *mask, ma; - IcStride dstStride, maskStride; + FbStride dstStride, maskStride; uint16_t w; uint32_t m, n, o, p; fbComposeGetSolid(iSrc, src); - dstMask = IcFullMask (iDst->pixels->depth); + dstMask = FbFullMask (iDst->pixels->depth); srca = src >> 24; if (src == 0) return; @@ -244,20 +244,20 @@ pixman_compositeSolidMask_nx8888x8888C (pixman_operator_t op, else if (ma) { d = *dst; -#define IcInOverC(src,srca,msk,dst,i,result) { \ - uint16_t __a = IcGet8(msk,i); \ +#define FbInOverC(src,srca,msk,dst,i,result) { \ + uint16_t __a = FbGet8(msk,i); \ uint32_t __t, __ta; \ uint32_t __i; \ - __t = IcIntMult (IcGet8(src,i), __a,__i); \ - __ta = (uint8_t) ~IcIntMult (srca, __a,__i); \ - __t = __t + IcIntMult(IcGet8(dst,i),__ta,__i); \ + __t = FbIntMult (FbGet8(src,i), __a,__i); \ + __ta = (uint8_t) ~FbIntMult (srca, __a,__i); \ + __t = __t + FbIntMult(FbGet8(dst,i),__ta,__i); \ __t = (uint32_t) (uint8_t) (__t | (-(__t >> 8))); \ result = __t << (i); \ } - IcInOverC (src, srca, ma, d, 0, m); - IcInOverC (src, srca, ma, d, 8, n); - IcInOverC (src, srca, ma, d, 16, o); - IcInOverC (src, srca, ma, d, 24, p); + FbInOverC (src, srca, ma, d, 0, m); + FbInOverC (src, srca, ma, d, 8, n); + FbInOverC (src, srca, ma, d, 16, o); + FbInOverC (src, srca, ma, d, 24, p); *dst = m|n|o|p; } dst++; @@ -283,7 +283,7 @@ pixman_compositeSolidMask_nx8x0888 (pixman_operator_t op, uint8_t *dstLine, *dst; uint32_t d; uint8_t *maskLine, *mask, m; - IcStride dstStride, maskStride; + FbStride dstStride, maskStride; uint16_t w; fbComposeGetSolid(iSrc, src); @@ -345,7 +345,7 @@ pixman_compositeSolidMask_nx8x0565 (pixman_operator_t op, uint16_t *dstLine, *dst; uint32_t d; uint8_t *maskLine, *mask, m; - IcStride dstStride, maskStride; + FbStride dstStride, maskStride; uint16_t w; fbComposeGetSolid(iSrc, src); @@ -409,7 +409,7 @@ pixman_compositeSolidMask_nx8888x0565C (pixman_operator_t op, uint16_t *dstLine, *dst; uint32_t d; uint32_t *maskLine, *mask, ma; - IcStride dstStride, maskStride; + FbStride dstStride, maskStride; uint16_t w; uint32_t m, n, o; @@ -452,9 +452,9 @@ pixman_compositeSolidMask_nx8888x0565C (pixman_operator_t op, { d = *dst; d = cvt0565to8888(d); - IcInOverC (src, srca, ma, d, 0, m); - IcInOverC (src, srca, ma, d, 8, n); - IcInOverC (src, srca, ma, d, 16, o); + FbInOverC (src, srca, ma, d, 0, m); + FbInOverC (src, srca, ma, d, 8, n); + FbInOverC (src, srca, ma, d, 16, o); d = m|n|o; *dst = cvt8888to0565(d); } @@ -479,14 +479,14 @@ pixman_compositeSrc_8888x8888 (pixman_operator_t op, { uint32_t *dstLine, *dst, dstMask; uint32_t *srcLine, *src, s; - IcStride dstStride, srcStride; + FbStride dstStride, srcStride; uint8_t a; uint16_t w; fbComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); fbComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - dstMask = IcFullMask (iDst->pixels->depth); + dstMask = FbFullMask (iDst->pixels->depth); while (height--) { @@ -527,7 +527,7 @@ pixman_compositeSrc_8888x0888 (pixman_operator_t op, uint32_t d; uint32_t *srcLine, *src, s; uint8_t a; - IcStride dstStride, srcStride; + FbStride dstStride, srcStride; uint16_t w; fbComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 3); @@ -576,7 +576,7 @@ pixman_compositeSrc_8888x0565 (pixman_operator_t op, uint32_t d; uint32_t *srcLine, *src, s; uint8_t a; - IcStride dstStride, srcStride; + FbStride dstStride, srcStride; uint16_t w; fbComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); @@ -626,7 +626,7 @@ pixman_compositeSrc_0565x0565 (pixman_operator_t op, { uint16_t *dstLine, *dst; uint16_t *srcLine, *src; - IcStride dstStride, srcStride; + FbStride dstStride, srcStride; uint16_t w; fbComposeGetStart (iSrc, xSrc, ySrc, uint16_t, srcStride, srcLine, 1); @@ -662,7 +662,7 @@ pixman_compositeSrcAdd_8000x8000 (pixman_operator_t op, { uint8_t *dstLine, *dst; uint8_t *srcLine, *src; - IcStride dstStride, srcStride; + FbStride dstStride, srcStride; uint8_t w; uint8_t s, d; uint16_t t; @@ -712,7 +712,7 @@ pixman_compositeSrcAdd_8888x8888 (pixman_operator_t op, { uint32_t *dstLine, *dst; uint32_t *srcLine, *src; - IcStride dstStride, srcStride; + FbStride dstStride, srcStride; uint16_t w; uint32_t s, d; uint16_t t; @@ -739,10 +739,10 @@ pixman_compositeSrcAdd_8888x8888 (pixman_operator_t op, d = *dst; if (d) { - m = IcAdd(s,d,0,t); - n = IcAdd(s,d,8,t); - o = IcAdd(s,d,16,t); - p = IcAdd(s,d,24,t); + m = FbAdd(s,d,0,t); + n = FbAdd(s,d,8,t); + o = FbAdd(s,d,16,t); + p = FbAdd(s,d,24,t); s = m|n|o|p; } } @@ -768,14 +768,14 @@ pixman_compositeSrcAdd_1000x1000 (pixman_operator_t op, uint16_t height) { FbBits *dstBits, *srcBits; - IcStride dstStride, srcStride; + FbStride dstStride, srcStride; int dstBpp, srcBpp; int dstXoff, dstYoff; int srcXoff, srcYoff; - IcGetPixels(iSrc->pixels, srcBits, srcStride, srcBpp, srcXoff, srcYoff); + FbGetPixels(iSrc->pixels, srcBits, srcStride, srcBpp, srcXoff, srcYoff); - IcGetPixels(iDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff); + FbGetPixels(iDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff); fbBlt (srcBits + srcStride * (ySrc + srcYoff), srcStride, @@ -811,8 +811,8 @@ pixman_compositeSolidMask_nx1xn (pixman_operator_t op, uint16_t height) { FbBits *dstBits; - IcStip *maskBits; - IcStride dstStride, maskStride; + FbStip *maskBits; + FbStride dstStride, maskStride; int dstBpp, maskBpp; int dstXoff, dstYoff; int maskXoff, maskYoff; @@ -827,8 +827,8 @@ pixman_compositeSolidMask_nx1xn (pixman_operator_t op, width, height); return; } - IcGetStipPixels (iMask->pixels, maskBits, maskStride, maskBpp, maskXoff, maskYoff); - IcGetPixels (iDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff); + FbGetStipPixels (iMask->pixels, maskBits, maskStride, maskBpp, maskXoff, maskYoff); + FbGetPixels (iDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff); switch (dstBpp) { case 32: @@ -907,7 +907,7 @@ pixman_composite (pixman_operator_t op, region = pixman_region_create(); pixman_region_union_rect (region, region, xDst, yDst, width, height); - if (!IcComputeCompositeRegion (region, + if (!FbComputeCompositeRegion (region, iSrc, iMask, iDst, @@ -1084,7 +1084,7 @@ pixman_composite (pixman_operator_t op, break; } /* if we are transforming, we handle repeats in - * IcFetch[a]_transform + * FbFetch[a]_transform */ if (iSrc->transform) srcRepeat = 0; diff --git a/pixman/src/icblt.c b/pixman/src/icblt.c index 2fc536350..1ebf6cc31 100644 --- a/pixman/src/icblt.c +++ b/pixman/src/icblt.c @@ -38,11 +38,11 @@ void fbBlt (FbBits *srcLine, - IcStride srcStride, + FbStride srcStride, int srcX, FbBits *dstLine, - IcStride dstStride, + FbStride dstStride, int dstX, int width, @@ -62,7 +62,7 @@ fbBlt (FbBits *srcLine, int n, nmiddle; int destInvarient; int startbyte, endbyte; - IcDeclareMergeRop (); + FbDeclareMergeRop (); /* are we just copying multiples of 8 bits? if so, run, forrest, run! the memcpy()'s should be pluggable ala mplayer|xine - perhaps we can get @@ -89,15 +89,15 @@ fbBlt (FbBits *srcLine, } #ifdef FB_24BIT - if (bpp == 24 && !IcCheck24Pix (pm)) + if (bpp == 24 && !FbCheck24Pix (pm)) { fbBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX, width, height, alu, pm, reverse, upsidedown); return; } #endif - IcInitializeMergeRop(alu, pm); - destInvarient = IcDestInvarientMergeRop(); + FbInitializeMergeRop(alu, pm); + destInvarient = FbDestInvarientMergeRop(); if (upsidedown) { srcLine += (height - 1) * (srcStride); @@ -105,7 +105,7 @@ fbBlt (FbBits *srcLine, srcStride = -srcStride; dstStride = -dstStride; } - IcMaskBitsBytes (dstX, width, destInvarient, startmask, startbyte, + FbMaskBitsBytes (dstX, width, destInvarient, startmask, startbyte, nmiddle, endmask, endbyte); if (reverse) { @@ -135,13 +135,13 @@ fbBlt (FbBits *srcLine, { bits = *--src; --dst; - IcDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); } n = nmiddle; if (destInvarient) { while (n--) - *--dst = IcDoDestInvarientMergeRop(*--src); + *--dst = FbDoDestInvarientMergeRop(*--src); } else { @@ -149,14 +149,14 @@ fbBlt (FbBits *srcLine, { bits = *--src; --dst; - *dst = IcDoMergeRop (bits, *dst); + *dst = FbDoMergeRop (bits, *dst); } } if (startmask) { bits = *--src; --dst; - IcDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); + FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); } } else @@ -164,7 +164,7 @@ fbBlt (FbBits *srcLine, if (startmask) { bits = *src++; - IcDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); + FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); dst++; } n = nmiddle; @@ -194,21 +194,21 @@ fbBlt (FbBits *srcLine, } #endif while (n--) - *dst++ = IcDoDestInvarientMergeRop(*src++); + *dst++ = FbDoDestInvarientMergeRop(*src++); } else { while (n--) { bits = *src++; - *dst = IcDoMergeRop (bits, *dst); + *dst = FbDoMergeRop (bits, *dst); dst++; } } if (endmask) { bits = *src; - IcDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); } } } @@ -239,48 +239,48 @@ fbBlt (FbBits *srcLine, bits1 = *--src; if (endmask) { - bits = IcScrRight(bits1, rightShift); - if (IcScrRight(endmask, leftShift)) + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(endmask, leftShift)) { bits1 = *--src; - bits |= IcScrLeft(bits1, leftShift); + bits |= FbScrLeft(bits1, leftShift); } --dst; - IcDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); } n = nmiddle; if (destInvarient) { while (n--) { - bits = IcScrRight(bits1, rightShift); + bits = FbScrRight(bits1, rightShift); bits1 = *--src; - bits |= IcScrLeft(bits1, leftShift); + bits |= FbScrLeft(bits1, leftShift); --dst; - *dst = IcDoDestInvarientMergeRop(bits); + *dst = FbDoDestInvarientMergeRop(bits); } } else { while (n--) { - bits = IcScrRight(bits1, rightShift); + bits = FbScrRight(bits1, rightShift); bits1 = *--src; - bits |= IcScrLeft(bits1, leftShift); + bits |= FbScrLeft(bits1, leftShift); --dst; - *dst = IcDoMergeRop(bits, *dst); + *dst = FbDoMergeRop(bits, *dst); } } if (startmask) { - bits = IcScrRight(bits1, rightShift); - if (IcScrRight(startmask, leftShift)) + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(startmask, leftShift)) { bits1 = *--src; - bits |= IcScrLeft(bits1, leftShift); + bits |= FbScrLeft(bits1, leftShift); } --dst; - IcDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); + FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); } } else @@ -289,10 +289,10 @@ fbBlt (FbBits *srcLine, bits1 = *src++; if (startmask) { - bits = IcScrLeft(bits1, leftShift); + bits = FbScrLeft(bits1, leftShift); bits1 = *src++; - bits |= IcScrRight(bits1, rightShift); - IcDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); + bits |= FbScrRight(bits1, rightShift); + FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); dst++; } n = nmiddle; @@ -300,10 +300,10 @@ fbBlt (FbBits *srcLine, { while (n--) { - bits = IcScrLeft(bits1, leftShift); + bits = FbScrLeft(bits1, leftShift); bits1 = *src++; - bits |= IcScrRight(bits1, rightShift); - *dst = IcDoDestInvarientMergeRop(bits); + bits |= FbScrRight(bits1, rightShift); + *dst = FbDoDestInvarientMergeRop(bits); dst++; } } @@ -311,22 +311,22 @@ fbBlt (FbBits *srcLine, { while (n--) { - bits = IcScrLeft(bits1, leftShift); + bits = FbScrLeft(bits1, leftShift); bits1 = *src++; - bits |= IcScrRight(bits1, rightShift); - *dst = IcDoMergeRop(bits, *dst); + bits |= FbScrRight(bits1, rightShift); + *dst = FbDoMergeRop(bits, *dst); dst++; } } if (endmask) { - bits = IcScrLeft(bits1, leftShift); - if (IcScrLeft(endmask, rightShift)) + bits = FbScrLeft(bits1, leftShift); + if (FbScrLeft(endmask, rightShift)) { bits1 = *src; - bits |= IcScrRight(bits1, rightShift); + bits |= FbScrRight(bits1, rightShift); } - IcDoRightMaskByteMergeRop (dst, bits, endbyte, endmask); + FbDoRightMaskByteMergeRop (dst, bits, endbyte, endmask); } } } @@ -378,10 +378,10 @@ fbBlt24Line (FbBits *src, FbBits mask; int rot; - IcDeclareMergeRop (); + FbDeclareMergeRop (); - IcInitializeMergeRop (alu, FB_ALLONES); - IcMaskBits(dstX, width, startmask, n, endmask); + FbInitializeMergeRop (alu, FB_ALLONES); + FbMaskBits(dstX, width, startmask, n, endmask); #ifdef DEBUG_BLT24 ErrorF ("dstX %d width %d reverse %d\n", dstX, width, reverse); #endif @@ -389,8 +389,8 @@ fbBlt24Line (FbBits *src, { src += ((srcX + width - 1) >> FB_SHIFT) + 1; dst += ((dstX + width - 1) >> FB_SHIFT) + 1; - rot = IcFirst24Rot (((dstX + width - 8) & FB_MASK)); - rot = IcPrev24Rot(rot); + rot = FbFirst24Rot (((dstX + width - 8) & FB_MASK)); + rot = FbPrev24Rot(rot); #ifdef DEBUG_BLT24 ErrorF ("dstX + width - 8: %d rot: %d\n", (dstX + width - 8) & FB_MASK, rot); #endif @@ -403,12 +403,12 @@ fbBlt24Line (FbBits *src, dst += dstX >> FB_SHIFT; srcX &= FB_MASK; dstX &= FB_MASK; - rot = IcFirst24Rot (dstX); + rot = FbFirst24Rot (dstX); #ifdef DEBUG_BLT24 ErrorF ("dstX: %d rot: %d\n", dstX, rot); #endif } - mask = IcRot24(pm,rot); + mask = FbRot24(pm,rot); #ifdef DEBUG_BLT24 ErrorF ("pm 0x%x mask 0x%x\n", pm, mask); #endif @@ -420,21 +420,21 @@ fbBlt24Line (FbBits *src, { bits = *--src; --dst; - *dst = IcDoMaskMergeRop (bits, *dst, mask & endmask); - mask = IcPrev24Pix (mask); + *dst = FbDoMaskMergeRop (bits, *dst, mask & endmask); + mask = FbPrev24Pix (mask); } while (n--) { bits = *--src; --dst; - *dst = IcDoMaskMergeRop (bits, *dst, mask); - mask = IcPrev24Pix (mask); + *dst = FbDoMaskMergeRop (bits, *dst, mask); + mask = FbPrev24Pix (mask); } if (startmask) { bits = *--src; --dst; - *dst = IcDoMaskMergeRop(bits, *dst, mask & startmask); + *dst = FbDoMaskMergeRop(bits, *dst, mask & startmask); } } else @@ -442,21 +442,21 @@ fbBlt24Line (FbBits *src, if (startmask) { bits = *src++; - *dst = IcDoMaskMergeRop (bits, *dst, mask & startmask); + *dst = FbDoMaskMergeRop (bits, *dst, mask & startmask); dst++; - mask = IcNext24Pix(mask); + mask = FbNext24Pix(mask); } while (n--) { bits = *src++; - *dst = IcDoMaskMergeRop (bits, *dst, mask); + *dst = FbDoMaskMergeRop (bits, *dst, mask); dst++; - mask = IcNext24Pix(mask); + mask = FbNext24Pix(mask); } if (endmask) { bits = *src; - *dst = IcDoMaskMergeRop(bits, *dst, mask & endmask); + *dst = FbDoMaskMergeRop(bits, *dst, mask & endmask); } } } @@ -480,35 +480,35 @@ fbBlt24Line (FbBits *src, bits1 = *--src; if (endmask) { - bits = IcScrRight(bits1, rightShift); - if (IcScrRight(endmask, leftShift)) + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(endmask, leftShift)) { bits1 = *--src; - bits |= IcScrLeft(bits1, leftShift); + bits |= FbScrLeft(bits1, leftShift); } --dst; - *dst = IcDoMaskMergeRop (bits, *dst, mask & endmask); - mask = IcPrev24Pix(mask); + *dst = FbDoMaskMergeRop (bits, *dst, mask & endmask); + mask = FbPrev24Pix(mask); } while (n--) { - bits = IcScrRight(bits1, rightShift); + bits = FbScrRight(bits1, rightShift); bits1 = *--src; - bits |= IcScrLeft(bits1, leftShift); + bits |= FbScrLeft(bits1, leftShift); --dst; - *dst = IcDoMaskMergeRop(bits, *dst, mask); - mask = IcPrev24Pix(mask); + *dst = FbDoMaskMergeRop(bits, *dst, mask); + mask = FbPrev24Pix(mask); } if (startmask) { - bits = IcScrRight(bits1, rightShift); - if (IcScrRight(startmask, leftShift)) + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(startmask, leftShift)) { bits1 = *--src; - bits |= IcScrLeft(bits1, leftShift); + bits |= FbScrLeft(bits1, leftShift); } --dst; - *dst = IcDoMaskMergeRop (bits, *dst, mask & startmask); + *dst = FbDoMaskMergeRop (bits, *dst, mask & startmask); } } else @@ -517,31 +517,31 @@ fbBlt24Line (FbBits *src, bits1 = *src++; if (startmask) { - bits = IcScrLeft(bits1, leftShift); + bits = FbScrLeft(bits1, leftShift); bits1 = *src++; - bits |= IcScrRight(bits1, rightShift); - *dst = IcDoMaskMergeRop (bits, *dst, mask & startmask); + bits |= FbScrRight(bits1, rightShift); + *dst = FbDoMaskMergeRop (bits, *dst, mask & startmask); dst++; - mask = IcNext24Pix(mask); + mask = FbNext24Pix(mask); } while (n--) { - bits = IcScrLeft(bits1, leftShift); + bits = FbScrLeft(bits1, leftShift); bits1 = *src++; - bits |= IcScrRight(bits1, rightShift); - *dst = IcDoMaskMergeRop(bits, *dst, mask); + bits |= FbScrRight(bits1, rightShift); + *dst = FbDoMaskMergeRop(bits, *dst, mask); dst++; - mask = IcNext24Pix(mask); + mask = FbNext24Pix(mask); } if (endmask) { - bits = IcScrLeft(bits1, leftShift); - if (IcScrLeft(endmask, rightShift)) + bits = FbScrLeft(bits1, leftShift); + if (FbScrLeft(endmask, rightShift)) { bits1 = *src; - bits |= IcScrRight(bits1, rightShift); + bits |= FbScrRight(bits1, rightShift); } - *dst = IcDoMaskMergeRop (bits, *dst, mask & endmask); + *dst = FbDoMaskMergeRop (bits, *dst, mask & endmask); } } } @@ -565,11 +565,11 @@ fbBlt24Line (FbBits *src, void fbBlt24 (FbBits *srcLine, - IcStride srcStride, + FbStride srcStride, int srcX, FbBits *dstLine, - IcStride dstStride, + FbStride dstStride, int dstX, int width, @@ -609,14 +609,14 @@ fbBlt24 (FbBits *srcLine, void fbBltOdd (FbBits *srcLine, - IcStride srcStrideEven, - IcStride srcStrideOdd, + FbStride srcStrideEven, + FbStride srcStrideOdd, int srcXEven, int srcXOdd, FbBits *dstLine, - IcStride dstStrideEven, - IcStride dstStrideOdd, + FbStride dstStrideEven, + FbStride dstStrideOdd, int dstXEven, int dstXOdd, @@ -648,10 +648,10 @@ fbBltOdd (FbBits *srcLine, int destInvarient; int even; - IcDeclareMergeRop (); + FbDeclareMergeRop (); - IcInitializeMergeRop (alu, pm); - destInvarient = IcDestInvarientMergeRop(); + FbInitializeMergeRop (alu, pm); + destInvarient = FbDestInvarientMergeRop(); srcLine += srcXEven >> FB_SHIFT; dstLine += dstXEven >> FB_SHIFT; @@ -660,8 +660,8 @@ fbBltOdd (FbBits *srcLine, srcXOdd &= FB_MASK; dstXOdd &= FB_MASK; - IcMaskBits(dstXEven, width, startmaskEven, nmiddleEven, endmaskEven); - IcMaskBits(dstXOdd, width, startmaskOdd, nmiddleOdd, endmaskOdd); + FbMaskBits(dstXEven, width, startmaskEven, nmiddleEven, endmaskEven); + FbMaskBits(dstXOdd, width, startmaskOdd, nmiddleOdd, endmaskOdd); even = 1; InitializeShifts(srcXEven, dstXEven, leftShiftEven, rightShiftEven); @@ -701,7 +701,7 @@ fbBltOdd (FbBits *srcLine, if (startmask) { bits = *src++; - *dst = IcDoMaskMergeRop (bits, *dst, startmask); + *dst = FbDoMaskMergeRop (bits, *dst, startmask); dst++; } n = nmiddle; @@ -710,7 +710,7 @@ fbBltOdd (FbBits *srcLine, while (n--) { bits = *src++; - *dst = IcDoDestInvarientMergeRop(bits); + *dst = FbDoDestInvarientMergeRop(bits); dst++; } } @@ -719,14 +719,14 @@ fbBltOdd (FbBits *srcLine, while (n--) { bits = *src++; - *dst = IcDoMergeRop (bits, *dst); + *dst = FbDoMergeRop (bits, *dst); dst++; } } if (endmask) { bits = *src; - *dst = IcDoMaskMergeRop(bits, *dst, endmask); + *dst = FbDoMaskMergeRop(bits, *dst, endmask); } } else @@ -736,10 +736,10 @@ fbBltOdd (FbBits *srcLine, bits = *src++; if (startmask) { - bits1 = IcScrLeft(bits, leftShift); + bits1 = FbScrLeft(bits, leftShift); bits = *src++; - bits1 |= IcScrRight(bits, rightShift); - *dst = IcDoMaskMergeRop (bits1, *dst, startmask); + bits1 |= FbScrRight(bits, rightShift); + *dst = FbDoMaskMergeRop (bits1, *dst, startmask); dst++; } n = nmiddle; @@ -747,10 +747,10 @@ fbBltOdd (FbBits *srcLine, { while (n--) { - bits1 = IcScrLeft(bits, leftShift); + bits1 = FbScrLeft(bits, leftShift); bits = *src++; - bits1 |= IcScrRight(bits, rightShift); - *dst = IcDoDestInvarientMergeRop(bits1); + bits1 |= FbScrRight(bits, rightShift); + *dst = FbDoDestInvarientMergeRop(bits1); dst++; } } @@ -758,22 +758,22 @@ fbBltOdd (FbBits *srcLine, { while (n--) { - bits1 = IcScrLeft(bits, leftShift); + bits1 = FbScrLeft(bits, leftShift); bits = *src++; - bits1 |= IcScrRight(bits, rightShift); - *dst = IcDoMergeRop(bits1, *dst); + bits1 |= FbScrRight(bits, rightShift); + *dst = FbDoMergeRop(bits1, *dst); dst++; } } if (endmask) { - bits1 = IcScrLeft(bits, leftShift); - if (IcScrLeft(endmask, rightShift)) + bits1 = FbScrLeft(bits, leftShift); + if (FbScrLeft(endmask, rightShift)) { bits = *src; - bits1 |= IcScrRight(bits, rightShift); + bits1 |= FbScrRight(bits, rightShift); } - *dst = IcDoMaskMergeRop (bits1, *dst, endmask); + *dst = FbDoMaskMergeRop (bits1, *dst, endmask); } } } @@ -782,14 +782,14 @@ fbBltOdd (FbBits *srcLine, #ifdef FB_24BIT void fbBltOdd24 (FbBits *srcLine, - IcStride srcStrideEven, - IcStride srcStrideOdd, + FbStride srcStrideEven, + FbStride srcStrideOdd, int srcXEven, int srcXOdd, FbBits *dstLine, - IcStride dstStrideEven, - IcStride dstStrideOdd, + FbStride dstStrideEven, + FbStride dstStrideOdd, int dstXEven, int dstXOdd, @@ -830,12 +830,12 @@ fbBltOdd24 (FbBits *srcLine, #if FB_STIP_SHIFT != FB_SHIFT void -fbSetBltOdd (IcStip *stip, - IcStride stipStride, +fbSetBltOdd (FbStip *stip, + FbStride stipStride, int srcX, FbBits **bits, - IcStride *strideEven, - IcStride *strideOdd, + FbStride *strideEven, + FbStride *strideOdd, int *srcXEven, int *srcXOdd) { @@ -847,23 +847,23 @@ fbSetBltOdd (IcStip *stip, */ srcAdjust = (((int) stip) & (FB_MASK >> 3)); /* - * IcStip units needed to align stride + * FbStip units needed to align stride */ strideAdjust = stipStride & (FB_MASK >> FB_STIP_SHIFT); *bits = (FbBits *) ((char *) stip - srcAdjust); if (srcAdjust) { - *strideEven = IcStipStrideToBitsStride (stipStride + 1); - *strideOdd = IcStipStrideToBitsStride (stipStride); + *strideEven = FbStipStrideToBitsStride (stipStride + 1); + *strideOdd = FbStipStrideToBitsStride (stipStride); *srcXEven = srcX + (srcAdjust << 3); *srcXOdd = srcX + (srcAdjust << 3) - (strideAdjust << FB_STIP_SHIFT); } else { - *strideEven = IcStipStrideToBitsStride (stipStride); - *strideOdd = IcStipStrideToBitsStride (stipStride + 1); + *strideEven = FbStipStrideToBitsStride (stipStride); + *strideOdd = FbStipStrideToBitsStride (stipStride + 1); *srcXEven = srcX; *srcXOdd = srcX + (strideAdjust << FB_STIP_SHIFT); @@ -872,12 +872,12 @@ fbSetBltOdd (IcStip *stip, #endif void -fbBltStip (IcStip *src, - IcStride srcStride, /* in IcStip units, not FbBits units */ +fbBltStip (FbStip *src, + FbStride srcStride, /* in FbStip units, not FbBits units */ int srcX, - IcStip *dst, - IcStride dstStride, /* in IcStip units, not FbBits units */ + FbStip *dst, + FbStride dstStride, /* in FbStip units, not FbBits units */ int dstX, int width, @@ -891,8 +891,8 @@ fbBltStip (IcStip *src, if (FB_STIP_ODDSTRIDE(srcStride) || FB_STIP_ODDPTR(src) || FB_STIP_ODDSTRIDE(dstStride) || FB_STIP_ODDPTR(dst)) { - IcStride srcStrideEven, srcStrideOdd; - IcStride dstStrideEven, dstStrideOdd; + FbStride srcStrideEven, srcStrideOdd; + FbStride dstStrideEven, dstStrideOdd; int srcXEven, srcXOdd; int dstXEven, dstXOdd; FbBits *s, *d; @@ -914,7 +914,7 @@ fbBltStip (IcStip *src, &dstXEven, &dstXOdd); #ifdef FB_24BIT - if (bpp == 24 && !IcCheck24Pix (pm)) + if (bpp == 24 && !FbCheck24Pix (pm)) { fbBltOdd24 (s, srcStrideEven, srcStrideOdd, srcXEven, srcXOdd, @@ -939,9 +939,9 @@ fbBltStip (IcStip *src, else #endif { - fbBlt ((FbBits *) src, IcStipStrideToBitsStride (srcStride), + fbBlt ((FbBits *) src, FbStipStrideToBitsStride (srcStride), srcX, - (FbBits *) dst, IcStipStrideToBitsStride (dstStride), + (FbBits *) dst, FbStipStrideToBitsStride (dstStride), dstX, width, height, alu, pm, bpp, 0, 0); diff --git a/pixman/src/icbltone.c b/pixman/src/icbltone.c index f0fa80b7f..9455452be 100644 --- a/pixman/src/icbltone.c +++ b/pixman/src/icbltone.c @@ -48,8 +48,8 @@ #define LoadBits {\ if (leftShift) { \ bitsRight = *src++; \ - bits = (IcStipLeft (bitsLeft, leftShift) | \ - IcStipRight(bitsRight, rightShift)); \ + bits = (FbStipLeft (bitsLeft, leftShift) | \ + FbStipRight(bitsRight, rightShift)); \ bitsLeft = bitsRight; \ } else \ bits = *src++; \ @@ -57,7 +57,7 @@ #ifndef FBNOPIXADDR -#define LaneCases1(n,a) case n: (void)IcLaneCase(n,a); break +#define LaneCases1(n,a) case n: (void)FbLaneCase(n,a); break #define LaneCases2(n,a) LaneCases1(n,a); LaneCases1(n+1,a) #define LaneCases4(n,a) LaneCases2(n,a); LaneCases2(n+2,a) #define LaneCases8(n,a) LaneCases4(n,a); LaneCases4(n+4,a) @@ -135,11 +135,11 @@ fbLaneTable(int bpp) #endif void -fbBltOne (IcStip *src, - IcStride srcStride, /* IcStip units per scanline */ +fbBltOne (FbStip *src, + FbStride srcStride, /* FbStip units per scanline */ int srcX, /* bit position of source */ FbBits *dst, - IcStride dstStride, /* FbBits units per scanline */ + FbStride dstStride, /* FbBits units per scanline */ int dstX, /* bit position of dest */ int dstBpp, /* bits per destination unit */ @@ -153,11 +153,11 @@ fbBltOne (IcStip *src, { const FbBits *icbits; int pixelsPerDst; /* dst pixels per FbBits */ - int unitsPerSrc; /* src patterns per IcStip */ + int unitsPerSrc; /* src patterns per FbStip */ int leftShift, rightShift; /* align source with dest */ FbBits startmask, endmask; /* dest scanline masks */ - IcStip bits=0, bitsLeft, bitsRight;/* source bits */ - IcStip left; + FbStip bits=0, bitsLeft, bitsRight;/* source bits */ + FbStip left; FbBits mask; int nDst; /* dest longwords (w.o. end) */ int w; @@ -190,7 +190,7 @@ fbBltOne (IcStip *src, pixelsPerDst = FB_UNIT / dstBpp; /* - * Number of source stipple patterns in IcStip + * Number of source stipple patterns in FbStip */ unitsPerSrc = FB_STIP_UNIT / pixelsPerDst; @@ -209,7 +209,7 @@ fbBltOne (IcStip *src, srcX &= FB_STIP_MASK; dstX &= FB_MASK; - IcMaskBitsBytes(dstX, width, copy, + FbMaskBitsBytes(dstX, width, copy, startmask, startbyte, nmiddle, endmask, endbyte); /* @@ -296,10 +296,10 @@ fbBltOne (IcStip *src, { #if FB_UNIT > 32 if (pixelsPerDst == 16) - mask = IcStipple16Bits(IcLeftStipBits(bits,16)); + mask = FbStipple16Bits(FbLeftStipBits(bits,16)); else #endif - mask = icbits[IcLeftStipBits(bits,pixelsPerDst)]; + mask = icbits[FbLeftStipBits(bits,pixelsPerDst)]; #ifndef FBNOPIXADDR if (fbLane) { @@ -309,11 +309,11 @@ fbBltOne (IcStip *src, #endif { if (mask || !transparent) - IcDoLeftMaskByteStippleRRop (dst, mask, + FbDoLeftMaskByteStippleRRop (dst, mask, fgand, fgxor, bgand, bgxor, startbyte, startmask); } - bits = IcStipLeft (bits, pixelsPerDst); + bits = FbStipLeft (bits, pixelsPerDst); dst++; n--; w--; @@ -330,13 +330,13 @@ fbBltOne (IcStip *src, { #if FB_UNIT > 32 if (pixelsPerDst == 16) - mask = IcStipple16Bits(IcLeftStipBits(bits,16)); + mask = FbStipple16Bits(FbLeftStipBits(bits,16)); else #endif - mask = icbits[IcLeftStipBits(bits,pixelsPerDst)]; - *dst = IcOpaqueStipple (mask, fgxor, bgxor); + mask = icbits[FbLeftStipBits(bits,pixelsPerDst)]; + *dst = FbOpaqueStipple (mask, fgxor, bgxor); dst++; - bits = IcStipLeft(bits, pixelsPerDst); + bits = FbStipLeft(bits, pixelsPerDst); } } else @@ -346,10 +346,10 @@ fbBltOne (IcStip *src, { while (bits && n) { - switch (fbLane[IcLeftStipBits(bits,pixelsPerDst)]) { + switch (fbLane[FbLeftStipBits(bits,pixelsPerDst)]) { LaneCases((uint8_t *) dst); } - bits = IcStipLeft(bits,pixelsPerDst); + bits = FbStipLeft(bits,pixelsPerDst); dst++; n--; } @@ -360,15 +360,15 @@ fbBltOne (IcStip *src, { while (n--) { - left = IcLeftStipBits(bits,pixelsPerDst); + left = FbLeftStipBits(bits,pixelsPerDst); if (left || !transparent) { mask = icbits[left]; - *dst = IcStippleRRop (*dst, mask, + *dst = FbStippleRRop (*dst, mask, fgand, fgxor, bgand, bgxor); } dst++; - bits = IcStipLeft(bits, pixelsPerDst); + bits = FbStipLeft(bits, pixelsPerDst); } } } @@ -394,10 +394,10 @@ fbBltOne (IcStip *src, } #if FB_UNIT > 32 if (pixelsPerDst == 16) - mask = IcStipple16Bits(IcLeftStipBits(bits,16)); + mask = FbStipple16Bits(FbLeftStipBits(bits,16)); else #endif - mask = icbits[IcLeftStipBits(bits,pixelsPerDst)]; + mask = icbits[FbLeftStipBits(bits,pixelsPerDst)]; #ifndef FBNOPIXADDR if (fbLane) { @@ -407,7 +407,7 @@ fbBltOne (IcStip *src, #endif { if (mask || !transparent) - IcDoRightMaskByteStippleRRop (dst, mask, + FbDoRightMaskByteStippleRRop (dst, mask, fgand, fgxor, bgand, bgxor, endbyte, endmask); } @@ -452,10 +452,10 @@ fbBltOne (IcStip *src, SelMask24(b,2,r) | \ SelMask24(b,3,r)) -#define IcStip24New(rot) (2 + (rot != 0)) -#define IcStip24Len 4 +#define FbStip24New(rot) (2 + (rot != 0)) +#define FbStip24Len 4 -static const FbBits fbStipple24Bits[3][1 << IcStip24Len] = { +static const FbBits fbStipple24Bits[3][1 << FbStip24Len] = { /* rotate 0 */ { C4_24( 0, 0), C4_24( 1, 0), C4_24( 2, 0), C4_24( 3, 0), @@ -486,14 +486,14 @@ static const FbBits fbStipple24Bits[3][1 << IcStip24Len] = { (SelMask24(b,0,r) | \ SelMask24(b,1,r)) -#define IcStip24Len 2 +#define FbStip24Len 2 #if BITMAP_BIT_ORDER == MSBFirst -#define IcStip24New(rot) (1 + (rot == 0)) +#define FbStip24New(rot) (1 + (rot == 0)) #else -#define IcStip24New(rot) (1 + (rot == 8)) +#define FbStip24New(rot) (1 + (rot == 8)) #endif -static const FbBits fbStipple24Bits[3][1 << IcStip24Len] = { +static const FbBits fbStipple24Bits[3][1 << FbStip24Len] = { /* rotate 0 */ { C2_24( 0, 0), C2_24 ( 1, 0), C2_24 ( 2, 0), C2_24 ( 3, 0), @@ -511,51 +511,51 @@ static const FbBits fbStipple24Bits[3][1 << IcStip24Len] = { #if BITMAP_BIT_ORDER == LSBFirst -#define IcMergeStip24Bits(left, right, new) \ - (IcStipLeft (left, new) | IcStipRight ((right), (IcStip24Len - (new)))) +#define FbMergeStip24Bits(left, right, new) \ + (FbStipLeft (left, new) | FbStipRight ((right), (FbStip24Len - (new)))) -#define IcMergePartStip24Bits(left, right, llen, rlen) \ - (left | IcStipRight(right, llen)) +#define FbMergePartStip24Bits(left, right, llen, rlen) \ + (left | FbStipRight(right, llen)) #else -#define IcMergeStip24Bits(left, right, new) \ - ((IcStipLeft (left, new) & ((1 << IcStip24Len) - 1)) | right) +#define FbMergeStip24Bits(left, right, new) \ + ((FbStipLeft (left, new) & ((1 << FbStip24Len) - 1)) | right) -#define IcMergePartStip24Bits(left, right, llen, rlen) \ - (IcStipLeft(left, rlen) | right) +#define FbMergePartStip24Bits(left, right, llen, rlen) \ + (FbStipLeft(left, rlen) | right) #endif #define fbFirstStipBits(len,stip) {\ int __len = (len); \ if (len <= remain) { \ - stip = IcLeftStipBits(bits, len); \ + stip = FbLeftStipBits(bits, len); \ } else { \ - stip = IcLeftStipBits(bits, remain); \ + stip = FbLeftStipBits(bits, remain); \ bits = *src++; \ __len = (len) - remain; \ - stip = IcMergePartStip24Bits(stip, IcLeftStipBits(bits, __len), \ + stip = FbMergePartStip24Bits(stip, FbLeftStipBits(bits, __len), \ remain, __len); \ remain = FB_STIP_UNIT; \ } \ - bits = IcStipLeft (bits, __len); \ + bits = FbStipLeft (bits, __len); \ remain -= __len; \ } #define fbInitStipBits(offset,len,stip) {\ - bits = IcStipLeft (*src++,offset); \ + bits = FbStipLeft (*src++,offset); \ remain = FB_STIP_UNIT - offset; \ fbFirstStipBits(len,stip); \ - stip = IcMergeStip24Bits (0, stip, len); \ + stip = FbMergeStip24Bits (0, stip, len); \ } #define fbNextStipBits(rot,stip) {\ - int __new = IcStip24New(rot); \ - IcStip __right; \ + int __new = FbStip24New(rot); \ + FbStip __right; \ fbFirstStipBits(__new, __right); \ - stip = IcMergeStip24Bits (stip, __right, __new); \ - rot = IcNext24Rot (rot); \ + stip = FbMergeStip24Bits (stip, __right, __new); \ + rot = FbNext24Rot (rot); \ } /* @@ -568,11 +568,11 @@ static const FbBits fbStipple24Bits[3][1 << IcStip24Len] = { * and text */ void -fbBltOne24 (IcStip *srcLine, - IcStride srcStride, /* IcStip units per scanline */ +fbBltOne24 (FbStip *srcLine, + FbStride srcStride, /* FbStip units per scanline */ int srcX, /* bit position of source */ FbBits *dst, - IcStride dstStride, /* FbBits units per scanline */ + FbStride dstStride, /* FbBits units per scanline */ int dstX, /* bit position of dest */ int dstBpp, /* bits per destination unit */ @@ -584,10 +584,10 @@ fbBltOne24 (IcStip *srcLine, FbBits bgand, FbBits bgxor) { - IcStip *src; + FbStip *src; FbBits leftMask, rightMask, mask; int nlMiddle, nl; - IcStip stip, bits; + FbStip stip, bits; int remain; int dstS; int firstlen; @@ -598,12 +598,12 @@ fbBltOne24 (IcStip *srcLine, dst += dstX >> FB_SHIFT; srcX &= FB_STIP_MASK; dstX &= FB_MASK; - rot0 = IcFirst24Rot (dstX); + rot0 = FbFirst24Rot (dstX); - IcMaskBits (dstX, width, leftMask, nlMiddle, rightMask); + FbMaskBits (dstX, width, leftMask, nlMiddle, rightMask); dstS = (dstX + 23) / 24; - firstlen = IcStip24Len - dstS; + firstlen = FbStip24Len - dstS; nDst = nlMiddle; if (leftMask) @@ -622,9 +622,9 @@ fbBltOne24 (IcStip *srcLine, if (leftMask) { mask = fbStipple24Bits[rot >> 3][stip]; - *dst = (*dst & ~leftMask) | (IcOpaqueStipple (mask, - IcRot24(fgxor, rot), - IcRot24(bgxor, rot)) + *dst = (*dst & ~leftMask) | (FbOpaqueStipple (mask, + FbRot24(fgxor, rot), + FbRot24(bgxor, rot)) & leftMask); dst++; fbNextStipBits(rot,stip); @@ -633,18 +633,18 @@ fbBltOne24 (IcStip *srcLine, while (nl--) { mask = fbStipple24Bits[rot>>3][stip]; - *dst = IcOpaqueStipple (mask, - IcRot24(fgxor, rot), - IcRot24(bgxor, rot)); + *dst = FbOpaqueStipple (mask, + FbRot24(fgxor, rot), + FbRot24(bgxor, rot)); dst++; fbNextStipBits(rot,stip); } if (rightMask) { mask = fbStipple24Bits[rot >> 3][stip]; - *dst = (*dst & ~rightMask) | (IcOpaqueStipple (mask, - IcRot24(fgxor, rot), - IcRot24(bgxor, rot)) + *dst = (*dst & ~rightMask) | (FbOpaqueStipple (mask, + FbRot24(fgxor, rot), + FbRot24(bgxor, rot)) & rightMask); } dst += dstStride; @@ -665,7 +665,7 @@ fbBltOne24 (IcStip *srcLine, if (stip) { mask = fbStipple24Bits[rot >> 3][stip] & leftMask; - *dst = (*dst & ~mask) | (IcRot24(fgxor, rot) & mask); + *dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask); } dst++; fbNextStipBits (rot, stip); @@ -676,7 +676,7 @@ fbBltOne24 (IcStip *srcLine, if (stip) { mask = fbStipple24Bits[rot>>3][stip]; - *dst = (*dst & ~mask) | (IcRot24(fgxor,rot) & mask); + *dst = (*dst & ~mask) | (FbRot24(fgxor,rot) & mask); } dst++; fbNextStipBits (rot, stip); @@ -686,7 +686,7 @@ fbBltOne24 (IcStip *srcLine, if (stip) { mask = fbStipple24Bits[rot >> 3][stip] & rightMask; - *dst = (*dst & ~mask) | (IcRot24(fgxor, rot) & mask); + *dst = (*dst & ~mask) | (FbRot24(fgxor, rot) & mask); } } dst += dstStride; @@ -703,11 +703,11 @@ fbBltOne24 (IcStip *srcLine, if (leftMask) { mask = fbStipple24Bits[rot >> 3][stip]; - *dst = IcStippleRRopMask (*dst, mask, - IcRot24(fgand, rot), - IcRot24(fgxor, rot), - IcRot24(bgand, rot), - IcRot24(bgxor, rot), + *dst = FbStippleRRopMask (*dst, mask, + FbRot24(fgand, rot), + FbRot24(fgxor, rot), + FbRot24(bgand, rot), + FbRot24(bgxor, rot), leftMask); dst++; fbNextStipBits(rot,stip); @@ -716,22 +716,22 @@ fbBltOne24 (IcStip *srcLine, while (nl--) { mask = fbStipple24Bits[rot >> 3][stip]; - *dst = IcStippleRRop (*dst, mask, - IcRot24(fgand, rot), - IcRot24(fgxor, rot), - IcRot24(bgand, rot), - IcRot24(bgxor, rot)); + *dst = FbStippleRRop (*dst, mask, + FbRot24(fgand, rot), + FbRot24(fgxor, rot), + FbRot24(bgand, rot), + FbRot24(bgxor, rot)); dst++; fbNextStipBits(rot,stip); } if (rightMask) { mask = fbStipple24Bits[rot >> 3][stip]; - *dst = IcStippleRRopMask (*dst, mask, - IcRot24(fgand, rot), - IcRot24(fgxor, rot), - IcRot24(bgand, rot), - IcRot24(bgxor, rot), + *dst = FbStippleRRopMask (*dst, mask, + FbRot24(fgand, rot), + FbRot24(fgxor, rot), + FbRot24(bgand, rot), + FbRot24(bgxor, rot), rightMask); } dst += dstStride; diff --git a/pixman/src/iccolor.c b/pixman/src/iccolor.c index afa52f7e2..e3e2a30b0 100644 --- a/pixman/src/iccolor.c +++ b/pixman/src/iccolor.c @@ -26,7 +26,7 @@ #ifdef ICINT_NEED_IC_ONES /* Fall back on HACKMEM 169. */ int -_IcOnes (unsigned long mask) +_FbOnes (unsigned long mask) { register unsigned long y; @@ -43,10 +43,10 @@ pixman_color_to_pixel (const pixman_format_t *format, { uint32_t r, g, b, a; - r = color->red >> (16 - _IcOnes (format->redMask)); - g = color->green >> (16 - _IcOnes (format->greenMask)); - b = color->blue >> (16 - _IcOnes (format->blueMask)); - a = color->alpha >> (16 - _IcOnes (format->alphaMask)); + r = color->red >> (16 - _FbOnes (format->redMask)); + g = color->green >> (16 - _FbOnes (format->greenMask)); + b = color->blue >> (16 - _FbOnes (format->blueMask)); + a = color->alpha >> (16 - _FbOnes (format->alphaMask)); r = r << format->red; g = g << format->green; b = b << format->blue; @@ -56,7 +56,7 @@ pixman_color_to_pixel (const pixman_format_t *format, slim_hidden_def(pixman_color_to_pixel); static uint16_t -IcFillColor (uint32_t pixel, int bits) +FbFillColor (uint32_t pixel, int bits) { while (bits < 16) { @@ -77,8 +77,8 @@ pixman_pixel_to_color (const pixman_format_t *format, g = (pixel >> format->green) & format->greenMask; b = (pixel >> format->blue) & format->blueMask; a = (pixel >> format->alpha) & format->alphaMask; - color->red = IcFillColor (r, _IcOnes (format->redMask)); - color->green = IcFillColor (r, _IcOnes (format->greenMask)); - color->blue = IcFillColor (r, _IcOnes (format->blueMask)); - color->alpha = IcFillColor (r, _IcOnes (format->alphaMask)); + color->red = FbFillColor (r, _FbOnes (format->redMask)); + color->green = FbFillColor (r, _FbOnes (format->greenMask)); + color->blue = FbFillColor (r, _FbOnes (format->blueMask)); + color->alpha = FbFillColor (r, _FbOnes (format->alphaMask)); } diff --git a/pixman/src/iccompose.c b/pixman/src/iccompose.c index 7394c3822..611cb7c93 100644 --- a/pixman/src/iccompose.c +++ b/pixman/src/iccompose.c @@ -55,18 +55,18 @@ fbCombineMaskU (FbCompositeOperand *src, if (a == 0xff) return x; - m = IcInU(x,0,a,t); - n = IcInU(x,8,a,t); - o = IcInU(x,16,a,t); - p = IcInU(x,24,a,t); + m = FbInU(x,0,a,t); + n = FbInU(x,8,a,t); + o = FbInU(x,16,a,t); + p = FbInU(x,24,a,t); return m|n|o|p; } -static IcCompSrc +static FbCompSrc fbCombineMaskC (FbCompositeOperand *src, FbCompositeOperand *msk) { - IcCompSrc s; + FbCompSrc s; uint32_t x; uint32_t a; uint16_t xa; @@ -103,16 +103,16 @@ fbCombineMaskC (FbCompositeOperand *src, return s; } - m = IcInC(x,0,a,t); - n = IcInC(x,8,a,t); - o = IcInC(x,16,a,t); - p = IcInC(x,24,a,t); + m = FbInC(x,0,a,t); + n = FbInC(x,8,a,t); + o = FbInC(x,16,a,t); + p = FbInC(x,24,a,t); s.value = m|n|o|p; xa = x >> 24; - m = IcInU(a,0,xa,t); - n = IcInU(a,8,xa,t); - o = IcInU(a,16,xa,t); - p = IcInU(a,24,xa,t); + m = FbInU(a,0,xa,t); + n = FbInU(a,8,xa,t); + o = FbInU(a,16,xa,t); + p = FbInU(a,24,xa,t); s.alpha = m|n|o|p; return s; } @@ -139,10 +139,10 @@ fbCombineMaskValueC (FbCompositeOperand *src, if (a == 0xffffffff) return x; - m = IcInC(x,0,a,t); - n = IcInC(x,8,a,t); - o = IcInC(x,16,a,t); - p = IcInC(x,24,a,t); + m = FbInC(x,0,a,t); + n = FbInC(x,8,a,t); + o = FbInC(x,16,a,t); + p = FbInC(x,24,a,t); return m|n|o|p; } @@ -168,7 +168,7 @@ fbCombineMaskAlphaU (FbCompositeOperand *src, if (a == 0xff) return x; - return IcInU(x,24,a,t); + return FbInU(x,24,a,t); } static uint32_t @@ -191,10 +191,10 @@ fbCombineMaskAlphaC (FbCompositeOperand *src, if (a == 0xffffffff) return x; - m = IcInC(x,0,a,t); - n = IcInC(x,8,a,t); - o = IcInC(x,16,a,t); - p = IcInC(x,24,a,t); + m = FbInC(x,0,a,t); + n = FbInC(x,8,a,t); + o = FbInC(x,16,a,t); + p = FbInC(x,24,a,t); return m|n|o|p; } @@ -250,10 +250,10 @@ fbCombineOverU (FbCompositeOperand *src, if (a) { d = (*dst->fetch) (dst); - m = IcOverU(s,d,0,a,t); - n = IcOverU(s,d,8,a,t); - o = IcOverU(s,d,16,a,t); - p = IcOverU(s,d,24,a,t); + m = FbOverU(s,d,0,a,t); + n = FbOverU(s,d,8,a,t); + o = FbOverU(s,d,16,a,t); + p = FbOverU(s,d,24,a,t); s = m|n|o|p; } (*dst->store) (dst, s); @@ -265,7 +265,7 @@ fbCombineOverC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCompSrc cs; + FbCompSrc cs; uint32_t s, d; uint32_t a; uint16_t t; @@ -279,10 +279,10 @@ fbCombineOverC (FbCompositeOperand *src, if (a) { d = (*dst->fetch) (dst); - m = IcOverC(s,d,0,a,t); - n = IcOverC(s,d,8,a,t); - o = IcOverC(s,d,16,a,t); - p = IcOverC(s,d,24,a,t); + m = FbOverC(s,d,0,a,t); + n = FbOverC(s,d,8,a,t); + o = FbOverC(s,d,16,a,t); + p = FbOverC(s,d,24,a,t); s = m|n|o|p; } (*dst->store) (dst, s); @@ -306,10 +306,10 @@ fbCombineOverReverseU (FbCompositeOperand *src, s = fbCombineMaskU (src, msk); if (a != 0xff) { - m = IcOverU(d,s,0,a,t); - n = IcOverU(d,s,8,a,t); - o = IcOverU(d,s,16,a,t); - p = IcOverU(d,s,24,a,t); + m = FbOverU(d,s,0,a,t); + n = FbOverU(d,s,8,a,t); + o = FbOverU(d,s,16,a,t); + p = FbOverU(d,s,24,a,t); s = m|n|o|p; } (*dst->store) (dst, s); @@ -333,10 +333,10 @@ fbCombineOverReverseC (FbCompositeOperand *src, s = fbCombineMaskValueC (src, msk); if (a != 0xff) { - m = IcOverU(d,s,0,a,t); - n = IcOverU(d,s,8,a,t); - o = IcOverU(d,s,16,a,t); - p = IcOverU(d,s,24,a,t); + m = FbOverU(d,s,0,a,t); + n = FbOverU(d,s,8,a,t); + o = FbOverU(d,s,16,a,t); + p = FbOverU(d,s,24,a,t); s = m|n|o|p; } (*dst->store) (dst, s); @@ -361,10 +361,10 @@ fbCombineInU (FbCompositeOperand *src, s = fbCombineMaskU (src, msk); if (a != 0xff) { - m = IcInU(s,0,a,t); - n = IcInU(s,8,a,t); - o = IcInU(s,16,a,t); - p = IcInU(s,24,a,t); + m = FbInU(s,0,a,t); + n = FbInU(s,8,a,t); + o = FbInU(s,16,a,t); + p = FbInU(s,24,a,t); s = m|n|o|p; } } @@ -389,10 +389,10 @@ fbCombineInC (FbCompositeOperand *src, s = fbCombineMaskValueC (src, msk); if (a != 0xff) { - m = IcInU(s,0,a,t); - n = IcInU(s,8,a,t); - o = IcInU(s,16,a,t); - p = IcInU(s,24,a,t); + m = FbInU(s,0,a,t); + n = FbInU(s,8,a,t); + o = FbInU(s,16,a,t); + p = FbInU(s,24,a,t); s = m|n|o|p; } } @@ -417,10 +417,10 @@ fbCombineInReverseU (FbCompositeOperand *src, if (a) { d = (*dst->fetch) (dst); - m = IcInU(d,0,a,t); - n = IcInU(d,8,a,t); - o = IcInU(d,16,a,t); - p = IcInU(d,24,a,t); + m = FbInU(d,0,a,t); + n = FbInU(d,8,a,t); + o = FbInU(d,16,a,t); + p = FbInU(d,24,a,t); d = m|n|o|p; } (*dst->store) (dst, d); @@ -445,10 +445,10 @@ fbCombineInReverseC (FbCompositeOperand *src, if (a) { d = (*dst->fetch) (dst); - m = IcInC(d,0,a,t); - n = IcInC(d,8,a,t); - o = IcInC(d,16,a,t); - p = IcInC(d,24,a,t); + m = FbInC(d,0,a,t); + n = FbInC(d,8,a,t); + o = FbInC(d,16,a,t); + p = FbInC(d,24,a,t); d = m|n|o|p; } (*dst->store) (dst, d); @@ -473,10 +473,10 @@ fbCombineOutU (FbCompositeOperand *src, s = fbCombineMaskU (src, msk); if (a != 0xff) { - m = IcInU(s,0,a,t); - n = IcInU(s,8,a,t); - o = IcInU(s,16,a,t); - p = IcInU(s,24,a,t); + m = FbInU(s,0,a,t); + n = FbInU(s,8,a,t); + o = FbInU(s,16,a,t); + p = FbInU(s,24,a,t); s = m|n|o|p; } } @@ -501,10 +501,10 @@ fbCombineOutC (FbCompositeOperand *src, s = fbCombineMaskValueC (src, msk); if (a != 0xff) { - m = IcInU(s,0,a,t); - n = IcInU(s,8,a,t); - o = IcInU(s,16,a,t); - p = IcInU(s,24,a,t); + m = FbInU(s,0,a,t); + n = FbInU(s,8,a,t); + o = FbInU(s,16,a,t); + p = FbInU(s,24,a,t); s = m|n|o|p; } } @@ -529,10 +529,10 @@ fbCombineOutReverseU (FbCompositeOperand *src, if (a) { d = (*dst->fetch) (dst); - m = IcInU(d,0,a,t); - n = IcInU(d,8,a,t); - o = IcInU(d,16,a,t); - p = IcInU(d,24,a,t); + m = FbInU(d,0,a,t); + n = FbInU(d,8,a,t); + o = FbInU(d,16,a,t); + p = FbInU(d,24,a,t); d = m|n|o|p; } (*dst->store) (dst, d); @@ -557,10 +557,10 @@ fbCombineOutReverseC (FbCompositeOperand *src, if (a) { d = (*dst->fetch) (dst); - m = IcInC(d,0,a,t); - n = IcInC(d,8,a,t); - o = IcInC(d,16,a,t); - p = IcInC(d,24,a,t); + m = FbInC(d,0,a,t); + n = FbInC(d,8,a,t); + o = FbInC(d,16,a,t); + p = FbInC(d,24,a,t); d = m|n|o|p; } (*dst->store) (dst, d); @@ -581,10 +581,10 @@ fbCombineAtopU (FbCompositeOperand *src, d = (*dst->fetch) (dst); ad = ~s >> 24; as = d >> 24; - m = IcGen(s,d,0,as,ad,t,u,v); - n = IcGen(s,d,8,as,ad,t,u,v); - o = IcGen(s,d,16,as,ad,t,u,v); - p = IcGen(s,d,24,as,ad,t,u,v); + m = FbGen(s,d,0,as,ad,t,u,v); + n = FbGen(s,d,8,as,ad,t,u,v); + o = FbGen(s,d,16,as,ad,t,u,v); + p = FbGen(s,d,24,as,ad,t,u,v); (*dst->store) (dst, m|n|o|p); } @@ -593,7 +593,7 @@ fbCombineAtopC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCompSrc cs; + FbCompSrc cs; uint32_t s, d; uint32_t ad; uint16_t as; @@ -605,10 +605,10 @@ fbCombineAtopC (FbCompositeOperand *src, s = cs.value; ad = cs.alpha; as = d >> 24; - m = IcGen(s,d,0,as,IcGet8(ad,0),t,u,v); - n = IcGen(s,d,8,as,IcGet8(ad,8),t,u,v); - o = IcGen(s,d,16,as,IcGet8(ad,16),t,u,v); - p = IcGen(s,d,24,as,IcGet8(ad,24),t,u,v); + m = FbGen(s,d,0,as,FbGet8(ad,0),t,u,v); + n = FbGen(s,d,8,as,FbGet8(ad,8),t,u,v); + o = FbGen(s,d,16,as,FbGet8(ad,16),t,u,v); + p = FbGen(s,d,24,as,FbGet8(ad,24),t,u,v); (*dst->store) (dst, m|n|o|p); } @@ -626,10 +626,10 @@ fbCombineAtopReverseU (FbCompositeOperand *src, d = (*dst->fetch) (dst); ad = s >> 24; as = ~d >> 24; - m = IcGen(s,d,0,as,ad,t,u,v); - n = IcGen(s,d,8,as,ad,t,u,v); - o = IcGen(s,d,16,as,ad,t,u,v); - p = IcGen(s,d,24,as,ad,t,u,v); + m = FbGen(s,d,0,as,ad,t,u,v); + n = FbGen(s,d,8,as,ad,t,u,v); + o = FbGen(s,d,16,as,ad,t,u,v); + p = FbGen(s,d,24,as,ad,t,u,v); (*dst->store) (dst, m|n|o|p); } @@ -638,7 +638,7 @@ fbCombineAtopReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCompSrc cs; + FbCompSrc cs; uint32_t s, d, ad; uint16_t as; uint16_t t, u, v; @@ -649,10 +649,10 @@ fbCombineAtopReverseC (FbCompositeOperand *src, s = cs.value; ad = cs.alpha; as = ~d >> 24; - m = IcGen(s,d,0,as,IcGet8(ad,0),t,u,v); - n = IcGen(s,d,8,as,IcGet8(ad,8),t,u,v); - o = IcGen(s,d,16,as,IcGet8(ad,16),t,u,v); - p = IcGen(s,d,24,as,IcGet8(ad,24),t,u,v); + m = FbGen(s,d,0,as,FbGet8(ad,0),t,u,v); + n = FbGen(s,d,8,as,FbGet8(ad,8),t,u,v); + o = FbGen(s,d,16,as,FbGet8(ad,16),t,u,v); + p = FbGen(s,d,24,as,FbGet8(ad,24),t,u,v); (*dst->store) (dst, m|n|o|p); } @@ -670,10 +670,10 @@ fbCombineXorU (FbCompositeOperand *src, d = (*dst->fetch) (dst); ad = ~s >> 24; as = ~d >> 24; - m = IcGen(s,d,0,as,ad,t,u,v); - n = IcGen(s,d,8,as,ad,t,u,v); - o = IcGen(s,d,16,as,ad,t,u,v); - p = IcGen(s,d,24,as,ad,t,u,v); + m = FbGen(s,d,0,as,ad,t,u,v); + n = FbGen(s,d,8,as,ad,t,u,v); + o = FbGen(s,d,16,as,ad,t,u,v); + p = FbGen(s,d,24,as,ad,t,u,v); (*dst->store) (dst, m|n|o|p); } @@ -682,7 +682,7 @@ fbCombineXorC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - IcCompSrc cs; + FbCompSrc cs; uint32_t s, d, ad; uint16_t as; uint16_t t, u, v; @@ -693,10 +693,10 @@ fbCombineXorC (FbCompositeOperand *src, s = cs.value; ad = ~cs.alpha; as = ~d >> 24; - m = IcGen(s,d,0,as,ad,t,u,v); - n = IcGen(s,d,8,as,ad,t,u,v); - o = IcGen(s,d,16,as,ad,t,u,v); - p = IcGen(s,d,24,as,ad,t,u,v); + m = FbGen(s,d,0,as,ad,t,u,v); + n = FbGen(s,d,8,as,ad,t,u,v); + o = FbGen(s,d,16,as,ad,t,u,v); + p = FbGen(s,d,24,as,ad,t,u,v); (*dst->store) (dst, m|n|o|p); } @@ -717,10 +717,10 @@ fbCombineAddU (FbCompositeOperand *src, d = (*dst->fetch) (dst); if (s && d != ~0) { - m = IcAdd(s,d,0,t); - n = IcAdd(s,d,8,t); - o = IcAdd(s,d,16,t); - p = IcAdd(s,d,24,t); + m = FbAdd(s,d,0,t); + n = FbAdd(s,d,8,t); + o = FbAdd(s,d,16,t); + p = FbAdd(s,d,24,t); (*dst->store) (dst, m|n|o|p); } } @@ -743,10 +743,10 @@ fbCombineAddC (FbCompositeOperand *src, d = (*dst->fetch) (dst); if (s && d != ~0) { - m = IcAdd(s,d,0,t); - n = IcAdd(s,d,8,t); - o = IcAdd(s,d,16,t); - p = IcAdd(s,d,24,t); + m = FbAdd(s,d,0,t); + n = FbAdd(s,d,8,t); + o = FbAdd(s,d,16,t); + p = FbAdd(s,d,24,t); (*dst->store) (dst, m|n|o|p); } } @@ -800,7 +800,7 @@ fbCombineDisjointOutPart (uint8_t a, uint8_t b) b = ~b; /* 1 - b */ if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ return 0xff; /* 1 */ - return IcIntDiv(b,a); /* (1-b) / a */ + return FbIntDiv(b,a); /* (1-b) / a */ } /* portion covered by both a and b */ @@ -814,7 +814,7 @@ fbCombineDisjointInPart (uint8_t a, uint8_t b) b = ~b; /* 1 - b */ if (b >= a) /* 1 - b >= a -> (1-b)/a >= 1 */ return 0; /* 1 - 1 */ - return ~IcIntDiv(b,a); /* 1 - (1-b) / a */ + return ~FbIntDiv(b,a); /* 1 - (1-b) / a */ } static void @@ -863,10 +863,10 @@ fbCombineDisjointGeneralU (FbCompositeOperand *src, Fb = 0xff; break; } - m = IcGen (s,d,0,Fa,Fb,t,u,v); - n = IcGen (s,d,8,Fa,Fb,t,u,v); - o = IcGen (s,d,16,Fa,Fb,t,u,v); - p = IcGen (s,d,24,Fa,Fb,t,u,v); + m = FbGen (s,d,0,Fa,Fb,t,u,v); + n = FbGen (s,d,8,Fa,Fb,t,u,v); + o = FbGen (s,d,16,Fa,Fb,t,u,v); + p = FbGen (s,d,24,Fa,Fb,t,u,v); s = m|n|o|p; (*dst->store) (dst, s); } @@ -877,7 +877,7 @@ fbCombineDisjointGeneralC (FbCompositeOperand *src, FbCompositeOperand *dst, uint8_t combine) { - IcCompSrc cs; + FbCompSrc cs; uint32_t s, d; uint32_t m,n,o,p; uint32_t Fa; @@ -929,10 +929,10 @@ fbCombineDisjointGeneralC (FbCompositeOperand *src, Fb = 0xff; break; } - m = IcGen (s,d,0,IcGet8(Fa,0),Fb,t,u,v); - n = IcGen (s,d,8,IcGet8(Fa,8),Fb,t,u,v); - o = IcGen (s,d,16,IcGet8(Fa,16),Fb,t,u,v); - p = IcGen (s,d,24,IcGet8(Fa,24),Fb,t,u,v); + m = FbGen (s,d,0,FbGet8(Fa,0),Fb,t,u,v); + n = FbGen (s,d,8,FbGet8(Fa,8),Fb,t,u,v); + o = FbGen (s,d,16,FbGet8(Fa,16),Fb,t,u,v); + p = FbGen (s,d,24,FbGet8(Fa,24),Fb,t,u,v); s = m|n|o|p; (*dst->store) (dst, s); } @@ -955,10 +955,10 @@ fbCombineDisjointOverU (FbCompositeOperand *src, { d = (*dst->fetch) (dst); a = fbCombineDisjointOutPart (d >> 24, a); - m = IcOverU(s,d,0,a,t); - n = IcOverU(s,d,8,a,t); - o = IcOverU(s,d,16,a,t); - p = IcOverU(s,d,24,a,t); + m = FbOverU(s,d,0,a,t); + n = FbOverU(s,d,8,a,t); + o = FbOverU(s,d,16,a,t); + p = FbOverU(s,d,24,a,t); s = m|n|o|p; } (*dst->store) (dst, s); @@ -1112,7 +1112,7 @@ fbCombineConjointOutPart (uint8_t a, uint8_t b) if (b >= a) /* b >= a -> b/a >= 1 */ return 0x00; /* 0 */ - return ~IcIntDiv(b,a); /* 1 - b/a */ + return ~FbIntDiv(b,a); /* 1 - b/a */ } /* portion covered by both a and b */ @@ -1123,7 +1123,7 @@ fbCombineConjointInPart (uint8_t a, uint8_t b) if (b >= a) /* b >= a -> b/a >= 1 */ return 0xff; /* 1 */ - return IcIntDiv(b,a); /* b/a */ + return FbIntDiv(b,a); /* b/a */ } static void @@ -1172,10 +1172,10 @@ fbCombineConjointGeneralU (FbCompositeOperand *src, Fb = 0xff; break; } - m = IcGen (s,d,0,Fa,Fb,t,u,v); - n = IcGen (s,d,8,Fa,Fb,t,u,v); - o = IcGen (s,d,16,Fa,Fb,t,u,v); - p = IcGen (s,d,24,Fa,Fb,t,u,v); + m = FbGen (s,d,0,Fa,Fb,t,u,v); + n = FbGen (s,d,8,Fa,Fb,t,u,v); + o = FbGen (s,d,16,Fa,Fb,t,u,v); + p = FbGen (s,d,24,Fa,Fb,t,u,v); s = m|n|o|p; (*dst->store) (dst, s); } @@ -1186,7 +1186,7 @@ fbCombineConjointGeneralC (FbCompositeOperand *src, FbCompositeOperand *dst, uint8_t combine) { - IcCompSrc cs; + FbCompSrc cs; uint32_t s, d; uint32_t m,n,o,p; uint32_t Fa; @@ -1238,10 +1238,10 @@ fbCombineConjointGeneralC (FbCompositeOperand *src, Fb = 0xff; break; } - m = IcGen (s,d,0,IcGet8(Fa,0),Fb,t,u,v); - n = IcGen (s,d,8,IcGet8(Fa,8),Fb,t,u,v); - o = IcGen (s,d,16,IcGet8(Fa,16),Fb,t,u,v); - p = IcGen (s,d,24,IcGet8(Fa,24),Fb,t,u,v); + m = FbGen (s,d,0,FbGet8(Fa,0),Fb,t,u,v); + n = FbGen (s,d,8,FbGet8(Fa,8),Fb,t,u,v); + o = FbGen (s,d,16,FbGet8(Fa,16),Fb,t,u,v); + p = FbGen (s,d,24,FbGet8(Fa,24),Fb,t,u,v); s = m|n|o|p; (*dst->store) (dst, s); } @@ -1266,10 +1266,10 @@ fbCombineConjointOverU (FbCompositeOperand *src, { d = (*dst->fetch) (dst); a = fbCombineConjointOutPart (d >> 24, a); - m = IcOverU(s,d,0,a,t); - n = IcOverU(s,d,8,a,t); - o = IcOverU(s,d,16,a,t); - p = IcOverU(s,d,24,a,t); + m = FbOverU(s,d,0,a,t); + n = FbOverU(s,d,8,a,t); + o = FbOverU(s,d,16,a,t); + p = FbOverU(s,d,24,a,t); s = m|n|o|p; } (*dst->store) (dst, s); @@ -1413,7 +1413,7 @@ fbCombineConjointXorC (FbCompositeOperand *src, fbCombineConjointGeneralC (src, msk, dst, CombineXor); } -static IcCombineFunc const fbCombineFuncU[] = { +static FbCombineFunc const fbCombineFuncU[] = { fbCombineClear, fbCombineSrcU, fbCombineDst, @@ -1460,7 +1460,7 @@ static IcCombineFunc const fbCombineFuncU[] = { fbCombineConjointXorU, }; -static IcCombineFunc const fbCombineFuncC[] = { +static FbCombineFunc const fbCombineFuncC[] = { fbCombineClear, fbCombineSrcC, fbCombineDst, @@ -2210,7 +2210,7 @@ fbStore_a1 (FbCompositeOperand *op, uint32_t value) { FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; uint32_t *pixel = ((uint32_t *) line) + (offset >> 5); - uint32_t mask = IcStipMask(offset & 0x1f, 1); + uint32_t mask = FbStipMask(offset & 0x1f, 1); value = value & 0x80000000 ? mask : 0; *pixel = (*pixel & ~mask) | value; @@ -2440,7 +2440,7 @@ fbFetcha_transform (FbCompositeOperand *op) return bits; } -static IcAccessMap const fbAccessMap[] = { +static FbAccessMap const fbAccessMap[] = { /* 32bpp formats */ { PICT_a8r8g8b8, fbFetch_a8r8g8b8, fbFetch_a8r8g8b8, fbStore_a8r8g8b8 }, { PICT_x8r8g8b8, fbFetch_x8r8g8b8, fbFetch_x8r8g8b8, fbStore_x8r8g8b8 }, @@ -2619,7 +2619,7 @@ fbBuildCompositeOperand (pixman_image_t *image, if (fbAccessMap[i].format_code == image->format_code) { FbBits *bits; - IcStride stride; + FbStride stride; int bpp; op->fetch = fbAccessMap[i].fetch; @@ -2635,7 +2635,7 @@ fbBuildCompositeOperand (pixman_image_t *image, else op->src_clip = image->pSourceClip; - IcGetPixels (image->pixels, bits, stride, bpp, + FbGetPixels (image->pixels, bits, stride, bpp, xoff, yoff); if (image->repeat && image->pixels->width == 1 && image->pixels->height == 1) @@ -2682,7 +2682,7 @@ pixman_compositeGeneral (pixman_operator_t op, FbCompositeOperand *srcPict, *srcAlpha; FbCompositeOperand *dstPict, *dstAlpha; FbCompositeOperand *mskPict = 0, *mskAlpha = 0; - IcCombineFunc f; + FbCombineFunc f; int w; if (!fbBuildCompositeOperand (iSrc, src, xSrc, ySrc, 1, 1)) diff --git a/pixman/src/icformat.c b/pixman/src/icformat.c index 8e93ca0b4..37d9bc549 100644 --- a/pixman/src/icformat.c +++ b/pixman/src/icformat.c @@ -76,10 +76,10 @@ pixman_format_create_masks (int bpp, type = PICT_TYPE_ABGR; format_code = PICT_FORMAT (bpp, type, - _IcOnes (alpha_mask), - _IcOnes (red_mask), - _IcOnes (green_mask), - _IcOnes (blue_mask)); + _FbOnes (alpha_mask), + _FbOnes (red_mask), + _FbOnes (green_mask), + _FbOnes (blue_mask)); format = malloc (sizeof (pixman_format_t)); if (format == NULL) @@ -148,7 +148,7 @@ pixman_format_init (pixman_format_t *format, int format_code) break; } - format->depth = _IcOnes ((format->alphaMask << format->alpha) | + format->depth = _FbOnes ((format->alphaMask << format->alpha) | (format->redMask << format->red) | (format->blueMask << format->blue) | (format->greenMask << format->green)); diff --git a/pixman/src/icimage.c b/pixman/src/icimage.c index 33539fdec..1399def65 100644 --- a/pixman/src/icimage.c +++ b/pixman/src/icimage.c @@ -29,15 +29,15 @@ pixman_image_create (pixman_format_t *format, int height) { pixman_image_t *image; - IcPixels *pixels; + FbPixels *pixels; - pixels = IcPixelsCreate (width, height, format->depth); + pixels = FbPixelsCreate (width, height, format->depth); if (pixels == NULL) return NULL; image = pixman_image_createForPixels (pixels, format); if (image == NULL) { - IcPixelsDestroy (pixels); + FbPixelsDestroy (pixels); return NULL; } @@ -51,15 +51,15 @@ pixman_image_t * pixman_image_create_for_data (FbBits *data, pixman_format_t *format, int width, int height, int bpp, int stride) { pixman_image_t *image; - IcPixels *pixels; + FbPixels *pixels; - pixels = IcPixelsCreateForData (data, width, height, format->depth, bpp, stride); + pixels = FbPixelsCreateForData (data, width, height, format->depth, bpp, stride); if (pixels == NULL) return NULL; image = pixman_image_createForPixels (pixels, format); if (image == NULL) { - IcPixelsDestroy (pixels); + FbPixelsDestroy (pixels); return NULL; } @@ -69,7 +69,7 @@ pixman_image_create_for_data (FbBits *data, pixman_format_t *format, int width, } pixman_image_t * -pixman_image_createForPixels (IcPixels *pixels, +pixman_image_createForPixels (FbPixels *pixels, pixman_format_t *format) { pixman_image_t *image; @@ -265,7 +265,7 @@ pixman_image_destroy (pixman_image_t *image) } if (image->owns_pixels) { - IcPixelsDestroy (image->pixels); + FbPixelsDestroy (image->pixels); image->pixels = NULL; } @@ -331,7 +331,7 @@ pixman_image_set_clip_region (pixman_image_t *image, #define BOUND(v) (int16_t) ((v) < MINSHORT ? MINSHORT : (v) > MAXSHORT ? MAXSHORT : (v)) static __inline int -IcClipImageReg (pixman_region16_t *region, +FbClipImageReg (pixman_region16_t *region, pixman_region16_t *clip, int dx, int dy) @@ -367,7 +367,7 @@ IcClipImageReg (pixman_region16_t *region, } static __inline int -IcClipImageSrc (pixman_region16_t *region, +FbClipImageSrc (pixman_region16_t *region, pixman_image_t *image, int dx, int dy) @@ -399,7 +399,7 @@ IcClipImageSrc (pixman_region16_t *region, clip = image->pCompositeClip; else clip = image->pSourceClip; - return IcClipImageReg (region, + return FbClipImageReg (region, clip, dx, dy); @@ -594,7 +594,7 @@ SetPictureClipRects (PicturePtr pPicture, */ int -IcComputeCompositeRegion (pixman_region16_t *region, +FbComputeCompositeRegion (pixman_region16_t *region, pixman_image_t *iSrc, pixman_image_t *iMask, pixman_image_t *iDst, @@ -629,14 +629,14 @@ IcComputeCompositeRegion (pixman_region16_t *region, return 1; } /* clip against src */ - if (!IcClipImageSrc (region, iSrc, xDst - xSrc, yDst - ySrc)) + if (!FbClipImageSrc (region, iSrc, xDst - xSrc, yDst - ySrc)) { pixman_region_destroy (region); return 0; } if (iSrc->alphaMap) { - if (!IcClipImageSrc (region, iSrc->alphaMap, + if (!FbClipImageSrc (region, iSrc->alphaMap, xDst - (xSrc + iSrc->alphaOrigin.x), yDst - (ySrc + iSrc->alphaOrigin.y))) { @@ -647,14 +647,14 @@ IcComputeCompositeRegion (pixman_region16_t *region, /* clip against mask */ if (iMask) { - if (!IcClipImageSrc (region, iMask, xDst - xMask, yDst - yMask)) + if (!FbClipImageSrc (region, iMask, xDst - xMask, yDst - yMask)) { pixman_region_destroy (region); return 0; } if (iMask->alphaMap) { - if (!IcClipImageSrc (region, iMask->alphaMap, + if (!FbClipImageSrc (region, iMask->alphaMap, xDst - (xMask + iMask->alphaOrigin.x), yDst - (yMask + iMask->alphaOrigin.y))) { @@ -663,14 +663,14 @@ IcComputeCompositeRegion (pixman_region16_t *region, } } } - if (!IcClipImageReg (region, iDst->pCompositeClip, 0, 0)) + if (!FbClipImageReg (region, iDst->pCompositeClip, 0, 0)) { pixman_region_destroy (region); return 0; } if (iDst->alphaMap) { - if (!IcClipImageReg (region, iDst->alphaMap->pCompositeClip, + if (!FbClipImageReg (region, iDst->alphaMap->pCompositeClip, -iDst->alphaOrigin.x, -iDst->alphaOrigin.y)) { diff --git a/pixman/src/icimage.h b/pixman/src/icimage.h index ef61b2be8..98bdb2e19 100644 --- a/pixman/src/icimage.h +++ b/pixman/src/icimage.h @@ -34,10 +34,10 @@ */ -#define IcIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) ) -#define IcIntDiv(a,b) (((uint16_t) (a) * 255) / (b)) +#define FbIntMult(a,b,t) ( (t) = (a) * (b) + 0x80, ( ( ( (t)>>8 ) + (t) )>>8 ) ) +#define FbIntDiv(a,b) (((uint16_t) (a) * 255) / (b)) -#define IcGet8(v,i) ((uint16_t) (uint8_t) ((v) >> i)) +#define FbGet8(v,i) ((uint16_t) (uint8_t) ((v) >> i)) /* * There are two ways of handling alpha -- either as a single unified value or @@ -47,22 +47,22 @@ * this difference will have two versions using the same convention. */ -#define IcOverU(x,y,i,a,t) ((t) = IcIntMult(IcGet8(y,i),(a),(t)) + IcGet8(x,i),\ +#define FbOverU(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),(a),(t)) + FbGet8(x,i),\ (uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i)) -#define IcOverC(x,y,i,a,t) ((t) = IcIntMult(IcGet8(y,i),IcGet8(a,i),(t)) + IcGet8(x,i),\ +#define FbOverC(x,y,i,a,t) ((t) = FbIntMult(FbGet8(y,i),FbGet8(a,i),(t)) + FbGet8(x,i),\ (uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i)) -#define IcInU(x,i,a,t) ((uint32_t) IcIntMult(IcGet8(x,i),(a),(t)) << (i)) +#define FbInU(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),(a),(t)) << (i)) -#define IcInC(x,i,a,t) ((uint32_t) IcIntMult(IcGet8(x,i),IcGet8(a,i),(t)) << (i)) +#define FbInC(x,i,a,t) ((uint32_t) FbIntMult(FbGet8(x,i),FbGet8(a,i),(t)) << (i)) -#define IcGen(x,y,i,ax,ay,t,u,v) ((t) = (IcIntMult(IcGet8(y,i),ay,(u)) + \ - IcIntMult(IcGet8(x,i),ax,(v))),\ +#define FbGen(x,y,i,ax,ay,t,u,v) ((t) = (FbIntMult(FbGet8(y,i),ay,(u)) + \ + FbIntMult(FbGet8(x,i),ax,(v))),\ (uint32_t) ((uint8_t) ((t) | \ (0 - ((t) >> 8)))) << (i)) -#define IcAdd(x,y,i,t) ((t) = IcGet8(x,i) + IcGet8(y,i), \ +#define FbAdd(x,y,i,t) ((t) = FbGet8(x,i) + FbGet8(y,i), \ (uint32_t) ((uint8_t) ((t) | (0 - ((t) >> 8)))) << (i)) /* @@ -87,7 +87,7 @@ typedef struct pixman_format { */ struct pixman_image { - IcPixels *pixels; + FbPixels *pixels; pixman_format_t image_format; int format_code; int refcnt; @@ -105,9 +105,9 @@ struct pixman_image { unsigned int unused : 21; struct pixman_image *alphaMap; - IcPoint alphaOrigin; + FbPoint alphaOrigin; - IcPoint clipOrigin; + FbPoint clipOrigin; void *clientClip; unsigned long dither; @@ -135,28 +135,28 @@ struct pixman_image { #define IC_MAX_INDEXED 256 /* XXX depth must be <= 8 */ #if IC_MAX_INDEXED <= 256 -typedef uint8_t IcIndexType; +typedef uint8_t FbIndexType; #endif /* XXX: We're not supporting indexed operations, right? -typedef struct _IcIndexed { +typedef struct _FbIndexed { int color; uint32_t rgba[IC_MAX_INDEXED]; - IcIndexType ent[32768]; -} IcIndexedRec, *IcIndexedPtr; + FbIndexType ent[32768]; +} FbIndexedRec, *FbIndexedPtr; */ -#define IcCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \ +#define FbCvtR8G8B8to15(s) ((((s) >> 3) & 0x001f) | \ (((s) >> 6) & 0x03e0) | \ (((s) >> 9) & 0x7c00)) -#define IcIndexToEnt15(icf,rgb15) ((icf)->ent[rgb15]) -#define IcIndexToEnt24(icf,rgb24) IcIndexToEnt15(icf,IcCvtR8G8B8to15(rgb24)) +#define FbIndexToEnt15(icf,rgb15) ((icf)->ent[rgb15]) +#define FbIndexToEnt24(icf,rgb24) FbIndexToEnt15(icf,FbCvtR8G8B8to15(rgb24)) -#define IcIndexToEntY24(icf,rgb24) ((icf)->ent[CvtR8G8B8toY15(rgb24)]) +#define FbIndexToEntY24(icf,rgb24) ((icf)->ent[CvtR8G8B8toY15(rgb24)]) /* pixman_private int -IcCreatePicture (PicturePtr pPicture); +FbCreatePicture (PicturePtr pPicture); */ pixman_private void @@ -167,14 +167,14 @@ pixman_image_destroyClip (pixman_image_t *image); /* pixman_private void -IcValidatePicture (PicturePtr pPicture, +FbValidatePicture (PicturePtr pPicture, Mask mask); */ /* XXX: What should this be? pixman_private int -IcClipPicture (pixman_region16_t *region, +FbClipPicture (pixman_region16_t *region, pixman_image_t *image, int16_t xReg, int16_t yReg, @@ -183,7 +183,7 @@ IcClipPicture (pixman_region16_t *region, */ pixman_private int -IcComputeCompositeRegion (pixman_region16_t *region, +FbComputeCompositeRegion (pixman_region16_t *region, pixman_image_t *iSrc, pixman_image_t *iMask, pixman_image_t *iDst, @@ -201,12 +201,12 @@ miIsSolidAlpha (pixman_image_t *src); /* pixman_private int -IcPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); +FbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); */ /* pixman_private void -IcGlyphs (pixman_operator_t op, +FbGlyphs (pixman_operator_t op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, @@ -227,7 +227,7 @@ pixman_compositeRects (pixman_operator_t op, */ pixman_private pixman_image_t * -IcCreateAlphaPicture (pixman_image_t *dst, +FbCreateAlphaPicture (pixman_image_t *dst, pixman_format_t *format, uint16_t width, uint16_t height); @@ -262,7 +262,7 @@ struct _FbCompositeOperand { int start_offset; pixman_bits_t *line; uint32_t offset; - IcStride stride; + FbStride stride; int bpp; } drawable; struct { @@ -289,29 +289,29 @@ struct _FbCompositeOperand { pixman_compositeStep down; pixman_compositeSet set; /* XXX: We're not supporting indexed operations, right? - IcIndexedPtr indexed; + FbIndexedPtr indexed; */ pixman_region16_t *dst_clip; pixman_region16_t *src_clip; }; -typedef void (*IcCombineFunc) (FbCompositeOperand *src, +typedef void (*FbCombineFunc) (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst); -typedef struct _IcAccessMap { +typedef struct _FbAccessMap { uint32_t format_code; pixman_compositeFetch fetch; pixman_compositeFetch fetcha; pixman_compositeStore store; -} IcAccessMap; +} FbAccessMap; /* iccompose.c */ -typedef struct _IcCompSrc { +typedef struct _FbCompSrc { uint32_t value; uint32_t alpha; -} IcCompSrc; +} FbCompSrc; pixman_private int fbBuildCompositeOperand (pixman_image_t *image, diff --git a/pixman/src/icint.h b/pixman/src/icint.h index 87eb5caaa..ebdd6aed5 100644 --- a/pixman/src/icint.h +++ b/pixman/src/icint.h @@ -54,9 +54,9 @@ */ #define MOD(a, b) ((b) == 1 ? 0 : (a) >= 0 ? (a) % (b) : (b) - (-(a) - 1) % (b) - 1) -typedef struct _IcPoint { +typedef struct _FbPoint { int16_t x,y ; -} IcPoint; +} FbPoint; typedef unsigned int Mask; @@ -130,78 +130,78 @@ typedef unsigned int Mask; #define FB_STIP_SHIFT LOG2_BITMAP_PAD #define FB_STIP_UNIT (1 << FB_STIP_SHIFT) #define FB_STIP_MASK (FB_STIP_UNIT - 1) -#define FB_STIP_ALLONES ((IcStip) -1) +#define FB_STIP_ALLONES ((FbStip) -1) #define FB_STIP_ODDSTRIDE(s) (((s) & (FB_MASK >> FB_STIP_SHIFT)) != 0) #define FB_STIP_ODDPTR(p) ((((long) (p)) & (FB_MASK >> 3)) != 0) -#define IcStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT))) -#define IcBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT))) +#define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT))) +#define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT))) -#define IcFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((pixman_bits_t) 1) << n) - 1)) +#define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((pixman_bits_t) 1) << n) - 1)) -typedef uint32_t IcStip; -typedef int IcStride; +typedef uint32_t FbStip; +typedef int FbStride; #ifdef FB_DEBUG extern void fbValidateDrawable(DrawablePtr d); extern void fbInitializeDrawable(DrawablePtr d); -extern void fbSetBits (IcStip *bits, int stride, IcStip data); -#define FB_HEAD_BITS (IcStip) (0xbaadf00d) -#define FB_TAIL_BITS (IcStip) (0xbaddf0ad) +extern void fbSetBits (FbStip *bits, int stride, FbStip data); +#define FB_HEAD_BITS (FbStip) (0xbaadf00d) +#define FB_TAIL_BITS (FbStip) (0xbaddf0ad) #else #define fbValidateDrawable(d) #define fdInitializeDrawable(d) #endif #if BITMAP_BIT_ORDER == LSBFirst -#define IcScrLeft(x,n) ((x) >> (n)) -#define IcScrRight(x,n) ((x) << (n)) -/* #define IcLeftBits(x,n) ((x) & ((((pixman_bits_t) 1) << (n)) - 1)) */ -#define IcLeftStipBits(x,n) ((x) & ((((IcStip) 1) << (n)) - 1)) -#define IcStipMoveLsb(x,s,n) (IcStipRight (x,(s)-(n))) -#define IcPatternOffsetBits 0 +#define FbScrLeft(x,n) ((x) >> (n)) +#define FbScrRight(x,n) ((x) << (n)) +/* #define FbLeftBits(x,n) ((x) & ((((pixman_bits_t) 1) << (n)) - 1)) */ +#define FbLeftStipBits(x,n) ((x) & ((((FbStip) 1) << (n)) - 1)) +#define FbStipMoveLsb(x,s,n) (FbStipRight (x,(s)-(n))) +#define FbPatternOffsetBits 0 #else -#define IcScrLeft(x,n) ((x) << (n)) -#define IcScrRight(x,n) ((x) >> (n)) -/* #define IcLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */ -#define IcLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n))) -#define IcStipMoveLsb(x,s,n) (x) -#define IcPatternOffsetBits (sizeof (pixman_bits_t) - 1) +#define FbScrLeft(x,n) ((x) << (n)) +#define FbScrRight(x,n) ((x) >> (n)) +/* #define FbLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */ +#define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n))) +#define FbStipMoveLsb(x,s,n) (x) +#define FbPatternOffsetBits (sizeof (pixman_bits_t) - 1) #endif -#define IcStipLeft(x,n) IcScrLeft(x,n) -#define IcStipRight(x,n) IcScrRight(x,n) +#define FbStipLeft(x,n) FbScrLeft(x,n) +#define FbStipRight(x,n) FbScrRight(x,n) -#define IcRotLeft(x,n) IcScrLeft(x,n) | (n ? IcScrRight(x,FB_UNIT-n) : 0) -#define IcRotRight(x,n) IcScrRight(x,n) | (n ? IcScrLeft(x,FB_UNIT-n) : 0) +#define FbRotLeft(x,n) FbScrLeft(x,n) | (n ? FbScrRight(x,FB_UNIT-n) : 0) +#define FbRotRight(x,n) FbScrRight(x,n) | (n ? FbScrLeft(x,FB_UNIT-n) : 0) -#define IcRotStipLeft(x,n) IcStipLeft(x,n) | (n ? IcStipRight(x,FB_STIP_UNIT-n) : 0) -#define IcRotStipRight(x,n) IcStipRight(x,n) | (n ? IcStipLeft(x,FB_STIP_UNIT-n) : 0) +#define FbRotStipLeft(x,n) FbStipLeft(x,n) | (n ? FbStipRight(x,FB_STIP_UNIT-n) : 0) +#define FbRotStipRight(x,n) FbStipRight(x,n) | (n ? FbStipLeft(x,FB_STIP_UNIT-n) : 0) -#define IcLeftMask(x) ( ((x) & FB_MASK) ? \ - IcScrRight(FB_ALLONES,(x) & FB_MASK) : 0) -#define IcRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \ - IcScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0) +#define FbLeftMask(x) ( ((x) & FB_MASK) ? \ + FbScrRight(FB_ALLONES,(x) & FB_MASK) : 0) +#define FbRightMask(x) ( ((FB_UNIT - (x)) & FB_MASK) ? \ + FbScrLeft(FB_ALLONES,(FB_UNIT - (x)) & FB_MASK) : 0) -#define IcLeftStipMask(x) ( ((x) & FB_STIP_MASK) ? \ - IcStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) : 0) -#define IcRightStipMask(x) ( ((FB_STIP_UNIT - (x)) & FB_STIP_MASK) ? \ - IcScrLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - (x)) & FB_STIP_MASK) : 0) +#define FbLeftStipMask(x) ( ((x) & FB_STIP_MASK) ? \ + FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) : 0) +#define FbRightStipMask(x) ( ((FB_STIP_UNIT - (x)) & FB_STIP_MASK) ? \ + FbScrLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - (x)) & FB_STIP_MASK) : 0) -#define IcBitsMask(x,w) (IcScrRight(FB_ALLONES,(x) & FB_MASK) & \ - IcScrLeft(FB_ALLONES,(FB_UNIT - ((x) + (w))) & FB_MASK)) +#define FbBitsMask(x,w) (FbScrRight(FB_ALLONES,(x) & FB_MASK) & \ + FbScrLeft(FB_ALLONES,(FB_UNIT - ((x) + (w))) & FB_MASK)) -#define IcStipMask(x,w) (IcStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \ - IcStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK)) +#define FbStipMask(x,w) (FbStipRight(FB_STIP_ALLONES,(x) & FB_STIP_MASK) & \ + FbStipLeft(FB_STIP_ALLONES,(FB_STIP_UNIT - ((x)+(w))) & FB_STIP_MASK)) -#define IcMaskBits(x,w,l,n,r) { \ +#define FbMaskBits(x,w,l,n,r) { \ n = (w); \ - r = IcRightMask((x)+n); \ - l = IcLeftMask(x); \ + r = FbRightMask((x)+n); \ + l = FbLeftMask(x); \ if (l) { \ n -= FB_UNIT - ((x) & FB_MASK); \ if (n < 0) { \ @@ -214,54 +214,54 @@ extern void fbSetBits (IcStip *bits, int stride, IcStip data); } #ifdef ICNOPIXADDR -#define IcMaskBitsBytes(x,w,copy,l,lb,n,r,rb) IcMaskBits(x,w,l,n,r) -#define IcDoLeftMaskByteRRop(dst,lb,l,and,xor) { \ - *dst = IcDoMaskRRop(*dst,and,xor,l); \ +#define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) FbMaskBits(x,w,l,n,r) +#define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \ + *dst = FbDoMaskRRop(*dst,and,xor,l); \ } -#define IcDoRightMaskByteRRop(dst,rb,r,and,xor) { \ - *dst = IcDoMaskRRop(*dst,and,xor,r); \ +#define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \ + *dst = FbDoMaskRRop(*dst,and,xor,r); \ } #else -#define IcByteMaskInvalid 0x10 +#define FbByteMaskInvalid 0x10 -#define IcPatternOffset(o,t) ((o) ^ (IcPatternOffsetBits & ~(sizeof (t) - 1))) +#define FbPatternOffset(o,t) ((o) ^ (FbPatternOffsetBits & ~(sizeof (t) - 1))) -#define IcPtrOffset(p,o,t) ((t *) ((uint8_t *) (p) + (o))) -#define IcSelectPatternPart(xor,o,t) ((xor) >> (IcPatternOffset (o,t) << 3)) -#define IcStorePart(dst,off,t,xor) (*IcPtrOffset(dst,off,t) = \ - IcSelectPart(xor,off,t)) -#ifndef IcSelectPart -#define IcSelectPart(x,o,t) IcSelectPatternPart(x,o,t) +#define FbPtrOffset(p,o,t) ((t *) ((uint8_t *) (p) + (o))) +#define FbSelectPatternPart(xor,o,t) ((xor) >> (FbPatternOffset (o,t) << 3)) +#define FbStorePart(dst,off,t,xor) (*FbPtrOffset(dst,off,t) = \ + FbSelectPart(xor,off,t)) +#ifndef FbSelectPart +#define FbSelectPart(x,o,t) FbSelectPatternPart(x,o,t) #endif -#define IcMaskBitsBytes(x,w,copy,l,lb,n,r,rb) { \ +#define FbMaskBitsBytes(x,w,copy,l,lb,n,r,rb) { \ n = (w); \ lb = 0; \ rb = 0; \ - r = IcRightMask((x)+n); \ + r = FbRightMask((x)+n); \ if (r) { \ /* compute right byte length */ \ if ((copy) && (((x) + n) & 7) == 0) { \ rb = (((x) + n) & FB_MASK) >> 3; \ } else { \ - rb = IcByteMaskInvalid; \ + rb = FbByteMaskInvalid; \ } \ } \ - l = IcLeftMask(x); \ + l = FbLeftMask(x); \ if (l) { \ /* compute left byte length */ \ if ((copy) && ((x) & 7) == 0) { \ lb = ((x) & FB_MASK) >> 3; \ } else { \ - lb = IcByteMaskInvalid; \ + lb = FbByteMaskInvalid; \ } \ /* subtract out the portion painted by leftMask */ \ n -= FB_UNIT - ((x) & FB_MASK); \ if (n < 0) { \ - if (lb != IcByteMaskInvalid) { \ - if (rb == IcByteMaskInvalid) { \ - lb = IcByteMaskInvalid; \ + if (lb != FbByteMaskInvalid) { \ + if (rb == FbByteMaskInvalid) { \ + lb = FbByteMaskInvalid; \ } else if (rb) { \ lb |= (rb - lb) << (FB_SHIFT - 3); \ rb = 0; \ @@ -276,169 +276,169 @@ extern void fbSetBits (IcStip *bits, int stride, IcStip data); } #if FB_SHIFT == 6 -#define IcDoLeftMaskByteRRop6Cases(dst,xor) \ +#define FbDoLeftMaskByteRRop6Cases(dst,xor) \ case (sizeof (pixman_bits_t) - 7) | (1 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 7) | (2 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 7) | (3 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 7) | (4 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 7) | (5 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 7) | (6 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 7): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 6) | (1 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 6) | (2 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 6) | (3 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 6) | (4 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 6) | (5 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 6): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 5) | (1 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 5) | (2 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 5) | (3 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 5) | (4 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 5): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 4) | (1 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 4) | (2 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 4) | (3 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 4): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ break; -#define IcDoRightMaskByteRRop6Cases(dst,xor) \ +#define FbDoRightMaskByteRRop6Cases(dst,xor) \ case 4: \ - IcStorePart(dst,0,uint32_t,xor); \ + FbStorePart(dst,0,uint32_t,xor); \ break; \ case 5: \ - IcStorePart(dst,0,uint32_t,xor); \ - IcStorePart(dst,4,uint8_t,xor); \ + FbStorePart(dst,0,uint32_t,xor); \ + FbStorePart(dst,4,uint8_t,xor); \ break; \ case 6: \ - IcStorePart(dst,0,uint32_t,xor); \ - IcStorePart(dst,4,uint16_t,xor); \ + FbStorePart(dst,0,uint32_t,xor); \ + FbStorePart(dst,4,uint16_t,xor); \ break; \ case 7: \ - IcStorePart(dst,0,uint32_t,xor); \ - IcStorePart(dst,4,uint16_t,xor); \ - IcStorePart(dst,6,uint8_t,xor); \ + FbStorePart(dst,0,uint32_t,xor); \ + FbStorePart(dst,4,uint16_t,xor); \ + FbStorePart(dst,6,uint8_t,xor); \ break; #else -#define IcDoLeftMaskByteRRop6Cases(dst,xor) -#define IcDoRightMaskByteRRop6Cases(dst,xor) +#define FbDoLeftMaskByteRRop6Cases(dst,xor) +#define FbDoRightMaskByteRRop6Cases(dst,xor) #endif -#define IcDoLeftMaskByteRRop(dst,lb,l,and,xor) { \ +#define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \ switch (lb) { \ - IcDoLeftMaskByteRRop6Cases(dst,xor) \ + FbDoLeftMaskByteRRop6Cases(dst,xor) \ case (sizeof (pixman_bits_t) - 3) | (1 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 3,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 3,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 3) | (2 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 3,uint8_t,xor); \ - IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 3,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ break; \ case (sizeof (pixman_bits_t) - 2) | (1 << (FB_SHIFT - 3)): \ - IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ break; \ case sizeof (pixman_bits_t) - 3: \ - IcStorePart(dst,sizeof (pixman_bits_t) - 3,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 3,uint8_t,xor); \ case sizeof (pixman_bits_t) - 2: \ - IcStorePart(dst,sizeof (pixman_bits_t) - 2,uint16_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint16_t,xor); \ break; \ case sizeof (pixman_bits_t) - 1: \ - IcStorePart(dst,sizeof (pixman_bits_t) - 1,uint8_t,xor); \ + FbStorePart(dst,sizeof (pixman_bits_t) - 1,uint8_t,xor); \ break; \ default: \ - *dst = IcDoMaskRRop(*dst, and, xor, l); \ + *dst = FbDoMaskRRop(*dst, and, xor, l); \ break; \ } \ } -#define IcDoRightMaskByteRRop(dst,rb,r,and,xor) { \ +#define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \ switch (rb) { \ case 1: \ - IcStorePart(dst,0,uint8_t,xor); \ + FbStorePart(dst,0,uint8_t,xor); \ break; \ case 2: \ - IcStorePart(dst,0,uint16_t,xor); \ + FbStorePart(dst,0,uint16_t,xor); \ break; \ case 3: \ - IcStorePart(dst,0,uint16_t,xor); \ - IcStorePart(dst,2,uint8_t,xor); \ + FbStorePart(dst,0,uint16_t,xor); \ + FbStorePart(dst,2,uint8_t,xor); \ break; \ - IcDoRightMaskByteRRop6Cases(dst,xor) \ + FbDoRightMaskByteRRop6Cases(dst,xor) \ default: \ - *dst = IcDoMaskRRop (*dst, and, xor, r); \ + *dst = FbDoMaskRRop (*dst, and, xor, r); \ } \ } #endif -#define IcMaskStip(x,w,l,n,r) { \ +#define FbMaskStip(x,w,l,n,r) { \ n = (w); \ - r = IcRightStipMask((x)+n); \ - l = IcLeftStipMask(x); \ + r = FbRightStipMask((x)+n); \ + l = FbLeftStipMask(x); \ if (l) { \ n -= FB_STIP_UNIT - ((x) & FB_STIP_MASK); \ if (n < 0) { \ @@ -462,72 +462,72 @@ extern void fbSetBits (IcStip *bits, int stride, IcStip data); * The term "lane" comes from the hardware term "byte-lane" which */ -#define IcLaneCase1(n,a,o) ((n) == 0x01 ? \ - (*(uint8_t *) ((a)+IcPatternOffset(o,uint8_t)) = \ +#define FbLaneCase1(n,a,o) ((n) == 0x01 ? \ + (*(uint8_t *) ((a)+FbPatternOffset(o,uint8_t)) = \ fgxor) : 0) -#define IcLaneCase2(n,a,o) ((n) == 0x03 ? \ - (*(uint16_t *) ((a)+IcPatternOffset(o,uint16_t)) = \ +#define FbLaneCase2(n,a,o) ((n) == 0x03 ? \ + (*(uint16_t *) ((a)+FbPatternOffset(o,uint16_t)) = \ fgxor) : \ - ((void)IcLaneCase1((n)&1,a,o), \ - IcLaneCase1((n)>>1,a,(o)+1))) -#define IcLaneCase4(n,a,o) ((n) == 0x0f ? \ - (*(uint32_t *) ((a)+IcPatternOffset(o,uint32_t)) = \ + ((void)FbLaneCase1((n)&1,a,o), \ + FbLaneCase1((n)>>1,a,(o)+1))) +#define FbLaneCase4(n,a,o) ((n) == 0x0f ? \ + (*(uint32_t *) ((a)+FbPatternOffset(o,uint32_t)) = \ fgxor) : \ - ((void)IcLaneCase2((n)&3,a,o), \ - IcLaneCase2((n)>>2,a,(o)+2))) -#define IcLaneCase8(n,a,o) ((n) == 0x0ff ? (*(pixman_bits_t *) ((a)+(o)) = fgxor) : \ - ((void)IcLaneCase4((n)&15,a,o), \ - IcLaneCase4((n)>>4,a,(o)+4))) + ((void)FbLaneCase2((n)&3,a,o), \ + FbLaneCase2((n)>>2,a,(o)+2))) +#define FbLaneCase8(n,a,o) ((n) == 0x0ff ? (*(pixman_bits_t *) ((a)+(o)) = fgxor) : \ + ((void)FbLaneCase4((n)&15,a,o), \ + FbLaneCase4((n)>>4,a,(o)+4))) #if FB_SHIFT == 6 -#define IcLaneCase(n,a) IcLaneCase8(n,(uint8_t *) (a),0) +#define FbLaneCase(n,a) FbLaneCase8(n,(uint8_t *) (a),0) #endif #if FB_SHIFT == 5 -#define IcLaneCase(n,a) IcLaneCase4(n,(uint8_t *) (a),0) +#define FbLaneCase(n,a) FbLaneCase4(n,(uint8_t *) (a),0) #endif /* Rotate a filled pixel value to the specified alignement */ -#define IcRot24(p,b) (IcScrRight(p,b) | IcScrLeft(p,24-(b))) -#define IcRot24Stip(p,b) (IcStipRight(p,b) | IcStipLeft(p,24-(b))) +#define FbRot24(p,b) (FbScrRight(p,b) | FbScrLeft(p,24-(b))) +#define FbRot24Stip(p,b) (FbStipRight(p,b) | FbStipLeft(p,24-(b))) /* step a filled pixel value to the next/previous FB_UNIT alignment */ -#define IcNext24Pix(p) (IcRot24(p,(24-FB_UNIT%24))) -#define IcPrev24Pix(p) (IcRot24(p,FB_UNIT%24)) -#define IcNext24Stip(p) (IcRot24(p,(24-FB_STIP_UNIT%24))) -#define IcPrev24Stip(p) (IcRot24(p,FB_STIP_UNIT%24)) +#define FbNext24Pix(p) (FbRot24(p,(24-FB_UNIT%24))) +#define FbPrev24Pix(p) (FbRot24(p,FB_UNIT%24)) +#define FbNext24Stip(p) (FbRot24(p,(24-FB_STIP_UNIT%24))) +#define FbPrev24Stip(p) (FbRot24(p,FB_STIP_UNIT%24)) /* step a rotation value to the next/previous rotation value */ #if FB_UNIT == 64 -#define IcNext24Rot(r) ((r) == 16 ? 0 : (r) + 8) -#define IcPrev24Rot(r) ((r) == 0 ? 16 : (r) - 8) +#define FbNext24Rot(r) ((r) == 16 ? 0 : (r) + 8) +#define FbPrev24Rot(r) ((r) == 0 ? 16 : (r) - 8) #if IMAGE_BYTE_ORDER == MSBFirst -#define IcFirst24Rot(x) (((x) + 8) % 24) +#define FbFirst24Rot(x) (((x) + 8) % 24) #else -#define IcFirst24Rot(x) ((x) % 24) +#define FbFirst24Rot(x) ((x) % 24) #endif #endif #if FB_UNIT == 32 -#define IcNext24Rot(r) ((r) == 0 ? 16 : (r) - 8) -#define IcPrev24Rot(r) ((r) == 16 ? 0 : (r) + 8) +#define FbNext24Rot(r) ((r) == 0 ? 16 : (r) - 8) +#define FbPrev24Rot(r) ((r) == 16 ? 0 : (r) + 8) #if IMAGE_BYTE_ORDER == MSBFirst -#define IcFirst24Rot(x) (((x) + 16) % 24) +#define FbFirst24Rot(x) (((x) + 16) % 24) #else -#define IcFirst24Rot(x) ((x) % 24) +#define FbFirst24Rot(x) ((x) % 24) #endif #endif -#define IcNext24RotStip(r) ((r) == 0 ? 16 : (r) - 8) -#define IcPrev24RotStip(r) ((r) == 16 ? 0 : (r) + 8) +#define FbNext24RotStip(r) ((r) == 0 ? 16 : (r) - 8) +#define FbPrev24RotStip(r) ((r) == 16 ? 0 : (r) + 8) /* Whether 24-bit specific code is needed for this filled pixel value */ -#define IcCheck24Pix(p) ((p) == IcNext24Pix(p)) +#define FbCheck24Pix(p) ((p) == FbNext24Pix(p)) -#define IcGetPixels(icpixels, pointer, _stride_, _bpp_, xoff, yoff) { \ +#define FbGetPixels(icpixels, pointer, _stride_, _bpp_, xoff, yoff) { \ (pointer) = icpixels->data; \ (_stride_) = icpixels->stride / sizeof(pixman_bits_t); \ (_bpp_) = icpixels->bpp; \ @@ -535,8 +535,8 @@ extern void fbSetBits (IcStip *bits, int stride, IcStip data); (yoff) = icpixels->y; /* XXX: fb.h had this ifdef'd to constant 0. Why? */ \ } -#define IcGetStipPixels(icpixels, pointer, _stride_, _bpp_, xoff, yoff) { \ - (pointer) = (IcStip *) icpixels->data; \ +#define FbGetStipPixels(icpixels, pointer, _stride_, _bpp_, xoff, yoff) { \ + (pointer) = (FbStip *) icpixels->data; \ (_stride_) = icpixels->stride; \ (_bpp_) = icpixels->bpp; \ (xoff) = icpixels->x; \ @@ -549,27 +549,27 @@ extern void fbSetBits (IcStip *bits, int stride, IcStip data); (PixmapWidthPaddingInfo[d].padRoundUp+1))) #endif -#define IcPowerOfTwo(w) (((w) & ((w) - 1)) == 0) +#define FbPowerOfTwo(w) (((w) & ((w) - 1)) == 0) /* * Accelerated tiles are power of 2 width <= FB_UNIT */ -#define fbEvenTile(w) ((w) <= FB_UNIT && IcPowerOfTwo(w)) +#define fbEvenTile(w) ((w) <= FB_UNIT && FbPowerOfTwo(w)) /* * Accelerated stipples are power of 2 width and <= FB_UNIT/dstBpp * with dstBpp a power of 2 as well */ -#define IcEvenStip(w,bpp) ((w) * (bpp) <= FB_UNIT && IcPowerOfTwo(w) && IcPowerOfTwo(bpp)) +#define FbEvenStip(w,bpp) ((w) * (bpp) <= FB_UNIT && FbPowerOfTwo(w) && FbPowerOfTwo(bpp)) /* * icblt.c */ pixman_private void fbBlt (pixman_bits_t *src, - IcStride srcStride, + FbStride srcStride, int srcX, pixman_bits_t *dst, - IcStride dstStride, + FbStride dstStride, int dstX, int width, @@ -584,11 +584,11 @@ fbBlt (pixman_bits_t *src, pixman_private void fbBlt24 (pixman_bits_t *srcLine, - IcStride srcStride, + FbStride srcStride, int srcX, pixman_bits_t *dstLine, - IcStride dstStride, + FbStride dstStride, int dstX, int width, @@ -601,12 +601,12 @@ fbBlt24 (pixman_bits_t *srcLine, int upsidedown); pixman_private void -fbBltStip (IcStip *src, - IcStride srcStride, /* in IcStip units, not pixman_bits_t units */ +fbBltStip (FbStip *src, + FbStride srcStride, /* in FbStip units, not pixman_bits_t units */ int srcX, - IcStip *dst, - IcStride dstStride, /* in IcStip units, not pixman_bits_t units */ + FbStip *dst, + FbStride dstStride, /* in FbStip units, not pixman_bits_t units */ int dstX, int width, @@ -620,11 +620,11 @@ fbBltStip (IcStip *src, * icbltone.c */ pixman_private void -fbBltOne (IcStip *src, - IcStride srcStride, +fbBltOne (FbStip *src, + FbStride srcStride, int srcX, pixman_bits_t *dst, - IcStride dstStride, + FbStride dstStride, int dstX, int dstBpp, @@ -638,11 +638,11 @@ fbBltOne (IcStip *src, #ifdef FB_24BIT pixman_private void -fbBltOne24 (IcStip *src, - IcStride srcStride, /* IcStip units per scanline */ +fbBltOne24 (FbStip *src, + FbStride srcStride, /* FbStip units per scanline */ int srcX, /* bit position of source */ pixman_bits_t *dst, - IcStride dstStride, /* pixman_bits_t units per scanline */ + FbStride dstStride, /* pixman_bits_t units per scanline */ int dstX, /* bit position of dest */ int dstBpp, /* bits per destination unit */ @@ -667,15 +667,15 @@ fbTransparentSpan (pixman_bits_t *dst, pixman_private void fbEvenStipple (pixman_bits_t *dst, - IcStride dstStride, + FbStride dstStride, int dstX, int dstBpp, int width, int height, - IcStip *stip, - IcStride stipStride, + FbStip *stip, + FbStride stipStride, int stipHeight, pixman_bits_t fgand, @@ -688,15 +688,15 @@ fbEvenStipple (pixman_bits_t *dst, pixman_private void fbOddStipple (pixman_bits_t *dst, - IcStride dstStride, + FbStride dstStride, int dstX, int dstBpp, int width, int height, - IcStip *stip, - IcStride stipStride, + FbStip *stip, + FbStride stipStride, int stipWidth, int stipHeight, @@ -710,15 +710,15 @@ fbOddStipple (pixman_bits_t *dst, pixman_private void fbStipple (pixman_bits_t *dst, - IcStride dstStride, + FbStride dstStride, int dstX, int dstBpp, int width, int height, - IcStip *stip, - IcStride stipStride, + FbStip *stip, + FbStride stipStride, int stipWidth, int stipHeight, int even, @@ -741,7 +741,7 @@ struct pixman_format { int alpha, alphaMask; }; -typedef struct _IcPixels { +typedef struct _FbPixels { pixman_bits_t *data; unsigned int width; unsigned int height; @@ -751,7 +751,7 @@ typedef struct _IcPixels { int x; int y; unsigned int refcnt; -} IcPixels; +} FbPixels; /* XXX: This is to avoid including colormap.h from the server includes */ typedef uint32_t Pixel; @@ -788,14 +788,14 @@ fbRasterizeTrapezoid (pixman_image_t *pMask, good as the static function below. */ #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) # if __INT_MIN__ == 0x7fffffff -# define _IcOnes(mask) __builtin_popcount(mask) +# define _FbOnes(mask) __builtin_popcount(mask) # else -# define _IcOnes(mask) __builtin_popcountl((mask) & 0xffffffff) +# define _FbOnes(mask) __builtin_popcountl((mask) & 0xffffffff) # endif #else # define ICINT_NEED_FB_ONES int -_IcOnes(unsigned long mask); +_FbOnes(unsigned long mask); #endif /* icformat.c */ @@ -806,19 +806,19 @@ pixman_format_init (pixman_format_t *format, int format_code); /* icimage.c */ pixman_private pixman_image_t * -pixman_image_createForPixels (IcPixels *pixels, +pixman_image_createForPixels (FbPixels *pixels, pixman_format_t *format); /* icpixels.c */ -pixman_private IcPixels * -IcPixelsCreate (int width, int height, int depth); +pixman_private FbPixels * +FbPixelsCreate (int width, int height, int depth); -pixman_private IcPixels * -IcPixelsCreateForData (pixman_bits_t *data, int width, int height, int depth, int bpp, int stride); +pixman_private FbPixels * +FbPixelsCreateForData (pixman_bits_t *data, int width, int height, int depth, int bpp, int stride); pixman_private void -IcPixelsDestroy (IcPixels *pixels); +FbPixelsDestroy (FbPixels *pixels); /* ictransform.c */ diff --git a/pixman/src/icpixels.c b/pixman/src/icpixels.c index 8aa373c3a..7b3798ed8 100644 --- a/pixman/src/icpixels.c +++ b/pixman/src/icpixels.c @@ -1,5 +1,5 @@ /* - * $Id: icpixels.c,v 1.8 2005-06-25 01:21:16 jrmuizel Exp $ + * $Id: icpixels.c,v 1.9 2005-06-25 03:13:19 jrmuizel Exp $ * * Copyright © 1998 Keith Packard * @@ -25,7 +25,7 @@ #include "pixman-xserver-compat.h" static void -IcPixelsInit (IcPixels *pixels, pixman_bits_t *buf, int width, int height, int depth, int bpp, int stride); +FbPixelsInit (FbPixels *pixels, pixman_bits_t *buf, int width, int height, int depth, int bpp, int stride); static unsigned int pixman_bits_per_pixel (unsigned int depth); @@ -47,10 +47,10 @@ pixman_bits_per_pixel (unsigned int depth) return 1; } -IcPixels * -IcPixelsCreate (int width, int height, int depth) +FbPixels * +FbPixelsCreate (int width, int height, int depth) { - IcPixels *pixels; + FbPixels *pixels; pixman_bits_t *buf; unsigned int buf_size; unsigned int bpp; @@ -61,7 +61,7 @@ IcPixelsCreate (int width, int height, int depth) bpp = pixman_bits_per_pixel (depth); stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (pixman_bits_t); buf_size = height * stride; - base = sizeof (IcPixels); + base = sizeof (FbPixels); adjust = 0; if (base & 7) adjust = 8 - (base & 7); @@ -73,27 +73,27 @@ IcPixelsCreate (int width, int height, int depth) buf = (pixman_bits_t *) ((char *)pixels + base + adjust); - IcPixelsInit (pixels, buf, width, height, depth, bpp, stride); + FbPixelsInit (pixels, buf, width, height, depth, bpp, stride); return pixels; } -IcPixels * -IcPixelsCreateForData (pixman_bits_t *data, int width, int height, int depth, int bpp, int stride) +FbPixels * +FbPixelsCreateForData (pixman_bits_t *data, int width, int height, int depth, int bpp, int stride) { - IcPixels *pixels; + FbPixels *pixels; - pixels = malloc (sizeof (IcPixels)); + pixels = malloc (sizeof (FbPixels)); if (pixels == NULL) return NULL; - IcPixelsInit (pixels, data, width, height, depth, bpp, stride); + FbPixelsInit (pixels, data, width, height, depth, bpp, stride); return pixels; } static void -IcPixelsInit (IcPixels *pixels, pixman_bits_t *buf, int width, int height, int depth, int bpp, int stride) +FbPixelsInit (FbPixels *pixels, pixman_bits_t *buf, int width, int height, int depth, int bpp, int stride) { pixels->data = buf; pixels->width = width; @@ -107,7 +107,7 @@ IcPixelsInit (IcPixels *pixels, pixman_bits_t *buf, int width, int height, int d } void -IcPixelsDestroy (IcPixels *pixels) +FbPixelsDestroy (FbPixels *pixels) { if(--pixels->refcnt) return; diff --git a/pixman/src/icrect.c b/pixman/src/icrect.c index 996eb4f39..ac62d3ae5 100644 --- a/pixman/src/icrect.c +++ b/pixman/src/icrect.c @@ -247,13 +247,13 @@ pixman_fill_rectangles (pixman_operator_t op, else { pixman_format_t rgbaFormat; - IcPixels *pixels; + FbPixels *pixels; pixman_image_t *src; pixman_bits_t pixel; pixman_format_init (&rgbaFormat, PICT_a8r8g8b8); - pixels = IcPixelsCreate (1, 1, rgbaFormat.depth); + pixels = FbPixelsCreate (1, 1, rgbaFormat.depth); if (!pixels) goto bail1; @@ -286,7 +286,7 @@ pixman_fill_rectangles (pixman_operator_t op, pixman_image_destroy (src); bail2: - IcPixelsDestroy (pixels); + FbPixelsDestroy (pixels); bail1: ; } diff --git a/pixman/src/icrop.h b/pixman/src/icrop.h index 964eb9295..7e8d1fdb2 100644 --- a/pixman/src/icrop.h +++ b/pixman/src/icrop.h @@ -27,50 +27,50 @@ typedef struct _mergeRopBits { pixman_bits_t ca1, cx1, ca2, cx2; -} IcMergeRopRec, *IcMergeRopPtr; +} FbMergeRopRec, *FbMergeRopPtr; -extern const IcMergeRopRec IcMergeRopBits[16] pixman_private; +extern const FbMergeRopRec FbMergeRopBits[16] pixman_private; -#define IcDeclareMergeRop() pixman_bits_t _ca1, _cx1, _ca2, _cx2; -#define IcDeclarePrebuiltMergeRop() pixman_bits_t _cca, _ccx; +#define FbDeclareMergeRop() pixman_bits_t _ca1, _cx1, _ca2, _cx2; +#define FbDeclarePrebuiltMergeRop() pixman_bits_t _cca, _ccx; -#define IcInitializeMergeRop(alu,pm) {\ - const IcMergeRopRec *_bits; \ - _bits = &IcMergeRopBits[alu]; \ +#define FbInitializeMergeRop(alu,pm) {\ + const FbMergeRopRec *_bits; \ + _bits = &FbMergeRopBits[alu]; \ _ca1 = _bits->ca1 & pm; \ _cx1 = _bits->cx1 | ~pm; \ _ca2 = _bits->ca2 & pm; \ _cx2 = _bits->cx2 & pm; \ } -#define IcDestInvarientRop(alu,pm) ((pm) == FB_ALLONES && \ +#define FbDestInvarientRop(alu,pm) ((pm) == FB_ALLONES && \ (((alu) >> 1 & 5) == ((alu) & 5))) -#define IcDestInvarientMergeRop() (_ca1 == 0 && _cx1 == 0) +#define FbDestInvarientMergeRop() (_ca1 == 0 && _cx1 == 0) /* AND has higher precedence than XOR */ -#define IcDoMergeRop(src, dst) \ +#define FbDoMergeRop(src, dst) \ (((dst) & (((src) & _ca1) ^ _cx1)) ^ (((src) & _ca2) ^ _cx2)) -#define IcDoDestInvarientMergeRop(src) (((src) & _ca2) ^ _cx2) +#define FbDoDestInvarientMergeRop(src) (((src) & _ca2) ^ _cx2) -#define IcDoMaskMergeRop(src, dst, mask) \ +#define FbDoMaskMergeRop(src, dst, mask) \ (((dst) & ((((src) & _ca1) ^ _cx1) | ~(mask))) ^ ((((src) & _ca2) ^ _cx2) & (mask))) -#define IcDoLeftMaskByteMergeRop(dst, src, lb, l) { \ +#define FbDoLeftMaskByteMergeRop(dst, src, lb, l) { \ pixman_bits_t __xor = ((src) & _ca2) ^ _cx2; \ - IcDoLeftMaskByteRRop(dst,lb,l,((src) & _ca1) ^ _cx1,__xor); \ + FbDoLeftMaskByteRRop(dst,lb,l,((src) & _ca1) ^ _cx1,__xor); \ } -#define IcDoRightMaskByteMergeRop(dst, src, rb, r) { \ +#define FbDoRightMaskByteMergeRop(dst, src, rb, r) { \ pixman_bits_t __xor = ((src) & _ca2) ^ _cx2; \ - IcDoRightMaskByteRRop(dst,rb,r,((src) & _ca1) ^ _cx1,__xor); \ + FbDoRightMaskByteRRop(dst,rb,r,((src) & _ca1) ^ _cx1,__xor); \ } -#define IcDoRRop(dst, and, xor) (((dst) & (and)) ^ (xor)) +#define FbDoRRop(dst, and, xor) (((dst) & (and)) ^ (xor)) -#define IcDoMaskRRop(dst, and, xor, mask) \ +#define FbDoMaskRRop(dst, and, xor, mask) \ (((dst) & ((and) | ~(mask))) ^ (xor & mask)) /* @@ -89,9 +89,9 @@ extern const IcMergeRopRec IcMergeRopBits[16] pixman_private; #define fbAnd(rop,fg,pm) fbAndT(rop,fg,pm,pixman_bits_t) -#define fbXorStip(rop,fg,pm) fbXorT(rop,fg,pm,IcStip) +#define fbXorStip(rop,fg,pm) fbXorT(rop,fg,pm,FbStip) -#define fbAndStip(rop,fg,pm) fbAndT(rop,fg,pm,IcStip) +#define fbAndStip(rop,fg,pm) fbAndT(rop,fg,pm,FbStip) /* * Stippling operations; @@ -105,33 +105,33 @@ extern const pixman_bits_t fbStipple16Bits[256] pixman_private; pixman_private const pixman_bits_t * fbStippleTable(int bits); -#define IcStippleRRop(dst, b, fa, fx, ba, bx) \ - (IcDoRRop(dst, fa, fx) & b) | (IcDoRRop(dst, ba, bx) & ~b) +#define FbStippleRRop(dst, b, fa, fx, ba, bx) \ + (FbDoRRop(dst, fa, fx) & b) | (FbDoRRop(dst, ba, bx) & ~b) -#define IcStippleRRopMask(dst, b, fa, fx, ba, bx, m) \ - (IcDoMaskRRop(dst, fa, fx, m) & (b)) | (IcDoMaskRRop(dst, ba, bx, m) & ~(b)) +#define FbStippleRRopMask(dst, b, fa, fx, ba, bx, m) \ + (FbDoMaskRRop(dst, fa, fx, m) & (b)) | (FbDoMaskRRop(dst, ba, bx, m) & ~(b)) -#define IcDoLeftMaskByteStippleRRop(dst, b, fa, fx, ba, bx, lb, l) { \ +#define FbDoLeftMaskByteStippleRRop(dst, b, fa, fx, ba, bx, lb, l) { \ pixman_bits_t __xor = ((fx) & (b)) | ((bx) & ~(b)); \ - IcDoLeftMaskByteRRop(dst, lb, l, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ + FbDoLeftMaskByteRRop(dst, lb, l, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ } -#define IcDoRightMaskByteStippleRRop(dst, b, fa, fx, ba, bx, rb, r) { \ +#define FbDoRightMaskByteStippleRRop(dst, b, fa, fx, ba, bx, rb, r) { \ pixman_bits_t __xor = ((fx) & (b)) | ((bx) & ~(b)); \ - IcDoRightMaskByteRRop(dst, rb, r, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ + FbDoRightMaskByteRRop(dst, rb, r, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ } -#define IcOpaqueStipple(b, fg, bg) (((fg) & (b)) | ((bg) & ~(b))) +#define FbOpaqueStipple(b, fg, bg) (((fg) & (b)) | ((bg) & ~(b))) /* * Compute rop for using tile code for 1-bit dest stipples; modifies * existing rop to flip depending on pixel values */ -#define IcStipple1RopPick(alu,b) (((alu) >> (2 - (((b) & 1) << 1))) & 3) +#define FbStipple1RopPick(alu,b) (((alu) >> (2 - (((b) & 1) << 1))) & 3) -#define IcOpaqueStipple1Rop(alu,fg,bg) (IcStipple1RopPick(alu,fg) | \ - (IcStipple1RopPick(alu,bg) << 2)) +#define FbOpaqueStipple1Rop(alu,fg,bg) (FbStipple1RopPick(alu,fg) | \ + (FbStipple1RopPick(alu,bg) << 2)) -#define IcStipple1Rop(alu,fg) (IcStipple1RopPick(alu,fg) | 4) +#define FbStipple1Rop(alu,fg) (FbStipple1RopPick(alu,fg) | 4) #endif diff --git a/pixman/src/icstipple.c b/pixman/src/icstipple.c index 2f3776c1c..e077cbb0b 100644 --- a/pixman/src/icstipple.c +++ b/pixman/src/icstipple.c @@ -31,7 +31,7 @@ * transparent stipple */ #define LaneCases1(c,a) case c: \ - while (n--) { (void)IcLaneCase(c,a); a++; } \ + while (n--) { (void)FbLaneCase(c,a); a++; } \ break #define LaneCases2(c,a) LaneCases1(c,a); LaneCases1(c+1,a) #define LaneCases4(c,a) LaneCases2(c,a); LaneCases2(c+2,a) @@ -60,17 +60,17 @@ fbTransparentSpan (FbBits *dst, FbBits fgxor, int n) { - IcStip s; + FbStip s; - s = ((IcStip) (stip ) & 0x01); - s |= ((IcStip) (stip >> 8) & 0x02); - s |= ((IcStip) (stip >> 16) & 0x04); - s |= ((IcStip) (stip >> 24) & 0x08); + s = ((FbStip) (stip ) & 0x01); + s |= ((FbStip) (stip >> 8) & 0x02); + s |= ((FbStip) (stip >> 16) & 0x04); + s |= ((FbStip) (stip >> 24) & 0x08); #if FB_SHIFT > 5 - s |= ((IcStip) (stip >> 32) & 0x10); - s |= ((IcStip) (stip >> 40) & 0x20); - s |= ((IcStip) (stip >> 48) & 0x40); - s |= ((IcStip) (stip >> 56) & 0x80); + s |= ((FbStip) (stip >> 32) & 0x10); + s |= ((FbStip) (stip >> 40) & 0x20); + s |= ((FbStip) (stip >> 48) & 0x40); + s |= ((FbStip) (stip >> 56) & 0x80); #endif switch (s) { LaneCases(dst); diff --git a/pixman/src/ictrap.c b/pixman/src/ictrap.c index 0fcd59b33..b4eedc85c 100644 --- a/pixman/src/ictrap.c +++ b/pixman/src/ictrap.c @@ -1,5 +1,5 @@ /* - * $Id: ictrap.c,v 1.25 2005-05-13 03:25:07 keithp Exp $ + * $Id: ictrap.c,v 1.26 2005-06-25 03:13:19 jrmuizel Exp $ * * Copyright © 2002 Keith Packard * @@ -25,7 +25,7 @@ #include "icint.h" pixman_image_t * -IcCreateAlphaPicture (pixman_image_t *dst, +FbCreateAlphaPicture (pixman_image_t *dst, pixman_format_t *format, uint16_t width, uint16_t height) @@ -167,7 +167,7 @@ pixman_composite_trapezoids (pixman_operator_t op, if (!format) return; - image = IcCreateAlphaPicture (dst, format, + image = FbCreateAlphaPicture (dst, format, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); if (!image) diff --git a/pixman/src/ictri.c b/pixman/src/ictri.c index 97fbca544..27deb3ca4 100644 --- a/pixman/src/ictri.c +++ b/pixman/src/ictri.c @@ -57,7 +57,7 @@ pixman_triangle_bounds (int ntri, const pixman_triangle_t *tris, pixman_box16_t } static void -IcRasterizeTriangle (pixman_image_t *image, +FbRasterizeTriangle (pixman_image_t *image, const pixman_triangle_t *tri, int x_off, int y_off) @@ -159,7 +159,7 @@ pixman_composite_triangles (pixman_operator_t op, pixman_triangle_bounds (ntris, tris, &bounds); if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) return; - image = IcCreateAlphaPicture (dst, + image = FbCreateAlphaPicture (dst, format, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); @@ -173,14 +173,14 @@ pixman_composite_triangles (pixman_operator_t op, pixman_triangle_bounds (1, tris, &bounds); if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) continue; - image = IcCreateAlphaPicture (dst, + image = FbCreateAlphaPicture (dst, format, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); if (!image) break; } - IcRasterizeTriangle (image, tris, -bounds.x1, -bounds.y1); + FbRasterizeTriangle (image, tris, -bounds.x1, -bounds.y1); if (!format) { xRel = bounds.x1 + xSrc - xDst; @@ -233,7 +233,7 @@ pixman_composite_tri_strip (pixman_operator_t op, pixman_point_fixed_bounds (npoints, points, &bounds); if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) return; - image = IcCreateAlphaPicture (dst, + image = FbCreateAlphaPicture (dst, format, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); @@ -250,14 +250,14 @@ pixman_composite_tri_strip (pixman_operator_t op, pixman_triangle_bounds (1, &tri, &bounds); if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) continue; - image = IcCreateAlphaPicture (dst, + image = FbCreateAlphaPicture (dst, format, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); if (!image) continue; } - IcRasterizeTriangle (image, &tri, -bounds.x1, -bounds.y1); + FbRasterizeTriangle (image, &tri, -bounds.x1, -bounds.y1); if (!format) { xRel = bounds.x1 + xSrc - xDst; @@ -310,7 +310,7 @@ pixman_composite_tri_fan (pixman_operator_t op, pixman_point_fixed_bounds (npoints, points, &bounds); if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) return; - image = IcCreateAlphaPicture (dst, + image = FbCreateAlphaPicture (dst, format, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); @@ -329,14 +329,14 @@ pixman_composite_tri_fan (pixman_operator_t op, pixman_triangle_bounds (1, &tri, &bounds); if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1) continue; - image = IcCreateAlphaPicture (dst, + image = FbCreateAlphaPicture (dst, format, bounds.x2 - bounds.x1, bounds.y2 - bounds.y1); if (!image) continue; } - IcRasterizeTriangle (image, &tri, -bounds.x1, -bounds.y1); + FbRasterizeTriangle (image, &tri, -bounds.x1, -bounds.y1); if (!format) { xRel = bounds.x1 + xSrc - xDst; diff --git a/pixman/src/icutil.c b/pixman/src/icutil.c index a2259d0bf..73d14a5e4 100644 --- a/pixman/src/icutil.c +++ b/pixman/src/icutil.c @@ -29,7 +29,7 @@ fbReplicatePixel (Pixel p, int bpp) { pixman_bits_t b = p; - b &= IcFullMask (bpp); + b &= FbFullMask (bpp); while (bpp < FB_UNIT) { b |= b << bpp; @@ -41,7 +41,7 @@ fbReplicatePixel (Pixel p, int bpp) #define O 0 #define I FB_ALLONES -const IcMergeRopRec IcMergeRopBits[16] = { +const FbMergeRopRec FbMergeRopBits[16] = { { O,O,O,O }, /* clear 0x0 0 */ { I,O,O,O }, /* and 0x1 src AND dst */ { I,O,I,O }, /* andReverse 0x2 src AND NOT dst */ diff --git a/pixman/src/pixman-xserver-compat.h b/pixman/src/pixman-xserver-compat.h index 3050b6d59..9d012a139 100644 --- a/pixman/src/pixman-xserver-compat.h +++ b/pixman/src/pixman-xserver-compat.h @@ -73,7 +73,7 @@ typedef pixman_triangle_t xTriangle; #define FB_MASK IC_MASK #define FB_ALLONES IC_ALLONES */ -#define FbMaskBits IcMaskBits +//#define FbMaskBits IcMaskBits /* XXX: We changed some function and field names which makes for some * ugly hacks... */ -- cgit v1.2.3 From 13a27d19d4e8748a4233b70cdd4a223865d3d57c Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sat, 25 Jun 2005 02:00:17 +0000 Subject: From: J. Ali Harlow" Reviewed by: Vladimir Vukicevic Update win32 backend to match current API, so it actually builds once again. --- ChangeLog | 22 ++++++++++++++++++++++ src/cairo-win32-surface.c | 19 +++++++++++-------- test/Makefile.am | 4 ++-- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index b5e05463a..91cfef6e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2005-06-25 Carl Worth + + From: J. Ali Harlow" + Reviewed by: Vladimir Vukicevic + + * test/Makefile.am: + * src/cairo-win32-surface.c: (_cairo_win32_surface_create_for_dc), + (_cairo_win32_surface_create_similar), + (_cairo_win32_surface_create_dib), + (_cairo_win32_surface_composite), (categorize_solid_dest_operator), + (_cairo_win32_surface_set_clip_region): Update win32 backend to + match current API, so it actually builds once again. + +2005-06-25 Carl Worth + + * src/cairo-win32-surface.c: (_cairo_win32_surface_create_for_dc), + (_cairo_win32_surface_create_similar), + (_cairo_win32_surface_create_dib), + (_cairo_win32_surface_composite), (categorize_solid_dest_operator), + (_cairo_win32_surface_set_clip_region): + * test/Makefile.am: + 2005-06-24 Carl Worth * src/cairo-ft-font.c: (_cairo_ft_unscaled_font_create_glyph): diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c index 8d63adbf3..f4d3062b6 100644 --- a/src/cairo-win32-surface.c +++ b/src/cairo-win32-surface.c @@ -240,7 +240,6 @@ _create_dc_and_bitmap (cairo_win32_surface_t *surface, static cairo_surface_t * _cairo_win32_surface_create_for_dc (HDC original_dc, cairo_format_t format, - int drawable, int width, int height) { @@ -297,8 +296,7 @@ _cairo_win32_surface_create_similar (void *abstract_src, { cairo_win32_surface_t *src = abstract_src; - return _cairo_win32_surface_create_for_dc (src->dc, format, drawable, - width, height); + return _cairo_win32_surface_create_for_dc (src->dc, format, width, height); } /** @@ -319,8 +317,7 @@ _cairo_win32_surface_create_dib (cairo_format_t format, int width, int height) { - return _cairo_win32_surface_create_for_dc (NULL, format, TRUE, - width, height); + return _cairo_win32_surface_create_for_dc (NULL, format, width, height); } static cairo_status_t @@ -577,7 +574,6 @@ _cairo_win32_surface_composite (cairo_operator_t operator, } else if (integer_transform && (src->format == CAIRO_FORMAT_RGB24 || src->format == CAIRO_FORMAT_ARGB32) && dst->format == CAIRO_FORMAT_RGB24 && - !src->base.repeat && operator == CAIRO_OPERATOR_OVER) { BLENDFUNCTION blend_function; @@ -675,6 +671,9 @@ categorize_solid_dest_operator (cairo_operator_t operator, return DO_UNSUPPORTED; break; } + + ASSERT_NOT_REACHED; + return DO_UNSUPPORTED; } static cairo_int_status_t @@ -751,8 +750,12 @@ _cairo_win32_surface_set_clip_region (void *abstract_surface, /* If we are in-memory, then we set the clip on the image surface * as well as on the underlying GDI surface. */ - if (surface->image) - _cairo_surface_set_clip_region (surface->image, region); + if (surface->image) { + unsigned int serial; + + serial = _cairo_surface_allocate_clip_serial (surface->image); + _cairo_surface_set_clip_region (surface->image, region, serial); + } /* The semantics we want is that any clip set by cairo combines * is intersected with the clip on device context that the diff --git a/test/Makefile.am b/test/Makefile.am index 48204192d..17ac36a85 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -109,8 +109,8 @@ INCLUDES = \ -D_GNU_SOURCE \ $(CAIRO_CFLAGS) \ -I$(srcdir) \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src + -I$(top_builddir)/src \ + -I$(top_srcdir)/src noinst_LTLIBRARIES = libcairotest.la -- cgit v1.2.3 From 5f0e8de3e5721d55328b6b06922f7b29b49cc5cb Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Sat, 25 Jun 2005 13:51:22 +0000 Subject: Add mostly useless (other than perhaps 90-degree rotation) code for transforming bitmap glyphs. --- ChangeLog | 8 +++- src/cairo-ft-font.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 142 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 91cfef6e7..550bc13e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-06-24 Owen Taylor + + * src/cairo-ft-font.c (_transform_glyph_bitmap): Add mostly + useless (other than perhaps 90-degree rotation) code for + transforming bitmap glyphs. + 2005-06-25 Carl Worth From: J. Ali Harlow" @@ -41,7 +47,7 @@ * src/cairo-ft-font.c (_render_glyph_bitmap): Handle rendering bitmap glyphslots as well as outline glyphslots. - + * src/cairo-ft-font.c (_ft_unscaled_font_set_scale): When setting the scale for a non-scalable font, use the nearest available size (FreeType won't set the glyph metrics otherwise.) diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 3aea02d77..7fbac1305 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -86,10 +86,11 @@ typedef struct { int id; /* We temporarily scale the unscaled font as neede */ - int have_scale; + cairo_bool_t have_scale; cairo_matrix_t current_scale; double x_scale; /* Extracted X scale factor */ double y_scale; /* Extracted Y scale factor */ + cairo_bool_t have_shape; /* true if the current scale has a non-scale component*/ int lock; /* count of how many times this font has been locked */ @@ -474,6 +475,11 @@ _ft_unscaled_font_set_scale (ft_unscaled_font_t *unscaled, mat.xy = - DOUBLE_TO_16_16(sf.shape[1][0]); mat.yy = DOUBLE_TO_16_16(sf.shape[1][1]); + unscaled->have_shape = (mat.xx != 0x10000 || + mat.yx != 0x00000 || + mat.xy != 0x00000 || + mat.yy != 0x10000); + FT_Set_Transform(unscaled->face, &mat, NULL); if ((unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) != 0) { @@ -723,6 +729,125 @@ _render_glyph_bitmap (FT_Face face, return status; } +static cairo_status_t +_transform_glyph_bitmap (cairo_image_glyph_cache_entry_t *val) +{ + ft_font_transform_t sf; + cairo_matrix_t original_to_transformed; + cairo_matrix_t transformed_to_original; + cairo_image_surface_t *old_image; + cairo_surface_t *image; + double x[4], y[4]; + double origin_x, origin_y; + int i; + int x_min, y_min, x_max, y_max; + int width, height; + cairo_status_t status; + cairo_surface_pattern_t pattern; + + /* We want to compute a transform that takes the origin + * (val->size.x, val->size.y) to 0,0, then applies the "shape" + * portion of the font transform + */ + _compute_transform (&sf, &val->key.scale); + + cairo_matrix_init (&original_to_transformed, + sf.shape[0][0], sf.shape[0][1], + sf.shape[1][0], sf.shape[1][1], + 0, 0); + + cairo_matrix_translate (&original_to_transformed, + val->size.x, val->size.y); + + /* Find the bounding box of the original bitmap under that + * transform + */ + x[0] = 0; y[0] = 0; + x[1] = val->size.width; y[1] = 0; + x[2] = val->size.width; y[2] = val->size.height; + x[3] = 0; y[3] = val->size.height; + + for (i = 0; i < 4; i++) + cairo_matrix_transform_point (&original_to_transformed, + &x[i], &y[i]); + + x_min = floor (x[0]); y_min = floor (y[0]); + x_max = ceil (x[0]); y_max = ceil (y[0]); + + for (i = 1; i < 4; i++) { + if (x[i] < x_min) + x_min = floor (x[i]); + if (x[i] > x_max) + x_max = ceil (x[i]); + if (y[i] < y_min) + y_min = floor (y[i]); + if (y[i] > y_max) + y_max = ceil (y[i]); + } + + /* Adjust the transform so that the bounding box starts at 0,0 ... + * this gives our final transform from original bitmap to transformed + * bitmap. + */ + original_to_transformed.x0 -= x_min; + original_to_transformed.y0 -= y_min; + + /* Create the transformed bitmap + */ + width = x_max - x_min; + height = y_max - y_min; + + transformed_to_original = original_to_transformed; + status = cairo_matrix_invert (&transformed_to_original); + if (status) + return status; + + /* We need to pad out the width to 32-bit intervals for cairo-xlib-surface.c */ + width = (width + 3) & ~3; + image = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height); + if (!image) + return CAIRO_STATUS_NO_MEMORY; + + /* Initialize it to empty + */ + _cairo_surface_fill_rectangle (image, CAIRO_OPERATOR_SOURCE, + CAIRO_COLOR_TRANSPARENT, + 0, 0, + width, height); + + /* Draw the original bitmap transformed into the new bitmap + */ + _cairo_pattern_init_for_surface (&pattern, &val->image->base); + cairo_pattern_set_matrix (&pattern.base, &transformed_to_original); + + _cairo_surface_composite (CAIRO_OPERATOR_OVER, + &pattern.base, NULL, image, + 0, 0, 0, 0, 0, 0, + width, + height); + + _cairo_pattern_fini (&pattern.base); + + /* Now update the cache entry for the new bitmap, recomputing + * the origin based on the final transform. + */ + origin_x = - val->size.x; + origin_y = - val->size.y; + cairo_matrix_transform_point (&original_to_transformed, + &origin_x, &origin_y); + + old_image = val->image; + val->image = (cairo_image_surface_t *)image; + cairo_surface_destroy (&old_image->base); + + val->size.width = width; + val->size.height = height; + val->size.x = - floor (origin_x + 0.5); + val->size.y = - floor (origin_y + 0.5); + + return status; +} + static cairo_status_t _cairo_ft_unscaled_font_create_glyph (void *abstract_font, cairo_image_glyph_cache_entry_t *val) @@ -775,7 +900,16 @@ _cairo_ft_unscaled_font_create_glyph (void *abstract_ else status = _render_glyph_bitmap (face, val); + if (unscaled->have_shape && + (unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) == 0) + status = _transform_glyph_bitmap (val); + FAIL: + if (status && val->image) { + cairo_surface_destroy (&val->image->base); + val->image = NULL; + } + _ft_unscaled_font_unlock_face (unscaled); return status; -- cgit v1.2.3 From be38e07c4e511c075f9a30c67a4385bbb1d30594 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Sat, 25 Jun 2005 14:41:38 +0000 Subject: Fix broken build on older gcc's caused by overzealous s/IC_/FB_/g --- pixman/ChangeLog | 5 +++++ pixman/src/icint.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index 972f15cc0..09d62fd69 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,8 @@ +2005-06-25 Jeff Muizelaar + + * src/icint.h: + Fix broken build on older gcc's caused by overzealous s/IC_/FB_/g + 2005-06-24 Jeff Muizelaar * src/ic.c: diff --git a/pixman/src/icint.h b/pixman/src/icint.h index ebdd6aed5..8cf374769 100644 --- a/pixman/src/icint.h +++ b/pixman/src/icint.h @@ -793,7 +793,7 @@ fbRasterizeTrapezoid (pixman_image_t *pMask, # define _FbOnes(mask) __builtin_popcountl((mask) & 0xffffffff) # endif #else -# define ICINT_NEED_FB_ONES +# define ICINT_NEED_IC_ONES int _FbOnes(unsigned long mask); #endif -- cgit v1.2.3 From 574f7f560bf2cc851ad4f3267840e37fa06611fa Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Sat, 25 Jun 2005 15:03:17 +0000 Subject: Merge over most of the low-hanging renames from xserver/fb. --- pixman/ChangeLog | 34 +++ pixman/src/ic.c | 30 +-- pixman/src/icblt.c | 34 +-- pixman/src/icbltone.c | 32 +-- pixman/src/iccompose.c | 498 ++++++++++++++++++------------------- pixman/src/icint.h | 296 ++++++++++++---------- pixman/src/icrop.h | 18 +- pixman/src/icutil.c | 2 +- pixman/src/pixman-xserver-compat.h | 4 +- 9 files changed, 501 insertions(+), 447 deletions(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index 09d62fd69..1bcf0933b 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,37 @@ +2005-06-25 Jeff Muizelaar + + * src/ic.c: (fbOver): + * src/icblt.c: (fbBlt), (fbBlt24Line), (fbBlt24), (fbBltOdd), + (fbBltOdd24), (fbBltStip): + * src/icbltone.c: (fbBltOne): + * src/iccompose.c: (fbCombineMaskU), (fbCombineMaskC), + (fbCombineMaskValueC), (fbCombineMaskAlphaC), (fbCombineOverU), + (fbCombineOverC), (fbCombineOverReverseU), (fbCombineOverReverseC), + (fbCombineInU), (fbCombineInC), (fbCombineInReverseU), + (fbCombineInReverseC), (fbCombineOutU), (fbCombineOutC), + (fbCombineOutReverseU), (fbCombineOutReverseC), (fbCombineAtopU), + (fbCombineAtopC), (fbCombineAtopReverseU), (fbCombineAtopReverseC), + (fbCombineXorU), (fbCombineXorC), (fbCombineAddU), (fbCombineAddC), + (fbCombineDisjointGeneralU), (fbCombineDisjointGeneralC), + (fbCombineDisjointOverU), (fbCombineConjointGeneralU), + (fbCombineConjointGeneralC), (fbCombineConjointOverU), + (fbFetch_a8r8g8b8), (fbFetch_x8r8g8b8), (fbFetch_a8b8g8r8), + (fbFetch_x8b8g8r8), (fbFetch_r8g8b8), (fbFetch_b8g8r8), + (fbFetch_r5g6b5), (fbFetch_b5g6r5), (fbFetch_a1r5g5b5), + (fbFetch_x1r5g5b5), (fbFetch_a1b5g5r5), (fbFetch_x1b5g5r5), + (fbFetch_a4r4g4b4), (fbFetch_x4r4g4b4), (fbFetch_a4b4g4r4), + (fbFetch_x4b4g4r4), (fbFetch_a8), (fbFetcha_a8), (fbFetch_r3g3b2), + (fbFetch_b2g3r3), (fbFetch_a2r2g2b2), (fbFetch_a4), (fbFetcha_a4), + (fbFetch_r1g2b1), (fbFetch_b1g2r1), (fbFetch_a1r1g1b1), + (fbFetch_a1b1g1r1), (fbFetcha_a1), (fbFetch_a1), + (fbBuildCompositeOperand), (pixman_compositeGeneral): + * src/icint.h: + * src/icrop.h: + * src/icutil.c: + * src/pixman-xserver-compat.h: + + Merge over most of the low-hanging renames from xserver/fb. + 2005-06-25 Jeff Muizelaar * src/icint.h: diff --git a/pixman/src/ic.c b/pixman/src/ic.c index b8d636c10..1fc715a6b 100644 --- a/pixman/src/ic.c +++ b/pixman/src/ic.c @@ -32,30 +32,30 @@ #if IMAGE_BYTE_ORDER == MSBFirst #define Fetch24(a) ((unsigned long) (a) & 1 ? \ - ((*(a) << 16) | *((uint16_t *) ((a)+1))) : \ - ((*((uint16_t *) (a)) << 8) | *((a)+2))) + ((*(a) << 16) | *((CARD16 *) ((a)+1))) : \ + ((*((CARD16 *) (a)) << 8) | *((a)+2))) #define Store24(a,v) ((unsigned long) (a) & 1 ? \ - ((*(a) = (uint8_t) ((v) >> 16)), \ - (*((uint16_t *) ((a)+1)) = (uint16_t) (v))) : \ - ((*((uint16_t *) (a)) = (uint16_t) ((v) >> 8)), \ - (*((a)+2) = (uint8_t) (v)))) + ((*(a) = (CARD8) ((v) >> 16)), \ + (*((CARD16 *) ((a)+1)) = (CARD16) (v))) : \ + ((*((CARD16 *) (a)) = (CARD16) ((v) >> 8)), \ + (*((a)+2) = (CARD8) (v)))) #else #define Fetch24(a) ((unsigned long) (a) & 1 ? \ - ((*(a)) | (*((uint16_t *) ((a)+1)) << 8)) : \ - ((*((uint16_t *) (a))) | (*((a)+2) << 16))) + ((*(a)) | (*((CARD16 *) ((a)+1)) << 8)) : \ + ((*((CARD16 *) (a))) | (*((a)+2) << 16))) #define Store24(a,v) ((unsigned long) (a) & 1 ? \ - ((*(a) = (uint8_t) (v)), \ - (*((uint16_t *) ((a)+1)) = (uint16_t) ((v) >> 8))) : \ - ((*((uint16_t *) (a)) = (uint16_t) (v)),\ - (*((a)+2) = (uint8_t) ((v) >> 16)))) + ((*(a) = (CARD8) (v)), \ + (*((CARD16 *) ((a)+1)) = (CARD16) ((v) >> 8))) : \ + ((*((CARD16 *) (a)) = (CARD16) (v)),\ + (*((a)+2) = (CARD8) ((v) >> 16)))) #endif static uint32_t fbOver (uint32_t x, uint32_t y) { - uint16_t a = ~x >> 24; - uint16_t t; - uint32_t m,n,o,p; + CARD16 a = ~x >> 24; + CARD16 t; + CARD32 m,n,o,p; m = FbOverU(x,y,0,a,t); n = FbOverU(x,y,8,a,t); diff --git a/pixman/src/icblt.c b/pixman/src/icblt.c index 1ebf6cc31..e183440ee 100644 --- a/pixman/src/icblt.c +++ b/pixman/src/icblt.c @@ -52,15 +52,15 @@ fbBlt (FbBits *srcLine, FbBits pm, int bpp, - int reverse, - int upsidedown) + Bool reverse, + Bool upsidedown) { FbBits *src, *dst; int leftShift, rightShift; FbBits startmask, endmask; FbBits bits, bits1; int n, nmiddle; - int destInvarient; + Bool destInvarient; int startbyte, endbyte; FbDeclareMergeRop (); @@ -361,7 +361,7 @@ fbBlt24Line (FbBits *src, int alu, FbBits pm, - int reverse) + Bool reverse) { #ifdef DEBUG_BLT24 char *origDst = (char *) dst; @@ -578,8 +578,8 @@ fbBlt24 (FbBits *srcLine, int alu, FbBits pm, - int reverse, - int upsidedown) + Bool reverse, + Bool upsidedown) { if (upsidedown) { @@ -646,8 +646,8 @@ fbBltOdd (FbBits *srcLine, FbBits bits, bits1; int n; - int destInvarient; - int even; + Bool destInvarient; + Bool even; FbDeclareMergeRop (); FbInitializeMergeRop (alu, pm); @@ -663,7 +663,7 @@ fbBltOdd (FbBits *srcLine, FbMaskBits(dstXEven, width, startmaskEven, nmiddleEven, endmaskEven); FbMaskBits(dstXOdd, width, startmaskOdd, nmiddleOdd, endmaskOdd); - even = 1; + even = TRUE; InitializeShifts(srcXEven, dstXEven, leftShiftEven, rightShiftEven); InitializeShifts(srcXOdd, dstXOdd, leftShiftOdd, rightShiftOdd); while (height--) @@ -681,7 +681,7 @@ fbBltOdd (FbBits *srcLine, rightShift = rightShiftEven; srcLine += srcStrideEven; dstLine += dstStrideEven; - even = 0; + even = FALSE; } else { @@ -694,7 +694,7 @@ fbBltOdd (FbBits *srcLine, rightShift = rightShiftOdd; srcLine += srcStrideOdd; dstLine += dstStrideOdd; - even = 1; + even = TRUE; } if (srcX == dstX) { @@ -799,25 +799,25 @@ fbBltOdd24 (FbBits *srcLine, int alu, FbBits pm) { - int even = 1; + Bool even = TRUE; while (height--) { if (even) { fbBlt24Line (srcLine, srcXEven, dstLine, dstXEven, - width, alu, pm, 0); + width, alu, pm, FALSE); srcLine += srcStrideEven; dstLine += dstStrideEven; - even = 0; + even = FALSE; } else { fbBlt24Line (srcLine, srcXOdd, dstLine, dstXOdd, - width, alu, pm, 0); + width, alu, pm, FALSE); srcLine += srcStrideOdd; dstLine += dstStrideOdd; - even = 1; + even = TRUE; } } #if 0 @@ -944,6 +944,6 @@ fbBltStip (FbStip *src, (FbBits *) dst, FbStipStrideToBitsStride (dstStride), dstX, width, height, - alu, pm, bpp, 0, 0); + alu, pm, bpp, FALSE, FALSE); } } diff --git a/pixman/src/icbltone.c b/pixman/src/icbltone.c index 9455452be..58f6e19d8 100644 --- a/pixman/src/icbltone.c +++ b/pixman/src/icbltone.c @@ -151,7 +151,7 @@ fbBltOne (FbStip *src, FbBits bgand, FbBits bgxor) { - const FbBits *icbits; + const FbBits *fbBits; int pixelsPerDst; /* dst pixels per FbBits */ int unitsPerSrc; /* src patterns per FbStip */ int leftShift, rightShift; /* align source with dest */ @@ -163,12 +163,12 @@ fbBltOne (FbStip *src, int w; int n, nmiddle; int dstS; /* stipple-relative dst X coordinate */ - int copy; /* accelerate dest-invariant */ - int transparent; /* accelerate 0 nop */ + Bool copy; /* accelerate dest-invariant */ + Bool transparent; /* accelerate 0 nop */ int srcinc; /* source units consumed */ - int endNeedsLoad = 0; /* need load for endmask */ + Bool endNeedsLoad = FALSE; /* need load for endmask */ #ifndef FBNOPIXADDR - const uint8_t *fbLane; + const CARD8 *fbLane; #endif int startbyte, endbyte; @@ -194,12 +194,12 @@ fbBltOne (FbStip *src, */ unitsPerSrc = FB_STIP_UNIT / pixelsPerDst; - copy = 0; - transparent = 0; + copy = FALSE; + transparent = FALSE; if (bgand == 0 && fgand == 0) - copy = 1; + copy = TRUE; else if (bgand == FB_ALLONES && bgxor == 0) - transparent = 1; + transparent = TRUE; /* * Adjust source and dest to nearest FbBits boundary @@ -233,9 +233,9 @@ fbBltOne (FbStip *src, /* * Get pointer to stipple mask array for this depth */ - icbits = 0; /* unused */ + fbBits = 0; /* unused */ if (pixelsPerDst <= 8) - icbits = fbStippleTable(pixelsPerDst); + fbBits = fbStippleTable(pixelsPerDst); #ifndef FBNOPIXADDR fbLane = 0; if (transparent && fgand == 0 && dstBpp >= 8) @@ -299,7 +299,7 @@ fbBltOne (FbStip *src, mask = FbStipple16Bits(FbLeftStipBits(bits,16)); else #endif - mask = icbits[FbLeftStipBits(bits,pixelsPerDst)]; + mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)]; #ifndef FBNOPIXADDR if (fbLane) { @@ -333,7 +333,7 @@ fbBltOne (FbStip *src, mask = FbStipple16Bits(FbLeftStipBits(bits,16)); else #endif - mask = icbits[FbLeftStipBits(bits,pixelsPerDst)]; + mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)]; *dst = FbOpaqueStipple (mask, fgxor, bgxor); dst++; bits = FbStipLeft(bits, pixelsPerDst); @@ -347,7 +347,7 @@ fbBltOne (FbStip *src, while (bits && n) { switch (fbLane[FbLeftStipBits(bits,pixelsPerDst)]) { - LaneCases((uint8_t *) dst); + LaneCases((CARD8 *) dst); } bits = FbStipLeft(bits,pixelsPerDst); dst++; @@ -363,7 +363,7 @@ fbBltOne (FbStip *src, left = FbLeftStipBits(bits,pixelsPerDst); if (left || !transparent) { - mask = icbits[left]; + mask = fbBits[left]; *dst = FbStippleRRop (*dst, mask, fgand, fgxor, bgand, bgxor); } @@ -397,7 +397,7 @@ fbBltOne (FbStip *src, mask = FbStipple16Bits(FbLeftStipBits(bits,16)); else #endif - mask = icbits[FbLeftStipBits(bits,pixelsPerDst)]; + mask = fbBits[FbLeftStipBits(bits,pixelsPerDst)]; #ifndef FBNOPIXADDR if (fbLane) { diff --git a/pixman/src/iccompose.c b/pixman/src/iccompose.c index 611cb7c93..bf9de02ff 100644 --- a/pixman/src/iccompose.c +++ b/pixman/src/iccompose.c @@ -39,10 +39,10 @@ static uint32_t fbCombineMaskU (FbCompositeOperand *src, FbCompositeOperand *msk) { - uint32_t x; - uint16_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 x; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; if (!msk) return (*src->fetch) (src); @@ -67,11 +67,11 @@ fbCombineMaskC (FbCompositeOperand *src, FbCompositeOperand *msk) { FbCompSrc s; - uint32_t x; - uint32_t a; - uint16_t xa; - uint16_t t; - uint32_t m,n,o,p; + CARD32 x; + CARD32 a; + CARD16 xa; + CARD16 t; + CARD32 m,n,o,p; if (!msk) { @@ -121,10 +121,10 @@ static uint32_t fbCombineMaskValueC (FbCompositeOperand *src, FbCompositeOperand *msk) { - uint32_t x; - uint32_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 x; + CARD32 a; + CARD16 t; + CARD32 m,n,o,p; if (!msk) { @@ -175,10 +175,10 @@ static uint32_t fbCombineMaskAlphaC (FbCompositeOperand *src, FbCompositeOperand *msk) { - uint32_t x; - uint32_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 x; + CARD32 a; + CARD16 t; + CARD32 m,n,o,p; if (!msk) return (*src->fetch) (src); @@ -238,10 +238,10 @@ fbCombineOverU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; s = fbCombineMaskU (src, msk); a = ~s >> 24; @@ -266,10 +266,10 @@ fbCombineOverC (FbCompositeOperand *src, FbCompositeOperand *dst) { FbCompSrc cs; - uint32_t s, d; - uint32_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD32 a; + CARD16 t; + CARD32 m,n,o,p; cs = fbCombineMaskC (src, msk); s = cs.value; @@ -294,10 +294,10 @@ fbCombineOverReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; d = (*dst->fetch) (dst); a = ~d >> 24; @@ -321,10 +321,10 @@ fbCombineOverReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint32_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD32 a; + CARD16 t; + CARD32 m,n,o,p; d = (*dst->fetch) (dst); a = ~d >> 24; @@ -348,10 +348,10 @@ fbCombineInU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; d = (*dst->fetch) (dst); a = d >> 24; @@ -376,10 +376,10 @@ fbCombineInC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; d = (*dst->fetch) (dst); a = d >> 24; @@ -404,10 +404,10 @@ fbCombineInReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; s = fbCombineMaskAlphaU (src, msk); a = s >> 24; @@ -432,10 +432,10 @@ fbCombineInReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint32_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD32 a; + CARD16 t; + CARD32 m,n,o,p; s = fbCombineMaskAlphaC (src, msk); a = s; @@ -460,10 +460,10 @@ fbCombineOutU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; d = (*dst->fetch) (dst); a = ~d >> 24; @@ -488,10 +488,10 @@ fbCombineOutC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; d = (*dst->fetch) (dst); a = ~d >> 24; @@ -516,10 +516,10 @@ fbCombineOutReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; s = fbCombineMaskAlphaU (src, msk); a = ~s >> 24; @@ -544,10 +544,10 @@ fbCombineOutReverseC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint32_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD32 a; + CARD16 t; + CARD32 m,n,o,p; s = fbCombineMaskAlphaC (src, msk); a = ~s; @@ -572,10 +572,10 @@ fbCombineAtopU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t ad, as; - uint16_t t,u,v; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 ad, as; + CARD16 t,u,v; + CARD32 m,n,o,p; s = fbCombineMaskU (src, msk); d = (*dst->fetch) (dst); @@ -594,11 +594,11 @@ fbCombineAtopC (FbCompositeOperand *src, FbCompositeOperand *dst) { FbCompSrc cs; - uint32_t s, d; - uint32_t ad; - uint16_t as; - uint16_t t, u, v; - uint32_t m,n,o,p; + CARD32 s, d; + CARD32 ad; + CARD16 as; + CARD16 t, u, v; + CARD32 m,n,o,p; cs = fbCombineMaskC (src, msk); d = (*dst->fetch) (dst); @@ -617,10 +617,10 @@ fbCombineAtopReverseU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t ad, as; - uint16_t t, u, v; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 ad, as; + CARD16 t, u, v; + CARD32 m,n,o,p; s = fbCombineMaskU (src, msk); d = (*dst->fetch) (dst); @@ -639,10 +639,10 @@ fbCombineAtopReverseC (FbCompositeOperand *src, FbCompositeOperand *dst) { FbCompSrc cs; - uint32_t s, d, ad; - uint16_t as; - uint16_t t, u, v; - uint32_t m,n,o,p; + CARD32 s, d, ad; + CARD16 as; + CARD16 t, u, v; + CARD32 m,n,o,p; cs = fbCombineMaskC (src, msk); d = (*dst->fetch) (dst); @@ -661,10 +661,10 @@ fbCombineXorU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t ad, as; - uint16_t t, u, v; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 ad, as; + CARD16 t, u, v; + CARD32 m,n,o,p; s = fbCombineMaskU (src, msk); d = (*dst->fetch) (dst); @@ -683,10 +683,10 @@ fbCombineXorC (FbCompositeOperand *src, FbCompositeOperand *dst) { FbCompSrc cs; - uint32_t s, d, ad; - uint16_t as; - uint16_t t, u, v; - uint32_t m,n,o,p; + CARD32 s, d, ad; + CARD16 as; + CARD16 t, u, v; + CARD32 m,n,o,p; cs = fbCombineMaskC (src, msk); d = (*dst->fetch) (dst); @@ -705,9 +705,9 @@ fbCombineAddU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 t; + CARD32 m,n,o,p; s = fbCombineMaskU (src, msk); if (s == ~0) @@ -731,9 +731,9 @@ fbCombineAddC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 t; + CARD32 m,n,o,p; s = fbCombineMaskValueC (src, msk); if (s == ~0) @@ -821,12 +821,12 @@ static void fbCombineDisjointGeneralU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst, - uint8_t combine) + CARD8 combine) { - uint32_t s, d; - uint32_t m,n,o,p; - uint16_t Fa, Fb, t, u, v; - uint8_t sa, da; + CARD32 s, d; + CARD32 m,n,o,p; + CARD16 Fa, Fb, t, u, v; + CARD8 sa, da; s = fbCombineMaskU (src, msk); sa = s >> 24; @@ -875,15 +875,15 @@ static void fbCombineDisjointGeneralC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst, - uint8_t combine) + CARD8 combine) { FbCompSrc cs; - uint32_t s, d; - uint32_t m,n,o,p; - uint32_t Fa; - uint16_t Fb, t, u, v; - uint32_t sa; - uint8_t da; + CARD32 s, d; + CARD32 m,n,o,p; + CARD32 Fa; + CARD16 Fb, t, u, v; + CARD32 sa; + CARD8 da; cs = fbCombineMaskC (src, msk); s = cs.value; @@ -897,17 +897,17 @@ fbCombineDisjointGeneralC (FbCompositeOperand *src, Fa = 0; break; case CombineAOut: - m = fbCombineDisjointOutPart ((uint8_t) (sa >> 0), da); - n = fbCombineDisjointOutPart ((uint8_t) (sa >> 8), da) << 8; - o = fbCombineDisjointOutPart ((uint8_t) (sa >> 16), da) << 16; - p = fbCombineDisjointOutPart ((uint8_t) (sa >> 24), da) << 24; + m = fbCombineDisjointOutPart ((CARD8) (sa >> 0), da); + n = fbCombineDisjointOutPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineDisjointOutPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineDisjointOutPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineAIn: - m = fbCombineDisjointOutPart ((uint8_t) (sa >> 0), da); - n = fbCombineDisjointOutPart ((uint8_t) (sa >> 8), da) << 8; - o = fbCombineDisjointOutPart ((uint8_t) (sa >> 16), da) << 16; - p = fbCombineDisjointOutPart ((uint8_t) (sa >> 24), da) << 24; + m = fbCombineDisjointOutPart ((CARD8) (sa >> 0), da); + n = fbCombineDisjointOutPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineDisjointOutPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineDisjointOutPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineA: @@ -942,10 +942,10 @@ fbCombineDisjointOverU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst) { - uint32_t s, d; - uint16_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; s = fbCombineMaskU (src, msk); a = s >> 24; @@ -1130,12 +1130,12 @@ static void fbCombineConjointGeneralU (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst, - uint8_t combine) + CARD8 combine) { - uint32_t s, d; - uint32_t m,n,o,p; - uint16_t Fa, Fb, t, u, v; - uint8_t sa, da; + CARD32 s, d; + CARD32 m,n,o,p; + CARD16 Fa, Fb, t, u, v; + CARD8 sa, da; s = fbCombineMaskU (src, msk); sa = s >> 24; @@ -1184,15 +1184,15 @@ static void fbCombineConjointGeneralC (FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst, - uint8_t combine) + CARD8 combine) { FbCompSrc cs; - uint32_t s, d; - uint32_t m,n,o,p; - uint32_t Fa; - uint16_t Fb, t, u, v; - uint32_t sa; - uint8_t da; + CARD32 s, d; + CARD32 m,n,o,p; + CARD32 Fa; + CARD16 Fb, t, u, v; + CARD32 sa; + CARD8 da; cs = fbCombineMaskC (src, msk); s = cs.value; @@ -1206,17 +1206,17 @@ fbCombineConjointGeneralC (FbCompositeOperand *src, Fa = 0; break; case CombineAOut: - m = fbCombineConjointOutPart ((uint8_t) (sa >> 0), da); - n = fbCombineConjointOutPart ((uint8_t) (sa >> 8), da) << 8; - o = fbCombineConjointOutPart ((uint8_t) (sa >> 16), da) << 16; - p = fbCombineConjointOutPart ((uint8_t) (sa >> 24), da) << 24; + m = fbCombineConjointOutPart ((CARD8) (sa >> 0), da); + n = fbCombineConjointOutPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineConjointOutPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineConjointOutPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineAIn: - m = fbCombineConjointOutPart ((uint8_t) (sa >> 0), da); - n = fbCombineConjointOutPart ((uint8_t) (sa >> 8), da) << 8; - o = fbCombineConjointOutPart ((uint8_t) (sa >> 16), da) << 16; - p = fbCombineConjointOutPart ((uint8_t) (sa >> 24), da) << 24; + m = fbCombineConjointOutPart ((CARD8) (sa >> 0), da); + n = fbCombineConjointOutPart ((CARD8) (sa >> 8), da) << 8; + o = fbCombineConjointOutPart ((CARD8) (sa >> 16), da) << 16; + p = fbCombineConjointOutPart ((CARD8) (sa >> 24), da) << 24; Fa = m|n|o|p; break; case CombineA: @@ -1253,10 +1253,10 @@ fbCombineConjointOverU (FbCompositeOperand *src, { fbCombineConjointGeneralU (src, msk, dst, CombineAOver); /* - uint32_t s, d; - uint16_t a; - uint16_t t; - uint32_t m,n,o,p; + CARD32 s, d; + CARD16 a; + CARD16 t; + CARD32 m,n,o,p; s = fbCombineMaskU (src, msk); a = s >> 24; @@ -1514,22 +1514,22 @@ static FbCombineFunc const fbCombineFuncC[] = { static uint32_t fbFetch_a8r8g8b8 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - return ((uint32_t *)line)[offset >> 5]; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + return ((CARD32 *)line)[offset >> 5]; } static uint32_t fbFetch_x8r8g8b8 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - return ((uint32_t *)line)[offset >> 5] | 0xff000000; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + return ((CARD32 *)line)[offset >> 5] | 0xff000000; } static uint32_t fbFetch_a8b8g8r8 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint32_t *)line)[offset >> 5]; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD32 *)line)[offset >> 5]; return ((pixel & 0xff000000) | ((pixel >> 16) & 0xff) | @@ -1540,8 +1540,8 @@ fbFetch_a8b8g8r8 (FbCompositeOperand *op) static uint32_t fbFetch_x8b8g8r8 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint32_t *)line)[offset >> 5]; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD32 *)line)[offset >> 5]; return ((0xff000000) | ((pixel >> 16) & 0xff) | @@ -1552,8 +1552,8 @@ fbFetch_x8b8g8r8 (FbCompositeOperand *op) static uint32_t fbFetch_r8g8b8 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | (pixel[0] << 16) | @@ -1570,8 +1570,8 @@ fbFetch_r8g8b8 (FbCompositeOperand *op) static uint32_t fbFetch_b8g8r8 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint8_t *pixel = ((uint8_t *) line) + (offset >> 3); + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD8 *pixel = ((CARD8 *) line) + (offset >> 3); #if IMAGE_BYTE_ORDER == MSBFirst return (0xff000000 | (pixel[2] << 16) | @@ -1588,9 +1588,9 @@ fbFetch_b8g8r8 (FbCompositeOperand *op) static uint32_t fbFetch_r5g6b5 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint16_t *) line)[offset >> 4]; - uint32_t r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD16 *) line)[offset >> 4]; + CARD32 r,g,b; r = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) << 8; g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; @@ -1601,9 +1601,9 @@ fbFetch_r5g6b5 (FbCompositeOperand *op) static uint32_t fbFetch_b5g6r5 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint16_t *) line)[offset >> 4]; - uint32_t r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD16 *) line)[offset >> 4]; + CARD32 r,g,b; b = ((pixel & 0xf800) | ((pixel & 0xe000) >> 5)) >> 8; g = ((pixel & 0x07e0) | ((pixel & 0x0600) >> 6)) << 5; @@ -1614,11 +1614,11 @@ fbFetch_b5g6r5 (FbCompositeOperand *op) static uint32_t fbFetch_a1r5g5b5 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint16_t *) line)[offset >> 4]; - uint32_t a,r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD16 *) line)[offset >> 4]; + CARD32 a,r,g,b; - a = (uint32_t) ((uint8_t) (0 - ((pixel & 0x8000) >> 15))) << 24; + a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24; r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; b = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) >> 2; @@ -1628,9 +1628,9 @@ fbFetch_a1r5g5b5 (FbCompositeOperand *op) static uint32_t fbFetch_x1r5g5b5 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint16_t *) line)[offset >> 4]; - uint32_t r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD16 *) line)[offset >> 4]; + CARD32 r,g,b; r = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) << 9; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; @@ -1641,11 +1641,11 @@ fbFetch_x1r5g5b5 (FbCompositeOperand *op) static uint32_t fbFetch_a1b5g5r5 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint16_t *) line)[offset >> 4]; - uint32_t a,r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD16 *) line)[offset >> 4]; + CARD32 a,r,g,b; - a = (uint32_t) ((uint8_t) (0 - ((pixel & 0x8000) >> 15))) << 24; + a = (CARD32) ((CARD8) (0 - ((pixel & 0x8000) >> 15))) << 24; b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; r = ((pixel & 0x001c) | ((pixel & 0x001f) << 5)) << 14; @@ -1655,9 +1655,9 @@ fbFetch_a1b5g5r5 (FbCompositeOperand *op) static uint32_t fbFetch_x1b5g5r5 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint16_t *) line)[offset >> 4]; - uint32_t r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD16 *) line)[offset >> 4]; + CARD32 r,g,b; b = ((pixel & 0x7c00) | ((pixel & 0x7000) >> 5)) >> 7; g = ((pixel & 0x03e0) | ((pixel & 0x0380) >> 5)) << 6; @@ -1668,9 +1668,9 @@ fbFetch_x1b5g5r5 (FbCompositeOperand *op) static uint32_t fbFetch_a4r4g4b4 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint16_t *) line)[offset >> 4]; - uint32_t a,r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD16 *) line)[offset >> 4]; + CARD32 a,r,g,b; a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16; r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; @@ -1682,9 +1682,9 @@ fbFetch_a4r4g4b4 (FbCompositeOperand *op) static uint32_t fbFetch_x4r4g4b4 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint16_t *) line)[offset >> 4]; - uint32_t r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD16 *) line)[offset >> 4]; + CARD32 r,g,b; r = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; @@ -1695,9 +1695,9 @@ fbFetch_x4r4g4b4 (FbCompositeOperand *op) static uint32_t fbFetch_a4b4g4r4 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint16_t *) line)[offset >> 4]; - uint32_t a,r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD16 *) line)[offset >> 4]; + CARD32 a,r,g,b; a = ((pixel & 0xf000) | ((pixel & 0xf000) >> 4)) << 16; b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; @@ -1709,9 +1709,9 @@ fbFetch_a4b4g4r4 (FbCompositeOperand *op) static uint32_t fbFetch_x4b4g4r4 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint16_t *) line)[offset >> 4]; - uint32_t r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD16 *) line)[offset >> 4]; + CARD32 r,g,b; b = ((pixel & 0x0f00) | ((pixel & 0x0f00) >> 4)) << 12; g = ((pixel & 0x00f0) | ((pixel & 0x00f0) >> 4)) << 8; @@ -1722,8 +1722,8 @@ fbFetch_x4b4g4r4 (FbCompositeOperand *op) static uint32_t fbFetch_a8 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint8_t *) line)[offset>>3]; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD8 *) line)[offset>>3]; return pixel << 24; } @@ -1731,8 +1731,8 @@ fbFetch_a8 (FbCompositeOperand *op) static uint32_t fbFetcha_a8 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint8_t *) line)[offset>>3]; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD8 *) line)[offset>>3]; pixel |= pixel << 8; pixel |= pixel << 16; @@ -1742,9 +1742,9 @@ fbFetcha_a8 (FbCompositeOperand *op) static uint32_t fbFetch_r3g3b2 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint8_t *) line)[offset>>3]; - uint32_t r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD8 *) line)[offset>>3]; + CARD32 r,g,b; r = ((pixel & 0xe0) | ((pixel & 0xe0) >> 3) | ((pixel & 0xc0) >> 6)) << 16; g = ((pixel & 0x1c) | ((pixel & 0x18) >> 3) | ((pixel & 0x1c) << 3)) << 8; @@ -1758,9 +1758,9 @@ fbFetch_r3g3b2 (FbCompositeOperand *op) static uint32_t fbFetch_b2g3r3 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint8_t *) line)[offset>>3]; - uint32_t r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD8 *) line)[offset>>3]; + CARD32 r,g,b; b = (((pixel & 0xc0) ) | ((pixel & 0xc0) >> 2) | @@ -1776,9 +1776,9 @@ fbFetch_b2g3r3 (FbCompositeOperand *op) static uint32_t fbFetch_a2r2g2b2 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint8_t *) line)[offset>>3]; - uint32_t a,r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD8 *) line)[offset>>3]; + CARD32 a,r,g,b; a = ((pixel & 0xc0) * 0x55) << 18; r = ((pixel & 0x30) * 0x55) << 12; @@ -1787,7 +1787,7 @@ fbFetch_a2r2g2b2 (FbCompositeOperand *op) return a|r|g|b; } -#define Fetch8(l,o) (((uint8_t *) (l))[(o) >> 3]) +#define Fetch8(l,o) (((CARD8 *) (l))[(o) >> 3]) #if IMAGE_BYTE_ORDER == MSBFirst #define Fetch4(l,o) ((o) & 2 ? Fetch8(l,o) & 0xf : Fetch8(l,o) >> 4) #else @@ -1797,8 +1797,8 @@ fbFetch_a2r2g2b2 (FbCompositeOperand *op) static uint32_t fbFetch_a4 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = Fetch4(line, offset); + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = Fetch4(line, offset); pixel |= pixel << 4; return pixel << 24; @@ -1807,8 +1807,8 @@ fbFetch_a4 (FbCompositeOperand *op) static uint32_t fbFetcha_a4 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = Fetch4(line, offset); + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = Fetch4(line, offset); pixel |= pixel << 4; pixel |= pixel << 8; @@ -1819,9 +1819,9 @@ fbFetcha_a4 (FbCompositeOperand *op) static uint32_t fbFetch_r1g2b1 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = Fetch4(line, offset); - uint32_t r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = Fetch4(line, offset); + CARD32 r,g,b; r = ((pixel & 0x8) * 0xff) << 13; g = ((pixel & 0x6) * 0x55) << 7; @@ -1832,9 +1832,9 @@ fbFetch_r1g2b1 (FbCompositeOperand *op) static uint32_t fbFetch_b1g2r1 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = Fetch4(line, offset); - uint32_t r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = Fetch4(line, offset); + CARD32 r,g,b; b = ((pixel & 0x8) * 0xff) >> 3; g = ((pixel & 0x6) * 0x55) << 7; @@ -1845,9 +1845,9 @@ fbFetch_b1g2r1 (FbCompositeOperand *op) static uint32_t fbFetch_a1r1g1b1 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = Fetch4(line, offset); - uint32_t a,r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = Fetch4(line, offset); + CARD32 a,r,g,b; a = ((pixel & 0x8) * 0xff) << 21; r = ((pixel & 0x4) * 0xff) << 14; @@ -1859,9 +1859,9 @@ fbFetch_a1r1g1b1 (FbCompositeOperand *op) static uint32_t fbFetch_a1b1g1r1 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = Fetch4(line, offset); - uint32_t a,r,g,b; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = Fetch4(line, offset); + CARD32 a,r,g,b; a = ((pixel & 0x8) * 0xff) << 21; r = ((pixel & 0x4) * 0xff) >> 3; @@ -1873,9 +1873,9 @@ fbFetch_a1b1g1r1 (FbCompositeOperand *op) static uint32_t fbFetcha_a1 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint32_t *)line)[offset >> 5]; - uint32_t a; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD32 *)line)[offset >> 5]; + CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = pixel >> (0x1f - (offset & 0x1f)); #else @@ -1893,9 +1893,9 @@ fbFetcha_a1 (FbCompositeOperand *op) static uint32_t fbFetch_a1 (FbCompositeOperand *op) { - FbBits *line = op->u.drawable.line; uint32_t offset = op->u.drawable.offset; - uint32_t pixel = ((uint32_t *)line)[offset >> 5]; - uint32_t a; + FbBits *line = op->u.drawable.line; CARD32 offset = op->u.drawable.offset; + CARD32 pixel = ((CARD32 *)line)[offset >> 5]; + CARD32 a; #if BITMAP_BIT_ORDER == MSBFirst a = pixel >> (0x1f - (offset & 0x1f)); #else @@ -2549,10 +2549,10 @@ fbSet_transform (FbCompositeOperand *op, int x, int y) int fbBuildCompositeOperand (pixman_image_t *image, FbCompositeOperand op[4], - int16_t x, - int16_t y, - int transform, - int alpha) + INT16 x, + INT16 y, + Bool transform, + Bool alpha) { /* Check for transform */ if (transform && image->transform) @@ -2658,25 +2658,25 @@ fbBuildCompositeOperand (pixman_image_t *image, op->u.drawable.stride = stride; op->u.drawable.bpp = bpp; - return 1; + return TRUE; } - return 0; + return FALSE; } } void pixman_compositeGeneral (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { FbCompositeOperand src[4],msk[4],dst[4],*pmsk; FbCompositeOperand *srcPict, *srcAlpha; @@ -2685,11 +2685,11 @@ pixman_compositeGeneral (pixman_operator_t op, FbCombineFunc f; int w; - if (!fbBuildCompositeOperand (iSrc, src, xSrc, ySrc, 1, 1)) + if (!fbBuildCompositeOperand (pSrc, src, xSrc, ySrc, TRUE, TRUE)) return; - if (!fbBuildCompositeOperand (iDst, dst, xDst, yDst, 0, 1)) + if (!fbBuildCompositeOperand (pDst, dst, xDst, yDst, FALSE, TRUE)) return; - if (iSrc->alphaMap) + if (pSrc->alphaMap) { srcPict = &src[1]; srcAlpha = &src[2]; @@ -2699,7 +2699,7 @@ pixman_compositeGeneral (pixman_operator_t op, srcPict = &src[0]; srcAlpha = 0; } - if (iDst->alphaMap) + if (pDst->alphaMap) { dstPict = &dst[1]; dstAlpha = &dst[2]; @@ -2710,14 +2710,14 @@ pixman_compositeGeneral (pixman_operator_t op, dstAlpha = 0; } f = fbCombineFuncU[op]; - if (iMask) + if (pMask) { - if (!fbBuildCompositeOperand (iMask, msk, xMask, yMask, 1, 1)) + if (!fbBuildCompositeOperand (pMask, msk, xMask, yMask, TRUE, TRUE)) return; pmsk = msk; - if (iMask->componentAlpha) + if (pMask->componentAlpha) f = fbCombineFuncC[op]; - if (iMask->alphaMap) + if (pMask->alphaMap) { mskPict = &msk[1]; mskAlpha = &msk[2]; diff --git a/pixman/src/icint.h b/pixman/src/icint.h index 8cf374769..6ba28840b 100644 --- a/pixman/src/icint.h +++ b/pixman/src/icint.h @@ -70,7 +70,27 @@ typedef unsigned int Mask; #define CPLastBit 11 +/* Define any names that the server code will be expecting in + * terms of libpixman names. */ +typedef uint8_t CARD8; +typedef uint16_t CARD16; +typedef uint32_t CARD32; +typedef int16_t INT16; + +typedef int Bool; +#define FALSE 0 +#define TRUE 1 + +typedef pixman_bits_t FbBits; +typedef pixman_image_t* PicturePtr; +typedef pixman_box16_t BoxRec; +typedef pixman_box16_t* BoxPtr; + +typedef pixman_point_fixed_t xPointFixed; +typedef pixman_line_fixed_t xLineFixed; +typedef pixman_trapezoid_t xTrapezoid; +typedef pixman_triangle_t xTriangle; /* These few definitions avoid me needing to include servermd.h and misc.h from Xserver/include */ #ifndef BITMAP_SCANLINE_PAD @@ -138,7 +158,7 @@ typedef unsigned int Mask; #define FbStipStrideToBitsStride(s) (((s) >> (FB_SHIFT - FB_STIP_SHIFT))) #define FbBitsStrideToStipStride(s) (((s) << (FB_SHIFT - FB_STIP_SHIFT))) -#define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((pixman_bits_t) 1) << n) - 1)) +#define FbFullMask(n) ((n) == FB_UNIT ? FB_ALLONES : ((((FbBits) 1) << n) - 1)) typedef uint32_t FbStip; @@ -159,7 +179,7 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data); #if BITMAP_BIT_ORDER == LSBFirst #define FbScrLeft(x,n) ((x) >> (n)) #define FbScrRight(x,n) ((x) << (n)) -/* #define FbLeftBits(x,n) ((x) & ((((pixman_bits_t) 1) << (n)) - 1)) */ +/* #define FbLeftBits(x,n) ((x) & ((((FbBits) 1) << (n)) - 1)) */ #define FbLeftStipBits(x,n) ((x) & ((((FbStip) 1) << (n)) - 1)) #define FbStipMoveLsb(x,s,n) (FbStipRight (x,(s)-(n))) #define FbPatternOffsetBits 0 @@ -169,7 +189,7 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data); /* #define FbLeftBits(x,n) ((x) >> (FB_UNIT - (n))) */ #define FbLeftStipBits(x,n) ((x) >> (FB_STIP_UNIT - (n))) #define FbStipMoveLsb(x,s,n) (x) -#define FbPatternOffsetBits (sizeof (pixman_bits_t) - 1) +#define FbPatternOffsetBits (sizeof (FbBits) - 1) #endif #define FbStipLeft(x,n) FbScrLeft(x,n) @@ -227,7 +247,7 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data); #define FbPatternOffset(o,t) ((o) ^ (FbPatternOffsetBits & ~(sizeof (t) - 1))) -#define FbPtrOffset(p,o,t) ((t *) ((uint8_t *) (p) + (o))) +#define FbPtrOffset(p,o,t) ((t *) ((CARD8 *) (p) + (o))) #define FbSelectPatternPart(xor,o,t) ((xor) >> (FbPatternOffset (o,t) << 3)) #define FbStorePart(dst,off,t,xor) (*FbPtrOffset(dst,off,t) = \ FbSelectPart(xor,off,t)) @@ -277,111 +297,111 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data); #if FB_SHIFT == 6 #define FbDoLeftMaskByteRRop6Cases(dst,xor) \ - case (sizeof (pixman_bits_t) - 7) | (1 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ + case (sizeof (FbBits) - 7) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 7) | (2 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint8_t,xor); \ + case (sizeof (FbBits) - 7) | (2 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 7) | (3 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + case (sizeof (FbBits) - 7) | (3 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ break; \ - case (sizeof (pixman_bits_t) - 7) | (4 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ + case (sizeof (FbBits) - 7) | (4 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 7) | (5 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + case (sizeof (FbBits) - 7) | (5 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ break; \ - case (sizeof (pixman_bits_t) - 7) | (6 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + case (sizeof (FbBits) - 7) | (6 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 7): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 7,uint8_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ + case (sizeof (FbBits) - 7): \ + FbStorePart(dst,sizeof (FbBits) - 7,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ break; \ - case (sizeof (pixman_bits_t) - 6) | (1 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint8_t,xor); \ + case (sizeof (FbBits) - 6) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 6) | (2 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ + case (sizeof (FbBits) - 6) | (2 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ break; \ - case (sizeof (pixman_bits_t) - 6) | (3 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ + case (sizeof (FbBits) - 6) | (3 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 6) | (4 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + case (sizeof (FbBits) - 6) | (4 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ break; \ - case (sizeof (pixman_bits_t) - 6) | (5 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + case (sizeof (FbBits) - 6) | (5 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 6): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 6,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ + case (sizeof (FbBits) - 6): \ + FbStorePart(dst,sizeof (FbBits) - 6,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ break; \ - case (sizeof (pixman_bits_t) - 5) | (1 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ + case (sizeof (FbBits) - 5) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 5) | (2 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ + case (sizeof (FbBits) - 5) | (2 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 5) | (3 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + case (sizeof (FbBits) - 5) | (3 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ break; \ - case (sizeof (pixman_bits_t) - 5) | (4 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + case (sizeof (FbBits) - 5) | (4 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 5): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 5,uint8_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ + case (sizeof (FbBits) - 5): \ + FbStorePart(dst,sizeof (FbBits) - 5,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ break; \ - case (sizeof (pixman_bits_t) - 4) | (1 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint8_t,xor); \ + case (sizeof (FbBits) - 4) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 4) | (2 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ + case (sizeof (FbBits) - 4) | (2 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ break; \ - case (sizeof (pixman_bits_t) - 4) | (3 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint16_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + case (sizeof (FbBits) - 4) | (3 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD16,xor); \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 4): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 4,uint32_t,xor); \ + case (sizeof (FbBits) - 4): \ + FbStorePart(dst,sizeof (FbBits) - 4,CARD32,xor); \ break; #define FbDoRightMaskByteRRop6Cases(dst,xor) \ case 4: \ - FbStorePart(dst,0,uint32_t,xor); \ + FbStorePart(dst,0,CARD32,xor); \ break; \ case 5: \ - FbStorePart(dst,0,uint32_t,xor); \ - FbStorePart(dst,4,uint8_t,xor); \ + FbStorePart(dst,0,CARD32,xor); \ + FbStorePart(dst,4,CARD8,xor); \ break; \ case 6: \ - FbStorePart(dst,0,uint32_t,xor); \ - FbStorePart(dst,4,uint16_t,xor); \ + FbStorePart(dst,0,CARD32,xor); \ + FbStorePart(dst,4,CARD16,xor); \ break; \ case 7: \ - FbStorePart(dst,0,uint32_t,xor); \ - FbStorePart(dst,4,uint16_t,xor); \ - FbStorePart(dst,6,uint8_t,xor); \ + FbStorePart(dst,0,CARD32,xor); \ + FbStorePart(dst,4,CARD16,xor); \ + FbStorePart(dst,6,CARD8,xor); \ break; #else #define FbDoLeftMaskByteRRop6Cases(dst,xor) @@ -391,23 +411,23 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data); #define FbDoLeftMaskByteRRop(dst,lb,l,and,xor) { \ switch (lb) { \ FbDoLeftMaskByteRRop6Cases(dst,xor) \ - case (sizeof (pixman_bits_t) - 3) | (1 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 3,uint8_t,xor); \ + case (sizeof (FbBits) - 3) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 3) | (2 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 3,uint8_t,xor); \ - FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + case (sizeof (FbBits) - 3) | (2 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ - case (sizeof (pixman_bits_t) - 2) | (1 << (FB_SHIFT - 3)): \ - FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint8_t,xor); \ + case (sizeof (FbBits) - 2) | (1 << (FB_SHIFT - 3)): \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD8,xor); \ break; \ - case sizeof (pixman_bits_t) - 3: \ - FbStorePart(dst,sizeof (pixman_bits_t) - 3,uint8_t,xor); \ - case sizeof (pixman_bits_t) - 2: \ - FbStorePart(dst,sizeof (pixman_bits_t) - 2,uint16_t,xor); \ + case sizeof (FbBits) - 3: \ + FbStorePart(dst,sizeof (FbBits) - 3,CARD8,xor); \ + case sizeof (FbBits) - 2: \ + FbStorePart(dst,sizeof (FbBits) - 2,CARD16,xor); \ break; \ - case sizeof (pixman_bits_t) - 1: \ - FbStorePart(dst,sizeof (pixman_bits_t) - 1,uint8_t,xor); \ + case sizeof (FbBits) - 1: \ + FbStorePart(dst,sizeof (FbBits) - 1,CARD8,xor); \ break; \ default: \ *dst = FbDoMaskRRop(*dst, and, xor, l); \ @@ -419,14 +439,14 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data); #define FbDoRightMaskByteRRop(dst,rb,r,and,xor) { \ switch (rb) { \ case 1: \ - FbStorePart(dst,0,uint8_t,xor); \ + FbStorePart(dst,0,CARD8,xor); \ break; \ case 2: \ - FbStorePart(dst,0,uint16_t,xor); \ + FbStorePart(dst,0,CARD16,xor); \ break; \ case 3: \ - FbStorePart(dst,0,uint16_t,xor); \ - FbStorePart(dst,2,uint8_t,xor); \ + FbStorePart(dst,0,CARD16,xor); \ + FbStorePart(dst,2,CARD8,xor); \ break; \ FbDoRightMaskByteRRop6Cases(dst,xor) \ default: \ @@ -457,34 +477,34 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data); * sequence of partial word writes * * 'n' is the bytemask of which bytes to store, 'a' is the address - * of the pixman_bits_t base unit, 'o' is the offset within that unit + * of the FbBits base unit, 'o' is the offset within that unit * * The term "lane" comes from the hardware term "byte-lane" which */ #define FbLaneCase1(n,a,o) ((n) == 0x01 ? \ - (*(uint8_t *) ((a)+FbPatternOffset(o,uint8_t)) = \ + (*(CARD8 *) ((a)+FbPatternOffset(o,CARD8)) = \ fgxor) : 0) #define FbLaneCase2(n,a,o) ((n) == 0x03 ? \ - (*(uint16_t *) ((a)+FbPatternOffset(o,uint16_t)) = \ + (*(CARD16 *) ((a)+FbPatternOffset(o,CARD16)) = \ fgxor) : \ ((void)FbLaneCase1((n)&1,a,o), \ FbLaneCase1((n)>>1,a,(o)+1))) #define FbLaneCase4(n,a,o) ((n) == 0x0f ? \ - (*(uint32_t *) ((a)+FbPatternOffset(o,uint32_t)) = \ + (*(CARD32 *) ((a)+FbPatternOffset(o,CARD32)) = \ fgxor) : \ ((void)FbLaneCase2((n)&3,a,o), \ FbLaneCase2((n)>>2,a,(o)+2))) -#define FbLaneCase8(n,a,o) ((n) == 0x0ff ? (*(pixman_bits_t *) ((a)+(o)) = fgxor) : \ +#define FbLaneCase8(n,a,o) ((n) == 0x0ff ? (*(FbBits *) ((a)+(o)) = fgxor) : \ ((void)FbLaneCase4((n)&15,a,o), \ FbLaneCase4((n)>>4,a,(o)+4))) #if FB_SHIFT == 6 -#define FbLaneCase(n,a) FbLaneCase8(n,(uint8_t *) (a),0) +#define FbLaneCase(n,a) FbLaneCase8(n,(CARD8 *) (a),0) #endif #if FB_SHIFT == 5 -#define FbLaneCase(n,a) FbLaneCase4(n,(uint8_t *) (a),0) +#define FbLaneCase(n,a) FbLaneCase4(n,(CARD8 *) (a),0) #endif /* Rotate a filled pixel value to the specified alignement */ @@ -553,7 +573,7 @@ extern void fbSetBits (FbStip *bits, int stride, FbStip data); /* * Accelerated tiles are power of 2 width <= FB_UNIT */ -#define fbEvenTile(w) ((w) <= FB_UNIT && FbPowerOfTwo(w)) +#define FbEvenTile(w) ((w) <= FB_UNIT && FbPowerOfTwo(w)) /* * Accelerated stipples are power of 2 width and <= FB_UNIT/dstBpp * with dstBpp a power of 2 as well @@ -568,7 +588,7 @@ fbBlt (pixman_bits_t *src, FbStride srcStride, int srcX, - pixman_bits_t *dst, + FbBits *dst, FbStride dstStride, int dstX, @@ -576,18 +596,18 @@ fbBlt (pixman_bits_t *src, int height, int alu, - pixman_bits_t pm, + FbBits pm, int bpp, - int reverse, - int upsidedown); + Bool reverse, + Bool upsidedown); pixman_private void fbBlt24 (pixman_bits_t *srcLine, FbStride srcStride, int srcX, - pixman_bits_t *dstLine, + FbBits *dstLine, FbStride dstStride, int dstX, @@ -595,25 +615,25 @@ fbBlt24 (pixman_bits_t *srcLine, int height, int alu, - pixman_bits_t pm, + FbBits pm, - int reverse, - int upsidedown); + Bool reverse, + Bool upsidedown); pixman_private void fbBltStip (FbStip *src, - FbStride srcStride, /* in FbStip units, not pixman_bits_t units */ + FbStride srcStride, /* in FbStip units, not FbBits units */ int srcX, FbStip *dst, - FbStride dstStride, /* in FbStip units, not pixman_bits_t units */ + FbStride dstStride, /* in FbStip units, not FbBits units */ int dstX, int width, int height, int alu, - pixman_bits_t pm, + FbBits pm, int bpp); /* @@ -623,7 +643,7 @@ pixman_private void fbBltOne (FbStip *src, FbStride srcStride, int srcX, - pixman_bits_t *dst, + FbBits *dst, FbStride dstStride, int dstX, int dstBpp, @@ -631,28 +651,28 @@ fbBltOne (FbStip *src, int width, int height, - pixman_bits_t fgand, - pixman_bits_t icxor, - pixman_bits_t bgand, - pixman_bits_t bgxor); + FbBits fgand, + FbBits fbxor, + FbBits bgand, + FbBits bgxor); #ifdef FB_24BIT pixman_private void fbBltOne24 (FbStip *src, FbStride srcStride, /* FbStip units per scanline */ int srcX, /* bit position of source */ - pixman_bits_t *dst, - FbStride dstStride, /* pixman_bits_t units per scanline */ + FbBits *dst, + FbStride dstStride, /* FbBits units per scanline */ int dstX, /* bit position of dest */ int dstBpp, /* bits per destination unit */ int width, /* width in bits of destination */ int height, /* height in scanlines */ - pixman_bits_t fgand, /* rrop values */ - pixman_bits_t fgxor, - pixman_bits_t bgand, - pixman_bits_t bgxor); + FbBits fgand, /* rrop values */ + FbBits fgxor, + FbBits bgand, + FbBits bgxor); #endif /* @@ -678,10 +698,10 @@ fbEvenStipple (pixman_bits_t *dst, FbStride stipStride, int stipHeight, - pixman_bits_t fgand, - pixman_bits_t fgxor, - pixman_bits_t bgand, - pixman_bits_t bgxor, + FbBits fgand, + FbBits fgxor, + FbBits bgand, + FbBits bgxor, int xRot, int yRot); @@ -700,10 +720,10 @@ fbOddStipple (pixman_bits_t *dst, int stipWidth, int stipHeight, - pixman_bits_t fgand, - pixman_bits_t fgxor, - pixman_bits_t bgand, - pixman_bits_t bgxor, + FbBits fgand, + FbBits fgxor, + FbBits bgand, + FbBits bgxor, int xRot, int yRot); @@ -721,12 +741,12 @@ fbStipple (pixman_bits_t *dst, FbStride stipStride, int stipWidth, int stipHeight, - int even, + Bool even, - pixman_bits_t fgand, - pixman_bits_t fgxor, - pixman_bits_t bgand, - pixman_bits_t bgxor, + FbBits fgand, + FbBits fgxor, + FbBits bgand, + FbBits bgxor, int xRot, int yRot); diff --git a/pixman/src/icrop.h b/pixman/src/icrop.h index 7e8d1fdb2..8f17547e8 100644 --- a/pixman/src/icrop.h +++ b/pixman/src/icrop.h @@ -26,13 +26,13 @@ #define _ICROP_H_ typedef struct _mergeRopBits { - pixman_bits_t ca1, cx1, ca2, cx2; + FbBits ca1, cx1, ca2, cx2; } FbMergeRopRec, *FbMergeRopPtr; extern const FbMergeRopRec FbMergeRopBits[16] pixman_private; -#define FbDeclareMergeRop() pixman_bits_t _ca1, _cx1, _ca2, _cx2; -#define FbDeclarePrebuiltMergeRop() pixman_bits_t _cca, _ccx; +#define FbDeclareMergeRop() FbBits _ca1, _cx1, _ca2, _cx2; +#define FbDeclarePrebuiltMergeRop() FbBits _cca, _ccx; #define FbInitializeMergeRop(alu,pm) {\ const FbMergeRopRec *_bits; \ @@ -59,12 +59,12 @@ extern const FbMergeRopRec FbMergeRopBits[16] pixman_private; (((dst) & ((((src) & _ca1) ^ _cx1) | ~(mask))) ^ ((((src) & _ca2) ^ _cx2) & (mask))) #define FbDoLeftMaskByteMergeRop(dst, src, lb, l) { \ - pixman_bits_t __xor = ((src) & _ca2) ^ _cx2; \ + FbBits __xor = ((src) & _ca2) ^ _cx2; \ FbDoLeftMaskByteRRop(dst,lb,l,((src) & _ca1) ^ _cx1,__xor); \ } #define FbDoRightMaskByteMergeRop(dst, src, rb, r) { \ - pixman_bits_t __xor = ((src) & _ca2) ^ _cx2; \ + FbBits __xor = ((src) & _ca2) ^ _cx2; \ FbDoRightMaskByteRRop(dst,rb,r,((src) & _ca1) ^ _cx1,__xor); \ } @@ -85,9 +85,9 @@ extern const FbMergeRopRec FbMergeRopBits[16] pixman_private; (~(fg) & fbFillFromBit((rop>>2) ^ (rop>>3),t))) | \ ~(pm)) -#define fbXor(rop,fg,pm) fbXorT(rop,fg,pm,pixman_bits_t) +#define fbXor(rop,fg,pm) fbXorT(rop,fg,pm,FbBits) -#define fbAnd(rop,fg,pm) fbAndT(rop,fg,pm,pixman_bits_t) +#define fbAnd(rop,fg,pm) fbAndT(rop,fg,pm,FbBits) #define fbXorStip(rop,fg,pm) fbXorT(rop,fg,pm,FbStip) @@ -112,12 +112,12 @@ fbStippleTable(int bits); (FbDoMaskRRop(dst, fa, fx, m) & (b)) | (FbDoMaskRRop(dst, ba, bx, m) & ~(b)) #define FbDoLeftMaskByteStippleRRop(dst, b, fa, fx, ba, bx, lb, l) { \ - pixman_bits_t __xor = ((fx) & (b)) | ((bx) & ~(b)); \ + FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \ FbDoLeftMaskByteRRop(dst, lb, l, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ } #define FbDoRightMaskByteStippleRRop(dst, b, fa, fx, ba, bx, rb, r) { \ - pixman_bits_t __xor = ((fx) & (b)) | ((bx) & ~(b)); \ + FbBits __xor = ((fx) & (b)) | ((bx) & ~(b)); \ FbDoRightMaskByteRRop(dst, rb, r, ((fa) & (b)) | ((ba) & ~(b)), __xor); \ } diff --git a/pixman/src/icutil.c b/pixman/src/icutil.c index 73d14a5e4..f6119df7b 100644 --- a/pixman/src/icutil.c +++ b/pixman/src/icutil.c @@ -62,7 +62,7 @@ const FbMergeRopRec FbMergeRopBits[16] = { /* * Stipple masks are independent of bit/byte order as long - * as bitorder == byteorder. IC doesn't handle the case + * as bitorder == byteorder. FB doesn't handle the case * where these differ */ #define BitsMask(x,w) ((FB_ALLONES << ((x) & FB_MASK)) & \ diff --git a/pixman/src/pixman-xserver-compat.h b/pixman/src/pixman-xserver-compat.h index 9d012a139..352387683 100644 --- a/pixman/src/pixman-xserver-compat.h +++ b/pixman/src/pixman-xserver-compat.h @@ -48,7 +48,7 @@ /* Then, define any names that the server code will be expecting in * terms of libpixman names. */ - +/* typedef uint8_t CARD8; typedef uint16_t CARD16; typedef int16_t INT16; @@ -66,7 +66,7 @@ typedef pixman_point_fixed_t xPointFixed; typedef pixman_line_fixed_t xLineFixed; typedef pixman_trapezoid_t xTrapezoid; typedef pixman_triangle_t xTriangle; - +*/ #define RENDER 1 /* #define FB_SHIFT IC_SHIFT -- cgit v1.2.3 From 3b0c3d0ee84f991347df12249f944c780dde99f8 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 25 Jun 2005 23:24:19 +0000 Subject: Provide locking macros, implement with pthreads. Add _cairo_cache_shrink_to which reduces cache memory usage to a specified level. Change global glyph and xlib glyphset caches behaviour to only shrink cache on unlock. This is done by telling the cache code to never shrink (max_memory == 0), and then manually shrinking using _cairo_cache_shrink_to from the unlock function. Fix Carl's variable renaming mixing (cache = cache). reviewed by: cworth --- ChangeLog | 33 ++++++++++++++++++++++++++++++ configure.in | 8 ++++++++ src/cairo-cache.c | 24 ++++++++++++++-------- src/cairo-font.c | 28 ++++++++++++++++--------- src/cairo-ft-font.c | 6 ++++-- src/cairo-hash.c | 24 ++++++++++++++-------- src/cairo-xlib-surface.c | 53 +++++++++++++++--------------------------------- src/cairoint.h | 23 +++++++++++++++++++++ 8 files changed, 132 insertions(+), 67 deletions(-) diff --git a/ChangeLog b/ChangeLog index 550bc13e5..dbdaaff8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,35 @@ +2005-06-25 Keith Packard + + reviewed by: cworth + + * configure.in: + * src/cairo-cache.c: (_cairo_cache_shrink_to), + (_cairo_cache_lookup): + * src/cairo-font.c: (_lock_global_simple_cache), + (_unlock_global_simple_cache), (_lock_global_font_cache), + (_unlock_global_font_cache), + (_cairo_lock_global_image_glyph_cache), + (_cairo_unlock_global_image_glyph_cache), + (_cairo_get_global_image_glyph_cache): + * src/cairo-ft-font.c: (_lock_global_ft_cache), + (_unlock_global_ft_cache): + * src/cairo-xlib-surface.c: (_xlib_glyphset_cache_create_entry), + (_xlib_glyphset_cache_destroy_entry), (_lock_xlib_glyphset_caches), + (_unlock_xlib_glyphset_caches), (_get_glyphset_cache), + (_cairo_xlib_surface_show_glyphs): + * src/cairoint.h: + Provide locking macros, implement with pthreads. + + Add _cairo_cache_shrink_to which reduces cache memory usage + to a specified level. + + Change global glyph and xlib glyphset caches behaviour to only + shrink cache on unlock. This is done by telling the cache code to + never shrink (max_memory == 0), and then manually shrinking using + _cairo_cache_shrink_to from the unlock function. + + Fix Carl's variable renaming mixing (cache = cache). + 2005-06-24 Owen Taylor * src/cairo-ft-font.c (_transform_glyph_bitmap): Add mostly @@ -26,6 +58,7 @@ (_cairo_win32_surface_set_clip_region): * test/Makefile.am: +>>>>>>> 1.689 2005-06-24 Carl Worth * src/cairo-ft-font.c: (_cairo_ft_unscaled_font_create_glyph): diff --git a/configure.in b/configure.in index 413391c2f..8fca1e403 100644 --- a/configure.in +++ b/configure.in @@ -307,6 +307,14 @@ AC_SUBST(FT_FONT_FEATURE) dnl =========================================================================== +# +# The FreeType backend uses pthread locking when avaialble +# + +AC_CHECK_HEADERS([pthread.h]) + +dnl =========================================================================== + AC_ARG_ENABLE(pdf, [ --disable-pdf Disable cairo's PDF backend], [use_pdf=$enableval], [use_pdf=yes]) diff --git a/src/cairo-cache.c b/src/cairo-cache.c index e7547bc29..a0c202223 100644 --- a/src/cairo-cache.c +++ b/src/cairo-cache.c @@ -383,6 +383,19 @@ _cairo_cache_destroy (cairo_cache_t *cache) cache->backend->destroy_cache (cache); } +void +_cairo_cache_shrink_to (cairo_cache_t *cache, + unsigned long max_memory) +{ + unsigned long idx; + /* Make some entries die if we're under memory pressure. */ + while (cache->live_entries > 0 && cache->used_memory > max_memory) { + idx = _random_entry (cache, NULL) - cache->entries; + assert (idx < cache->arrangement->size); + _entry_destroy (cache, idx); + } +} + cairo_status_t _cairo_cache_lookup (cairo_cache_t *cache, void *key, @@ -390,7 +403,6 @@ _cairo_cache_lookup (cairo_cache_t *cache, int *created_entry) { - unsigned long idx; cairo_status_t status = CAIRO_STATUS_SUCCESS; cairo_cache_entry_base_t **slot = NULL, *new_entry; @@ -440,14 +452,8 @@ _cairo_cache_lookup (cairo_cache_t *cache, /* Store the hash value in case the backend forgot. */ new_entry->hashcode = cache->backend->hash (cache, key); - /* Make some entries die if we're under memory pressure. */ - while (cache->live_entries > 0 && - cache->max_memory > 0 && - ((cache->max_memory - cache->used_memory) < new_entry->memory)) { - idx = _random_entry (cache, NULL) - cache->entries; - assert (idx < cache->arrangement->size); - _entry_destroy (cache, idx); - } + if (cache->live_entries && cache->max_memory) + _cairo_cache_shrink_to (cache, cache->max_memory); /* Can't assert this; new_entry->memory may be larger than max_memory */ /* assert(cache->max_memory >= (cache->used_memory + new_entry->memory)); */ diff --git a/src/cairo-font.c b/src/cairo-font.c index 0aeb00b61..a241f9e80 100644 --- a/src/cairo-font.c +++ b/src/cairo-font.c @@ -183,16 +183,18 @@ typedef struct { static const cairo_cache_backend_t _cairo_simple_font_cache_backend; +CAIRO_MUTEX_DECLARE(_global_simple_cache_mutex); + static void _lock_global_simple_cache (void) { - /* FIXME: Perform locking here. */ + CAIRO_MUTEX_LOCK (_global_simple_cache_mutex); } static void _unlock_global_simple_cache (void) { - /* FIXME: Perform locking here. */ + CAIRO_MUTEX_UNLOCK (_global_simple_cache_mutex); } static cairo_cache_t * @@ -451,16 +453,18 @@ typedef struct { static const cairo_cache_backend_t _cairo_outer_font_cache_backend; static const cairo_cache_backend_t _cairo_inner_font_cache_backend; +CAIRO_MUTEX_DECLARE(_global_font_cache_mutex); + static void _lock_global_font_cache (void) { - /* FIXME: Perform locking here. */ + CAIRO_MUTEX_LOCK (_global_font_cache_mutex); } static void _unlock_global_font_cache (void) { - /* FIXME: Perform locking here. */ + CAIRO_MUTEX_UNLOCK (_global_font_cache_mutex); } static cairo_cache_t * @@ -1177,21 +1181,25 @@ static const cairo_cache_backend_t cairo_image_cache_backend = { _image_glyph_cache_destroy_cache }; +CAIRO_MUTEX_DECLARE(_global_image_glyph_cache_mutex); + +static cairo_cache_t * +_global_image_glyph_cache = NULL; + void _cairo_lock_global_image_glyph_cache() { - /* FIXME: implement locking. */ + CAIRO_MUTEX_LOCK (_global_image_glyph_cache_mutex); } void _cairo_unlock_global_image_glyph_cache() { - /* FIXME: implement locking. */ + _cairo_cache_shrink_to (_global_image_glyph_cache, + CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT); + CAIRO_MUTEX_UNLOCK (_global_image_glyph_cache_mutex); } -static cairo_cache_t * -_global_image_glyph_cache = NULL; - cairo_cache_t * _cairo_get_global_image_glyph_cache () { @@ -1203,7 +1211,7 @@ _cairo_get_global_image_glyph_cache () if (_cairo_cache_init (_global_image_glyph_cache, &cairo_image_cache_backend, - CAIRO_IMAGE_GLYPH_CACHE_MEMORY_DEFAULT)) + 0)) goto FAIL; } diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 7fbac1305..f1d418f75 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -274,16 +274,18 @@ static const cairo_cache_backend_t _ft_font_cache_backend = { static ft_cache_t *_global_ft_cache = NULL; +CAIRO_MUTEX_DECLARE(_global_ft_cache_mutex); + static void _lock_global_ft_cache (void) { - /* FIXME: Perform locking here. */ + CAIRO_MUTEX_LOCK(_global_ft_cache_mutex); } static void _unlock_global_ft_cache (void) { - /* FIXME: Perform locking here. */ + CAIRO_MUTEX_UNLOCK(_global_ft_cache_mutex); } static cairo_cache_t * diff --git a/src/cairo-hash.c b/src/cairo-hash.c index e7547bc29..a0c202223 100644 --- a/src/cairo-hash.c +++ b/src/cairo-hash.c @@ -383,6 +383,19 @@ _cairo_cache_destroy (cairo_cache_t *cache) cache->backend->destroy_cache (cache); } +void +_cairo_cache_shrink_to (cairo_cache_t *cache, + unsigned long max_memory) +{ + unsigned long idx; + /* Make some entries die if we're under memory pressure. */ + while (cache->live_entries > 0 && cache->used_memory > max_memory) { + idx = _random_entry (cache, NULL) - cache->entries; + assert (idx < cache->arrangement->size); + _entry_destroy (cache, idx); + } +} + cairo_status_t _cairo_cache_lookup (cairo_cache_t *cache, void *key, @@ -390,7 +403,6 @@ _cairo_cache_lookup (cairo_cache_t *cache, int *created_entry) { - unsigned long idx; cairo_status_t status = CAIRO_STATUS_SUCCESS; cairo_cache_entry_base_t **slot = NULL, *new_entry; @@ -440,14 +452,8 @@ _cairo_cache_lookup (cairo_cache_t *cache, /* Store the hash value in case the backend forgot. */ new_entry->hashcode = cache->backend->hash (cache, key); - /* Make some entries die if we're under memory pressure. */ - while (cache->live_entries > 0 && - cache->max_memory > 0 && - ((cache->max_memory - cache->used_memory) < new_entry->memory)) { - idx = _random_entry (cache, NULL) - cache->entries; - assert (idx < cache->arrangement->size); - _entry_destroy (cache, idx); - } + if (cache->live_entries && cache->max_memory) + _cairo_cache_shrink_to (cache, cache->max_memory); /* Can't assert this; new_entry->memory may be larger than max_memory */ /* assert(cache->max_memory >= (cache->used_memory + new_entry->memory)); */ diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 399527738..ec02a290d 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -1510,7 +1510,6 @@ typedef struct glyphset_cache { typedef struct { cairo_glyph_cache_key_t key; Glyph glyph; - int refcount; } glyphset_cache_entry_t; static Glyph @@ -1549,7 +1548,6 @@ _xlib_glyphset_cache_create_entry (void *abstract_cache, return CAIRO_STATUS_NO_MEMORY; } - entry->refcount = 1; entry->key = *key; _cairo_unscaled_font_reference (entry->key.unscaled); @@ -1610,12 +1608,6 @@ _xlib_glyphset_cache_create_entry (void *abstract_cache, return CAIRO_STATUS_SUCCESS; } -static void -_glyphset_cache_entry_reference (glyphset_cache_entry_t *entry) -{ - entry->refcount++; -} - static void _xlib_glyphset_cache_destroy_cache (void *cache) { @@ -1626,12 +1618,9 @@ static void _xlib_glyphset_cache_destroy_entry (void *abstract_cache, void *abstract_entry) { - glyphset_cache_t *cache = cache; + glyphset_cache_t *cache = abstract_cache; glyphset_cache_entry_t *entry = abstract_entry; - if (--entry->refcount > 0) - return; - _cairo_unscaled_font_destroy (entry->key.unscaled); XRenderFreeGlyphs (cache->display, cache->glyphset, &(entry->glyph), 1); free (entry); @@ -1645,6 +1634,7 @@ static const cairo_cache_backend_t _xlib_glyphset_cache_backend = { _xlib_glyphset_cache_destroy_cache }; +CAIRO_MUTEX_DECLARE(_xlib_glyphset_caches_mutex); static glyphset_cache_t * _xlib_glyphset_caches = NULL; @@ -1652,13 +1642,15 @@ _xlib_glyphset_caches = NULL; static void _lock_xlib_glyphset_caches (void) { - /* FIXME: implement locking */ + CAIRO_MUTEX_LOCK(_xlib_glyphset_caches_mutex); } static void -_unlock_xlib_glyphset_caches (void) +_unlock_xlib_glyphset_caches (glyphset_cache_t *cache) { - /* FIXME: implement locking */ + _cairo_cache_shrink_to (&cache->base, + CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT); + CAIRO_MUTEX_UNLOCK(_xlib_glyphset_caches_mutex); } static glyphset_cache_t * @@ -1680,20 +1672,19 @@ _get_glyphset_cache (Display *d) if (cache == NULL) goto ERR; - cache->counter = 0; - cache->display = d; - cache->a8_pict_format = XRenderFindStandardFormat (d, PictStandardA8); - if (cache->a8_pict_format == NULL) - goto ERR; - if (_cairo_cache_init (&cache->base, - &_xlib_glyphset_cache_backend, - CAIRO_XLIB_GLYPH_CACHE_MEMORY_DEFAULT)) + &_xlib_glyphset_cache_backend, 0)) goto FREE_GLYPHSET_CACHE; - + + cache->display = d; + cache->counter = 0; + + cache->a8_pict_format = XRenderFindStandardFormat (d, PictStandardA8); cache->glyphset = XRenderCreateGlyphSet (d, cache->a8_pict_format); + cache->next = _xlib_glyphset_caches; _xlib_glyphset_caches = cache; + return cache; FREE_GLYPHSET_CACHE: @@ -2010,15 +2001,6 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, if (status != CAIRO_STATUS_SUCCESS || entries[i] == NULL) goto UNLOCK; - /* Referencing the glyph entries we use prevents them from - * being freed if lookup of later entries causes them to - * be ejected from the cache. It would be more efficient - * (though more complex) to prevent them from being ejected - * from the cache at all, so they could get reused later - * in the same string. - */ - _glyphset_cache_entry_reference (entries[i]); - if (elt_size == 8 && entries[i]->glyph > 0xff) elt_size = 16; if (elt_size == 16 && entries[i]->glyph > 0xffff) { @@ -2052,11 +2034,8 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, glyphs, entries, num_glyphs); } - for (i = 0; i < num_glyphs; ++i) - _xlib_glyphset_cache_destroy_entry (cache, entries[i]); - UNLOCK: - _unlock_xlib_glyphset_caches (); + _unlock_xlib_glyphset_caches (cache); if (num_glyphs >= N_STACK_BUF) free (entries); diff --git a/src/cairoint.h b/src/cairoint.h index 1b21228d7..0b394bf28 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -55,6 +55,10 @@ #include #include +#if HAVE_PTHREAD_H +#include +#endif + #ifdef _MSC_VER #define _USE_MATH_DEFINES #endif @@ -116,6 +120,21 @@ #define __attribute__(x) #endif +#if HAVE_PTHREAD_H +#define CAIRO_MUTEX_DECLARE(name) static pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER +#define CAIRO_MUTEX_DECLARE_GLOBAL(name) pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER +#define CAIRO_MUTEX_LOCK(name) pthread_mutex_lock (&name) +#define CAIRO_MUTEX_UNLOCK(name) pthread_mutex_unlock (&name) +#endif + +#ifndef CAIRO_MUTEX_DECLARE +#warning "No mutex declarations, assuming single-threaded code" +#define CAIRO_MUTEX_DECLARE(name) +#define CAIRO_MUTEX_DECLARE_GLOBAL(name) +#define CAIRO_MUTEX_LOCK(name) +#define CAIRO_MUTEX_UNLOCK(name) +#endif + #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) @@ -382,6 +401,10 @@ _cairo_cache_reference (cairo_cache_t *cache); cairo_private void _cairo_cache_destroy (cairo_cache_t *cache); +cairo_private void +_cairo_cache_shrink_to (cairo_cache_t *cache, + unsigned long max_memory); + cairo_private cairo_status_t _cairo_cache_lookup (cairo_cache_t *cache, void *key, -- cgit v1.2.3 From f3b7d3dfd8d2bec03969bc5a52fb41473b88c747 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 28 Jun 2005 05:02:27 +0000 Subject: Fix stray commit marker --- ChangeLog | 1 - 1 file changed, 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dbdaaff8f..8472c04c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -58,7 +58,6 @@ (_cairo_win32_surface_set_clip_region): * test/Makefile.am: ->>>>>>> 1.689 2005-06-24 Carl Worth * src/cairo-ft-font.c: (_cairo_ft_unscaled_font_create_glyph): -- cgit v1.2.3 From e0982300cad9cf9873c28f69e025dd9a278934f0 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 28 Jun 2005 11:52:42 +0000 Subject: Prevent crash on empty string. --- ChangeLog | 5 +++++ src/cairo-atsui-font.c | 17 ++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8472c04c7..eee3c31a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-06-28 T Rowley + + * src/cairo-atsui-font.c (_cairo_atsui_font_text_to_glyphs): + Prevent crash on empty string. + 2005-06-25 Keith Packard reviewed by: cworth diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index 06b4ecb7d..bcb079150 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -252,29 +252,32 @@ _cairo_atsui_font_text_to_glyphs(void *abstract_font, ItemCount glyphCount, charCount; UniChar *theText; - err = ATSUCreateTextLayout(&textLayout); - -#if 1 + // liberal estimate of size charCount = strlen(utf8); + if (charCount == 0) { + *glyphs = NULL; + *num_glyphs = 0; + return CAIRO_STATUS_SUCCESS; + } + // Set the text in the text layout object, so we can measure it theText = (UniChar *) malloc(charCount * sizeof(UniChar)); +#if 1 for (i = 0; i < charCount; i++) { theText[i] = utf8[i]; } #endif #if 0 - // Set the text in the text layout object, so we can measure it - charCount = strlen(utf8); - theText = (UniChar *) malloc(charCount * sizeof(UniChar)); - size_t inBytes = charCount, outBytes = charCount; iconv_t converter = iconv_open("UTF-8", "UTF-16"); charCount = iconv(converter, utf8, &inBytes, theText, &outBytes); #endif + err = ATSUCreateTextLayout(&textLayout); + err = ATSUSetTextPointerLocation(textLayout, theText, 0, charCount, charCount); -- cgit v1.2.3 From 6d65ee6fc40ed1dcf7cc2f50413afc207520b299 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Tue, 28 Jun 2005 13:28:53 +0000 Subject: Also flag older XFree86 servers as buggy-repeat. --- ChangeLog | 5 +++++ src/cairo-xlib-surface.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index eee3c31a4..057bef7ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-06-28 Owen Taylor + + * src/cairo-xlib-surface.c (_cairo_xlib_surface_create_internal): Also + flag older XFree86 servers as buggy-repeat. + 2005-06-28 T Rowley * src/cairo-atsui-font.c (_cairo_atsui_font_text_to_glyphs): diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index ec02a290d..f10dcfc57 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -1355,6 +1355,9 @@ _cairo_xlib_surface_create_internal (Display *dpy, if (strcmp (ServerVendor (dpy), "The X.Org Foundation") == 0) { if (VendorRelease (dpy) <= 60802000) surface->buggy_repeat = TRUE; + } else if (strcmp (ServerVendor (dpy), "The XFree86 Project, Inc") == 0) { + if (VendorRelease (dpy) <= 40400000) + surface->buggy_repeat = TRUE; } surface->dst_picture = None; -- cgit v1.2.3 From e7442a4523603642c4805058140a7ad23fc0489d Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 28 Jun 2005 15:03:53 +0000 Subject: Implement. reviewed by: otaylor --- ChangeLog | 7 +++ src/cairo-win32-font.c | 133 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 135 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 057bef7ca..321d422e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-06-28 T Rowley + + reviewed by: otaylor + + * src/cairo-win32-font.c (_cairo_win32_scaled_font_glyph_path): + Implement. + 2005-06-28 Owen Taylor * src/cairo-xlib-surface.c (_cairo_xlib_surface_create_internal): Also diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c index eef2b4e72..385297ee2 100644 --- a/src/cairo-win32-font.c +++ b/src/cairo-win32-font.c @@ -1101,13 +1101,136 @@ _cairo_win32_scaled_font_show_glyphs (void *abstract_font, } } +static cairo_fixed_t +_cairo_fixed_from_FIXED (FIXED f) +{ + return *((cairo_fixed_t *)&f); +} + static cairo_status_t -_cairo_win32_scaled_font_glyph_path (void *abstract_font, - cairo_glyph_t *glyphs, - int num_glyphs, - cairo_path_fixed_t *path) +_cairo_win32_scaled_font_glyph_path (void *abstract_font, + cairo_glyph_t *glyphs, + int num_glyphs, + cairo_path_fixed_t *path) { - return CAIRO_STATUS_SUCCESS; + static const MAT2 matrix = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, -1 } }; + cairo_win32_scaled_font_t *scaled_font = abstract_font; + cairo_status_t status; + GLYPHMETRICS metrics; + HDC hdc; + int i; + + hdc = _get_global_font_dc (); + if (!hdc) + return CAIRO_STATUS_NO_MEMORY; + + status = cairo_win32_scaled_font_select_font (&scaled_font->base, hdc); + if (status) + return status; + + for (i = 0; i < num_glyphs; i++) + { + DWORD bytesGlyph; + unsigned char *buffer, *ptr; + + cairo_fixed_t x = _cairo_fixed_from_double (glyphs[i].x); + cairo_fixed_t y = _cairo_fixed_from_double (glyphs[i].y); + + bytesGlyph = GetGlyphOutlineW (hdc, glyphs[i].index, + GGO_NATIVE | GGO_GLYPH_INDEX, + &metrics, 0, NULL, &matrix); + + if (bytesGlyph == GDI_ERROR) { + status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_glyph_path"); + goto FAIL; + } + + ptr = buffer = malloc (bytesGlyph); + + if (!buffer) { + status = CAIRO_STATUS_NO_MEMORY; + goto FAIL; + } + + if (GetGlyphOutlineW (hdc, glyphs[i].index, + GGO_NATIVE | GGO_GLYPH_INDEX, + &metrics, bytesGlyph, buffer, &matrix) == GDI_ERROR) { + status = _cairo_win32_print_gdi_error ("_cairo_win32_scaled_font_glyph_path"); + free (buffer); + goto FAIL; + } + + while (ptr < buffer + bytesGlyph) { + TTPOLYGONHEADER *header = (TTPOLYGONHEADER *)ptr; + unsigned char *endPoly = ptr + header->cb; + + ptr += sizeof (TTPOLYGONHEADER); + + _cairo_path_fixed_move_to (path, + _cairo_fixed_from_FIXED (header->pfxStart.x) + x, + _cairo_fixed_from_FIXED (header->pfxStart.y) + y); + + while (ptr < endPoly) { + TTPOLYCURVE *curve = (TTPOLYCURVE *)ptr; + POINTFX *points = curve->apfx; + int i; + switch (curve->wType) { + case TT_PRIM_LINE: + for (i = 0; i < curve->cpfx; i++) { + _cairo_path_fixed_line_to (path, + _cairo_fixed_from_FIXED (points[i].x) + x, + _cairo_fixed_from_FIXED (points[i].y) + y); + } + break; + case TT_PRIM_QSPLINE: + for (i = 0; i < curve->cpfx - 1; i++) { + cairo_fixed_t p1x, p1y, p2x, p2y, cx, cy, c1x, c1y, c2x, c2y; + _cairo_path_fixed_get_current_point (path, &p1x, &p1y); + cx = _cairo_fixed_from_FIXED (points[i].x) + x; + cy = _cairo_fixed_from_FIXED (points[i].y) + y; + + if (i + 1 == curve->cpfx - 1) { + p2x = _cairo_fixed_from_FIXED (points[i + 1].x) + x; + p2y = _cairo_fixed_from_FIXED (points[i + 1].y) + y; + } else { + /* records with more than one curve use interpolation for + control points, per http://support.microsoft.com/kb/q87115/ */ + p2x = (cx + _cairo_fixed_from_FIXED (points[i + 1].x) + x) / 2; + p2y = (cy + _cairo_fixed_from_FIXED (points[i + 1].y) + y) / 2; + } + + c1x = 2 * cx / 3 + p1x / 3; + c1y = 2 * cy / 3 + p1y / 3; + c2x = 2 * cx / 3 + p2x / 3; + c2y = 2 * cy / 3 + p2y / 3; + + _cairo_path_fixed_curve_to (path, c1x, c1y, c2x, c2y, p2x, p2y); + } + break; + case TT_PRIM_CSPLINE: + for (i = 0; i < curve->cpfx - 2; i += 2) { + _cairo_path_fixed_curve_to (path, + _cairo_fixed_from_FIXED (points[i].x) + x, + _cairo_fixed_from_FIXED (points[i].y) + y, + _cairo_fixed_from_FIXED (points[i + 1].x) + x, + _cairo_fixed_from_FIXED (points[i + 1].y) + y, + _cairo_fixed_from_FIXED (points[i + 2].x) + x, + _cairo_fixed_from_FIXED (points[i + 2].y) + y); + } + break; + } + ptr += sizeof(TTPOLYCURVE) + sizeof (POINTFX) * (curve->cpfx - 1); + } + _cairo_path_fixed_close_path (path); + } + free(buffer); + } + +FAIL: + + cairo_win32_scaled_font_done_font (&scaled_font->base); + + return status; } const cairo_scaled_font_backend_t cairo_win32_scaled_font_backend = { -- cgit v1.2.3 From 5ab8a3085ee4c5cab7d07d233530d74c2d978d94 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 28 Jun 2005 15:58:42 +0000 Subject: New functions to create a cairo_pattern_t corresponding to a solid color and a translucent color respectively. Document a few pattern functions. --- ChangeLog | 7 +++ src/cairo-pattern.c | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/cairo.c | 37 +++---------- src/cairo.h | 8 +++ 4 files changed, 171 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 321d422e4..cc76e855e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-06-28 Kristian Høgsberg + + * src/cairo-pattern.c (cairo_pattern_create_rgb) + (cairo_pattern_create_rgba): New functions to create a + cairo_pattern_t corresponding to a solid color and a translucent + color respectively. Document a few pattern functions. + 2005-06-28 T Rowley reviewed by: otaylor diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index cd099fdd2..270d5c7ae 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -294,6 +294,92 @@ _cairo_pattern_create_in_error (cairo_status_t status) return &pattern->base; } +/** + * cairo_pattern_create_rgb: + * @red: red component of the color + * @green: green component of the color + * @blue: blue component of the color + * + * Create a new cairo_pattern_t corresponding to a opaque color. The + * color components are floating point numbers in the range 0 to 1. + * If the values passed in are outside that range, they will be + * clamped. + * + * Return value: the newly created #cairo_pattern_t if succesful, or + * an error pattern in case of no memory. The caller owns the + * returned object and should call cairo_pattern_destroy() when + * finished with it. + * + * This function will always return a valid pointer, but if an error + * occurred the pattern status will be set to an error. To inspect + * the status of a pattern use cairo_pattern_status(). + **/ +cairo_pattern_t * +cairo_pattern_create_rgb (double red, double green, double blue) +{ + cairo_color_t color; + + _cairo_restrict_value (&red, 0.0, 1.0); + _cairo_restrict_value (&green, 0.0, 1.0); + _cairo_restrict_value (&blue, 0.0, 1.0); + + _cairo_color_init_rgb (&color, red, green, blue); + + return _cairo_pattern_create_solid (&color); +} + +/** + * cairo_pattern_create_rgba: + * @red: red component of the color + * @green: green component of the color + * @blue: blue component of the color + * @alpha: alpha component of the color + * + * Create a new cairo_pattern_t corresponding to a translucent color. + * The color components are floating point numbers in the range 0 to + * 1. If the values passed in are outside that range, they will be + * clamped. + * + * Return value: the newly created #cairo_pattern_t if succesful, or + * an error pattern in case of no memory. The caller owns the + * returned object and should call cairo_pattern_destroy() when + * finished with it. + * + * This function will always return a valid pointer, but if an error + * occurred the pattern status will be set to an error. To inspect + * the status of a pattern use cairo_pattern_status(). + **/ +cairo_pattern_t * +cairo_pattern_create_rgba (double red, double green, double blue, + double alpha) +{ + cairo_color_t color; + + _cairo_restrict_value (&red, 0.0, 1.0); + _cairo_restrict_value (&green, 0.0, 1.0); + _cairo_restrict_value (&blue, 0.0, 1.0); + _cairo_restrict_value (&alpha, 0.0, 1.0); + + _cairo_color_init_rgba (&color, red, green, blue, alpha); + + return _cairo_pattern_create_solid (&color); +} + +/** + * cairo_pattern_create_for_surface: + * @surface: the surface + * + * Create a new cairo_pattern_t for the given surface. + * + * Return value: the newly created #cairo_pattern_t if succesful, or + * an error pattern in case of no memory. The caller owns the + * returned object and should call cairo_pattern_destroy() when + * finished with it. + * + * This function will always return a valid pointer, but if an error + * occurred the pattern status will be set to an error. To inspect + * the status of a pattern use cairo_pattern_status(). + **/ cairo_pattern_t * cairo_pattern_create_for_surface (cairo_surface_t *surface) { @@ -308,6 +394,28 @@ cairo_pattern_create_for_surface (cairo_surface_t *surface) return &pattern->base; } +/** + * cairo_pattern_create_linear: + * @x0: x coordinate of the start point + * @y0: y coordinate of the start point + * @x1: x coordinate of the end point + * @y1: y coordinate of the end point + * + * Create a new linear gradient cairo_pattern_t along the line defined + * by (x0, y0) and (x1, y1). Before using the gradient pattern, a + * number of color stops should be defined using + * cairo_pattern_add_color_stop_rgb() or + * cairo_pattern_add_color_stop_rgba(). + * + * Return value: the newly created #cairo_pattern_t if succesful, or + * an error pattern in case of no memory. The caller owns the + * returned object and should call cairo_pattern_destroy() when + * finished with it. + * + * This function will always return a valid pointer, but if an error + * occurred the pattern status will be set to an error. To inspect + * the status of a pattern use cairo_pattern_status(). + **/ cairo_pattern_t * cairo_pattern_create_linear (double x0, double y0, double x1, double y1) { @@ -322,6 +430,30 @@ cairo_pattern_create_linear (double x0, double y0, double x1, double y1) return &pattern->base.base; } +/** + * cairo_pattern_create_radial: + * @cx0: x coordinate for the center of the start circle + * @cy0: y coordinate for the center of the start circle + * @radius0: radius of the start cirle + * @cx1: x coordinate for the center of the end circle + * @cy1: y coordinate for the center of the end circle + * @radius1: radius of the end cirle + * + * Create a new radial gradient cairo_pattern_t between the two + * circles defined by (x0, y0, c0) and (x1, y1, c0). Before using the + * gradient pattern, a number of color stops should be defined using + * cairo_pattern_add_color_stop_rgb() or + * cairo_pattern_add_color_stop_rgba(). + * + * Return value: the newly created #cairo_pattern_t if succesful, or + * an error pattern in case of no memory. The caller owns the + * returned object and should call cairo_pattern_destroy() when + * finished with it. + * + * This function will always return a valid pointer, but if an error + * occurred the pattern status will be set to an error. To inspect + * the status of a pattern use cairo_pattern_status(). + **/ cairo_pattern_t * cairo_pattern_create_radial (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1) @@ -337,6 +469,14 @@ cairo_pattern_create_radial (double cx0, double cy0, double radius0, return &pattern->base.base; } +/** + * cairo_pattern_reference: + * @pattern: a #cairo_pattern_t + * + * Increases the reference count on @pattern by one. This prevents + * @pattern from being destroyed until a matching call to + * cairo_pattern_destroy() is made. + **/ void cairo_pattern_reference (cairo_pattern_t *pattern) { @@ -364,6 +504,14 @@ cairo_pattern_status (cairo_pattern_t *pattern) return pattern->status; } +/** + * cairo_pattern_destroy: + * @pattern: a #cairo_pattern_t + * + * Decreases the reference count on @pattern by one. If the result is + * zero, then @pattern and all associated resources are freed. See + * cairo_pattern_reference(). + **/ void cairo_pattern_destroy (cairo_pattern_t *pattern) { diff --git a/src/cairo.c b/src/cairo.c index 76e4bf4ba..470b7305f 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -320,18 +320,6 @@ cairo_set_operator (cairo_t *cr, cairo_operator_t op) _cairo_error (cr, cr->status); } -static void -_cairo_set_source_solid (cairo_t *cr, const cairo_color_t *color) -{ - cairo_pattern_t *source; - - source = _cairo_pattern_create_solid (color); - - cairo_set_source (cr, source); - - cairo_pattern_destroy (source); -} - /** * cairo_set_source_rgb * @cr: a cairo context @@ -350,20 +338,16 @@ _cairo_set_source_solid (cairo_t *cr, const cairo_color_t *color) void cairo_set_source_rgb (cairo_t *cr, double red, double green, double blue) { - cairo_color_t color; + cairo_pattern_t *pattern; if (cr->status) { _cairo_error (cr, cr->status); return; } - _cairo_restrict_value (&red, 0.0, 1.0); - _cairo_restrict_value (&green, 0.0, 1.0); - _cairo_restrict_value (&blue, 0.0, 1.0); - - _cairo_color_init_rgb (&color, red, green, blue); - - _cairo_set_source_solid (cr, &color); + pattern = cairo_pattern_create_rgb (red, green, blue); + cairo_set_source (cr, pattern); + cairo_pattern_destroy (pattern); } /** @@ -387,21 +371,16 @@ cairo_set_source_rgba (cairo_t *cr, double red, double green, double blue, double alpha) { - cairo_color_t color; + cairo_pattern_t *pattern; if (cr->status) { _cairo_error (cr, cr->status); return; } - _cairo_restrict_value (&red, 0.0, 1.0); - _cairo_restrict_value (&green, 0.0, 1.0); - _cairo_restrict_value (&blue, 0.0, 1.0); - _cairo_restrict_value (&alpha, 0.0, 1.0); - - _cairo_color_init_rgba (&color, red, green, blue, alpha); - - _cairo_set_source_solid (cr, &color); + pattern = cairo_pattern_create_rgba (red, green, blue, alpha); + cairo_set_source (cr, pattern); + cairo_pattern_destroy (pattern); } /** diff --git a/src/cairo.h b/src/cairo.h index 0fcd85602..fc02c373b 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -992,6 +992,14 @@ cairo_image_surface_create_from_png_stream (cairo_read_func_t read_func, #endif /* Pattern creation functions */ + +cairo_pattern_t * +cairo_pattern_create_rgb (double red, double green, double blue); + +cairo_pattern_t * +cairo_pattern_create_rgba (double red, double green, double blue, + double alpha); + cairo_pattern_t * cairo_pattern_create_for_surface (cairo_surface_t *surface); -- cgit v1.2.3 From 82f244eca84b37886bd0b118dc44ec04342d7a26 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 29 Jun 2005 07:04:34 +0000 Subject: Rework the cache code as a hast table with a much simpler interface, (no object derviation is required to use it). Remove extraneous prototype for non-existent _cairo_cache_reference. --- ChangeLog | 14 ++ src/cairo-hash-private.h | 85 +++++++ src/cairo-hash.c | 643 ++++++++++++++++++++--------------------------- src/cairoint.h | 3 - 4 files changed, 374 insertions(+), 371 deletions(-) create mode 100644 src/cairo-hash-private.h diff --git a/ChangeLog b/ChangeLog index cc76e855e..ed3745f94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-06-29 Carl Worth + + * src/cairo-hash-private.h: + * src/cairo-hash.c: (_cairo_hash_table_create), + (_cairo_hash_table_destroy_entry), (_cairo_hash_table_destroy), + (_cairo_hash_table_lookup_internal), (_cairo_hash_table_resize), + (_cairo_hash_table_lookup), (_cairo_hash_table_insert), + (_cairo_hash_table_remove), (_cairo_hash_table_foreach): Rework + the cache code as a hast table with a much simpler interface, (no + object derviation is required to use it). + + * src/cairoint.h: Remove extraneous prototype for non-existent + _cairo_cache_reference. + 2005-06-28 Kristian Høgsberg * src/cairo-pattern.c (cairo_pattern_create_rgb) diff --git a/src/cairo-hash-private.h b/src/cairo-hash-private.h new file mode 100644 index 000000000..9ee27df43 --- /dev/null +++ b/src/cairo-hash-private.h @@ -0,0 +1,85 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2004 Red Hat, Inc. + * Copyright © 2005 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Red Hat, Inc. + * + * Contributor(s): + * Keith Packard + * Graydon Hoare + * Carl Worth + */ + +#ifndef CAIRO_HASH_PRIVATE_H +#define CAIRO_HASH_PRIVATE_H + +#include "cairoint.h" + +typedef struct _cairo_hash_table cairo_hash_table_t; + +typedef unsigned long +(*cairo_compute_hash_func_t) (void *key); + +typedef cairo_bool_t +(*cairo_keys_equal_func_t) (void *key_a, void *key_b); + +typedef void +(*cairo_hash_callback_func_t) (void *key, + void *value, + void *closure); + +cairo_private cairo_hash_table_t * +_cairo_hash_table_create (cairo_compute_hash_func_t compute_hash, + cairo_keys_equal_func_t keys_equal, + cairo_destroy_func_t key_destroy, + cairo_destroy_func_t value_destroy); + +cairo_private void +_cairo_hash_table_destroy (cairo_hash_table_t *hash_table); + +cairo_private cairo_bool_t +_cairo_hash_table_lookup (cairo_hash_table_t *hash_table, + void *key, + void **value_return); + +cairo_private cairo_status_t +_cairo_hash_table_insert (cairo_hash_table_t *hash_table, + void *key, + void *value); + +cairo_private void +_cairo_hash_table_remove (cairo_hash_table_t *hash_table, + void *key); + +cairo_private void +_cairo_hash_table_foreach (cairo_hash_table_t *hash_table, + cairo_hash_callback_func_t hash_callback, + void *closure); + +#endif diff --git a/src/cairo-hash.c b/src/cairo-hash.c index a0c202223..113efa292 100644 --- a/src/cairo-hash.c +++ b/src/cairo-hash.c @@ -1,6 +1,7 @@ /* cairo - a vector graphics library with display and print output * - * This file is Copyright © 2004 Red Hat, Inc. + * Copyright © 2004 Red Hat, Inc. + * Copyright © 2005 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it either under the terms of the GNU Lesser General Public @@ -30,11 +31,52 @@ * The Initial Developer of the Original Code is Red Hat, Inc. * * Contributor(s): - * Keith Packard + * Keith Packard * Graydon Hoare + * Carl Worth */ -#include "cairoint.h" +#include "cairo-hash-private.h" + +/* + * An entry can be in one of three states: + * + * FREE: Entry has never been used, terminates all searches. + * + * LIVE: Entry is currently being used. + * + * DEAD: Entry had been live in the past. A dead entry can be reused + * but does not terminate a search for an exact entry. + * + * We expect keys will not be destroyed frequently, so our table does not + * contain any explicit shrinking code nor any chain-coalescing code for + * entries randomly deleted by memory pressure (except during rehashing, of + * course). These assumptions are potentially bad, but they make the + * implementation straightforward. + * + * Revisit later if evidence appears that we're using excessive memory from + * a mostly-dead table. + * + * This table is open-addressed with double hashing. Each table size is a + * prime chosen to be a little more than double the high water mark for a + * given arrangement, so the tables should remain < 50% full. The table + * size makes for the "first" hash modulus; a second prime (2 less than the + * first prime) serves as the "second" hash modulus, which is co-prime and + * thus guarantees a complete permutation of table indices. + */ + +typedef enum { + CAIRO_HASH_ENTRY_STATE_FREE = 0, + CAIRO_HASH_ENTRY_STATE_LIVE = 1, + CAIRO_HASH_ENTRY_STATE_DEAD = 2 +} cairo_hash_entry_state_t; + +typedef struct { + cairo_hash_entry_state_t state; + unsigned long hash_code; + void *key; + void *value; +} cairo_hash_entry_t; /* * This structure, and accompanying table, is borrowed/modified from the @@ -43,7 +85,13 @@ * Packard. */ -static const cairo_cache_arrangement_t cache_arrangements [] = { +typedef struct _cairo_hash_table_arrangement { + unsigned long high_water_mark; + unsigned long size; + unsigned long rehash; +} cairo_hash_table_arrangement_t; + +static const cairo_hash_table_arrangement_t hash_table_arrangements [] = { { 16, 43, 41 }, { 32, 73, 71 }, { 64, 151, 149 }, @@ -71,140 +119,151 @@ static const cairo_cache_arrangement_t cache_arrangements [] = { { 268435456, 590559793, 590559791 } }; -#define N_CACHE_SIZES (sizeof(cache_arrangements)/sizeof(cache_arrangements[0])) +#define NUM_HASH_TABLE_ARRANGEMENTS (sizeof(hash_table_arrangements)/sizeof(hash_table_arrangements[0])) -/* - * Entries 'e' are poiners, in one of 3 states: - * - * e == NULL: The entry has never had anything put in it - * e != DEAD_ENTRY: The entry has an active value in it currently - * e == DEAD_ENTRY: The entry *had* a value in it at some point, but the - * entry has been killed. Lookups requesting free space can - * reuse these entries; lookups requesting a precise match - * should neither return these entries nor stop searching when - * seeing these entries. - * - * We expect keys will not be destroyed frequently, so our table does not - * contain any explicit shrinking code nor any chain-coalescing code for - * entries randomly deleted by memory pressure (except during rehashing, of - * course). These assumptions are potentially bad, but they make the - * implementation straightforward. - * - * Revisit later if evidence appears that we're using excessive memory from - * a mostly-dead table. - * - * Generally you do not need to worry about freeing cache entries; the - * cache will expire entries randomly as it experiences memory pressure. - * If max_memory is set, entries are not expired, and must be explicitely - * removed. - * - * This table is open-addressed with double hashing. Each table size is a - * prime chosen to be a little more than double the high water mark for a - * given arrangement, so the tables should remain < 50% full. The table - * size makes for the "first" hash modulus; a second prime (2 less than the - * first prime) serves as the "second" hash modulus, which is co-prime and - * thus guarantees a complete permutation of table indices. - * - */ +struct _cairo_hash_table { + cairo_compute_hash_func_t compute_hash; + cairo_keys_equal_func_t keys_equal; + cairo_destroy_func_t key_destroy; + cairo_destroy_func_t value_destroy; -#define DEAD_ENTRY ((cairo_cache_entry_base_t *) 1) -#define NULL_ENTRY_P(cache, i) ((cache)->entries[i] == NULL) -#define DEAD_ENTRY_P(cache, i) ((cache)->entries[i] == DEAD_ENTRY) -#define LIVE_ENTRY_P(cache, i) \ - (!((NULL_ENTRY_P((cache),(i))) || (DEAD_ENTRY_P((cache),(i))))) - -#ifdef NDEBUG -#define _cache_sane_state(c) -#else -static void -_cache_sane_state (cairo_cache_t *cache) -{ - assert (cache != NULL); - assert (cache->entries != NULL); - assert (cache->backend != NULL); - assert (cache->arrangement != NULL); - /* Cannot check this, a single object may larger */ - /* assert (cache->used_memory <= cache->max_memory); */ - assert (cache->live_entries <= cache->arrangement->size); + const cairo_hash_table_arrangement_t *arrangement; + cairo_hash_entry_t *entries; + + unsigned long live_entries; +}; + +cairo_hash_table_t * +_cairo_hash_table_create (cairo_compute_hash_func_t compute_hash, + cairo_keys_equal_func_t keys_equal, + cairo_destroy_func_t key_destroy, + cairo_destroy_func_t value_destroy) +{ + cairo_hash_table_t *hash_table; + + hash_table = malloc (sizeof (cairo_hash_table_t)); + if (hash_table == NULL) + return NULL; + + hash_table->compute_hash = compute_hash; + hash_table->keys_equal = keys_equal; + hash_table->key_destroy = key_destroy; + hash_table->value_destroy = value_destroy; + + hash_table->arrangement = &hash_table_arrangements[0]; + + hash_table->live_entries = 0; + + hash_table->entries = calloc (hash_table->arrangement->size, + sizeof(cairo_hash_entry_t)); + + if (hash_table->entries == NULL) { + free (hash_table); + return NULL; + } + + return hash_table; } -#endif static void -_entry_destroy (cairo_cache_t *cache, unsigned long i) +_cairo_hash_table_destroy_entry (cairo_hash_table_t *hash_table, + cairo_hash_entry_t *entry) { - _cache_sane_state (cache); + if (entry->state != CAIRO_HASH_ENTRY_STATE_LIVE) + return; - if (LIVE_ENTRY_P(cache, i)) - { - cairo_cache_entry_base_t *entry = cache->entries[i]; - assert(cache->live_entries > 0); - assert(cache->used_memory >= entry->memory); - - cache->live_entries--; - cache->used_memory -= entry->memory; - cache->backend->destroy_entry (cache, entry); - cache->entries[i] = DEAD_ENTRY; - } + assert(hash_table->live_entries > 0); + + hash_table->live_entries--; + + if (hash_table->key_destroy) + hash_table->key_destroy (entry->key); + + if (hash_table->value_destroy) + hash_table->value_destroy (entry->value); + + entry->state = CAIRO_HASH_ENTRY_STATE_DEAD; } -static cairo_cache_entry_base_t ** -_cache_lookup (cairo_cache_t *cache, - void *key, - int (*predicate)(void*,void*,void*)) -{ +void +_cairo_hash_table_destroy (cairo_hash_table_t *hash_table) +{ + unsigned long i; + if (hash_table == NULL) + return; + + for (i = 0; i < hash_table->arrangement->size; i++) + _cairo_hash_table_destroy_entry (hash_table, + &hash_table->entries[i]); + + free (hash_table->entries); + hash_table->entries = NULL; - cairo_cache_entry_base_t **probe; - unsigned long hash; + free (hash_table); +} + +/** + * _cairo_hash_table_lookup_internal: + * + * @hash_table: a #cairo_hash_table_t to search + * @key: the key to search on + * @hash_code: the hash_code for @key + * @key_unique: If TRUE, then caller asserts that no key already + * exists that will compare equal to #key, so search can be + * optimized. If unsure, set to FALSE and the code will always work. + * + * Search the hashtable for a live entry for which + * hash_table->keys_equal returns true. If no such entry exists then + * return the first available (free or dead entry). + * + * If the key_unique flag is set, then the search will never call + * hash_table->keys_equal and will act as if it always returned + * false. This is useful as a performance optimization in special + * circumstances where the caller knows that there is no existing + * entry in the hash table with a matching key. + * + * Return value: The matching entry in the hash table (if + * any). Otherwise, the first available entry. The caller should check + * entry->state to check whether a match was found or not. + **/ +static cairo_hash_entry_t * +_cairo_hash_table_lookup_internal (cairo_hash_table_t *hash_table, + void *key, + unsigned long hash_code, + cairo_bool_t key_is_unique) +{ + cairo_hash_entry_t *entry, *first_available = NULL; unsigned long table_size, i, idx, step; - _cache_sane_state (cache); - assert (key != NULL); + table_size = hash_table->arrangement->size; - table_size = cache->arrangement->size; - hash = cache->backend->hash (cache, key); - idx = hash % table_size; + idx = hash_code % table_size; step = 0; for (i = 0; i < table_size; ++i) { -#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE - cache->probes++; -#endif - assert(idx < table_size); - probe = cache->entries + idx; - - /* - * There are two lookup modes: searching for a free slot and searching - * for an exact entry. - */ - - if (predicate != NULL) - { - /* We are looking up an exact entry. */ - if (*probe == NULL) - { - /* Found an empty spot, there can't be a match */ - break; - } - else if (*probe != DEAD_ENTRY - && (*probe)->hashcode == hash - && predicate (cache, key, *probe)) - { - return probe; - } - } - else - { - /* We are just looking for a free slot. */ - if (*probe == NULL - || *probe == DEAD_ENTRY) - { - return probe; + entry = &hash_table->entries[idx]; + + switch (entry->state) { + case CAIRO_HASH_ENTRY_STATE_FREE: + return entry; + case CAIRO_HASH_ENTRY_STATE_LIVE: + if (! key_is_unique) + if (hash_table->keys_equal (key, entry->key)) + return entry; + break; + case CAIRO_HASH_ENTRY_STATE_DEAD: + if (key_is_unique) { + return entry; + } else { + if (! first_available) + first_available = entry; } + break; } if (step == 0) { - step = hash % cache->arrangement->rehash; + step = hash_code % hash_table->arrangement->rehash; if (step == 0) step = 1; } @@ -218,302 +277,150 @@ _cache_lookup (cairo_cache_t *cache, * The table should not have permitted you to get here if you were just * looking for a free slot: there should have been room. */ - assert(predicate != NULL); - return NULL; -} - -static cairo_cache_entry_base_t ** -_find_available_entry_for (cairo_cache_t *cache, - void *key) -{ - return _cache_lookup (cache, key, NULL); -} + assert (key_is_unique == 0); -static cairo_cache_entry_base_t ** -_find_exact_live_entry_for (cairo_cache_t *cache, - void *key) -{ - return _cache_lookup (cache, key, cache->backend->keys_equal); -} - -static const cairo_cache_arrangement_t * -_find_cache_arrangement (unsigned long proposed_size) -{ - unsigned long idx; - - for (idx = 0; idx < N_CACHE_SIZES; ++idx) - if (cache_arrangements[idx].high_water_mark >= proposed_size) - return &cache_arrangements[idx]; - return NULL; + return first_available; } static cairo_status_t -_resize_cache (cairo_cache_t *cache, unsigned long proposed_size) +_cairo_hash_table_resize (cairo_hash_table_t *hash_table, + unsigned long proposed_size) { - cairo_cache_t tmp; - cairo_cache_entry_base_t **e; + cairo_hash_table_t tmp; + cairo_hash_entry_t *entry; unsigned long new_size, i; - tmp = *cache; - tmp.arrangement = _find_cache_arrangement (proposed_size); - assert(tmp.arrangement != NULL); - if (tmp.arrangement == cache->arrangement) + if (hash_table->arrangement->high_water_mark >= proposed_size) return CAIRO_STATUS_SUCCESS; + tmp = *hash_table; + + for (i = 0; i < NUM_HASH_TABLE_ARRANGEMENTS; i++) + if (hash_table_arrangements[i].high_water_mark >= proposed_size) { + tmp.arrangement = &hash_table_arrangements[i]; + break; + } + /* This code is being abused if we can't make a table big enough. */ + assert (i < NUM_HASH_TABLE_ARRANGEMENTS); + new_size = tmp.arrangement->size; - tmp.entries = calloc (new_size, sizeof (cairo_cache_entry_base_t *)); + tmp.entries = calloc (new_size, sizeof (cairo_hash_entry_t)); if (tmp.entries == NULL) return CAIRO_STATUS_NO_MEMORY; - for (i = 0; i < cache->arrangement->size; ++i) { - if (LIVE_ENTRY_P(cache, i)) { - e = _find_available_entry_for (&tmp, cache->entries[i]); - assert (e != NULL); - *e = cache->entries[i]; + for (i = 0; i < hash_table->arrangement->size; ++i) { + if (hash_table->entries[i].state == CAIRO_HASH_ENTRY_STATE_LIVE) { + entry = _cairo_hash_table_lookup_internal (&tmp, + hash_table->entries[i].key, + hash_table->entries[i].hash_code, + TRUE); + assert (entry->state == CAIRO_HASH_ENTRY_STATE_FREE); + *entry = hash_table->entries[i]; } } - free (cache->entries); - cache->entries = tmp.entries; - cache->arrangement = tmp.arrangement; + free (hash_table->entries); + hash_table->entries = tmp.entries; + hash_table->arrangement = tmp.arrangement; return CAIRO_STATUS_SUCCESS; } - -#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE -static double -_load_factor (cairo_cache_t *cache) +cairo_bool_t +_cairo_hash_table_lookup (cairo_hash_table_t *hash_table, + void *key, + void **value_return) { - return ((double) cache->live_entries) - / ((double) cache->arrangement->size); -} -#endif - -/* Find a random in the cache matching the given predicate. We use the - * same algorithm as the probing algorithm to walk over the entries in - * the hash table in a pseudo-random order. Walking linearly would - * favor entries following gaps in the hash table. We could also - * call rand() repeatedly, which works well for almost-full tables, - * but degrades when the table is almost empty, or predicate - * returns false for most entries. - */ -static cairo_cache_entry_base_t ** -_random_entry (cairo_cache_t *cache, - int (*predicate)(void*)) -{ - cairo_cache_entry_base_t **probe; - unsigned long hash; - unsigned long table_size, i, idx, step; - - _cache_sane_state (cache); + unsigned long hash_code; + cairo_hash_entry_t *entry; - table_size = cache->arrangement->size; - hash = rand (); - idx = hash % table_size; - step = 0; + hash_code = hash_table->compute_hash (key); - for (i = 0; i < table_size; ++i) - { - assert(idx < table_size); - probe = cache->entries + idx; - - if (LIVE_ENTRY_P(cache, idx) - && (!predicate || predicate (*probe))) - return probe; - - if (step == 0) { - step = hash % cache->arrangement->rehash; - if (step == 0) - step = 1; - } - - idx += step; - if (idx >= table_size) - idx -= table_size; + /* See if we have an entry in the table already. */ + entry = _cairo_hash_table_lookup_internal (hash_table, key, + hash_code, FALSE); + if (entry->state == CAIRO_HASH_ENTRY_STATE_LIVE) { + *value_return = entry->value; + return TRUE; } - return NULL; -} - -/* public API follows */ - -cairo_status_t -_cairo_cache_init (cairo_cache_t *cache, - const cairo_cache_backend_t *backend, - unsigned long max_memory) -{ - assert (backend != NULL); - - if (cache != NULL){ - cache->arrangement = &cache_arrangements[0]; - cache->max_memory = max_memory; - cache->used_memory = 0; - cache->live_entries = 0; - -#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE - cache->hits = 0; - cache->misses = 0; - cache->probes = 0; -#endif - - cache->backend = backend; - cache->entries = calloc (cache->arrangement->size, - sizeof(cairo_cache_entry_base_t *)); - - if (cache->entries == NULL) - return CAIRO_STATUS_NO_MEMORY; - } - _cache_sane_state (cache); - return CAIRO_STATUS_SUCCESS; -} - -void -_cairo_cache_destroy (cairo_cache_t *cache) -{ - unsigned long i; - if (cache == NULL) - return; - - _cache_sane_state (cache); - - for (i = 0; i < cache->arrangement->size; ++i) - _entry_destroy (cache, i); - - free (cache->entries); - cache->entries = NULL; - cache->backend->destroy_cache (cache); -} - -void -_cairo_cache_shrink_to (cairo_cache_t *cache, - unsigned long max_memory) -{ - unsigned long idx; - /* Make some entries die if we're under memory pressure. */ - while (cache->live_entries > 0 && cache->used_memory > max_memory) { - idx = _random_entry (cache, NULL) - cache->entries; - assert (idx < cache->arrangement->size); - _entry_destroy (cache, idx); - } + *value_return = NULL; + return FALSE; } cairo_status_t -_cairo_cache_lookup (cairo_cache_t *cache, - void *key, - void **entry_return, - int *created_entry) +_cairo_hash_table_insert (cairo_hash_table_t *hash_table, + void *key, + void *value) { + cairo_status_t status; + unsigned long hash_code; + cairo_hash_entry_t *entry; - cairo_status_t status = CAIRO_STATUS_SUCCESS; - cairo_cache_entry_base_t **slot = NULL, *new_entry; - - _cache_sane_state (cache); - -#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE - if ((cache->hits + cache->misses) % 0xffff == 0) - printf("cache %p stats: size %ld, live %ld, load %.2f\n" - " mem %ld/%ld, hit %ld, miss %ld\n" - " probe %ld, %.2f probe/access\n", - cache, - cache->arrangement->size, - cache->live_entries, - _load_factor (cache), - cache->used_memory, - cache->max_memory, - cache->hits, - cache->misses, - cache->probes, - ((double) cache->probes) - / ((double) (cache->hits + - cache->misses + 1))); -#endif + hash_code = hash_table->compute_hash (key); - /* See if we have an entry in the table already. */ - slot = _find_exact_live_entry_for (cache, key); - if (slot != NULL) { -#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE - cache->hits++; -#endif - *entry_return = *slot; - if (created_entry) - *created_entry = 0; - return status; - } - -#ifdef CAIRO_MEASURE_CACHE_PERFORMANCE - cache->misses++; -#endif - - /* Build the new entry. */ - status = cache->backend->create_entry (cache, key, - (void **)&new_entry); - if (status != CAIRO_STATUS_SUCCESS) - return status; - - /* Store the hash value in case the backend forgot. */ - new_entry->hashcode = cache->backend->hash (cache, key); - - if (cache->live_entries && cache->max_memory) - _cairo_cache_shrink_to (cache, cache->max_memory); - - /* Can't assert this; new_entry->memory may be larger than max_memory */ - /* assert(cache->max_memory >= (cache->used_memory + new_entry->memory)); */ - - /* Make room in the table for a new slot. */ - status = _resize_cache (cache, cache->live_entries + 1); + /* Ensure there is room in the table in case we need to add a new + * entry. */ + status = _cairo_hash_table_resize (hash_table, + hash_table->live_entries + 1); if (status != CAIRO_STATUS_SUCCESS) { - cache->backend->destroy_entry (cache, new_entry); return status; } - slot = _find_available_entry_for (cache, key); - assert(slot != NULL); + entry = _cairo_hash_table_lookup_internal (hash_table, key, + hash_code, FALSE); - /* Store entry in slot and increment statistics. */ - *slot = new_entry; - cache->live_entries++; - cache->used_memory += new_entry->memory; + if (entry->state == CAIRO_HASH_ENTRY_STATE_LIVE) + { + /* Duplicate entry. Preserve old key, replace value. */ + if (hash_table->key_destroy) + hash_table->key_destroy (key); + if (hash_table->value_destroy) + hash_table->value_destroy (entry->value); + entry->value = value; + } + else + { + /* New entry. Store value and increment statistics. */ + entry->state = CAIRO_HASH_ENTRY_STATE_LIVE; + entry->key = key; + entry->hash_code = hash_code; + entry->value = value; - _cache_sane_state (cache); + hash_table->live_entries++; + } - *entry_return = new_entry; - if (created_entry) - *created_entry = 1; - return status; } -cairo_status_t -_cairo_cache_remove (cairo_cache_t *cache, - void *key) +void +_cairo_hash_table_remove (cairo_hash_table_t *hash_table, + void *key) { - cairo_cache_entry_base_t **slot; + unsigned long hash_code; + cairo_hash_entry_t *entry; - _cache_sane_state (cache); + hash_code = hash_table->compute_hash (key); /* See if we have an entry in the table already. */ - slot = _find_exact_live_entry_for (cache, key); - if (slot != NULL) - _entry_destroy (cache, slot - cache->entries); - - return CAIRO_STATUS_SUCCESS; + entry = _cairo_hash_table_lookup_internal (hash_table, key, + hash_code, FALSE); + if (entry->state == CAIRO_HASH_ENTRY_STATE_LIVE) + _cairo_hash_table_destroy_entry (hash_table, entry); } -void * -_cairo_cache_random_entry (cairo_cache_t *cache, - int (*predicate)(void*)) +void +_cairo_hash_table_foreach (cairo_hash_table_t *hash_table, + cairo_hash_callback_func_t hash_callback, + void *closure) { - cairo_cache_entry_base_t **slot = _random_entry (cache, predicate); - - return slot ? *slot : NULL; -} + unsigned long i; + cairo_hash_entry_t *entry; -unsigned long -_cairo_hash_string (const char *c) -{ - /* This is the djb2 hash. */ - unsigned long hash = 5381; - while (*c) - hash = ((hash << 5) + hash) + *c++; - return hash; + if (hash_table == NULL) + return; + + for (i = 0; i < hash_table->arrangement->size; i++) { + entry = &hash_table->entries[i]; + if (entry->state == CAIRO_HASH_ENTRY_STATE_LIVE) + hash_callback (entry->key, entry->value, closure); + } } - diff --git a/src/cairoint.h b/src/cairoint.h index 0b394bf28..8ac9bf6a5 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -395,9 +395,6 @@ _cairo_cache_init (cairo_cache_t *cache, const cairo_cache_backend_t *backend, unsigned long max_memory); -cairo_private void -_cairo_cache_reference (cairo_cache_t *cache); - cairo_private void _cairo_cache_destroy (cairo_cache_t *cache); -- cgit v1.2.3 From e7ffbb4179b388304d4aadda66eb6c641758f91b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 29 Jun 2005 15:02:10 +0000 Subject: Rewrite hash table to use a single cairo_hash_entry_t* rather than void *key and void *value. This is slightly more painful to use, but lends itself to a more memory-efficient implementation. Add documentation. --- ChangeLog | 12 ++ src/cairo-hash-private.h | 58 ++++++--- src/cairo-hash.c | 332 +++++++++++++++++++++++++---------------------- 3 files changed, 235 insertions(+), 167 deletions(-) diff --git a/ChangeLog b/ChangeLog index ed3745f94..fc1f15830 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2005-06-29 Carl Worth + + * src/cairo-hash-private.h: + * src/cairo-hash.c: (_cairo_hash_table_create), (_destroy_entry), + (_cairo_hash_table_destroy), (_cairo_hash_table_lookup_internal), + (_cairo_hash_table_resize), (_cairo_hash_table_lookup), + (_cairo_hash_table_insert), (_cairo_hash_table_remove), + (_cairo_hash_table_foreach): Rewrite hash table to use a single + cairo_hash_entry_t* rather than void *key and void *value. This is + slightly more painful to use, but lends itself to a more + memory-efficient implementation. Add documentation. + 2005-06-29 Carl Worth * src/cairo-hash-private.h: diff --git a/src/cairo-hash-private.h b/src/cairo-hash-private.h index 9ee27df43..a424ea66a 100644 --- a/src/cairo-hash-private.h +++ b/src/cairo-hash-private.h @@ -43,39 +43,67 @@ typedef struct _cairo_hash_table cairo_hash_table_t; -typedef unsigned long -(*cairo_compute_hash_func_t) (void *key); +/** + * cairo_hash_entry_t: + * + * A #cairo_hash_entry_t contains both a key and a value for + * cairo_hash_table_t. User-derived types for cairo_hash_entry_t must + * be type-compatible with this structure (eg. they must have an + * unsigned long as the first parameter. The easiest way to get this + * is to use: + * + * typedef _my_entry { + * cairo_hash_entry_t base; + * ... Remainder of key and value fields here .. + * } my_entry_t; + * + * which then allows a pointer to my_entry_t to be passed to any of + * the cairo_hash_table functions as follows without requiring a cast: + * + * _cairo_hash_table_insert (hash_table, &my_entry->base); + * + * IMPORTANT: The caller is reponsible for initializing + * my_entry->base.hash with a reasonable hash code derived from the + * key. + * + * Which parts of the entry make up the "key" and which part make up + * the value are entirely up to the caller, (as determined by the + * computation going into base.hash as well as the keys_equal + * function). A few of the cairo_hash_table functions accept an entry + * which will be used exclusively as a "key", (indicated by a + * parameter name of key). In these cases, the value-related fields of + * the entry need not be initialized if so desired. + **/ +typedef struct _cairo_hash_entry { + unsigned long hash; +} cairo_hash_entry_t; typedef cairo_bool_t -(*cairo_keys_equal_func_t) (void *key_a, void *key_b); +(*cairo_hash_keys_equal_func_t) (void *entry_a, void *entry_b); typedef void -(*cairo_hash_callback_func_t) (void *key, - void *value, +(*cairo_hash_callback_func_t) (void *entry, void *closure); cairo_private cairo_hash_table_t * -_cairo_hash_table_create (cairo_compute_hash_func_t compute_hash, - cairo_keys_equal_func_t keys_equal, - cairo_destroy_func_t key_destroy, - cairo_destroy_func_t value_destroy); +_cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal, + cairo_destroy_func_t entry_destroy); cairo_private void _cairo_hash_table_destroy (cairo_hash_table_t *hash_table); cairo_private cairo_bool_t -_cairo_hash_table_lookup (cairo_hash_table_t *hash_table, - void *key, - void **value_return); +_cairo_hash_table_lookup (cairo_hash_table_t *hash_table, + cairo_hash_entry_t *key, + cairo_hash_entry_t **entry_return); cairo_private cairo_status_t _cairo_hash_table_insert (cairo_hash_table_t *hash_table, - void *key, - void *value); + cairo_hash_entry_t *entry); cairo_private void _cairo_hash_table_remove (cairo_hash_table_t *hash_table, - void *key); + cairo_hash_entry_t *key); cairo_private void _cairo_hash_table_foreach (cairo_hash_table_t *hash_table, diff --git a/src/cairo-hash.c b/src/cairo-hash.c index 113efa292..9559411d9 100644 --- a/src/cairo-hash.c +++ b/src/cairo-hash.c @@ -42,13 +42,24 @@ * An entry can be in one of three states: * * FREE: Entry has never been used, terminates all searches. - * - * LIVE: Entry is currently being used. + * Appears in the table as a NULL pointer. * * DEAD: Entry had been live in the past. A dead entry can be reused * but does not terminate a search for an exact entry. - * - * We expect keys will not be destroyed frequently, so our table does not + * Appears in the table as a pointer to DEAD_ENTRY. + * + * LIVE: Entry is currently being used. + * Appears in the table as any non-NULL, non-DEAD_ENTRY pointer. + */ + +static cairo_hash_entry_t dead_entry = { 0 }; +#define DEAD_ENTRY (&dead_entry) + +#define ENTRY_IS_FREE(entry) ((entry) == NULL) +#define ENTRY_IS_DEAD(entry) ((entry) == DEAD_ENTRY) +#define ENTRY_IS_LIVE(entry) ((entry) && ! ENTRY_IS_DEAD(entry)) + +/* We expect keys will not be destroyed frequently, so our table does not * contain any explicit shrinking code nor any chain-coalescing code for * entries randomly deleted by memory pressure (except during rehashing, of * course). These assumptions are potentially bad, but they make the @@ -63,22 +74,7 @@ * size makes for the "first" hash modulus; a second prime (2 less than the * first prime) serves as the "second" hash modulus, which is co-prime and * thus guarantees a complete permutation of table indices. - */ - -typedef enum { - CAIRO_HASH_ENTRY_STATE_FREE = 0, - CAIRO_HASH_ENTRY_STATE_LIVE = 1, - CAIRO_HASH_ENTRY_STATE_DEAD = 2 -} cairo_hash_entry_state_t; - -typedef struct { - cairo_hash_entry_state_t state; - unsigned long hash_code; - void *key; - void *value; -} cairo_hash_entry_t; - -/* + * * This structure, and accompanying table, is borrowed/modified from the * file xserver/render/glyph.c in the freedesktop.org x server, with * permission (and suggested modification of doubling sizes) by Keith @@ -92,52 +88,65 @@ typedef struct _cairo_hash_table_arrangement { } cairo_hash_table_arrangement_t; static const cairo_hash_table_arrangement_t hash_table_arrangements [] = { - { 16, 43, 41 }, - { 32, 73, 71 }, - { 64, 151, 149 }, - { 128, 283, 281 }, - { 256, 571, 569 }, - { 512, 1153, 1151 }, - { 1024, 2269, 2267 }, - { 2048, 4519, 4517 }, - { 4096, 9013, 9011 }, - { 8192, 18043, 18041 }, - { 16384, 36109, 36107 }, - { 32768, 72091, 72089 }, - { 65536, 144409, 144407 }, - { 131072, 288361, 288359 }, - { 262144, 576883, 576881 }, - { 524288, 1153459, 1153457 }, - { 1048576, 2307163, 2307161 }, - { 2097152, 4613893, 4613891 }, - { 4194304, 9227641, 9227639 }, - { 8388608, 18455029, 18455027 }, - { 16777216, 36911011, 36911009 }, - { 33554432, 73819861, 73819859 }, - { 67108864, 147639589, 147639587 }, - { 134217728, 295279081, 295279079 }, - { 268435456, 590559793, 590559791 } + { 16, 43, 41 }, + { 32, 73, 71 }, + { 64, 151, 149 }, + { 128, 283, 281 }, + { 256, 571, 569 }, + { 512, 1153, 1151 }, + { 1024, 2269, 2267 }, + { 2048, 4519, 4517 }, + { 4096, 9013, 9011 }, + { 8192, 18043, 18041 }, + { 16384, 36109, 36107 }, + { 32768, 72091, 72089 }, + { 65536, 144409, 144407 }, + { 131072, 288361, 288359 }, + { 262144, 576883, 576881 }, + { 524288, 1153459, 1153457 }, + { 1048576, 2307163, 2307161 }, + { 2097152, 4613893, 4613891 }, + { 4194304, 9227641, 9227639 }, + { 8388608, 18455029, 18455027 }, + { 16777216, 36911011, 36911009 }, + { 33554432, 73819861, 73819859 }, + { 67108864, 147639589, 147639587 }, + { 134217728, 295279081, 295279079 }, + { 268435456, 590559793, 590559791 } }; #define NUM_HASH_TABLE_ARRANGEMENTS (sizeof(hash_table_arrangements)/sizeof(hash_table_arrangements[0])) struct _cairo_hash_table { - cairo_compute_hash_func_t compute_hash; - cairo_keys_equal_func_t keys_equal; - cairo_destroy_func_t key_destroy; - cairo_destroy_func_t value_destroy; + cairo_hash_keys_equal_func_t keys_equal; + cairo_destroy_func_t entry_destroy; const cairo_hash_table_arrangement_t *arrangement; - cairo_hash_entry_t *entries; + cairo_hash_entry_t **entries; unsigned long live_entries; }; +/** + * _cairo_hash_table_create: + * @keys_equal: a function to return TRUE if two keys are equal + * @entry_destroy: destroy notifier for hash entries + * + * Creates a new hash table which will use the keys_equal() function + * to compare hash keys. Data is provided to the hash table in the + * form of user-derived versions of cairo_hash_entry_t. A hash entry + * must be able to hold both a key (including a hash code) and a + * value. Sometimes only the key will be necessary, (as in + * _cairo_hash_table_remove), and other times both a key and a value + * will be necessary, (as in _cairo_hash_table_insert). + * + * See #cairo_hash_entry_t for more details. + * + * Return value: the new hash table or NULL if out of memory. + **/ cairo_hash_table_t * -_cairo_hash_table_create (cairo_compute_hash_func_t compute_hash, - cairo_keys_equal_func_t keys_equal, - cairo_destroy_func_t key_destroy, - cairo_destroy_func_t value_destroy) +_cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal, + cairo_destroy_func_t entry_destroy) { cairo_hash_table_t *hash_table; @@ -145,56 +154,54 @@ _cairo_hash_table_create (cairo_compute_hash_func_t compute_hash, if (hash_table == NULL) return NULL; - hash_table->compute_hash = compute_hash; hash_table->keys_equal = keys_equal; - hash_table->key_destroy = key_destroy; - hash_table->value_destroy = value_destroy; + hash_table->entry_destroy = entry_destroy; hash_table->arrangement = &hash_table_arrangements[0]; - hash_table->live_entries = 0; - hash_table->entries = calloc (hash_table->arrangement->size, - sizeof(cairo_hash_entry_t)); - + sizeof(cairo_hash_entry_t *)); if (hash_table->entries == NULL) { free (hash_table); return NULL; - } + } + + hash_table->live_entries = 0; return hash_table; } static void -_cairo_hash_table_destroy_entry (cairo_hash_table_t *hash_table, - cairo_hash_entry_t *entry) +_destroy_entry (cairo_hash_table_t *hash_table, cairo_hash_entry_t **entry) { - if (entry->state != CAIRO_HASH_ENTRY_STATE_LIVE) - return; - - assert(hash_table->live_entries > 0); - - hash_table->live_entries--; - - if (hash_table->key_destroy) - hash_table->key_destroy (entry->key); - - if (hash_table->value_destroy) - hash_table->value_destroy (entry->value); - - entry->state = CAIRO_HASH_ENTRY_STATE_DEAD; + if (hash_table->entry_destroy) + hash_table->entry_destroy (*entry); + *entry = DEAD_ENTRY; } +/** + * _cairo_hash_table_destroy: + * @hash_table: a hash table to destroy + * + * Immediately destroys the given hash table, freeing all resources + * associated with it. As part of this process, the entry_destroy() + * function, (as passed to cairo_hash_table_create), will be called + * for each live entry in the hash table. + **/ void _cairo_hash_table_destroy (cairo_hash_table_t *hash_table) { unsigned long i; + cairo_hash_entry_t **entry; + if (hash_table == NULL) return; - for (i = 0; i < hash_table->arrangement->size; i++) - _cairo_hash_table_destroy_entry (hash_table, - &hash_table->entries[i]); + for (i = 0; i < hash_table->arrangement->size; i++) { + entry = &hash_table->entries[i]; + if (ENTRY_IS_LIVE(*entry)) + _destroy_entry (hash_table, entry); + } free (hash_table->entries); hash_table->entries = NULL; @@ -226,44 +233,45 @@ _cairo_hash_table_destroy (cairo_hash_table_t *hash_table) * any). Otherwise, the first available entry. The caller should check * entry->state to check whether a match was found or not. **/ -static cairo_hash_entry_t * +static cairo_hash_entry_t ** _cairo_hash_table_lookup_internal (cairo_hash_table_t *hash_table, - void *key, - unsigned long hash_code, + cairo_hash_entry_t *key, cairo_bool_t key_is_unique) { - cairo_hash_entry_t *entry, *first_available = NULL; + cairo_hash_entry_t **entry, **first_available = NULL; unsigned long table_size, i, idx, step; table_size = hash_table->arrangement->size; - idx = hash_code % table_size; + idx = key->hash % table_size; step = 0; for (i = 0; i < table_size; ++i) { entry = &hash_table->entries[idx]; - switch (entry->state) { - case CAIRO_HASH_ENTRY_STATE_FREE: + if (*entry == NULL) + { return entry; - case CAIRO_HASH_ENTRY_STATE_LIVE: - if (! key_is_unique) - if (hash_table->keys_equal (key, entry->key)) - return entry; - break; - case CAIRO_HASH_ENTRY_STATE_DEAD: + } + else if (*entry == DEAD_ENTRY) + { if (key_is_unique) { return entry; } else { if (! first_available) first_available = entry; } - break; + } + else /* LIVE */ + { + if (! key_is_unique) + if (hash_table->keys_equal (key, *entry)) + return entry; } if (step == 0) { - step = hash_code % hash_table->arrangement->rehash; + step = key->hash % hash_table->arrangement->rehash; if (step == 0) step = 1; } @@ -287,7 +295,7 @@ _cairo_hash_table_resize (cairo_hash_table_t *hash_table, unsigned long proposed_size) { cairo_hash_table_t tmp; - cairo_hash_entry_t *entry; + cairo_hash_entry_t **entry; unsigned long new_size, i; if (hash_table->arrangement->high_water_mark >= proposed_size) @@ -295,26 +303,21 @@ _cairo_hash_table_resize (cairo_hash_table_t *hash_table, tmp = *hash_table; - for (i = 0; i < NUM_HASH_TABLE_ARRANGEMENTS; i++) - if (hash_table_arrangements[i].high_water_mark >= proposed_size) { - tmp.arrangement = &hash_table_arrangements[i]; - break; - } + tmp.arrangement = hash_table->arrangement + 1; /* This code is being abused if we can't make a table big enough. */ - assert (i < NUM_HASH_TABLE_ARRANGEMENTS); + assert (tmp.arrangement - hash_table_arrangements < NUM_HASH_TABLE_ARRANGEMENTS); new_size = tmp.arrangement->size; - tmp.entries = calloc (new_size, sizeof (cairo_hash_entry_t)); + tmp.entries = calloc (new_size, sizeof (cairo_hash_entry_t*)); if (tmp.entries == NULL) return CAIRO_STATUS_NO_MEMORY; for (i = 0; i < hash_table->arrangement->size; ++i) { - if (hash_table->entries[i].state == CAIRO_HASH_ENTRY_STATE_LIVE) { + if (ENTRY_IS_LIVE (hash_table->entries[i])) { entry = _cairo_hash_table_lookup_internal (&tmp, - hash_table->entries[i].key, - hash_table->entries[i].hash_code, + hash_table->entries[i], TRUE); - assert (entry->state == CAIRO_HASH_ENTRY_STATE_FREE); + assert (ENTRY_IS_FREE(*entry)); *entry = hash_table->entries[i]; } } @@ -324,38 +327,57 @@ _cairo_hash_table_resize (cairo_hash_table_t *hash_table, return CAIRO_STATUS_SUCCESS; } +/** + * _cairo_hash_table_lookup: + * @hash_table: a hash table + * @key: the key of interest + * @entry_return: pointer for return value. + * + * Performs a lookup in @hash_table looking for an entry which has a + * key that matches @key, (as determined by the keys_equal() function + * passed to cairo_hash_table_create). + * + * Return value: TRUE if there is an entry in the hash table that + * matches the given key, (which will now be in *entry_return). FALSE + * otherwise, (in which case *entry_return will be NULL). + **/ cairo_bool_t _cairo_hash_table_lookup (cairo_hash_table_t *hash_table, - void *key, - void **value_return) + cairo_hash_entry_t *key, + cairo_hash_entry_t **entry_return) { - unsigned long hash_code; - cairo_hash_entry_t *entry; - - hash_code = hash_table->compute_hash (key); + cairo_hash_entry_t **entry; /* See if we have an entry in the table already. */ - entry = _cairo_hash_table_lookup_internal (hash_table, key, - hash_code, FALSE); - if (entry->state == CAIRO_HASH_ENTRY_STATE_LIVE) { - *value_return = entry->value; + entry = _cairo_hash_table_lookup_internal (hash_table, key, FALSE); + if (ENTRY_IS_LIVE(*entry)) { + *entry_return = *entry; return TRUE; } - *value_return = NULL; + *entry_return = NULL; return FALSE; } +/** + * _cairo_hash_table_insert: + * @hash_table: a hash table + * @key_and_value: an entry to be inserted + * + * Insert the entry #key_and_value into the hash table. If an existing + * exists in the hash table with a matching key, then the old entry + * will be removed first, (and the entry_destroy() callback will be + * called on it). + * + * Return value: CAIRO_STATUS_SUCCESS if successful or + * CAIRO_STATUS_NO_MEMORY if insufficient memory is available. + **/ cairo_status_t _cairo_hash_table_insert (cairo_hash_table_t *hash_table, - void *key, - void *value) + cairo_hash_entry_t *key_and_value) { cairo_status_t status; - unsigned long hash_code; - cairo_hash_entry_t *entry; - - hash_code = hash_table->compute_hash (key); + cairo_hash_entry_t **entry; /* Ensure there is room in the table in case we need to add a new * entry. */ @@ -365,25 +387,18 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table, return status; } - entry = _cairo_hash_table_lookup_internal (hash_table, key, - hash_code, FALSE); + entry = _cairo_hash_table_lookup_internal (hash_table, + key_and_value, FALSE); - if (entry->state == CAIRO_HASH_ENTRY_STATE_LIVE) + if (ENTRY_IS_LIVE(*entry)) { - /* Duplicate entry. Preserve old key, replace value. */ - if (hash_table->key_destroy) - hash_table->key_destroy (key); - if (hash_table->value_destroy) - hash_table->value_destroy (entry->value); - entry->value = value; + if (hash_table->entry_destroy) + hash_table->entry_destroy (*entry); + *entry = key_and_value; } else { - /* New entry. Store value and increment statistics. */ - entry->state = CAIRO_HASH_ENTRY_STATE_LIVE; - entry->key = key; - entry->hash_code = hash_code; - entry->value = value; + *entry = key_and_value; hash_table->live_entries++; } @@ -391,22 +406,35 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table, return status; } +/** + * _cairo_hash_table_remove: + * @hash_table: a hash table + * @key: key of entry to be removed + * + * Remove an entry from the hash table which has a key that matches + * @key, (as determined by the keys_equal() function passed to + * _cairo_hash_table_create), if any. + **/ void _cairo_hash_table_remove (cairo_hash_table_t *hash_table, - void *key) + cairo_hash_entry_t *key) { - unsigned long hash_code; - cairo_hash_entry_t *entry; + cairo_hash_entry_t **entry; - hash_code = hash_table->compute_hash (key); - - /* See if we have an entry in the table already. */ - entry = _cairo_hash_table_lookup_internal (hash_table, key, - hash_code, FALSE); - if (entry->state == CAIRO_HASH_ENTRY_STATE_LIVE) - _cairo_hash_table_destroy_entry (hash_table, entry); + entry = _cairo_hash_table_lookup_internal (hash_table, key, FALSE); + if (ENTRY_IS_LIVE(*entry)) + _destroy_entry (hash_table, entry); } +/** + * _cairo_hash_table_foreach: + * @hash_table: a hash table + * @hash_callback: function to be called for each live entry + * @closure: additional argument to be passed to @hash_callback + * + * Call @hash_callback for each live entry in the hash table, in a + * non-specified order. + **/ void _cairo_hash_table_foreach (cairo_hash_table_t *hash_table, cairo_hash_callback_func_t hash_callback, @@ -419,8 +447,8 @@ _cairo_hash_table_foreach (cairo_hash_table_t *hash_table, return; for (i = 0; i < hash_table->arrangement->size; i++) { - entry = &hash_table->entries[i]; - if (entry->state == CAIRO_HASH_ENTRY_STATE_LIVE) - hash_callback (entry->key, entry->value, closure); + entry = hash_table->entries[i]; + if (ENTRY_IS_LIVE(entry)) + hash_callback (entry, closure); } } -- cgit v1.2.3 From aad6dce6bc9adc829e719345c5df954d9464cefb Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 29 Jun 2005 17:02:37 +0000 Subject: Add _cairo_hash_table_random_entry. Fix to update live_entries. style changes. Add code to shrink table as well as to grow it. Call new version of resize so that table will grow or shrink as needed on insert and remove. --- ChangeLog | 18 +++++++ src/cairo-hash-private.h | 5 +- src/cairo-hash.c | 138 +++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 139 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc1f15830..6f96009f1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2005-06-29 Carl Worth + + * src/cairo-hash-private.h: + * src/cairo-hash.c (_cairo_hash_table_random_entry): Add + _cairo_hash_table_random_entry. + + * src/cairo-hash.c: (_destroy_entry): Fix to update live_entries. + + * src/cairo-hash.c: (_cairo_hash_table_lookup_internal): style + changes. + + * src/cairo-hash.c (_cairo_hash_table_resize): Add code to shrink + table as well as to grow it. + + * src/cairo-hash.c (_cairo_hash_table_insert), + (_cairo_hash_table_remove): Call new version of resize so that + table will grow or shrink as needed on insert and remove. + 2005-06-29 Carl Worth * src/cairo-hash-private.h: diff --git a/src/cairo-hash-private.h b/src/cairo-hash-private.h index a424ea66a..190dc1087 100644 --- a/src/cairo-hash-private.h +++ b/src/cairo-hash-private.h @@ -97,11 +97,14 @@ _cairo_hash_table_lookup (cairo_hash_table_t *hash_table, cairo_hash_entry_t *key, cairo_hash_entry_t **entry_return); +cairo_private void * +_cairo_hash_table_random_entry (cairo_hash_table_t *hash_table); + cairo_private cairo_status_t _cairo_hash_table_insert (cairo_hash_table_t *hash_table, cairo_hash_entry_t *entry); -cairo_private void +cairo_private cairo_status_t _cairo_hash_table_remove (cairo_hash_table_t *hash_table, cairo_hash_entry_t *key); diff --git a/src/cairo-hash.c b/src/cairo-hash.c index 9559411d9..42cd078cc 100644 --- a/src/cairo-hash.c +++ b/src/cairo-hash.c @@ -174,9 +174,13 @@ _cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal, static void _destroy_entry (cairo_hash_table_t *hash_table, cairo_hash_entry_t **entry) { + if (! ENTRY_IS_LIVE (*entry)) + return; + if (hash_table->entry_destroy) hash_table->entry_destroy (*entry); *entry = DEAD_ENTRY; + hash_table->live_entries--; } /** @@ -250,11 +254,11 @@ _cairo_hash_table_lookup_internal (cairo_hash_table_t *hash_table, { entry = &hash_table->entries[idx]; - if (*entry == NULL) + if (ENTRY_IS_FREE(*entry)) { return entry; } - else if (*entry == DEAD_ENTRY) + else if (ENTRY_IS_DEAD(*entry)) { if (key_is_unique) { return entry; @@ -263,7 +267,7 @@ _cairo_hash_table_lookup_internal (cairo_hash_table_t *hash_table, first_available = entry; } } - else /* LIVE */ + else /* ENTRY_IS_LIVE(*entry) */ { if (! key_is_unique) if (hash_table->keys_equal (key, *entry)) @@ -290,22 +294,51 @@ _cairo_hash_table_lookup_internal (cairo_hash_table_t *hash_table, return first_available; } +/** + * _cairo_hash_table_resize: + * @hash_table: a hash table + * + * Resize the hash table if the number of entries has gotten much + * bigger or smaller than the ideal number of entries for the current + * size. + * + * Return value: CAIRO_STATUS_SUCCESS if successful or + * CAIRO_STATUS_NO_MEMORY if out of memory. + **/ static cairo_status_t -_cairo_hash_table_resize (cairo_hash_table_t *hash_table, - unsigned long proposed_size) +_cairo_hash_table_resize (cairo_hash_table_t *hash_table) { cairo_hash_table_t tmp; cairo_hash_entry_t **entry; unsigned long new_size, i; - if (hash_table->arrangement->high_water_mark >= proposed_size) + /* This keeps the hash table between 25% and 50% full. */ + unsigned long high = hash_table->arrangement->high_water_mark; + unsigned long low = high >> 2; + + if (hash_table->live_entries >= low && hash_table->live_entries <= high) return CAIRO_STATUS_SUCCESS; tmp = *hash_table; - tmp.arrangement = hash_table->arrangement + 1; - /* This code is being abused if we can't make a table big enough. */ - assert (tmp.arrangement - hash_table_arrangements < NUM_HASH_TABLE_ARRANGEMENTS); + if (hash_table->live_entries > high) + { + tmp.arrangement = hash_table->arrangement + 1; + /* This code is being abused if we can't make a table big enough. */ + assert (tmp.arrangement - hash_table_arrangements < + NUM_HASH_TABLE_ARRANGEMENTS); + fprintf (stderr, "Growing from %ld to %ld\n", + hash_table->arrangement->size, tmp.arrangement->size); + } + else /* hash_table->live_entries < low */ + { + /* Can't shrink if we're at the smallest size */ + if (hash_table->arrangement == &hash_table_arrangements[0]) + return CAIRO_STATUS_SUCCESS; + tmp.arrangement = hash_table->arrangement - 1; + fprintf (stderr, "Shrinking from %ld to %ld\n", + hash_table->arrangement->size, tmp.arrangement->size); + } new_size = tmp.arrangement->size; tmp.entries = calloc (new_size, sizeof (cairo_hash_entry_t*)); @@ -321,9 +354,11 @@ _cairo_hash_table_resize (cairo_hash_table_t *hash_table, *entry = hash_table->entries[i]; } } + free (hash_table->entries); hash_table->entries = tmp.entries; hash_table->arrangement = tmp.arrangement; + return CAIRO_STATUS_SUCCESS; } @@ -359,6 +394,59 @@ _cairo_hash_table_lookup (cairo_hash_table_t *hash_table, return FALSE; } +/** + * _cairo_hash_table_random_entry: + * @hash_table: a hash table + * + * Find a random entry in the hash table. + * + * We use the same algorithm as the lookup algorithm to walk over the + * entries in the hash table in a pseudo-random order. Walking + * linearly would favor entries following gaps in the hash table. We + * could also call rand() repeatedly, which works well for almost-full + * tables, but degrades when the table is almost empty, or predicate + * returns false for most entries. + * + * NOTE: It'd be really easy to turn this into a find function with a + * predicate if anybody might want that. + * + * Return value: a random live entry or NULL if there are no live + * entries. + **/ +void * +_cairo_hash_table_random_entry (cairo_hash_table_t *hash_table) +{ + cairo_hash_entry_t **entry; + unsigned long hash; + unsigned long table_size, i, idx, step; + + table_size = hash_table->arrangement->size; + + hash = rand (); + idx = hash % table_size; + step = 0; + + for (i = 0; i < table_size; ++i) + { + entry = &hash_table->entries[idx]; + + if (ENTRY_IS_LIVE (*entry)) + return *entry; + + if (step == 0) { + step = hash % hash_table->arrangement->rehash; + if (step == 0) + step = 1; + } + + idx += step; + if (idx >= table_size) + idx -= table_size; + } + + return NULL; +} + /** * _cairo_hash_table_insert: * @hash_table: a hash table @@ -379,14 +467,6 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table, cairo_status_t status; cairo_hash_entry_t **entry; - /* Ensure there is room in the table in case we need to add a new - * entry. */ - status = _cairo_hash_table_resize (hash_table, - hash_table->live_entries + 1); - if (status != CAIRO_STATUS_SUCCESS) { - return status; - } - entry = _cairo_hash_table_lookup_internal (hash_table, key_and_value, FALSE); @@ -403,7 +483,11 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table, hash_table->live_entries++; } - return status; + status = _cairo_hash_table_resize (hash_table); + if (status) + return status; + + return CAIRO_STATUS_SUCCESS; } /** @@ -414,16 +498,28 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table, * Remove an entry from the hash table which has a key that matches * @key, (as determined by the keys_equal() function passed to * _cairo_hash_table_create), if any. + * + * Return value: CAIRO_STATUS_SUCCESS if successful or + * CAIRO_STATUS_NO_MEMORY if out of memory. **/ -void +cairo_status_t _cairo_hash_table_remove (cairo_hash_table_t *hash_table, cairo_hash_entry_t *key) { + cairo_status_t status; cairo_hash_entry_t **entry; entry = _cairo_hash_table_lookup_internal (hash_table, key, FALSE); - if (ENTRY_IS_LIVE(*entry)) - _destroy_entry (hash_table, entry); + if (! ENTRY_IS_LIVE(*entry)) + return CAIRO_STATUS_SUCCESS; + + _destroy_entry (hash_table, entry); + + status = _cairo_hash_table_resize (hash_table); + if (status) + return status; + + return CAIRO_STATUS_SUCCESS; } /** -- cgit v1.2.3 From 4e01c4aa2f8427113153fe569b6cf22388ba0882 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 29 Jun 2005 17:05:31 +0000 Subject: Remove debugging printfs. --- ChangeLog | 7 ++++++- src/cairo-hash.c | 4 ---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f96009f1..12a126ba9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,14 @@ +2005-06-29 Carl Worth + + * src/cairo-hash.c (_cairo_hash_table_resize): Remove debugging + printfs. + 2005-06-29 Carl Worth * src/cairo-hash-private.h: * src/cairo-hash.c (_cairo_hash_table_random_entry): Add _cairo_hash_table_random_entry. - + * src/cairo-hash.c: (_destroy_entry): Fix to update live_entries. * src/cairo-hash.c: (_cairo_hash_table_lookup_internal): style diff --git a/src/cairo-hash.c b/src/cairo-hash.c index 42cd078cc..b46c90337 100644 --- a/src/cairo-hash.c +++ b/src/cairo-hash.c @@ -327,8 +327,6 @@ _cairo_hash_table_resize (cairo_hash_table_t *hash_table) /* This code is being abused if we can't make a table big enough. */ assert (tmp.arrangement - hash_table_arrangements < NUM_HASH_TABLE_ARRANGEMENTS); - fprintf (stderr, "Growing from %ld to %ld\n", - hash_table->arrangement->size, tmp.arrangement->size); } else /* hash_table->live_entries < low */ { @@ -336,8 +334,6 @@ _cairo_hash_table_resize (cairo_hash_table_t *hash_table) if (hash_table->arrangement == &hash_table_arrangements[0]) return CAIRO_STATUS_SUCCESS; tmp.arrangement = hash_table->arrangement - 1; - fprintf (stderr, "Shrinking from %ld to %ld\n", - hash_table->arrangement->size, tmp.arrangement->size); } new_size = tmp.arrangement->size; -- cgit v1.2.3 From 7ab5dbfa7547bd0d8a99e4d0fcd34d8a55722a11 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Fri, 1 Jul 2005 12:22:23 +0000 Subject: Add meta surface implementation. Add cairo-meta-surface.c and cairo-meta-surface-private.h --- ChangeLog | 8 + src/Makefile.am | 2 + src/cairo-meta-surface-private.h | 151 ++++++++++ src/cairo-meta-surface.c | 601 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 762 insertions(+) create mode 100644 src/cairo-meta-surface-private.h create mode 100644 src/cairo-meta-surface.c diff --git a/ChangeLog b/ChangeLog index 12a126ba9..6dc959927 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-07-01 Kristian Høgsberg + + * src/cairo-meta-surface-private.h: + * src/cairo-meta-surface.c: Add meta surface implementation. + + * src/Makefile.am (libcairo_la_SOURCES): Add cairo-meta-surface.c + and cairo-meta-surface-private.h + 2005-06-29 Carl Worth * src/cairo-hash.c (_cairo_hash_table_resize): Remove debugging diff --git a/src/Makefile.am b/src/Makefile.am index 68e4235e9..888105503 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -111,6 +111,8 @@ libcairo_la_SOURCES = \ cairo-output-stream.c \ cairo-wideint.c \ cairo-wideint.h \ + cairo-meta-surface.c \ + cairo-meta-surface-private.h \ $(libcairo_atsui_sources) \ $(libcairo_ft_sources) \ $(libcairo_ps_sources) \ diff --git a/src/cairo-meta-surface-private.h b/src/cairo-meta-surface-private.h new file mode 100644 index 000000000..49cc45617 --- /dev/null +++ b/src/cairo-meta-surface-private.h @@ -0,0 +1,151 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2005 Red Hat, Inc + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Red Hat, Inc. + * + * Contributor(s): + * Kristian Høgsberg + */ + +#ifndef CAIRO_META_SURFACE_H +#define CAIRO_META_SURFACE_H + +#include "cairoint.h" +#include "cairo-path-fixed-private.h" + +typedef enum { + CAIRO_COMMAND_COMPOSITE, + CAIRO_COMMAND_FILL_RECTANGLES, + CAIRO_COMMAND_COMPOSITE_TRAPEZOIDS, + CAIRO_COMMAND_SET_CLIP_REGION, + CAIRO_COMMAND_INTERSECT_CLIP_PATH, + CAIRO_COMMAND_SHOW_GLYPHS, + CAIRO_COMMAND_FILL_PATH +} cairo_command_type_t; + +typedef struct _cairo_command_composite { + cairo_command_type_t type; + cairo_operator_t operator; + cairo_pattern_union_t src_pattern; + cairo_pattern_union_t mask_pattern; + cairo_pattern_t *mask_pattern_pointer; + int src_x; + int src_y; + int mask_x; + int mask_y; + int dst_x; + int dst_y; + unsigned int width; + unsigned int height; +} cairo_command_composite_t; + +typedef struct _cairo_command_fill_rectangles { + cairo_command_type_t type; + cairo_operator_t operator; + cairo_color_t color; + cairo_rectangle_t *rects; + int num_rects; +} cairo_command_fill_rectangles_t; + +typedef struct _cairo_command_composite_trapezoids { + cairo_command_type_t type; + cairo_operator_t operator; + cairo_pattern_union_t pattern; + int x_src; + int y_src; + int x_dst; + int y_dst; + unsigned int width; + unsigned int height; + cairo_trapezoid_t *traps; + int num_traps; +} cairo_command_composite_trapezoids_t; + +typedef struct _cairo_command_set_clip_region { + cairo_command_type_t type; + pixman_region16_t *region; +} cairo_command_set_clip_region_t; + +typedef struct _cairo_command_intersect_clip_path { + cairo_command_type_t type; + cairo_path_fixed_t *path_pointer; + cairo_path_fixed_t path; + cairo_fill_rule_t fill_rule; + double tolerance; +} cairo_command_intersect_clip_path_t; + +typedef struct _cairo_command_show_glyphs { + cairo_command_type_t type; + cairo_scaled_font_t *scaled_font; + cairo_operator_t operator; + cairo_pattern_union_t pattern; + int source_x; + int source_y; + int dest_x; + int dest_y; + unsigned int width; + unsigned int height; + cairo_glyph_t *glyphs; + int num_glyphs; +} cairo_command_show_glyphs_t; + +typedef struct _cairo_command_fill_path { + cairo_command_type_t type; + cairo_operator_t operator; + cairo_pattern_union_t pattern; + cairo_path_fixed_t path; + cairo_fill_rule_t fill_rule; + double tolerance; +} cairo_command_fill_path_t; + +typedef union _cairo_command { + cairo_command_type_t type; + cairo_command_composite_t composite; + cairo_command_fill_rectangles_t fill_rectangles; + cairo_command_composite_trapezoids_t composite_trapezoids; + cairo_command_set_clip_region_t set_clip_region; + cairo_command_intersect_clip_path_t intersect_clip_path; + cairo_command_show_glyphs_t show_glyphs; + cairo_command_fill_path_t fill_path; +} cairo_command_t; + +typedef struct _cairo_meta_surface { + cairo_surface_t base; + double width, height; + cairo_array_t commands; +} cairo_meta_surface_t; + +cairo_surface_t * +_cairo_meta_surface_create (double width, double height); + +cairo_int_status_t +_cairo_meta_surface_replay (cairo_surface_t *surface, + cairo_surface_t *target); + +#endif /* CAIRO_META_SURFACE_H */ diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c new file mode 100644 index 000000000..a976a1f62 --- /dev/null +++ b/src/cairo-meta-surface.c @@ -0,0 +1,601 @@ +/* cairo - a vector graphics library with display and print output + * + * Copyright © 2005 Red Hat, Inc + * + * This library is free software; you can redistribute it and/or + * modify it either under the terms of the GNU Lesser General Public + * License version 2.1 as published by the Free Software Foundation + * (the "LGPL") or, at your option, under the terms of the Mozilla + * Public License Version 1.1 (the "MPL"). If you do not alter this + * notice, a recipient may use your version of this file under either + * the MPL or the LGPL. + * + * You should have received a copy of the LGPL along with this library + * in the file COPYING-LGPL-2.1; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * You should have received a copy of the MPL along with this library + * in the file COPYING-MPL-1.1 + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY + * OF ANY KIND, either express or implied. See the LGPL or the MPL for + * the specific language governing rights and limitations. + * + * The Original Code is the cairo graphics library. + * + * The Initial Developer of the Original Code is Red Hat, Inc. + * + * Contributor(s): + * Kristian Høgsberg + */ + +#include "cairoint.h" +#include "cairo-meta-surface-private.h" + +/* + * Notes: + * + * Can't use cairo_surface_* calls since we often don't want + * fallbacks. For example, when determining the font subsets or the + * fallback areas. Hmm... but maybe those passes could be integrated + * into the delegation wrappers and the ps output pass, respectively. + * + * Don't want to mark a valid NULL pattern as a error object, which is + * what we do if we set pattern->status = CAIRO_STATUS_NULL_POINTER. + * We could make a CAIRO_PATTERN_TYPE_NULL alternatively. Btw. what + * about a CAIRO_PATTERN_TYPE_ERROR for pattern->status != + * CAIRO_STATUS_SUCCESS cases? + */ + +static const cairo_surface_backend_t cairo_meta_surface_backend; + +cairo_surface_t * +_cairo_meta_surface_create (double width, double height) +{ + cairo_meta_surface_t *meta; + + meta = malloc (sizeof (cairo_meta_surface_t)); + if (meta == NULL) + return NULL; + + meta->width = width; + meta->height = height; + _cairo_surface_init (&meta->base, &cairo_meta_surface_backend); + _cairo_array_init (&meta->commands, sizeof (cairo_command_t *)); + + return &meta->base; +} + +static cairo_surface_t * +_cairo_meta_surface_create_similar (void *abstract_surface, + cairo_format_t format, + int width, + int height) +{ + return _cairo_meta_surface_create (width, height); +} + +static cairo_status_t +_cairo_meta_surface_finish (void *abstract_surface) +{ + cairo_meta_surface_t *meta = abstract_surface; + cairo_command_t *command; + cairo_command_t **elements; + int i, num_elements; + + num_elements = meta->commands.num_elements; + elements = (cairo_command_t **) meta->commands.elements; + for (i = 0; i < num_elements; i++) { + command = elements[i]; + switch (command->type) { + case CAIRO_COMMAND_COMPOSITE: + _cairo_pattern_fini (&command->composite.src_pattern.base); + if (command->composite.mask_pattern_pointer) + _cairo_pattern_fini (command->composite.mask_pattern_pointer); + free (command); + break; + + case CAIRO_COMMAND_FILL_RECTANGLES: + free (command->fill_rectangles.rects); + free (command); + break; + + case CAIRO_COMMAND_COMPOSITE_TRAPEZOIDS: + _cairo_pattern_fini (&command->composite_trapezoids.pattern.base); + free (command->composite_trapezoids.traps); + free (command); + break; + + case CAIRO_COMMAND_SET_CLIP_REGION: + free (command); + break; + + case CAIRO_COMMAND_INTERSECT_CLIP_PATH: + if (command->intersect_clip_path.path_pointer) + _cairo_path_fixed_fini (&command->intersect_clip_path.path); + free (command); + break; + + case CAIRO_COMMAND_SHOW_GLYPHS: + cairo_scaled_font_destroy (command->show_glyphs.scaled_font); + _cairo_pattern_fini (&command->show_glyphs.pattern.base); + free (command->show_glyphs.glyphs); + free (command); + break; + + case CAIRO_COMMAND_FILL_PATH: + _cairo_pattern_fini (&command->fill_path.pattern.base); + _cairo_path_fixed_fini (&command->fill_path.path); + free (command); + break; + + default: + ASSERT_NOT_REACHED; + } + } + + _cairo_array_fini (&meta->commands); + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_int_status_t +_cairo_meta_surface_composite (cairo_operator_t operator, + cairo_pattern_t *src_pattern, + cairo_pattern_t *mask_pattern, + void *abstract_surface, + int src_x, + int src_y, + int mask_x, + int mask_y, + int dst_x, + int dst_y, + unsigned int width, + unsigned int height) +{ + cairo_meta_surface_t *meta = abstract_surface; + cairo_command_composite_t *command; + + command = malloc (sizeof (cairo_command_composite_t)); + if (command == NULL) + return CAIRO_STATUS_NO_MEMORY; + + command->type = CAIRO_COMMAND_COMPOSITE; + command->operator = operator; + _cairo_pattern_init_copy (&command->src_pattern.base, src_pattern); + if (mask_pattern) { + _cairo_pattern_init_copy (&command->mask_pattern.base, mask_pattern); + command->mask_pattern_pointer = &command->mask_pattern.base; + } else { + command->mask_pattern_pointer = NULL; + } + + command->src_x = src_x; + command->src_y = src_y; + command->mask_x = mask_x; + command->mask_y = mask_y; + command->dst_x = dst_x; + command->dst_y = dst_y; + command->width = width; + command->height = height; + + if (_cairo_array_append (&meta->commands, &command, 1) == NULL) { + _cairo_pattern_fini (&command->src_pattern.base); + _cairo_pattern_fini (command->mask_pattern_pointer); + free (command); + return CAIRO_STATUS_NO_MEMORY; + } + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_int_status_t +_cairo_meta_surface_fill_rectangles (void *abstract_surface, + cairo_operator_t operator, + const cairo_color_t *color, + cairo_rectangle_t *rects, + int num_rects) +{ + cairo_meta_surface_t *meta = abstract_surface; + cairo_command_fill_rectangles_t *command; + + command = malloc (sizeof (cairo_command_fill_rectangles_t)); + if (command == NULL) + return CAIRO_STATUS_NO_MEMORY; + + command->type = CAIRO_COMMAND_FILL_RECTANGLES; + command->operator = operator; + command->color = *color; + + command->rects = malloc (sizeof (cairo_rectangle_t) * num_rects); + if (command->rects == NULL) { + free (command); + return CAIRO_STATUS_NO_MEMORY; + } + memcpy (command->rects, rects, sizeof (cairo_rectangle_t) * num_rects); + + command->num_rects = num_rects; + + if (_cairo_array_append (&meta->commands, &command, 1) == NULL) { + free (command->rects); + free (command); + return CAIRO_STATUS_NO_MEMORY; + } + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_int_status_t +_cairo_meta_surface_composite_trapezoids (cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_surface, + int x_src, + int y_src, + int x_dst, + int y_dst, + unsigned int width, + unsigned int height, + cairo_trapezoid_t *traps, + int num_traps) +{ + cairo_meta_surface_t *meta = abstract_surface; + cairo_command_composite_trapezoids_t *command; + + command = malloc (sizeof (cairo_command_composite_trapezoids_t)); + if (command == NULL) + return CAIRO_STATUS_NO_MEMORY; + + command->type = CAIRO_COMMAND_COMPOSITE_TRAPEZOIDS; + command->operator = operator; + _cairo_pattern_init_copy (&command->pattern.base, pattern); + command->x_src = x_src; + command->y_src = y_src; + command->x_dst = x_dst; + command->y_dst = y_dst; + command->width = width; + command->height = height; + + command->traps = malloc (sizeof (cairo_trapezoid_t) * num_traps); + if (command->traps == NULL) { + _cairo_pattern_fini (&command->pattern.base); + free (command); + return CAIRO_STATUS_NO_MEMORY; + } + memcpy (command->traps, traps, sizeof (cairo_trapezoid_t) * num_traps); + + command->num_traps = num_traps; + + if (_cairo_array_append (&meta->commands, &command, 1) == NULL) { + _cairo_pattern_fini (&command->pattern.base); + free (command->traps); + free (command); + return CAIRO_STATUS_NO_MEMORY; + } + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_int_status_t +_cairo_meta_surface_set_clip_region (void *abstract_surface, + pixman_region16_t *region) +{ + cairo_meta_surface_t *meta = abstract_surface; + cairo_command_set_clip_region_t *command; + + command = malloc (sizeof (cairo_command_set_clip_region_t)); + if (command == NULL) + return CAIRO_STATUS_NO_MEMORY; + + command->type = CAIRO_COMMAND_SET_CLIP_REGION; + + if (region) { + command->region = pixman_region_create (); + pixman_region_copy (command->region, region); + } else { + command->region = NULL; + } + + if (_cairo_array_append (&meta->commands, &command, 1) == NULL) { + if (command->region) + pixman_region_destroy (command->region); + free (command); + return CAIRO_STATUS_NO_MEMORY; + } + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_int_status_t +_cairo_meta_surface_intersect_clip_path (void *dst, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance) +{ + cairo_meta_surface_t *meta = dst; + cairo_command_intersect_clip_path_t *command; + cairo_status_t status; + + command = malloc (sizeof (cairo_command_intersect_clip_path_t)); + if (command == NULL) + return CAIRO_STATUS_NO_MEMORY; + + command->type = CAIRO_COMMAND_INTERSECT_CLIP_PATH; + + if (path) { + status = _cairo_path_fixed_init_copy (&command->path, path); + if (status) { + free (command); + return status; + } + command->path_pointer = &command->path; + } else { + command->path_pointer = NULL; + } + command->fill_rule = fill_rule; + command->tolerance = tolerance; + + if (_cairo_array_append (&meta->commands, &command, 1) == NULL) { + if (path) + _cairo_path_fixed_fini (&command->path); + free (command); + return CAIRO_STATUS_NO_MEMORY; + } + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_int_status_t +_cairo_meta_surface_get_extents (void *abstract_surface, + cairo_rectangle_t *rectangle) +{ + cairo_meta_surface_t *meta = abstract_surface; + + /* Currently this is used for getting the extents of the surface + * before calling cairo_paint(). This is the only this that + * requires the meta surface to have an explicit size. If paint + * was just a backend function, this would not be necessary. */ + + rectangle->x = 0; + rectangle->y = 0; + rectangle->width = meta->width; + rectangle->height = meta->height; + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_int_status_t +_cairo_meta_surface_show_glyphs (cairo_scaled_font_t *scaled_font, + cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_surface, + int source_x, + int source_y, + int dest_x, + int dest_y, + unsigned int width, + unsigned int height, + const cairo_glyph_t *glyphs, + int num_glyphs) +{ + cairo_meta_surface_t *meta = abstract_surface; + cairo_command_show_glyphs_t *command; + + command = malloc (sizeof (cairo_command_show_glyphs_t)); + if (command == NULL) + return CAIRO_STATUS_NO_MEMORY; + + command->type = CAIRO_COMMAND_SHOW_GLYPHS; + command->scaled_font = scaled_font; + cairo_scaled_font_reference (scaled_font); + command->operator = operator; + _cairo_pattern_init_copy (&command->pattern.base, pattern); + command->source_x = source_x; + command->source_y = source_y; + command->dest_x = dest_x; + command->dest_y = dest_y; + command->width = width; + command->height = height; + + command->glyphs = malloc (sizeof (cairo_glyph_t) * num_glyphs); + if (command->glyphs == NULL) { + _cairo_pattern_fini (&command->pattern.base); + free (command); + return CAIRO_STATUS_NO_MEMORY; + } + memcpy (command->glyphs, glyphs, sizeof (cairo_glyph_t) * num_glyphs); + + command->num_glyphs = num_glyphs; + + if (_cairo_array_append (&meta->commands, &command, 1) == NULL) { + _cairo_pattern_fini (&command->pattern.base); + free (command->glyphs); + free (command); + return CAIRO_STATUS_NO_MEMORY; + } + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_int_status_t +_cairo_meta_surface_fill_path (cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_surface, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance) +{ + cairo_meta_surface_t *meta = abstract_surface; + cairo_command_fill_path_t *command; + cairo_status_t status; + + command = malloc (sizeof (cairo_command_fill_path_t)); + if (command == NULL) + return CAIRO_STATUS_NO_MEMORY; + + command->type = CAIRO_COMMAND_FILL_PATH; + command->operator = operator; + _cairo_pattern_init_copy (&command->pattern.base, pattern); + status = _cairo_path_fixed_init_copy (&command->path, path); + if (status) { + _cairo_pattern_fini (&command->pattern.base); + free (command); + return CAIRO_STATUS_NO_MEMORY; + } + command->fill_rule = fill_rule; + command->tolerance = tolerance; + + if (_cairo_array_append (&meta->commands, &command, 1) == NULL) { + _cairo_path_fixed_fini (&command->path); + _cairo_pattern_fini (&command->pattern.base); + free (command); + return CAIRO_STATUS_NO_MEMORY; + } + + return CAIRO_STATUS_SUCCESS; +} + +static const cairo_surface_backend_t cairo_meta_surface_backend = { + _cairo_meta_surface_create_similar, + _cairo_meta_surface_finish, + NULL, /* acquire_source_image */ + NULL, /* release_source_image */ + NULL, /* acquire_dest_image */ + NULL, /* release_dest_image */ + NULL, /* clone_similar */ + _cairo_meta_surface_composite, + _cairo_meta_surface_fill_rectangles, + _cairo_meta_surface_composite_trapezoids, + NULL, /* copy_page */ + NULL, /* show_page */ + _cairo_meta_surface_set_clip_region, + _cairo_meta_surface_intersect_clip_path, + _cairo_meta_surface_get_extents, + _cairo_meta_surface_show_glyphs, + _cairo_meta_surface_fill_path, +}; + +cairo_int_status_t +_cairo_meta_surface_replay (cairo_surface_t *surface, + cairo_surface_t *target) +{ + cairo_meta_surface_t *meta; + cairo_command_t *command, **elements; + int i, num_elements; + cairo_int_status_t status; + + meta = (cairo_meta_surface_t *) surface; + status = CAIRO_STATUS_SUCCESS; + + num_elements = meta->commands.num_elements; + elements = (cairo_command_t **) meta->commands.elements; + for (i = 0; i < num_elements; i++) { + command = elements[i]; + switch (command->type) { + case CAIRO_COMMAND_COMPOSITE: + if (target->backend->composite == NULL) + break; + status = target->backend->composite + (command->composite.operator, + &command->composite.src_pattern.base, + command->composite.mask_pattern_pointer, + target, + command->composite.src_x, + command->composite.src_y, + command->composite.mask_x, + command->composite.mask_y, + command->composite.dst_x, + command->composite.dst_y, + command->composite.width, + command->composite.height); + break; + + case CAIRO_COMMAND_FILL_RECTANGLES: + if (target->backend->fill_rectangles == NULL) + break; + status = target->backend->fill_rectangles + (target, + command->fill_rectangles.operator, + &command->fill_rectangles.color, + command->fill_rectangles.rects, + command->fill_rectangles.num_rects); + break; + + case CAIRO_COMMAND_COMPOSITE_TRAPEZOIDS: + if (target->backend->composite_trapezoids == NULL) + break; + status = target->backend->composite_trapezoids + (command->composite_trapezoids.operator, + &command->composite_trapezoids.pattern.base, + target, + command->composite_trapezoids.x_src, + command->composite_trapezoids.y_src, + command->composite_trapezoids.x_dst, + command->composite_trapezoids.y_dst, + command->composite_trapezoids.width, + command->composite_trapezoids.height, + command->composite_trapezoids.traps, + command->composite_trapezoids.num_traps); + break; + + case CAIRO_COMMAND_SET_CLIP_REGION: + if (target->backend->set_clip_region == NULL) + break; + status = target->backend->set_clip_region + (target, + command->set_clip_region.region); + break; + + case CAIRO_COMMAND_INTERSECT_CLIP_PATH: + if (target->backend->intersect_clip_path == NULL) + break; + status = target->backend->intersect_clip_path + (target, + command->intersect_clip_path.path_pointer, + command->intersect_clip_path.fill_rule, + command->intersect_clip_path.tolerance); + break; + + case CAIRO_COMMAND_SHOW_GLYPHS: + if (target->backend->show_glyphs == NULL) + break; + status = target->backend->show_glyphs + (command->show_glyphs.scaled_font, + command->show_glyphs.operator, + &command->show_glyphs.pattern.base, + target, + command->show_glyphs.source_x, + command->show_glyphs.source_y, + command->show_glyphs.dest_x, + command->show_glyphs.dest_y, + command->show_glyphs.width, + command->show_glyphs.height, + command->show_glyphs.glyphs, + command->show_glyphs.num_glyphs); + break; + + case CAIRO_COMMAND_FILL_PATH: + if (target->backend->fill_path == NULL) + break; + status = target->backend->fill_path + (command->fill_path.operator, + &command->fill_path.pattern.base, + target, + &command->fill_path.path, + command->fill_path.fill_rule, + command->fill_path.tolerance); + break; + + default: + ASSERT_NOT_REACHED; + } + + if (status) + break; + } + + return status; +} -- cgit v1.2.3 From 7a923e6dddcefa643ef059e8eef0ebeba7e383ee Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Fri, 1 Jul 2005 12:45:35 +0000 Subject: Rewrite postscript backend to generate more interesting output than the current big-image implementation, using meta surfaces for font subsetting and image fallbacks. Remove obsolete comment. Make a couple of stylistic changes and add _cairo_output_stream_write_hex_string. Add _cairo_surface_intersect_clip_path so we can replay path clipping. --- ChangeLog | 15 + src/cairo-meta-surface.c | 6 - src/cairo-output-stream.c | 28 +- src/cairo-ps-surface.c | 1261 +++++++++++++++++++++++++++++++++++++++------ src/cairo-surface.c | 17 + src/cairoint.h | 11 + 6 files changed, 1167 insertions(+), 171 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6dc959927..c3aeb0ecd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2005-07-01 Kristian Høgsberg + + * src/cairo-ps-surface.c: Rewrite postscript backend to generate + more interesting output than the current big-image implementation, + using meta surfaces for font subsetting and image fallbacks. + + * src/cairo-meta-surface.c: Remove obsolete comment. + + * src/cairoint.h: + * src/cairo-output-stream.c: Make a couple of stylistic changes + and add _cairo_output_stream_write_hex_string. + + * src/cairo-surface.c: Add _cairo_surface_intersect_clip_path so + we can replay path clipping. + 2005-07-01 Kristian Høgsberg * src/cairo-meta-surface-private.h: diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c index a976a1f62..4ed72578a 100644 --- a/src/cairo-meta-surface.c +++ b/src/cairo-meta-surface.c @@ -43,12 +43,6 @@ * fallbacks. For example, when determining the font subsets or the * fallback areas. Hmm... but maybe those passes could be integrated * into the delegation wrappers and the ps output pass, respectively. - * - * Don't want to mark a valid NULL pattern as a error object, which is - * what we do if we set pattern->status = CAIRO_STATUS_NULL_POINTER. - * We could make a CAIRO_PATTERN_TYPE_NULL alternatively. Btw. what - * about a CAIRO_PATTERN_TYPE_ERROR for pattern->status != - * CAIRO_STATUS_SUCCESS cases? */ static const cairo_surface_backend_t cairo_meta_surface_backend; diff --git a/src/cairo-output-stream.c b/src/cairo-output-stream.c index 14b4486a6..17ef7e2cb 100644 --- a/src/cairo-output-stream.c +++ b/src/cairo-output-stream.c @@ -90,6 +90,26 @@ _cairo_output_stream_write (cairo_output_stream_t *stream, return stream->status; } +void +_cairo_output_stream_write_hex_string (cairo_output_stream_t *stream, + const char *data, + size_t length) +{ + const char hex_chars[] = "0123456789abcdef"; + char buffer[2]; + int i, column; + + for (i = 0, column = 0; i < length; i++, column++) { + if (column == 38) { + _cairo_output_stream_write (stream, "\n", 1); + column = 0; + } + buffer[0] = hex_chars[(data[i] >> 4) & 0x0f]; + buffer[1] = hex_chars[data[i] & 0x0f]; + _cairo_output_stream_write (stream, buffer, 2); + } +} + /* Format a double in a locale independent way and trim trailing * zeros. Based on code from Alex Larson . * http://mail.gnome.org/archives/gtk-devel-list/2001-October/msg00087.html @@ -187,8 +207,8 @@ _cairo_output_stream_vprintf (cairo_output_stream_t *stream, switch (*f | length_modifier) { case '%': - p[0] = *f; - p[1] = 0; + buffer[0] = *f; + buffer[1] = 0; break; case 'd': snprintf (buffer, sizeof buffer, "%d", va_arg (ap, int)); @@ -211,6 +231,10 @@ _cairo_output_stream_vprintf (cairo_output_stream_t *stream, case 'f': dtostr (buffer, sizeof buffer, va_arg (ap, double)); break; + case 'c': + buffer[0] = va_arg (ap, int); + buffer[1] = 0; + break; default: ASSERT_NOT_REACHED; } diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index dd12c2ca5..730ee9f20 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -1,6 +1,7 @@ /* cairo - a vector graphics library with display and print output * * Copyright © 2003 University of Southern California + * Copyright © 2005 Red Hat, Inc * * This library is free software; you can redistribute it and/or * modify it either under the terms of the GNU Lesser General Public @@ -32,14 +33,27 @@ * * Contributor(s): * Carl D. Worth + * Kristian Høgsberg */ #include "cairoint.h" #include "cairo-ps.h" +#include "cairo-font-subset-private.h" +#include "cairo-meta-surface-private.h" +#include "cairo-ft-private.h" #include #include +/* TODO: + * + * - Add document structure convention comments where appropriate. + * + * - Fix image compression. + * + * - Create a set of procs to use... specifically a trapezoid proc. + */ + static const cairo_surface_backend_t cairo_ps_surface_backend; typedef struct cairo_ps_surface { @@ -48,29 +62,36 @@ typedef struct cairo_ps_surface { /* PS-specific fields */ cairo_output_stream_t *stream; - double width_in_points; - double height_in_points; + double width; + double height; double x_dpi; double y_dpi; - int pages; - - cairo_image_surface_t *image; + cairo_surface_t *current_page; + cairo_array_t pages; + cairo_array_t fonts; } cairo_ps_surface_t; #define PS_SURFACE_DPI_DEFAULT 300.0 -static void -_cairo_ps_surface_erase (cairo_ps_surface_t *surface); +static cairo_int_status_t +_cairo_ps_surface_write_font_subsets (cairo_ps_surface_t *surface); + +static cairo_int_status_t +_cairo_ps_surface_render_page (cairo_ps_surface_t *surface, + cairo_surface_t *page, int page_number); + +static cairo_int_status_t +_cairo_ps_surface_render_fallbacks (cairo_ps_surface_t *surface, + cairo_surface_t *page); + static cairo_surface_t * _cairo_ps_surface_create_for_stream_internal (cairo_output_stream_t *stream, - double width_in_points, - double height_in_points) + double width, + double height) { cairo_ps_surface_t *surface; - int width_in_pixels, height_in_pixels; - time_t now = time (0); surface = malloc (sizeof (cairo_ps_surface_t)); if (surface == NULL) @@ -80,45 +101,20 @@ _cairo_ps_surface_create_for_stream_internal (cairo_output_stream_t *stream, surface->stream = stream; - surface->width_in_points = width_in_points; - surface->height_in_points = height_in_points; + surface->width = width; + surface->height = height; surface->x_dpi = PS_SURFACE_DPI_DEFAULT; surface->y_dpi = PS_SURFACE_DPI_DEFAULT; - surface->pages = 0; - - width_in_pixels = (int) (surface->x_dpi * width_in_points / 72.0 + 1.0); - height_in_pixels = (int) (surface->y_dpi * height_in_points / 72.0 + 1.0); - - surface->image = (cairo_image_surface_t *) - cairo_image_surface_create (CAIRO_FORMAT_ARGB32, - width_in_pixels, height_in_pixels); - if (surface->image == NULL) { + surface->current_page = _cairo_meta_surface_create (width, + height); + if (surface->current_page == NULL) { free (surface); return NULL; } - _cairo_ps_surface_erase (surface); - - /* Document header */ - _cairo_output_stream_printf (surface->stream, - "%%!PS-Adobe-3.0\n" - "%%%%Creator: Cairo (http://cairographics.org)\n"); - _cairo_output_stream_printf (surface->stream, - "%%%%CreationDate: %s", - ctime (&now)); - _cairo_output_stream_printf (surface->stream, - "%%%%BoundingBox: %f %f %f %f\n", - 0.0, 0.0, - surface->width_in_points, - surface->height_in_points); - /* The "/FlateDecode filter" currently used is a feature of LanguageLevel 3 */ - _cairo_output_stream_printf (surface->stream, - "%%%%DocumentData: Clean7Bit\n" - "%%%%LanguageLevel: 3\n"); - _cairo_output_stream_printf (surface->stream, - "%%%%Orientation: Portrait\n" - "%%%%EndComments\n"); + _cairo_array_init (&surface->pages, sizeof (cairo_surface_t *)); + _cairo_array_init (&surface->fonts, sizeof (cairo_font_subset_t *)); return &surface->base; } @@ -169,210 +165,1149 @@ static cairo_status_t _cairo_ps_surface_finish (void *abstract_surface) { cairo_ps_surface_t *surface = abstract_surface; + cairo_surface_t *page; + cairo_font_subset_t *subset; + cairo_status_t status; + int i; + time_t now; + + now = time (0); + + /* Document header */ + _cairo_output_stream_printf (surface->stream, + "%%!PS-Adobe-3.0\n" + "%%%%Creator: Cairo (http://cairographics.org)\n" + "%%%%CreationDate: %s" + "%%%%Title: Some clever title\n" + "%%%%Pages: %d\n" + "%%%%BoundingBox: %f %f %f %f\n", + ctime (&now), + surface->pages.num_elements, + 0.0, 0.0, + surface->width, + surface->height); + + /* The "/FlateDecode filter" currently used is a feature of + * LanguageLevel 3 */ + _cairo_output_stream_printf (surface->stream, + "%%%%DocumentData: Clean7Bit\n" + "%%%%LanguageLevel: 3\n" + "%%%%Orientation: Portrait\n" + "%%%%EndComments\n"); + + _cairo_ps_surface_write_font_subsets (surface); + + status = CAIRO_STATUS_SUCCESS; + for (i = 0; i < surface->pages.num_elements; i++) { + _cairo_array_copy_element (&surface->pages, i, &page); + + status = _cairo_ps_surface_render_page (surface, page, i + 1); + if (status) + break; + } /* Document footer */ _cairo_output_stream_printf (surface->stream, + "%%%%Trailer\n" "%%%%EOF\n"); - cairo_surface_destroy (&surface->image->base); + for (i = 0; i < surface->pages.num_elements; i++) { + _cairo_array_copy_element (&surface->pages, i, &page); + cairo_surface_destroy (page); + } + _cairo_array_fini (&surface->pages); - return CAIRO_STATUS_SUCCESS; + for (i = 0; i < surface->fonts.num_elements; i++) { + _cairo_array_copy_element (&surface->fonts, i, &subset); + _cairo_font_subset_destroy (subset); + } + _cairo_array_fini (&surface->fonts); + + _cairo_output_stream_destroy (surface->stream); + cairo_surface_destroy (surface->current_page); + + return status; } -static void -_cairo_ps_surface_erase (cairo_ps_surface_t *surface) +static cairo_int_status_t +_cairo_ps_surface_composite (cairo_operator_t operator, + cairo_pattern_t *src_pattern, + cairo_pattern_t *mask_pattern, + void *abstract_dst, + int src_x, + int src_y, + int mask_x, + int mask_y, + int dst_x, + int dst_y, + unsigned int width, + unsigned int height) { - _cairo_surface_fill_rectangle (&surface->image->base, - CAIRO_OPERATOR_SOURCE, - CAIRO_COLOR_TRANSPARENT, - 0, 0, - surface->image->width, - surface->image->height); + cairo_ps_surface_t *surface = abstract_dst; + + return _cairo_surface_composite (operator, + src_pattern, + mask_pattern, + surface->current_page, + src_x, + src_y, + mask_x, + mask_y, + dst_x, + dst_y, + width, + height); } -static cairo_status_t -_cairo_ps_surface_acquire_source_image (void *abstract_surface, - cairo_image_surface_t **image_out, - void **image_extra) +static cairo_int_status_t +_cairo_ps_surface_fill_rectangles (void *abstract_surface, + cairo_operator_t operator, + const cairo_color_t *color, + cairo_rectangle_t *rects, + int num_rects) { cairo_ps_surface_t *surface = abstract_surface; - - *image_out = surface->image; - return CAIRO_STATUS_SUCCESS; + return _cairo_surface_fill_rectangles (surface->current_page, + operator, + color, + rects, + num_rects); } -static cairo_status_t -_cairo_ps_surface_acquire_dest_image (void *abstract_surface, - cairo_rectangle_t *interest_rect, - cairo_image_surface_t **image_out, - cairo_rectangle_t *image_rect, - void **image_extra) +static cairo_int_status_t +_cairo_ps_surface_composite_trapezoids (cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_dst, + int x_src, + int y_src, + int x_dst, + int y_dst, + unsigned int width, + unsigned int height, + cairo_trapezoid_t *traps, + int num_traps) +{ + cairo_ps_surface_t *surface = abstract_dst; + + return _cairo_surface_composite_trapezoids (operator, + pattern, + surface->current_page, + x_src, + y_src, + x_dst, + y_dst, + width, + height, + traps, + num_traps); +} + +static cairo_int_status_t +_cairo_ps_surface_copy_page (void *abstract_surface) { cairo_ps_surface_t *surface = abstract_surface; - - image_rect->x = 0; - image_rect->y = 0; - image_rect->width = surface->image->width; - image_rect->height = surface->image->height; - - *image_out = surface->image; + + /* FIXME: We need to copy the meta surface contents here */ + + return _cairo_surface_show_page (&surface->base); +} + +static cairo_int_status_t +_cairo_ps_surface_show_page (void *abstract_surface) +{ + cairo_ps_surface_t *surface = abstract_surface; + + _cairo_array_append (&surface->pages, &surface->current_page, 1); + surface->current_page = _cairo_meta_surface_create (surface->width, + surface->height); + if (surface->current_page == NULL) + return CAIRO_STATUS_NO_MEMORY; return CAIRO_STATUS_SUCCESS; } static cairo_int_status_t -_cairo_ps_surface_copy_page (void *abstract_surface) +_cairo_ps_surface_intersect_clip_path (void *dst, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance) +{ + cairo_ps_surface_t *surface = dst; + + return _cairo_surface_intersect_clip_path (surface->current_page, + path, + fill_rule, + tolerance); +} + +static cairo_int_status_t +_cairo_ps_surface_get_extents (void *abstract_surface, + cairo_rectangle_t *rectangle) { - cairo_status_t status = CAIRO_STATUS_SUCCESS; cairo_ps_surface_t *surface = abstract_surface; - int width = surface->image->width; - int height = surface->image->height; - cairo_output_stream_t *stream = surface->stream; - int i, x, y; + rectangle->x = 0; + rectangle->y = 0; - cairo_solid_pattern_t white_pattern; - unsigned char *rgb, *compressed; - unsigned long rgb_size, compressed_size; + /* XXX: The conversion to integers here is pretty bogus, (not to + * mention the aribitray limitation of width to a short(!). We + * may need to come up with a better interface for get_size. + */ + rectangle->width = surface->width; + rectangle->height = surface->height; - rgb_size = 3 * width * height; - rgb = malloc (rgb_size); - if (rgb == NULL) { - status = CAIRO_STATUS_NO_MEMORY; - goto BAIL0; + return CAIRO_STATUS_SUCCESS; +} + +static cairo_font_subset_t * +_cairo_ps_surface_get_font (cairo_ps_surface_t *surface, + cairo_scaled_font_t *scaled_font) +{ + cairo_unscaled_font_t *unscaled_font; + cairo_font_subset_t *subset; + unsigned int num_fonts, i; + + /* XXX Why is this an ft specific function? */ + unscaled_font = _cairo_ft_scaled_font_get_unscaled_font (scaled_font); + + num_fonts = _cairo_array_num_elements (&surface->fonts); + for (i = 0; i < num_fonts; i++) { + _cairo_array_copy_element (&surface->fonts, i, &subset); + if (subset->unscaled_font == unscaled_font) + return subset; } - compressed_size = (int) (1.0 + 1.1 * rgb_size); - compressed = malloc (compressed_size); - if (compressed == NULL) { - status = CAIRO_STATUS_NO_MEMORY; - goto BAIL1; + subset = _cairo_font_subset_create (unscaled_font); + if (subset == NULL) + return NULL; + + subset->font_id = surface->fonts.num_elements; + if (_cairo_array_append (&surface->fonts, &subset, 1) == NULL) { + _cairo_font_subset_destroy (subset); + return NULL; + } + + return subset; +} + +static cairo_int_status_t +_cairo_ps_surface_show_glyphs (cairo_scaled_font_t *scaled_font, + cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_surface, + int source_x, + int source_y, + int dest_x, + int dest_y, + unsigned int width, + unsigned int height, + const cairo_glyph_t *glyphs, + int num_glyphs) +{ + cairo_ps_surface_t *surface = abstract_surface; + cairo_font_subset_t *subset; + int i; + + /* Collect font subset info as we go. */ + subset = _cairo_ps_surface_get_font (surface, scaled_font); + if (subset == NULL) + return CAIRO_STATUS_NO_MEMORY; + + for (i = 0; i < num_glyphs; i++) + _cairo_font_subset_use_glyph (subset, glyphs[i].index); + + return _cairo_surface_show_glyphs (scaled_font, + operator, + pattern, + surface->current_page, + source_x, + source_y, + dest_x, + dest_y, + width, + height, + glyphs, + num_glyphs); +} + +static cairo_int_status_t +_cairo_ps_surface_fill_path (cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_dst, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance) +{ + cairo_ps_surface_t *surface = abstract_dst; + + return _cairo_surface_fill_path (operator, + pattern, + surface->current_page, + path, + fill_rule, + tolerance); +} + +static const cairo_surface_backend_t cairo_ps_surface_backend = { + _cairo_ps_surface_create_similar, + _cairo_ps_surface_finish, + NULL, /* acquire_source_image */ + NULL, /* release_source_image */ + NULL, /* acquire_dest_image */ + NULL, /* release_dest_image */ + NULL, /* clone_similar */ + _cairo_ps_surface_composite, + _cairo_ps_surface_fill_rectangles, + _cairo_ps_surface_composite_trapezoids, + _cairo_ps_surface_copy_page, + _cairo_ps_surface_show_page, + NULL, /* set_clip_region */ + _cairo_ps_surface_intersect_clip_path, + _cairo_ps_surface_get_extents, + _cairo_ps_surface_show_glyphs, + _cairo_ps_surface_fill_path +}; + +static cairo_int_status_t +_cairo_ps_surface_write_type42_dict (cairo_ps_surface_t *surface, + cairo_font_subset_t *subset) +{ + const char *data; + unsigned long data_size; + cairo_status_t status; + int i; + + status = CAIRO_STATUS_SUCCESS; + + /* FIXME: Figure out document structure convention for fonts */ + + _cairo_output_stream_printf (surface->stream, + "11 dict begin\n" + "/FontType 42 def\n" + "/FontName /f%d def\n" + "/PaintType 0 def\n" + "/FontMatrix [ 1 0 0 1 0 0 ] def\n" + "/FontBBox [ 0 0 0 0 ] def\n" + "/Encoding 256 array def\n" + "0 1 255 { Encoding exch /.notdef put } for\n", + subset->font_id); + + /* FIXME: Figure out how subset->x_max etc maps to the /FontBBox */ + + for (i = 1; i < subset->num_glyphs; i++) + _cairo_output_stream_printf (surface->stream, + "Encoding %d /g%d put\n", i, i); + + _cairo_output_stream_printf (surface->stream, + "/CharStrings %d dict dup begin\n" + "/.notdef 0 def\n", + subset->num_glyphs); + + for (i = 1; i < subset->num_glyphs; i++) + _cairo_output_stream_printf (surface->stream, + "/g%d %d def\n", i, i); + + _cairo_output_stream_printf (surface->stream, + "end readonly def\n"); + + status = _cairo_font_subset_generate (subset, &data, &data_size); + + /* FIXME: We need to break up fonts bigger than 64k so we don't + * exceed string size limitation. At glyph boundaries. Stupid + * postscript. */ + _cairo_output_stream_printf (surface->stream, + "/sfnts [<"); + + _cairo_output_stream_write_hex_string (surface->stream, data, data_size); + + _cairo_output_stream_printf (surface->stream, + ">] def\n" + "FontName currentdict end definefont pop\n"); + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_int_status_t +_cairo_ps_surface_write_font_subsets (cairo_ps_surface_t *surface) +{ + cairo_font_subset_t *subset; + int i; + + for (i = 0; i < surface->fonts.num_elements; i++) { + _cairo_array_copy_element (&surface->fonts, i, &subset); + _cairo_ps_surface_write_type42_dict (surface, subset); } + return CAIRO_STATUS_SUCCESS; +} + +typedef struct _ps_output_surface { + cairo_surface_t base; + cairo_ps_surface_t *parent; +} ps_output_surface_t; + +static cairo_bool_t +color_is_gray (cairo_color_t *color) +{ + const double epsilon = 0.00001; + + return (fabs (color->red - color->green) < epsilon && + fabs (color->red - color->blue) < epsilon); +} + +/* PS Output - this section handles output of the parts of the meta + * surface we can render natively in PS. */ + +static void * +compress_dup (const void *data, unsigned long data_size, + unsigned long *compressed_size) +{ + void *compressed; + + /* Bound calculation taken from zlib. */ + *compressed_size = data_size + (data_size >> 12) + (data_size >> 14) + 11; + compressed = malloc (*compressed_size); + if (compressed == NULL) + return NULL; + + compress (compressed, compressed_size, data, data_size); + + return compressed; +} + +static cairo_status_t +emit_image (cairo_ps_surface_t *surface, + cairo_image_surface_t *image, + cairo_matrix_t *matrix) +{ + cairo_status_t status = CAIRO_STATUS_NO_MEMORY; + unsigned char *rgb, *compressed; + unsigned long rgb_size, compressed_size; + cairo_surface_t *opaque; + cairo_pattern_union_t pattern; + cairo_matrix_t d2i; + int x, y, i; + /* PostScript can not represent the alpha channel, so we blend the current image over a white RGB surface to eliminate it. */ - _cairo_pattern_init_solid (&white_pattern, CAIRO_COLOR_WHITE); + opaque = _cairo_surface_create_similar_solid (&image->base, + CAIRO_FORMAT_RGB24, + image->width, + image->height, + CAIRO_COLOR_WHITE); + if (opaque == NULL) + goto bail0; + + _cairo_pattern_init_for_surface (&pattern.surface, &image->base); _cairo_surface_composite (CAIRO_OPERATOR_DEST_OVER, - &white_pattern.base, + &pattern.base, NULL, - &surface->image->base, + opaque, 0, 0, 0, 0, 0, 0, - width, height); - - _cairo_pattern_fini (&white_pattern.base); + image->width, + image->height); + + _cairo_pattern_fini (&pattern.base); + + rgb_size = 3 * image->width * image->height; + rgb = malloc (rgb_size); + if (rgb == NULL) + goto bail1; i = 0; - for (y = 0; y < height; y++) { - pixman_bits_t *pixel = (pixman_bits_t *) (surface->image->data + y * surface->image->stride); - for (x = 0; x < width; x++, pixel++) { + for (y = 0; y < image->height; y++) { + pixman_bits_t *pixel = (pixman_bits_t *) (image->data + y * image->stride); + for (x = 0; x < image->width; x++, pixel++) { rgb[i++] = (*pixel & 0x00ff0000) >> 16; rgb[i++] = (*pixel & 0x0000ff00) >> 8; rgb[i++] = (*pixel & 0x000000ff) >> 0; } } - compress (compressed, &compressed_size, rgb, rgb_size); - - /* Page header */ - _cairo_output_stream_printf (stream, "%%%%Page: %d\n", ++surface->pages); + compressed = compress_dup (rgb, rgb_size, &compressed_size); + if (compressed == NULL) + goto bail2; - _cairo_output_stream_printf (stream, "gsave\n"); + /* matrix transforms from user space to image space. We need to + * transform from device space to image space to compensate for + * postscripts coordinate system. */ + cairo_matrix_init (&d2i, 1, 0, 0, -1, 0, surface->height); + cairo_matrix_multiply (&d2i, &d2i, matrix); - /* Image header goop */ - _cairo_output_stream_printf (stream, "%f %f translate\n", - 0.0, surface->height_in_points); - _cairo_output_stream_printf (stream, "/DeviceRGB setcolorspace\n"); - _cairo_output_stream_printf (stream, "<<\n"); - _cairo_output_stream_printf (stream, " /ImageType 1\n"); - _cairo_output_stream_printf (stream, " /Width %d\n", width); - _cairo_output_stream_printf (stream, " /Height %d\n", height); - _cairo_output_stream_printf (stream, " /BitsPerComponent 8\n"); - _cairo_output_stream_printf (stream, " /Decode [ 0 1 0 1 0 1 ]\n"); - _cairo_output_stream_printf (stream, " /DataSource currentfile /FlateDecode filter\n"); - _cairo_output_stream_printf (stream, " /ImageMatrix [ 1 0 0 -1 0 1 ]\n"); - _cairo_output_stream_printf (stream, ">>\n"); - _cairo_output_stream_printf (stream, "image\n"); + _cairo_output_stream_printf (surface->stream, + "/DeviceRGB setcolorspace\n" + "<<\n" + " /ImageType 1\n" + " /Width %d\n" + " /Height %d\n" + " /BitsPerComponent 8\n" + " /Decode [ 0 1 0 1 0 1 ]\n" + " /DataSource currentfile\n" + " /ImageMatrix [ %f %f %f %f %f %f ]\n" + ">>\n" + "image\n", + image->width, + image->height, + d2i.xx, d2i.yx, + d2i.xy, d2i.yy, + d2i.x0, d2i.y0); /* Compressed image data */ - _cairo_output_stream_write (stream, compressed, compressed_size); - - _cairo_output_stream_printf (stream, "showpage\n"); + _cairo_output_stream_write (surface->stream, rgb, rgb_size); + status = CAIRO_STATUS_SUCCESS; - _cairo_output_stream_printf (stream, "grestore\n"); - - /* Page footer */ - _cairo_output_stream_printf (stream, "%%%%EndPage\n"); + _cairo_output_stream_printf (surface->stream, + "\n"); free (compressed); - BAIL1: + bail2: free (rgb); - BAIL0: + bail1: + cairo_surface_destroy (opaque); + bail0: return status; } +static void +emit_solid_pattern (cairo_ps_surface_t *surface, + cairo_solid_pattern_t *pattern) +{ + if (color_is_gray (&pattern->color)) + _cairo_output_stream_printf (surface->stream, + "%f setgray\n", + pattern->color.red); + else + _cairo_output_stream_printf (surface->stream, + "%f %f %f setrgbcolor\n", + pattern->color.red, + pattern->color.green, + pattern->color.blue); +} + +static void +emit_surface_pattern (cairo_ps_surface_t *surface, + cairo_surface_pattern_t *pattern) +{ +} + +static void +emit_linear_pattern (cairo_ps_surface_t *surface, + cairo_linear_pattern_t *pattern) +{ +} + +static void +emit_radial_pattern (cairo_ps_surface_t *surface, + cairo_radial_pattern_t *pattern) +{ +} + +static void +emit_pattern (cairo_ps_surface_t *surface, cairo_pattern_t *pattern) +{ + /* FIXME: We should keep track of what pattern is currently set in + * the postscript file and only emit code if we're setting a + * different pattern. */ + + switch (pattern->type) { + case CAIRO_PATTERN_SOLID: + emit_solid_pattern (surface, (cairo_solid_pattern_t *) pattern); + break; + + case CAIRO_PATTERN_SURFACE: + emit_surface_pattern (surface, (cairo_surface_pattern_t *) pattern); + break; + + case CAIRO_PATTERN_LINEAR: + emit_linear_pattern (surface, (cairo_linear_pattern_t *) pattern); + break; + + case CAIRO_PATTERN_RADIAL: + emit_radial_pattern (surface, (cairo_radial_pattern_t *) pattern); + break; + } +} + + static cairo_int_status_t -_cairo_ps_surface_show_page (void *abstract_surface) +_ps_output_composite (cairo_operator_t operator, + cairo_pattern_t *src_pattern, + cairo_pattern_t *mask_pattern, + void *abstract_dst, + int src_x, + int src_y, + int mask_x, + int mask_y, + int dst_x, + int dst_y, + unsigned int width, + unsigned int height) +{ + ps_output_surface_t *surface = abstract_dst; + cairo_output_stream_t *stream = surface->parent->stream; + cairo_surface_pattern_t *surface_pattern; + cairo_status_t status; + cairo_image_surface_t *image; + void *image_extra; + + if (mask_pattern) { + /* FIXME: Investigate how this can be done... we'll probably + * need pixmap fallbacks for this, though. */ + _cairo_output_stream_printf (stream, + "%% _ps_output_composite: with mask\n"); + return CAIRO_STATUS_SUCCESS; + } + + status = CAIRO_STATUS_SUCCESS; + switch (src_pattern->type) { + case CAIRO_PATTERN_SOLID: + _cairo_output_stream_printf (stream, + "%% _ps_output_composite: solid\n"); + break; + + case CAIRO_PATTERN_SURFACE: + surface_pattern = (cairo_surface_pattern_t *) src_pattern; + + if (src_pattern->extend != CAIRO_EXTEND_NONE) { + _cairo_output_stream_printf (stream, + "%% _ps_output_composite: repeating image\n"); + break; + } + + + status = _cairo_surface_acquire_source_image (surface_pattern->surface, + &image, + &image_extra); + if (status == CAIRO_INT_STATUS_UNSUPPORTED) { + _cairo_output_stream_printf (stream, + "%% _ps_output_composite: src_pattern not available as image\n"); + break; + } else if (status) { + break; + } + status = emit_image (surface->parent, image, &src_pattern->matrix); + _cairo_surface_release_source_image (surface_pattern->surface, + image, image_extra); + break; + + case CAIRO_PATTERN_LINEAR: + case CAIRO_PATTERN_RADIAL: + _cairo_output_stream_printf (stream, + "%% _ps_output_composite: gradient\n"); + break; + } + + return status; +} + +static cairo_int_status_t +_ps_output_fill_rectangles (void *abstract_surface, + cairo_operator_t operator, + const cairo_color_t *color, + cairo_rectangle_t *rects, + int num_rects) +{ + ps_output_surface_t *surface = abstract_surface; + cairo_output_stream_t *stream = surface->parent->stream; + cairo_solid_pattern_t solid; + int i; + + _cairo_output_stream_printf (stream, + "%% _ps_output_fill_rectangles\n"); + + _cairo_pattern_init_solid (&solid, color); + emit_pattern (surface->parent, &solid.base); + _cairo_pattern_fini (&solid.base); + + _cairo_output_stream_printf (stream, "["); + for (i = 0; i < num_rects; i++) { + _cairo_output_stream_printf (stream, + " %d %d %d %d", + rects[i].x, + surface->parent->height - rects[i].y - rects[i].height, + rects[i].width, rects[i].height); + } + + _cairo_output_stream_printf (stream, " ] rectfill\n"); + + return CAIRO_STATUS_SUCCESS; +} + +static double +intersect (cairo_line_t *line, cairo_fixed_t y) +{ + return _cairo_fixed_to_double (line->p1.x) + + _cairo_fixed_to_double (line->p2.x - line->p1.x) * + _cairo_fixed_to_double (y - line->p1.y) / + _cairo_fixed_to_double (line->p2.y - line->p1.y); +} + +static cairo_int_status_t +_ps_output_composite_trapezoids (cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_dst, + int x_src, + int y_src, + int x_dst, + int y_dst, + unsigned int width, + unsigned int height, + cairo_trapezoid_t *traps, + int num_traps) +{ + ps_output_surface_t *surface = abstract_dst; + cairo_output_stream_t *stream = surface->parent->stream; + int i; + + _cairo_output_stream_printf (stream, + "%% _ps_output_composite_trapezoids\n"); + + emit_pattern (surface->parent, pattern); + + for (i = 0; i < num_traps; i++) { + double left_x1, left_x2, right_x1, right_x2, top, bottom; + + left_x1 = intersect (&traps[i].left, traps[i].top); + left_x2 = intersect (&traps[i].left, traps[i].bottom); + right_x1 = intersect (&traps[i].right, traps[i].top); + right_x2 = intersect (&traps[i].right, traps[i].bottom); + top = surface->parent->height - _cairo_fixed_to_double (traps[i].top); + bottom = surface->parent->height - _cairo_fixed_to_double (traps[i].bottom); + + _cairo_output_stream_printf + (stream, + "%f %f moveto %f %f lineto %f %f lineto %f %f lineto " + "closepath\n", + left_x1, top, + left_x2, bottom, + right_x2, bottom, + right_x1, top); + } + + _cairo_output_stream_printf (stream, + "fill\n"); + + return CAIRO_STATUS_SUCCESS; +} + +typedef struct +{ + double height; + cairo_output_stream_t *output_stream; + cairo_bool_t has_current_point; +} ps_output_path_info_t; + +static cairo_status_t +_ps_output_path_move_to (void *closure, cairo_point_t *point) { + ps_output_path_info_t *info = closure; + + _cairo_output_stream_printf (info->output_stream, + "%f %f moveto ", + _cairo_fixed_to_double (point->x), + info->height - _cairo_fixed_to_double (point->y)); + info->has_current_point = TRUE; + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_status_t +_ps_output_path_line_to (void *closure, cairo_point_t *point) +{ + ps_output_path_info_t *info = closure; + const char *ps_operator; + + if (info->has_current_point) + ps_operator = "lineto"; + else + ps_operator = "moveto"; + + _cairo_output_stream_printf (info->output_stream, + "%f %f %s ", + _cairo_fixed_to_double (point->x), + info->height - _cairo_fixed_to_double (point->y), + ps_operator); + info->has_current_point = TRUE; + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_status_t +_ps_output_path_curve_to (void *closure, + cairo_point_t *b, + cairo_point_t *c, + cairo_point_t *d) +{ + ps_output_path_info_t *info = closure; + + _cairo_output_stream_printf (info->output_stream, + "%f %f %f %f %f %f curveto ", + _cairo_fixed_to_double (b->x), + info->height - _cairo_fixed_to_double (b->y), + _cairo_fixed_to_double (c->x), + info->height - _cairo_fixed_to_double (c->y), + _cairo_fixed_to_double (d->x), + info->height - _cairo_fixed_to_double (d->y)); + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_status_t +_ps_output_path_close_path (void *closure) +{ + ps_output_path_info_t *info = closure; + + _cairo_output_stream_printf (info->output_stream, + "closepath\n"); + info->has_current_point = FALSE; + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_int_status_t +_ps_output_intersect_clip_path (void *abstract_surface, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance) +{ + ps_output_surface_t *surface = abstract_surface; + cairo_output_stream_t *stream = surface->parent->stream; + cairo_status_t status; + ps_output_path_info_t info; + const char *ps_operator; + + _cairo_output_stream_printf (stream, + "%% _ps_output_intersect_clip_path\n"); + + if (path == NULL) { + _cairo_output_stream_printf (stream, "initclip\n"); + return CAIRO_STATUS_SUCCESS; + } + + info.output_stream = stream; + info.has_current_point = FALSE; + info.height = surface->parent->height; + + status = _cairo_path_fixed_interpret (path, + CAIRO_DIRECTION_FORWARD, + _ps_output_path_move_to, + _ps_output_path_line_to, + _ps_output_path_curve_to, + _ps_output_path_close_path, + &info); + + switch (fill_rule) { + case CAIRO_FILL_RULE_WINDING: + ps_operator = "clip"; + break; + case CAIRO_FILL_RULE_EVEN_ODD: + ps_operator = "eoclip"; + break; + default: + ASSERT_NOT_REACHED; + } + + _cairo_output_stream_printf (stream, + "%s newpath\n", + ps_operator); + + return status; +} + + +static cairo_int_status_t +_ps_output_show_glyphs (cairo_scaled_font_t *scaled_font, + cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_surface, + int source_x, + int source_y, + int dest_x, + int dest_y, + unsigned int width, + unsigned int height, + const cairo_glyph_t *glyphs, + int num_glyphs) +{ + ps_output_surface_t *surface = abstract_surface; + cairo_output_stream_t *stream = surface->parent->stream; + cairo_font_subset_t *subset; + int i, subset_index; + + _cairo_output_stream_printf (stream, + "%% _ps_output_show_glyphs\n"); + + emit_pattern (surface->parent, pattern); + + /* FIXME: Need to optimize this so we only do this sequence if the + * font isn't already set. */ + + subset = _cairo_ps_surface_get_font (surface->parent, scaled_font); + _cairo_output_stream_printf (stream, + "/f%d findfont\n" + "[ %f %f %f %f 0 0 ] makefont\n" + "setfont\n", + subset->font_id, + scaled_font->scale.xx, + scaled_font->scale.yx, + scaled_font->scale.xy, + scaled_font->scale.yy); + + /* FIXME: Need to optimize per glyph code. Should detect when + * glyphs share the same baseline and when the spacing corresponds + * to the glyph widths. */ + + for (i = 0; i < num_glyphs; i++) { + subset_index = _cairo_font_subset_use_glyph (subset, glyphs[i].index); + _cairo_output_stream_printf (stream, + "%f %f moveto (\\%o) show\n", + glyphs[i].x, + surface->parent->height - glyphs[i].y, + subset_index); + + } + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_int_status_t +_ps_output_fill_path (cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_dst, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance) +{ + ps_output_surface_t *surface = abstract_dst; + cairo_output_stream_t *stream = surface->parent->stream; cairo_int_status_t status; - cairo_ps_surface_t *surface = abstract_surface; + ps_output_path_info_t info; + const char *ps_operator; + + _cairo_output_stream_printf (stream, + "%% _ps_output_fill_path\n"); + + emit_pattern (surface->parent, pattern); + + info.output_stream = stream; + info.has_current_point = FALSE; + info.height = surface->parent->height; + + status = _cairo_path_fixed_interpret (path, + CAIRO_DIRECTION_FORWARD, + _ps_output_path_move_to, + _ps_output_path_line_to, + _ps_output_path_curve_to, + _ps_output_path_close_path, + &info); + + switch (fill_rule) { + case CAIRO_FILL_RULE_WINDING: + ps_operator = "fill"; + break; + case CAIRO_FILL_RULE_EVEN_ODD: + ps_operator = "eofill"; + break; + default: + ASSERT_NOT_REACHED; + } - status = _cairo_ps_surface_copy_page (surface); - if (status) - return status; + _cairo_output_stream_printf (stream, + "%s\n", ps_operator); - _cairo_ps_surface_erase (surface); + return status; +} + +static const cairo_surface_backend_t ps_output_backend = { + NULL, /* create_similar */ + NULL, /* finish */ + NULL, /* acquire_source_image */ + NULL, /* release_source_image */ + NULL, /* acquire_dest_image */ + NULL, /* release_dest_image */ + NULL, /* clone_similar */ + _ps_output_composite, + _ps_output_fill_rectangles, + _ps_output_composite_trapezoids, + NULL, /* copy_page */ + NULL, /* show_page */ + NULL, /* set_clip_region */ + _ps_output_intersect_clip_path, + NULL, /* get_extents */ + _ps_output_show_glyphs, + _ps_output_fill_path +}; + +static cairo_int_status_t +_cairo_ps_surface_render_page (cairo_ps_surface_t *surface, + cairo_surface_t *page, int page_number) +{ + ps_output_surface_t *ps_output; + cairo_int_status_t status; + + _cairo_output_stream_printf (surface->stream, + "%%%%Page: %d\n" + "gsave\n", + page_number); + + ps_output = malloc (sizeof (ps_output_surface_t)); + if (ps_output == NULL) + return CAIRO_STATUS_NO_MEMORY; + + _cairo_surface_init (&ps_output->base, &ps_output_backend); + ps_output->parent = surface; + status = _cairo_meta_surface_replay (page, &ps_output->base); + cairo_surface_destroy (&ps_output->base); + + _cairo_ps_surface_render_fallbacks (surface, page); + + _cairo_output_stream_printf (surface->stream, + "showpage\n" + "grestore\n" + "%%%%EndPage\n"); + + return status; +} +typedef struct _cairo_ps_fallback_area cairo_ps_fallback_area_t; +struct _cairo_ps_fallback_area { + /* area */ + cairo_ps_fallback_area_t *next; +}; + +typedef struct _cairo_ps_fallback_info cairo_ps_fallback_info_t; +struct _cairo_ps_fallback_info { + cairo_ps_fallback_area_t *fallback_areas; +}; + +static cairo_int_status_t +_cairo_ps_fallback_info_add_area (cairo_ps_fallback_info_t *info, + int x, int y, + unsigned int width, + unsigned int height) +{ return CAIRO_STATUS_SUCCESS; } +static cairo_bool_t +_pattern_is_translucent (cairo_pattern_t *abstract_pattern) +{ + cairo_pattern_union_t *pattern; + + pattern = (cairo_pattern_union_t *) abstract_pattern; + switch (pattern->base.type) { + case CAIRO_PATTERN_SOLID: + return pattern->solid.color.alpha < 0.999; + case CAIRO_PATTERN_SURFACE: + case CAIRO_PATTERN_LINEAR: + case CAIRO_PATTERN_RADIAL: + return FALSE; + } +} + static cairo_int_status_t -_cairo_ps_surface_set_clip_region (void *abstract_surface, - pixman_region16_t *region) +_ps_locate_fallbacks_composite (cairo_operator_t operator, + cairo_pattern_t *src_pattern, + cairo_pattern_t *mask_pattern, + void *abstract_dst, + int src_x, + int src_y, + int mask_x, + int mask_y, + int dst_x, + int dst_y, + unsigned int width, + unsigned int height) { - cairo_ps_surface_t *surface = abstract_surface; +} - return _cairo_image_surface_set_clip_region (surface->image, region); +static cairo_int_status_t +_ps_locate_fallbacks_fill_rectangles (void *abstract_surface, + cairo_operator_t operator, + const cairo_color_t *color, + cairo_rectangle_t *rects, + int num_rects) +{ } static cairo_int_status_t -_cairo_ps_surface_get_extents (void *abstract_surface, - cairo_rectangle_t *rectangle) +_ps_locate_fallbacks_composite_trapezoids (cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_dst, + int x_src, + int y_src, + int x_dst, + int y_dst, + unsigned int width, + unsigned int height, + cairo_trapezoid_t *traps, + int num_traps) { - cairo_ps_surface_t *surface = abstract_surface; + cairo_ps_fallback_info_t *info; - rectangle->x = 0; - rectangle->y = 0; + info = abstract_dst; - /* XXX: The conversion to integers here is pretty bogus, (not to - * mention the aribitray limitation of width to a short(!). We - * may need to come up with a better interface for get_size. - */ - rectangle->width = (surface->width_in_points + 0.5); - rectangle->height = (surface->height_in_points + 0.5); + if (_pattern_is_translucent (pattern)) + _cairo_ps_fallback_info_add_area (info, x_dst, y_dst, width, height); +} +static cairo_int_status_t +_ps_locate_fallbacks_show_glyphs (cairo_scaled_font_t *scaled_font, + cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_surface, + int source_x, + int source_y, + int dest_x, + int dest_y, + unsigned int width, + unsigned int height, + const cairo_glyph_t *glyphs, + int num_glyphs) +{ return CAIRO_STATUS_SUCCESS; } -static const cairo_surface_backend_t cairo_ps_surface_backend = { - _cairo_ps_surface_create_similar, - _cairo_ps_surface_finish, - _cairo_ps_surface_acquire_source_image, +static cairo_int_status_t +_ps_locate_fallbacks_fill_path (cairo_operator_t operator, + cairo_pattern_t *pattern, + void *abstract_dst, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance) +{ + return CAIRO_STATUS_SUCCESS; +} + +static const cairo_surface_backend_t ps_locate_fallbacks_backend = { + NULL, /* create_similar */ + NULL, /* finish */ + NULL, /* acquire_source_image */ NULL, /* release_source_image */ - _cairo_ps_surface_acquire_dest_image, + NULL, /* acquire_dest_image */ NULL, /* release_dest_image */ NULL, /* clone_similar */ - NULL, /* composite */ - NULL, /* fill_rectangles */ - NULL, /* composite_trapezoids */ - _cairo_ps_surface_copy_page, - _cairo_ps_surface_show_page, - _cairo_ps_surface_set_clip_region, + _ps_locate_fallbacks_composite, + _ps_locate_fallbacks_fill_rectangles, + _ps_locate_fallbacks_composite_trapezoids, + NULL, /* copy_page */ + NULL, /* show_page */ + NULL, /* set_clip_region */ NULL, /* intersect_clip_path */ - _cairo_ps_surface_get_extents, - NULL /* show_glyphs */ + NULL, /* get_extents */ + _ps_locate_fallbacks_show_glyphs, + _ps_locate_fallbacks_fill_path }; + + +static cairo_int_status_t +_cairo_ps_surface_render_fallbacks (cairo_ps_surface_t *surface, + cairo_surface_t *page) +{ + return CAIRO_STATUS_SUCCESS; +} diff --git a/src/cairo-surface.c b/src/cairo-surface.c index 318ee87d9..e2541a1f9 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -889,6 +889,23 @@ _cairo_surface_set_clip_region (cairo_surface_t *surface, return surface->backend->set_clip_region (surface, region); } +cairo_private cairo_int_status_t +_cairo_surface_intersect_clip_path (cairo_surface_t *surface, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance) +{ + if (surface->finished) + return CAIRO_STATUS_SURFACE_FINISHED; + + assert (surface->backend->intersect_clip_path != NULL); + + return surface->backend->intersect_clip_path (surface, + path, + fill_rule, + tolerance); +} + static cairo_status_t _cairo_surface_set_clip_path_recursive (cairo_surface_t *surface, cairo_clip_path_t *clip_path) diff --git a/src/cairoint.h b/src/cairoint.h index 8ac9bf6a5..7dad819b6 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -1543,6 +1543,12 @@ _cairo_surface_set_clip_region (cairo_surface_t *surface, pixman_region16_t *region, unsigned int serial); +cairo_private cairo_int_status_t +_cairo_surface_intersect_clip_path (cairo_surface_t *surface, + cairo_path_fixed_t *path, + cairo_fill_rule_t fill_rule, + double tolerance); + typedef struct _cairo_clip_path cairo_clip_path_t; cairo_private cairo_status_t @@ -1830,6 +1836,11 @@ cairo_private cairo_status_t _cairo_output_stream_write (cairo_output_stream_t *stream, const void *data, size_t length); +cairo_private void +_cairo_output_stream_write_hex_string (cairo_output_stream_t *stream, + const char *data, + size_t length); + cairo_private cairo_status_t _cairo_output_stream_vprintf (cairo_output_stream_t *stream, const char *fmt, va_list ap); -- cgit v1.2.3 From e314e86cc1eb5feafee621ece4be79d897eb2850 Mon Sep 17 00:00:00 2001 From: David Reveman Date: Mon, 4 Jul 2005 03:58:43 +0000 Subject: Use frame buffer objects for accelerated offscreen drawing in glitz backend --- ChangeLog | 9 +++ configure.in | 2 +- src/cairo-glitz-surface.c | 156 ++++++++++++++++++---------------------------- 3 files changed, 72 insertions(+), 95 deletions(-) diff --git a/ChangeLog b/ChangeLog index c3aeb0ecd..8b6b5191b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-07-04 David Reveman + + * configure.in: Require glitz >= 0.4.4. + + * src/cairo-glitz-surface.c: Use frame buffer objects instead of + pbuffers for accelerated offscreen drawing. + (_cairo_glitz_pattern_acquire_surface): Minor improvement to gradient + pattern creation. + 2005-07-01 Kristian Høgsberg * src/cairo-ps-surface.c: Rewrite postscript backend to generate diff --git a/configure.in b/configure.in index 8fca1e403..af4e25db1 100644 --- a/configure.in +++ b/configure.in @@ -215,7 +215,7 @@ AC_ARG_ENABLE(glitz, [use_glitz=$enableval], [use_glitz=yes]) if test "x$use_glitz" = "xyes"; then - PKG_CHECK_MODULES(GLITZ, glitz >= 0.4.0, [ + PKG_CHECK_MODULES(GLITZ, glitz >= 0.4.4, [ GLITZ_REQUIRES=glitz use_glitz=yes], [use_glitz="no (requires glitz http://freedesktop.org/Software/glitz)"]) fi diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c index ce9da259b..962d0c641 100644 --- a/src/cairo-glitz-surface.c +++ b/src/cairo-glitz-surface.c @@ -440,73 +440,18 @@ _glitz_operator (cairo_operator_t op) return CAIRO_OPERATOR_XOR; } +#define CAIRO_GLITZ_FEATURE_OK(surface, name) \ + (glitz_drawable_get_features (glitz_surface_get_drawable (surface)) & \ + (GLITZ_FEATURE_ ## name ## _MASK)) + static glitz_status_t _glitz_ensure_target (glitz_surface_t *surface) { - glitz_drawable_t *drawable; - - drawable = glitz_surface_get_attached_drawable (surface); - if (!drawable) { - glitz_drawable_format_t *dformat; - glitz_drawable_format_t templ; - glitz_format_t *format; - glitz_drawable_t *pbuffer; - unsigned long mask; - int i; - - format = glitz_surface_get_format (surface); - if (format->type != GLITZ_FORMAT_TYPE_COLOR) - return CAIRO_INT_STATUS_UNSUPPORTED; - - drawable = glitz_surface_get_drawable (surface); - dformat = glitz_drawable_get_format (drawable); - - templ.types.pbuffer = 1; - mask = GLITZ_FORMAT_PBUFFER_MASK; - - templ.samples = dformat->samples; - mask |= GLITZ_FORMAT_SAMPLES_MASK; - - i = 0; - do { - dformat = glitz_find_similar_drawable_format (drawable, - mask, &templ, i++); - - if (dformat) { - int sufficient = 1; - - if (format->color.red_size) { - if (dformat->color.red_size < format->color.red_size) - sufficient = 0; - } - if (format->color.alpha_size) { - if (dformat->color.alpha_size < format->color.alpha_size) - sufficient = 0; - } - - if (sufficient) - break; - } - } while (dformat); - - if (!dformat) - return CAIRO_INT_STATUS_UNSUPPORTED; - - pbuffer = - glitz_create_pbuffer_drawable (drawable, dformat, - glitz_surface_get_width (surface), - glitz_surface_get_height (surface)); - if (!pbuffer) - return CAIRO_INT_STATUS_UNSUPPORTED; - - glitz_surface_attach (surface, pbuffer, - GLITZ_DRAWABLE_BUFFER_FRONT_COLOR, - 0, 0); - - glitz_drawable_destroy (pbuffer); - } + if (glitz_surface_get_attached_drawable (surface) || + CAIRO_GLITZ_FEATURE_OK (surface, FRAMEBUFFER_OBJECT)) + return CAIRO_STATUS_SUCCESS; - return CAIRO_STATUS_SUCCESS; + return CAIRO_INT_STATUS_UNSUPPORTED; } typedef struct _cairo_glitz_surface_attributes { @@ -536,13 +481,26 @@ _cairo_glitz_pattern_acquire_surface (cairo_pattern_t *pattern, switch (pattern->type) { case CAIRO_PATTERN_LINEAR: case CAIRO_PATTERN_RADIAL: { - cairo_gradient_pattern_t *gradient = + cairo_gradient_pattern_t *gradient = (cairo_gradient_pattern_t *) pattern; - glitz_drawable_t *drawable; - glitz_fixed16_16_t *params; - int n_params; - int i; - unsigned short alpha; + char *data; + glitz_fixed16_16_t *params; + int n_params; + unsigned int *pixels; + int i; + unsigned char alpha; + glitz_buffer_t *buffer; + static glitz_pixel_format_t format = { + { + 32, + 0xff000000, + 0x00ff0000, + 0x0000ff00, + 0x000000ff + }, + 0, 0, 0, + GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP + }; /* XXX: the current color gradient acceleration provided by glitz is * experimental, it's been proven inappropriate in a number of ways, @@ -565,22 +523,20 @@ _cairo_glitz_pattern_acquire_surface (cairo_pattern_t *pattern, break; } - drawable = glitz_surface_get_drawable (dst->surface); - if (!(glitz_drawable_get_features (drawable) & - GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK)) + if (!CAIRO_GLITZ_FEATURE_OK (dst->surface, FRAGMENT_PROGRAM)) break; - + if (pattern->filter != CAIRO_FILTER_BILINEAR && pattern->filter != CAIRO_FILTER_GOOD && pattern->filter != CAIRO_FILTER_BEST) break; - alpha = (gradient->stops[0].color.alpha) * 0xffff; + alpha = gradient->stops[0].color.alpha * 0xff; for (i = 1; i < gradient->n_stops; i++) { - unsigned short a; + unsigned char a; - a = (gradient->stops[i].color.alpha) * 0xffff; + a = gradient->stops[i].color.alpha * 0xff; if (a != alpha) break; } @@ -592,35 +548,51 @@ _cairo_glitz_pattern_acquire_surface (cairo_pattern_t *pattern, n_params = gradient->n_stops * 3 + 4; - params = malloc (sizeof (glitz_fixed16_16_t) * n_params); - if (!params) + data = malloc (sizeof (glitz_fixed16_16_t) * n_params + + sizeof (unsigned int) * gradient->n_stops); + if (!data) return CAIRO_STATUS_NO_MEMORY; + params = (glitz_fixed16_16_t *) data; + pixels = (unsigned int *) + (data + sizeof (glitz_fixed16_16_t) * n_params); + + buffer = glitz_buffer_create_for_data (pixels); + if (!buffer) + { + free (data); + return CAIRO_STATUS_NO_MEMORY; + } + src = (cairo_glitz_surface_t *) _cairo_surface_create_similar_scratch (&dst->base, CAIRO_FORMAT_ARGB32, gradient->n_stops, 1); if (!src) { - free (params); + glitz_buffer_destroy (buffer); + free (data); return CAIRO_STATUS_NO_MEMORY; } - for (i = 0; i < gradient->n_stops; i++) { - glitz_color_t color; - - color.red = gradient->stops[i].color.red * alpha; - color.green = gradient->stops[i].color.green * alpha; - color.blue = gradient->stops[i].color.blue * alpha; - color.alpha = alpha; - - glitz_set_rectangle (src->surface, &color, i, 0, 1, 1); - + for (i = 0; i < gradient->n_stops; i++) + { + pixels[i] = + (((int) alpha) << 24) | + (((int) gradient->stops[i].color.red * alpha) << 16) | + (((int) gradient->stops[i].color.green * alpha) << 8) | + (((int) gradient->stops[i].color.blue * alpha)); + params[4 + 3 * i] = gradient->stops[i].offset; params[5 + 3 * i] = i << 16; params[6 + 3 * i] = 0; } + glitz_set_pixels (src->surface, 0, 0, gradient->n_stops, 1, + &format, buffer); + + glitz_buffer_destroy (buffer); + if (pattern->type == CAIRO_PATTERN_LINEAR) { cairo_linear_pattern_t *grad = (cairo_linear_pattern_t *) pattern; @@ -910,10 +882,6 @@ _cairo_glitz_surface_fill_rectangles (void *abstract_dst, glitz_color.blue = color->blue_short; glitz_color.alpha = color->alpha_short; - if (glitz_surface_get_width (dst->surface) != 1 || - glitz_surface_get_height (dst->surface) != 1) - _glitz_ensure_target (dst->surface); - glitz_set_rectangles (dst->surface, &glitz_color, (glitz_rectangle_t *) rects, n_rects); } @@ -1452,7 +1420,7 @@ _cairo_glitz_area_find (cairo_glitz_area_t *area, width, height, kick_out, closure); if (status == CAIRO_STATUS_SUCCESS) - return CAIRO_STATUS_SUCCESS; + return CAIRO_STATUS_SUCCESS; } } break; case CAIRO_GLITZ_AREA_DIVIDED: { -- cgit v1.2.3 From ad0e040fb6625c9fcc76b99c65f3caff098fd256 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 5 Jul 2005 22:30:59 +0000 Subject: Disable the compilation of the _ps_locate_fallbacks code which, inaddition to being broken, appears to not currently be used. --- ChangeLog | 6 ++++++ src/cairo-ps-surface.c | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8b6b5191b..228dbcd40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-07-05 Carl Worth + + * src/cairo-ps-surface.c: Disable the compilation of the + _ps_locate_fallbacks code which, inaddition to being broken, + appears to not currently be used. + 2005-07-04 David Reveman * configure.in: Require glitz >= 0.4.4. diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 730ee9f20..59dac7b54 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -1185,6 +1185,10 @@ struct _cairo_ps_fallback_info { cairo_ps_fallback_area_t *fallback_areas; }; +/* XXX: This code is not compiling correctly (missing return values), + * but also appears to not be used currently. I'm turning it off for + * now. */ +#if 0 static cairo_int_status_t _cairo_ps_fallback_info_add_area (cairo_ps_fallback_info_t *info, int x, int y, @@ -1207,7 +1211,10 @@ _pattern_is_translucent (cairo_pattern_t *abstract_pattern) case CAIRO_PATTERN_LINEAR: case CAIRO_PATTERN_RADIAL: return FALSE; - } + } + + ASSERT_NOT_REACHED; + return FALSE; } static cairo_int_status_t @@ -1303,7 +1310,7 @@ static const cairo_surface_backend_t ps_locate_fallbacks_backend = { _ps_locate_fallbacks_show_glyphs, _ps_locate_fallbacks_fill_path }; - +#endif static cairo_int_status_t _cairo_ps_surface_render_fallbacks (cairo_ps_surface_t *surface, -- cgit v1.2.3 From eb12e493084ace63cebf9eb95b07953a952a817f Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 6 Jul 2005 11:23:39 +0000 Subject: Require libpixman >= 0.1.5, (since 0.1.4 crashes on some X servers). --- ChangeLog | 5 +++++ configure.in | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 228dbcd40..a5174fd65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-07-06 Carl Worth + + * configure.in: Require libpixman >= 0.1.5, (since 0.1.4 crashes + on some X servers). + 2005-07-05 Carl Worth * src/cairo-ps-surface.c: Disable the compilation of the diff --git a/configure.in b/configure.in index af4e25db1..e68f17cdd 100644 --- a/configure.in +++ b/configure.in @@ -233,7 +233,7 @@ AC_SUBST(GLITZ_REQUIRES) dnl =========================================================================== -PKG_CHECK_MODULES(PIXMAN, libpixman >= 0.1.4) +PKG_CHECK_MODULES(PIXMAN, libpixman >= 0.1.5) CAIRO_CFLAGS="$CAIRO_CFLAGS $PIXMAN_CFLAGS" CAIRO_LIBS="$CAIRO_LIBS $PIXMAN_LIBS" -- cgit v1.2.3 From f766e06d25334cd8d75d28d105b6a2fa62f08702 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 6 Jul 2005 14:52:01 +0000 Subject: Remove CAIRO_STATUS_NO_TARGET_SURFAC and add CAIRO_STATUS_INVALID_STATUS. Don't check for gstate->target == NULL anymore as the API now guarantees it never occurs. Check that path->status is a valid status value and cause an INVALID_STATUS error otherwise. Test the new CAIRO_STATUS_INVALID_STATUS error case in cairo_append_path. --- ChangeLog | 18 ++++++++++++++++++ src/cairo-gstate.c | 9 --------- src/cairo.c | 18 +++++++++++++----- src/cairo.h | 27 ++++++++++++++------------- test/path-data.c | 15 +++++++++++++++ 5 files changed, 60 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index a5174fd65..04d06a216 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2005-07-06 Carl Worth + + * src/cairo.h: + * src/cairo.c: (cairo_status_to_string): Remove + CAIRO_STATUS_NO_TARGET_SURFAC and add CAIRO_STATUS_INVALID_STATUS. + + * src/cairo-gstate.c: + (_cairo_gstate_clip_and_composite_trapezoids), + (_cairo_gstate_copy_page), (_cairo_gstate_show_page): Don't check + for gstate->target == NULL anymore as the API now guarantees it + never occurs. + + * src/cairo.c: (cairo_append_path): Check that path->status is a + valid status value and cause an INVALID_STATUS error otherwise. + + * test/path-data.c: (main): Test the new + CAIRO_STATUS_INVALID_STATUS error case in cairo_append_path. + 2005-07-06 Carl Worth * configure.in: Require libpixman >= 0.1.5, (since 0.1.4 crashes diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index 94770f329..50e6a9820 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -1376,9 +1376,6 @@ _cairo_gstate_clip_and_composite_trapezoids (cairo_gstate_t *gstate, if (traps->num_traps == 0) return CAIRO_STATUS_SUCCESS; - if (gstate->target == NULL) - return CAIRO_STATUS_NO_TARGET_SURFACE; - status = _cairo_traps_extract_region (traps, &trap_region); if (status) return status; @@ -1515,18 +1512,12 @@ BAIL: cairo_status_t _cairo_gstate_copy_page (cairo_gstate_t *gstate) { - if (gstate->target == NULL) - return CAIRO_STATUS_NO_TARGET_SURFACE; - return _cairo_surface_copy_page (gstate->target); } cairo_status_t _cairo_gstate_show_page (cairo_gstate_t *gstate) { - if (gstate->target == NULL) - return CAIRO_STATUS_NO_TARGET_SURFACE; - return _cairo_surface_show_page (gstate->target); } diff --git a/src/cairo.c b/src/cairo.c index 470b7305f..56da06eaa 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -62,7 +62,7 @@ static const cairo_t cairo_nil = { * a bit of a pain, but it should be easy to always catch as long as * one adds a new test case to test a trigger of the new status value. */ -#define CAIRO_STATUS_LAST_STATUS CAIRO_STATUS_SURFACE_TYPE_MISMATCH +#define CAIRO_STATUS_LAST_STATUS CAIRO_STATUS_PATTERN_TYPE_MISMATCH /** * _cairo_error: @@ -2268,13 +2268,21 @@ cairo_append_path (cairo_t *cr, return; } - if (path == NULL || path->data == NULL) { + if (path == NULL) { _cairo_error (cr, CAIRO_STATUS_NULL_POINTER); return; } if (path->status) { - _cairo_error (cr, path->status); + if (path->status <= CAIRO_STATUS_LAST_STATUS) + _cairo_error (cr, path->status); + else + _cairo_error (cr, CAIRO_STATUS_INVALID_STATUS); + return; + } + + if (path->data == NULL) { + _cairo_error (cr, CAIRO_STATUS_NULL_POINTER); return; } @@ -2305,8 +2313,8 @@ cairo_status_to_string (cairo_status_t status) return "no current point defined"; case CAIRO_STATUS_INVALID_MATRIX: return "invalid matrix (not invertible)"; - case CAIRO_STATUS_NO_TARGET_SURFACE: - return "no target surface has been set"; + case CAIRO_STATUS_INVALID_STATUS: + return " invalid value for an input cairo_status_t"; case CAIRO_STATUS_NULL_POINTER: return "NULL pointer"; case CAIRO_STATUS_INVALID_STRING: diff --git a/src/cairo.h b/src/cairo.h index fc02c373b..2637a8fd1 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -127,19 +127,20 @@ typedef struct _cairo_user_data_key { /** * cairo_status_t * @CAIRO_STATUS_SUCCESS: no error has occurred - * @CAIRO_STATUS_NO_MEMORY: - * @CAIRO_STATUS_INVALID_RESTORE: + * @CAIRO_STATUS_NO_MEMORY: out of memory + * @CAIRO_STATUS_INVALID_RESTORE: cairo_restore without matching cairo_save * @CAIRO_STATUS_INVALID_POP_GROUP: - * @CAIRO_STATUS_NO_CURRENT_POINT: - * @CAIRO_STATUS_INVALID_MATRIX: - * @CAIRO_STATUS_NO_TARGET_SURFACE: - * @CAIRO_STATUS_NULL_POINTER: - * @CAIRO_STATUS_INVALID_STRING: - * @CAIRO_STATUS_INVALID_PATH_DATA: - * @CAIRO_STATUS_READ_ERROR: - * @CAIRO_STATUS_WRITE_ERROR: - * @CAIRO_STATUS_SURFACE_FINISHED: - * @CAIRO_STATUS_SURFACE_TYPE_MISMATCH: + * @CAIRO_STATUS_NO_CURRENT_POINT: no current point defined + * @CAIRO_STATUS_INVALID_MATRIX: invalid matrix (not invertible) + * @CAIRO_STATUS_INVALID_STATUS: invalid value for an input cairo_status_t + * @CAIRO_STATUS_NULL_POINTER: NULL pointer + * @CAIRO_STATUS_INVALID_STRING: input string not valid UTF-8 + * @CAIRO_STATUS_INVALID_PATH_DATA: input path data not valid + * @CAIRO_STATUS_READ_ERROR: error while reading from input stream + * @CAIRO_STATUS_WRITE_ERROR: error while writing to output stream + * @CAIRO_STATUS_SURFACE_FINISHED: target surface has been finished + * @CAIRO_STATUS_SURFACE_TYPE_MISMATCH: the surface type is not appropriate for the operation + * @CAIRO_STATUS_PATTERN_TYPE_MISMATCH: the pattern type is not appropriate for the operation * * #cairo_status_t is used to indicate errors that can occur when * using Cairo. In some cases it is returned directly by functions. @@ -153,7 +154,7 @@ typedef enum cairo_status { CAIRO_STATUS_INVALID_POP_GROUP, CAIRO_STATUS_NO_CURRENT_POINT, CAIRO_STATUS_INVALID_MATRIX, - CAIRO_STATUS_NO_TARGET_SURFACE, + CAIRO_STATUS_INVALID_STATUS, CAIRO_STATUS_NULL_POINTER, CAIRO_STATUS_INVALID_STRING, CAIRO_STATUS_INVALID_PATH_DATA, diff --git a/test/path-data.c b/test/path-data.c index b2d7edbf5..b02ce4333 100644 --- a/test/path-data.c +++ b/test/path-data.c @@ -151,9 +151,24 @@ main (void) return 1; cairo_destroy (cr); + cr = cairo_create (surface); + path.status = -1; + cairo_append_path (cr, &path); + if (cairo_status (cr) != CAIRO_STATUS_INVALID_STATUS) + return 1; + cairo_destroy (cr); + + cr = cairo_create (surface); + path.status = CAIRO_STATUS_NO_MEMORY; + cairo_append_path (cr, &path); + if (cairo_status (cr) != CAIRO_STATUS_NO_MEMORY) + return 1; + cairo_destroy (cr); + cr = cairo_create (surface); path.data = NULL; path.num_data = 0; + path.status = CAIRO_STATUS_SUCCESS; cairo_append_path (cr, &path); if (cairo_status (cr) != CAIRO_STATUS_NULL_POINTER) return 1; -- cgit v1.2.3 From 9fd2f0a25c4954e839d79de00ff14b1990ae39eb Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 7 Jul 2005 01:15:21 +0000 Subject: Add a missing word. Note that the BadMatch bug has been resolved. --- CODING_STYLE | 4 ++-- ChangeLog | 6 ++++++ ROADMAP | 9 ++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CODING_STYLE b/CODING_STYLE index 04fc53c44..143723d4f 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -57,8 +57,8 @@ but some of the code uses an alternate style: } and that seems just fine. We won't lay down any strict rule on this -point, (though there should be some local). If you came here hoping to -find some guidance, then use the first form above. +point, (though there should be some local consistency). If you came +here hoping to find some guidance, then use the first form above. If all of the substatements of an if statement are single statements, the optional braces should not usually appear: diff --git a/ChangeLog b/ChangeLog index 04d06a216..e0cbedb7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-07-07 Carl Worth + + * CODING_STYLE: Add a missing word. + + * ROADMAP: Note that the BadMatch bug has been resolved. + 2005-07-06 Carl Worth * src/cairo.h: diff --git a/ROADMAP b/ROADMAP index 602e48c99..385463e8f 100644 --- a/ROADMAP +++ b/ROADMAP @@ -1,12 +1,15 @@ cairo 0.5.2 =========== - Get tor to sign off that the win32 stuff is up to snuff + Get tor to sign off that the win32 stuff is up to snuff glyph path patch reviewed and committed - Fix the BadMatch error introduced between 0.5.0 and 0.5.1: +✓ Fix the BadMatch error introduced between 0.5.0 and 0.5.1: https://bugs.freedesktop.org/show_bug.cgi?id=3604 - Add a workaround for Render's overlapping source/dest bug + (It turns out this was just exposing an old bug in libpixman + 0.1.4 which is already fixed in libpixman 0.1.5) + + Add a workaround for Render's overlapping source/dest bug Use XCopyArea when possible (integer translation) Otherwise make a copy of the source -- cgit v1.2.3 From 9a2ba48b298c3bf4b462e1030b105efaf9fd015c Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 8 Jul 2005 10:12:28 +0000 Subject: Give enum tags an underscore prefix to match the style of the struct tags. Add new cairo_content_t and change cairo_surface_create_similar to accept a cairo_content_t rather than a cairo_format_t. Change surface backend create_similar call to accept a cairo_content_t rather than a cairo_format_t. Fix all calls into create_similar to pass a cairo_content_t rather than a cairo_format_t. --- ChangeLog | 44 +++++++++++++++++++ src/cairo-glitz-surface.c | 41 +++++++++--------- src/cairo-gstate.c | 10 ++--- src/cairo-image-surface.c | 52 +++++++++++++++++++++-- src/cairo-meta-surface.c | 4 +- src/cairo-pattern.c | 2 +- src/cairo-pdf-surface.c | 4 +- src/cairo-ps-surface.c | 10 ++--- src/cairo-quartz-surface.c | 11 +++-- src/cairo-surface.c | 36 ++++++++++++---- src/cairo-win32-surface.c | 9 ++-- src/cairo-xcb-surface.c | 6 ++- src/cairo-xlib-surface.c | 8 ++-- src/cairo.h | 103 ++++++++++++++++++++++++++++----------------- src/cairoint.h | 14 ++++-- test/mask.c | 4 +- test/pixman-rotate.c | 2 +- test/source-clip.c | 2 +- 18 files changed, 256 insertions(+), 106 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0cbedb7e..931070235 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,47 @@ +2005-07-08 Carl Worth + + * src/cairo.h: Give enum tags an underscore prefix to match the + style of the struct tags. Add new cairo_content_t and change + cairo_surface_create_similar to accept a cairo_content_t rather + than a cairo_format_t. + + * src/cairoint.h: + * src/cairo-glitz-surface.c: (_cairo_glitz_surface_create_similar): + * src/cairo-image-surface.c: (_cairo_image_surface_create_similar): + * src/cairo-meta-surface.c: (_cairo_meta_surface_create_similar): + * src/cairo-pdf-surface.c: (_cairo_pdf_surface_create_similar): + * src/cairo-ps-surface.c: (_cairo_ps_surface_create_similar): + * src/cairo-quartz-surface.c: (_cairo_quartz_surface_create_similar): + * src/cairo-surface.c: (_cairo_surface_create_similar_scratch), + (cairo_surface_create_similar), + (_cairo_surface_create_similar_solid): + * src/cairo-win32-surface.c: (_cairo_win32_surface_create_similar), + (_cairo_win32_surface_get_subimage): + * src/cairo-xcb-surface.c: (_cairo_xcb_surface_create_similar), + (_cairo_xcb_surface_clone_similar): + * src/cairo-xlib-surface.c: (_cairo_xlib_surface_create_similar), + (_cairo_xlib_surface_clone_similar): Change surface backend + create_similar call to accept a cairo_content_t rather than a + cairo_format_t. + + * src/cairo-glitz-surface.c: (_glitz_format_from_content), + (_cairo_glitz_surface_clone_similar), + (_cairo_glitz_pattern_acquire_surface), + (_cairo_glitz_surface_fill_rectangles), + (_cairo_glitz_surface_composite_trapezoids): + * src/cairo-gstate.c: (_cairo_gstate_mask), + (_composite_traps_intermediate_surface), + (_cairo_gstate_intersect_clip_mask), (_cairo_gstate_show_glyphs): + * src/cairo-image-surface.c: (cairo_image_surface_create), + (cairo_image_surface_create_for_data), + (_cairo_format_from_content), (_cairo_content_from_format): + * src/cairo-pattern.c: (_cairo_pattern_acquire_surface_for_solid): + * src/cairo-ps-surface.c: (emit_image): + * test/mask.c: (mask_polygon), (draw): + * test/pixman-rotate.c: (draw): + * test/source-clip.c: (draw): Fix all calls into create_similar to + pass a cairo_content_t rather than a cairo_format_t. + 2005-07-07 Carl Worth * CODING_STYLE: Add a missing word. diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c index 962d0c641..4b9d619e6 100644 --- a/src/cairo-glitz-surface.c +++ b/src/cairo-glitz-surface.c @@ -52,26 +52,26 @@ _cairo_glitz_surface_finish (void *abstract_surface) } static glitz_format_name_t -_glitz_format (cairo_format_t format) +_glitz_format_from_content (cairo_content_t content) { - switch (format) { - default: - case CAIRO_FORMAT_ARGB32: - return GLITZ_STANDARD_ARGB32; - case CAIRO_FORMAT_RGB24: + switch (content) { + case CAIRO_CONTENT_COLOR: return GLITZ_STANDARD_RGB24; - case CAIRO_FORMAT_A8: + case CAIRO_CONTENT_ALPHA: return GLITZ_STANDARD_A8; - case CAIRO_FORMAT_A1: - return GLITZ_STANDARD_A1; + case CAIRO_CONTENT_COLOR_ALPHA: + return GLITZ_STANDARD_ARGB32; } + + ASSERT_NOT_REACHED; + return GLITZ_STANDARD_ARGB32; } static cairo_surface_t * _cairo_glitz_surface_create_similar (void *abstract_src, - cairo_format_t format, - int width, - int height) + cairo_content_t content, + int width, + int height) { cairo_glitz_surface_t *src = abstract_src; cairo_surface_t *crsurface; @@ -81,7 +81,8 @@ _cairo_glitz_surface_create_similar (void *abstract_src, drawable = glitz_surface_get_drawable (src->surface); - gformat = glitz_find_standard_format (drawable, _glitz_format (format)); + gformat = glitz_find_standard_format (drawable, + _glitz_format_from_content (content)); if (!gformat) return NULL; @@ -350,9 +351,10 @@ _cairo_glitz_surface_clone_similar (void *abstract_surface, else if (_cairo_surface_is_image (src)) { cairo_image_surface_t *image_src = (cairo_image_surface_t *) src; + cairo_content_t content = _cairo_content_from_format (image_src->format); clone = (cairo_glitz_surface_t *) - _cairo_glitz_surface_create_similar (surface, image_src->format, + _cairo_glitz_surface_create_similar (surface, content, image_src->width, image_src->height); if (!clone) @@ -563,10 +565,10 @@ _cairo_glitz_pattern_acquire_surface (cairo_pattern_t *pattern, free (data); return CAIRO_STATUS_NO_MEMORY; } - + src = (cairo_glitz_surface_t *) _cairo_surface_create_similar_scratch (&dst->base, - CAIRO_FORMAT_ARGB32, + CAIRO_CONTENT_COLOR_ALPHA, gradient->n_stops, 1); if (!src) { @@ -897,7 +899,8 @@ _cairo_glitz_surface_fill_rectangles (void *abstract_dst, src = (cairo_glitz_surface_t *) _cairo_surface_create_similar_solid (&dst->base, - CAIRO_FORMAT_ARGB32, 1, 1, + CAIRO_CONTENT_COLOR_ALPHA, + 1, 1, (cairo_color_t *) color); if (!src) return CAIRO_STATUS_NO_MEMORY; @@ -999,7 +1002,7 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op, mask = (cairo_glitz_surface_t *) _cairo_glitz_surface_create_similar (&dst->base, - CAIRO_FORMAT_A8, + CAIRO_CONTENT_ALPHA, 2, 1); if (!mask) { @@ -1099,7 +1102,7 @@ _cairo_glitz_surface_composite_trapezoids (cairo_operator_t op, mask = (cairo_glitz_surface_t *) _cairo_surface_create_similar_scratch (&dst->base, - CAIRO_FORMAT_A8, + CAIRO_CONTENT_ALPHA, width, height); if (!mask) { diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index 50e6a9820..2388900b3 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -903,7 +903,7 @@ _cairo_gstate_mask (cairo_gstate_t *gstate, cairo_surface_t *intermediate; intermediate = cairo_surface_create_similar (gstate->clip.surface, - CAIRO_FORMAT_A8, + CAIRO_CONTENT_ALPHA, extents.width, extents.height); if (intermediate == NULL) @@ -1242,7 +1242,7 @@ _composite_traps_intermediate_surface (cairo_gstate_t *gstate, translate_traps (traps, -extents->x, -extents->y); intermediate = _cairo_surface_create_similar_solid (gstate->clip.surface, - CAIRO_FORMAT_A8, + CAIRO_CONTENT_ALPHA, extents->width, extents->height, CAIRO_COLOR_TRANSPARENT); @@ -1718,7 +1718,7 @@ _cairo_gstate_intersect_clip_mask (cairo_gstate_t *gstate, _cairo_rectangle_intersect (&surface_rect, &gstate->clip.surface_rect); surface = _cairo_surface_create_similar_solid (gstate->target, - CAIRO_FORMAT_A8, + CAIRO_CONTENT_ALPHA, surface_rect.width, surface_rect.height, CAIRO_COLOR_WHITE); @@ -2129,9 +2129,9 @@ _cairo_gstate_show_glyphs (cairo_gstate_t *gstate, status = CAIRO_STATUS_SUCCESS; goto BAIL1; } - + intermediate = _cairo_surface_create_similar_solid (gstate->clip.surface, - CAIRO_FORMAT_A8, + CAIRO_CONTENT_ALPHA, extents.width, extents.height, CAIRO_COLOR_TRANSPARENT); diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 255cd0c43..8ee50e48e 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -156,6 +156,10 @@ cairo_image_surface_create (cairo_format_t format, pixman_format_t *pixman_format; pixman_image_t *pixman_image; + /* XXX: Really need to make this kind of thing pass through _cairo_error. */ + if (! CAIRO_FORMAT_VALID (format)) + return NULL; + pixman_format = _create_pixman_format (format); if (pixman_format == NULL) return NULL; @@ -205,6 +209,10 @@ cairo_image_surface_create_for_data (unsigned char *data, pixman_format_t *pixman_format; pixman_image_t *pixman_image; + /* XXX: Really need to make this kind of thing pass through _cairo_error. */ + if (! CAIRO_FORMAT_VALID (format)) + return NULL; + pixman_format = _create_pixman_format (format); if (pixman_format == NULL) return NULL; @@ -256,13 +264,51 @@ cairo_image_surface_get_height (cairo_surface_t *surface) return image_surface->height; } +cairo_format_t +_cairo_format_from_content (cairo_content_t content) +{ + switch (content) { + case CAIRO_CONTENT_COLOR: + return CAIRO_FORMAT_RGB24; + case CAIRO_CONTENT_ALPHA: + return CAIRO_FORMAT_A8; + case CAIRO_CONTENT_COLOR_ALPHA: + return CAIRO_FORMAT_ARGB32; + } + + ASSERT_NOT_REACHED; + return CAIRO_FORMAT_ARGB32; +} + +cairo_content_t +_cairo_content_from_format (cairo_format_t format) +{ + switch (format) { + case CAIRO_FORMAT_ARGB32: + return CAIRO_CONTENT_COLOR_ALPHA; + case CAIRO_FORMAT_RGB24: + return CAIRO_CONTENT_COLOR; + case CAIRO_FORMAT_A8: + case CAIRO_FORMAT_A1: + return CAIRO_CONTENT_ALPHA; + } + + ASSERT_NOT_REACHED; + return CAIRO_CONTENT_COLOR_ALPHA; +} + static cairo_surface_t * -_cairo_image_surface_create_similar (void *abstract_src, - cairo_format_t format, +_cairo_image_surface_create_similar (void *abstract_src, + cairo_content_t content, int width, int height) { - return cairo_image_surface_create (format, width, height); + /* XXX: Really need to make this kind of thing pass through _cairo_error. */ + if (! CAIRO_CONTENT_VALID (content)) + return NULL; + + return cairo_image_surface_create (_cairo_format_from_content (content), + width, height); } static cairo_status_t diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c index 4ed72578a..182bb13f1 100644 --- a/src/cairo-meta-surface.c +++ b/src/cairo-meta-surface.c @@ -65,8 +65,8 @@ _cairo_meta_surface_create (double width, double height) } static cairo_surface_t * -_cairo_meta_surface_create_similar (void *abstract_surface, - cairo_format_t format, +_cairo_meta_surface_create_similar (void *abstract_surface, + cairo_content_t content, int width, int height) { diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 270d5c7ae..5af55bf89 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -1225,7 +1225,7 @@ _cairo_pattern_acquire_surface_for_solid (cairo_solid_pattern_t *pattern, cairo_surface_attributes_t *attribs) { *out = _cairo_surface_create_similar_solid (dst, - CAIRO_FORMAT_ARGB32, + CAIRO_CONTENT_COLOR_ALPHA, 1, 1, &pattern->color); diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 34b79c4b6..bfb772170 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -389,8 +389,8 @@ _cairo_pdf_surface_clear (cairo_pdf_surface_t *surface) } static cairo_surface_t * -_cairo_pdf_surface_create_similar (void *abstract_src, - cairo_format_t format, +_cairo_pdf_surface_create_similar (void *abstract_src, + cairo_content_t content, int width, int height) { diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 59dac7b54..6684c6e68 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -153,10 +153,10 @@ cairo_ps_surface_create_for_stream (cairo_write_func_t write_func, } static cairo_surface_t * -_cairo_ps_surface_create_similar (void *abstract_src, - cairo_format_t format, - int width, - int height) +_cairo_ps_surface_create_similar (void *abstract_src, + cairo_content_t content, + int width, + int height) { return NULL; } @@ -593,7 +593,7 @@ emit_image (cairo_ps_surface_t *surface, current image over a white RGB surface to eliminate it. */ opaque = _cairo_surface_create_similar_solid (&image->base, - CAIRO_FORMAT_RGB24, + CAIRO_CONTENT_COLOR, image->width, image->height, CAIRO_COLOR_WHITE); diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c index 566842515..d0b32d972 100644 --- a/src/cairo-quartz-surface.c +++ b/src/cairo-quartz-surface.c @@ -58,12 +58,11 @@ ImageDataReleaseFunc(void *info, const void *data, size_t size) } } -static cairo_surface_t *_cairo_quartz_surface_create_similar(void - *abstract_src, - cairo_format_t - format, - int width, - int height) +static cairo_surface_t * +_cairo_quartz_surface_create_similar (void *abstract_src, + cairo_content_t content, + int width, + int height) { return NULL; } diff --git a/src/cairo-surface.c b/src/cairo-surface.c index e2541a1f9..9f4764ca3 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -59,42 +59,62 @@ _cairo_surface_init (cairo_surface_t *surface, } cairo_surface_t * -_cairo_surface_create_similar_scratch (cairo_surface_t *other, - cairo_format_t format, +_cairo_surface_create_similar_scratch (cairo_surface_t *other, + cairo_content_t content, int width, int height) { if (other == NULL) return NULL; - return other->backend->create_similar (other, format, width, height); + return other->backend->create_similar (other, content, width, height); } +/** + * cairo_surface_create_similar: + * @other: an existing surface used to select the backend of the new surface + * @content: the content for the new surface + * @width: width of the new surface, (in device-space units) + * @height: height of the new surface (in device-space units) + * + * Create a new surface that is as compatible as possible with an + * existing surface. The new surface will use the same backend as + * @other unless that is not possible for some reason. + * + * Return value: a pointer to the newly allocated surface, or NULL in + * the case of errors. The caller owns the surface and should call + * cairo_surface_destroy when done with it. + **/ cairo_surface_t * -cairo_surface_create_similar (cairo_surface_t *other, - cairo_format_t format, +cairo_surface_create_similar (cairo_surface_t *other, + cairo_content_t content, int width, int height) { if (other == NULL) return NULL; - return _cairo_surface_create_similar_solid (other, format, + /* XXX: Really need to make this kind of thing pass through _cairo_error. */ + if (! CAIRO_CONTENT_VALID (content)) + return NULL; + + return _cairo_surface_create_similar_solid (other, content, width, height, CAIRO_COLOR_TRANSPARENT); } cairo_surface_t * _cairo_surface_create_similar_solid (cairo_surface_t *other, - cairo_format_t format, + cairo_content_t content, int width, int height, const cairo_color_t *color) { cairo_status_t status; cairo_surface_t *surface; + cairo_format_t format = _cairo_format_from_content (content); - surface = _cairo_surface_create_similar_scratch (other, format, + surface = _cairo_surface_create_similar_scratch (other, content, width, height); if (surface == NULL) diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c index f4d3062b6..b58e6458d 100644 --- a/src/cairo-win32-surface.c +++ b/src/cairo-win32-surface.c @@ -290,11 +290,12 @@ _cairo_win32_surface_create_for_dc (HDC original_dc, static cairo_surface_t * _cairo_win32_surface_create_similar (void *abstract_src, - cairo_format_t format, + cairo_content_t content, int width, int height) { cairo_win32_surface_t *src = abstract_src; + cairo_format_t format = _cairo_format_from_content (content); return _cairo_win32_surface_create_for_dc (src->dc, format, width, height); } @@ -351,11 +352,13 @@ _cairo_win32_surface_get_subimage (cairo_win32_surface_t *surface, { cairo_win32_surface_t *local; cairo_status_t status; + cairo_content_t content = _cairo_content_from_format (surface->format); local = (cairo_win32_surface_t *) _cairo_win32_surface_create_similar (surface, - surface->format, - width, height); + content, + width, + height); if (!local) return CAIRO_STATUS_NO_MEMORY; diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c index 4e3204452..1b0e2aaee 100644 --- a/src/cairo-xcb-surface.c +++ b/src/cairo-xcb-surface.c @@ -228,7 +228,7 @@ _CAIRO_FORMAT_DEPTH (cairo_format_t format) static cairo_surface_t * _cairo_xcb_surface_create_similar (void *abstract_src, - cairo_format_t format, + cairo_content_t content, int width, int height) { @@ -236,6 +236,7 @@ _cairo_xcb_surface_create_similar (void *abstract_src, XCBConnection *dpy = src->dpy; XCBDRAWABLE d; cairo_xcb_surface_t *surface; + cairo_format_t format = _cairo_format_from_content (content); XCBRenderPICTFORMINFO xrender_format = _format_from_cairo (dpy, format); /* As a good first approximation, if the display doesn't have COMPOSITE, @@ -635,9 +636,10 @@ _cairo_xcb_surface_clone_similar (void *abstract_surface, } } else if (_cairo_surface_is_image (src)) { cairo_image_surface_t *image_src = (cairo_image_surface_t *)src; + cairo_content_t content = _cairo_content_from_format (image_src->format); clone = (cairo_xcb_surface_t *) - _cairo_xcb_surface_create_similar (surface, image_src->format, + _cairo_xcb_surface_create_similar (surface, content, image_src->width, image_src->height); if (clone == NULL) return CAIRO_STATUS_NO_MEMORY; diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index f10dcfc57..c5b26e505 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -179,8 +179,8 @@ _CAIRO_FORMAT_XRENDER_FORMAT(Display *dpy, cairo_format_t format) } static cairo_surface_t * -_cairo_xlib_surface_create_similar (void *abstract_src, - cairo_format_t format, +_cairo_xlib_surface_create_similar (void *abstract_src, + cairo_content_t content, int width, int height) { @@ -189,6 +189,7 @@ _cairo_xlib_surface_create_similar (void *abstract_src, int scr; Pixmap pix; cairo_xlib_surface_t *surface; + cairo_format_t format = _cairo_format_from_content (content); int depth = _CAIRO_FORMAT_DEPTH (format); XRenderPictFormat *xrender_format = _CAIRO_FORMAT_XRENDER_FORMAT (dpy, format); @@ -639,9 +640,10 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface, } } else if (_cairo_surface_is_image (src)) { cairo_image_surface_t *image_src = (cairo_image_surface_t *)src; + cairo_content_t content = _cairo_content_from_format (image_src->format); clone = (cairo_xlib_surface_t *) - _cairo_xlib_surface_create_similar (surface, image_src->format, + _cairo_xlib_surface_create_similar (surface, content, image_src->width, image_src->height); if (clone == NULL) return CAIRO_STATUS_NO_MEMORY; diff --git a/src/cairo.h b/src/cairo.h index 2637a8fd1..41ae83ce7 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -147,7 +147,7 @@ typedef struct _cairo_user_data_key { * but when using #cairo_t, the last error, if any, is stored in * the context and can be retrieved with cairo_status(). **/ -typedef enum cairo_status { +typedef enum _cairo_status { CAIRO_STATUS_SUCCESS = 0, CAIRO_STATUS_NO_MEMORY, CAIRO_STATUS_INVALID_RESTORE, @@ -221,7 +221,7 @@ cairo_pop_group (cairo_t *cr); /* Modify state */ -typedef enum cairo_operator { +typedef enum _cairo_operator { CAIRO_OPERATOR_CLEAR, CAIRO_OPERATOR_SOURCE, @@ -285,7 +285,7 @@ cairo_set_tolerance (cairo_t *cr, double tolerance); * (Note that filling is not actually implemented in this way. This * is just a description of the rule that is applied.) **/ -typedef enum cairo_fill_rule { +typedef enum _cairo_fill_rule { CAIRO_FILL_RULE_WINDING, CAIRO_FILL_RULE_EVEN_ODD } cairo_fill_rule_t; @@ -305,7 +305,7 @@ cairo_set_line_width (cairo_t *cr, double width); * * enumeration for style of line-endings **/ -typedef enum cairo_line_cap { +typedef enum _cairo_line_cap { CAIRO_LINE_CAP_BUTT, CAIRO_LINE_CAP_ROUND, CAIRO_LINE_CAP_SQUARE @@ -314,7 +314,7 @@ typedef enum cairo_line_cap { void cairo_set_line_cap (cairo_t *cr, cairo_line_cap_t line_cap); -typedef enum cairo_line_join { +typedef enum _cairo_line_join { CAIRO_LINE_JOIN_MITER, CAIRO_LINE_JOIN_ROUND, CAIRO_LINE_JOIN_BEVEL @@ -625,13 +625,13 @@ typedef struct { double max_y_advance; } cairo_font_extents_t; -typedef enum cairo_font_slant { +typedef enum _cairo_font_slant { CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_SLANT_ITALIC, CAIRO_FONT_SLANT_OBLIQUE } cairo_font_slant_t; -typedef enum cairo_font_weight { +typedef enum _cairo_font_weight { CAIRO_FONT_WEIGHT_NORMAL, CAIRO_FONT_WEIGHT_BOLD } cairo_font_weight_t; @@ -825,7 +825,7 @@ cairo_get_target (cairo_t *cr); * cairo_path_destroy (path); * */ -typedef enum cairo_path_data_type { +typedef enum _cairo_path_data_type { CAIRO_PATH_MOVE_TO, CAIRO_PATH_LINE_TO, CAIRO_PATH_CURVE_TO, @@ -888,39 +888,32 @@ cairo_status_to_string (cairo_status_t status); /* Surface manipulation */ /** - * cairo_format_t - * @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with - * alpha in the upper 8 bits, then red, then green, then blue. - * The 32-bit quantities are stored native-endian. Pre-multiplied - * alpha is used. (That is, 50% transparent red is 0x80800000, - * not 0x80ff0000.) - * @CAIRO_FORMAT_RGB24: each pixel is a 32-bit quantity, with - * the upper 8 bits unused. Red, Green, and Blue are stored - * in the remaining 24 bits in that order. - * @CAIRO_FORMAT_A8: each pixel is a 8-bit quantity holding - * an alpha value. - * @CAIRO_FORMAT_A1: each pixel is a 1-bit quantity holding - * an alpha value. Pixels are packed together into 32-bit - * quantities. The ordering of the bits matches the - * endianess of the platform. On a big-endian machine, the - * first pixel is in the uppermost bit, on a little-endian - * machine the first pixel is in the least-significant bit. + * cairo_content_t + * @CAIRO_CONTENT_COLOR: The surface will hold color content only. + * @CAIRO_CONTENT_ALPHA: The surface will hold alpha content only. + * @CAIRO_CONTENT_COLOR_ALPHA: The surface will hold color and alpha content. * - * #cairo_format_t is used to identify the memory format of - * image data. + * @cairo_content_t is used to describe the content that a surface will + * contain, whether color information, alpha information (translucence + * vs. opacity), or both. + * + * Note: The large values here are designed to keep cairo_content_t + * values distinct from cairo_format_t values so that the + * implementation can detect the error if users confuse the two types. */ -typedef enum cairo_format { - CAIRO_FORMAT_ARGB32, - CAIRO_FORMAT_RGB24, - CAIRO_FORMAT_A8, - CAIRO_FORMAT_A1 -} cairo_format_t; +typedef enum _cairo_content { + CAIRO_CONTENT_COLOR = 0x1000, + CAIRO_CONTENT_ALPHA = 0x2000, + CAIRO_CONTENT_COLOR_ALPHA = 0x3000 +} cairo_content_t; + +#define CAIRO_CONTENT_VALID(content) (((content) & ~(CAIRO_CONTENT_COLOR | \ + CAIRO_CONTENT_ALPHA | \ + CAIRO_CONTENT_COLOR_ALPHA)) == 0) -/* XXX: I want to remove this function, (replace with - cairo_begin_group and friends). */ cairo_surface_t * -cairo_surface_create_similar (cairo_surface_t *other, - cairo_format_t format, +cairo_surface_create_similar (cairo_surface_t *other, + cairo_content_t content, int width, int height); @@ -963,6 +956,38 @@ cairo_surface_set_device_offset (cairo_surface_t *surface, /* Image-surface functions */ +/** + * cairo_format_t + * @CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with + * alpha in the upper 8 bits, then red, then green, then blue. + * The 32-bit quantities are stored native-endian. Pre-multiplied + * alpha is used. (That is, 50% transparent red is 0x80800000, + * not 0x80ff0000.) + * @CAIRO_FORMAT_RGB24: each pixel is a 32-bit quantity, with + * the upper 8 bits unused. Red, Green, and Blue are stored + * in the remaining 24 bits in that order. + * @CAIRO_FORMAT_A8: each pixel is a 8-bit quantity holding + * an alpha value. + * @CAIRO_FORMAT_A1: each pixel is a 1-bit quantity holding + * an alpha value. Pixels are packed together into 32-bit + * quantities. The ordering of the bits matches the + * endianess of the platform. On a big-endian machine, the + * first pixel is in the uppermost bit, on a little-endian + * machine the first pixel is in the least-significant bit. + * + * #cairo_format_t is used to identify the memory format of + * image data. + */ +typedef enum _cairo_format { + CAIRO_FORMAT_ARGB32, + CAIRO_FORMAT_RGB24, + CAIRO_FORMAT_A8, + CAIRO_FORMAT_A1 +} cairo_format_t; + +#define CAIRO_FORMAT_VALID(format) ((format) >= CAIRO_FORMAT_ARGB32 && \ + (format) <= CAIRO_FORMAT_A1) + cairo_surface_t * cairo_image_surface_create (cairo_format_t format, int width, @@ -1040,7 +1065,7 @@ void cairo_pattern_get_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix); -typedef enum { +typedef enum _cairo_extend { CAIRO_EXTEND_NONE, CAIRO_EXTEND_REPEAT, CAIRO_EXTEND_REFLECT @@ -1052,7 +1077,7 @@ cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend); cairo_extend_t cairo_pattern_get_extend (cairo_pattern_t *pattern); -typedef enum { +typedef enum _cairo_filter { CAIRO_FILTER_FAST, CAIRO_FILTER_GOOD, CAIRO_FILTER_BEST, diff --git a/src/cairoint.h b/src/cairoint.h index 7dad819b6..21d7bbfd7 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -586,7 +586,7 @@ extern const cairo_private struct _cairo_scaled_font_backend cairo_atsui_scaled_ typedef struct _cairo_surface_backend { cairo_surface_t * (*create_similar) (void *surface, - cairo_format_t format, + cairo_content_t content, int width, int height); @@ -1424,14 +1424,14 @@ _cairo_path_fixed_stroke_to_traps (cairo_path_fixed_t *path, /* cairo-surface.c */ cairo_private cairo_surface_t * -_cairo_surface_create_similar_scratch (cairo_surface_t *other, - cairo_format_t format, +_cairo_surface_create_similar_scratch (cairo_surface_t *other, + cairo_content_t content, int width, int height); cairo_private cairo_surface_t * _cairo_surface_create_similar_solid (cairo_surface_t *other, - cairo_format_t format, + cairo_content_t content, int width, int height, const cairo_color_t *color); @@ -1576,6 +1576,12 @@ _cairo_surface_show_glyphs (cairo_scaled_font_t *scaled_font, /* cairo_image_surface.c */ +cairo_private cairo_format_t +_cairo_format_from_content (cairo_content_t content); + +cairo_private cairo_content_t +_cairo_content_from_format (cairo_format_t format); + cairo_private cairo_image_surface_t * _cairo_image_surface_create_with_masks (unsigned char *data, cairo_format_masks_t *format, diff --git a/test/mask.c b/test/mask.c index ec0322da0..89626167b 100644 --- a/test/mask.c +++ b/test/mask.c @@ -74,7 +74,7 @@ mask_polygon (cairo_t *cr, int x, int y) cairo_t *cr2; mask_surface = cairo_surface_create_similar (cairo_get_target (cr), - CAIRO_FORMAT_A8, + CAIRO_CONTENT_ALPHA, WIDTH, HEIGHT); cr2 = cairo_create (mask_surface); @@ -196,7 +196,7 @@ draw (cairo_t *cr, int width, int height) * a temporary surface and copy over. */ tmp_surface = cairo_surface_create_similar (cairo_get_target (cr), - CAIRO_FORMAT_ARGB32, + CAIRO_CONTENT_COLOR_ALPHA, IMAGE_WIDTH, IMAGE_HEIGHT); cr2 = cairo_create (tmp_surface); diff --git a/test/pixman-rotate.c b/test/pixman-rotate.c index 5c6fe4140..93ed42b30 100644 --- a/test/pixman-rotate.c +++ b/test/pixman-rotate.c @@ -28,7 +28,7 @@ draw (cairo_t *cr, int width, int height) cairo_t *cr2; stamp = cairo_surface_create_similar (cairo_get_target (cr), - CAIRO_FORMAT_ARGB32, + CAIRO_CONTENT_COLOR_ALPHA, WIDTH, HEIGHT); cr2 = cairo_create (stamp); { diff --git a/test/source-clip.c b/test/source-clip.c index 73be6b432..f479e485a 100644 --- a/test/source-clip.c +++ b/test/source-clip.c @@ -43,7 +43,7 @@ draw (cairo_t *cr, int width, int height) cairo_t *cr2; source_surface = cairo_surface_create_similar (cairo_get_target (cr), - CAIRO_FORMAT_ARGB32, + CAIRO_CONTENT_COLOR_ALPHA, SIZE, SIZE); cr2 = cairo_create (source_surface); -- cgit v1.2.3 From 36a57bcdcbb0025250bfa037fbd7e7c08819e43b Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Sat, 9 Jul 2005 15:47:43 +0000 Subject: More misc merging. Mostly stuff like s/uint32_t/CARD32/. --- pixman/ChangeLog | 16 ++ pixman/src/ic.c | 626 +++++++++++++++++++++++++++---------------------------- 2 files changed, 329 insertions(+), 313 deletions(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index 1bcf0933b..cb494a5d8 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,19 @@ +2005-07-09 Jeff Muizelaar + + * src/ic.c: (fbOver), (fbOver24), (fbIn), + (pixman_compositeSolidMask_nx8x8888), + (pixman_compositeSolidMask_nx8888x8888C), + (pixman_compositeSolidMask_nx8x0888), + (pixman_compositeSolidMask_nx8x0565), + (pixman_compositeSolidMask_nx8888x0565C), + (pixman_compositeSrc_8888x8888), (pixman_compositeSrc_8888x0888), + (pixman_compositeSrc_8888x0565), (pixman_compositeSrc_0565x0565), + (pixman_compositeSrcAdd_8000x8000), + (pixman_compositeSrcAdd_8888x8888), + (pixman_compositeSrcAdd_1000x1000), + (pixman_compositeSolidMask_nx1xn), (pixman_composite): + More misc merging. Mostly stuff like s/uint32_t/CARD32/. + 2005-06-25 Jeff Muizelaar * src/ic.c: (fbOver): diff --git a/pixman/src/ic.c b/pixman/src/ic.c index 1fc715a6b..8a9cb1d52 100644 --- a/pixman/src/ic.c +++ b/pixman/src/ic.c @@ -50,8 +50,8 @@ (*((a)+2) = (CARD8) ((v) >> 16)))) #endif -static uint32_t -fbOver (uint32_t x, uint32_t y) +static CARD32 +fbOver (CARD32 x, CARD32 y) { CARD16 a = ~x >> 24; CARD16 t; @@ -64,12 +64,12 @@ fbOver (uint32_t x, uint32_t y) return m|n|o|p; } -static uint32_t -fbOver24 (uint32_t x, uint32_t y) +static CARD32 +fbOver24 (CARD32 x, CARD32 y) { - uint16_t a = ~x >> 24; - uint16_t t; - uint32_t m,n,o; + CARD16 a = ~x >> 24; + CARD16 t; + CARD32 m,n,o; m = FbOverU(x,y,0,a,t); n = FbOverU(x,y,8,a,t); @@ -77,12 +77,12 @@ fbOver24 (uint32_t x, uint32_t y) return m|n|o; } -static uint32_t -fbIn (uint32_t x, uint8_t y) +static CARD32 +fbIn (CARD32 x, CARD8 y) { - uint16_t a = y; - uint16_t t; - uint32_t m,n,o,p; + CARD16 a = y; + CARD16 t; + CARD32 m,n,o,p; m = FbInU(x,0,a,t); n = FbInU(x,8,a,t); @@ -136,33 +136,33 @@ fbIn (uint32_t x, uint8_t y) static void pixman_compositeSolidMask_nx8x8888 (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - uint32_t src, srca; - uint32_t *dstLine, *dst, d, dstMask; - uint8_t *maskLine, *mask, m; + CARD32 src, srca; + CARD32 *dstLine, *dst, d, dstMask; + CARD8 *maskLine, *mask, m; FbStride dstStride, maskStride; - uint16_t w; + CARD16 w; - fbComposeGetSolid(iSrc, src); + fbComposeGetSolid(pSrc, src); - dstMask = FbFullMask (iDst->pixels->depth); + dstMask = FbFullMask (pDst->pixels->depth); srca = src >> 24; if (src == 0) return; - fbComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); - fbComposeGetStart (iMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { @@ -194,34 +194,34 @@ pixman_compositeSolidMask_nx8x8888 (pixman_operator_t op, static void pixman_compositeSolidMask_nx8888x8888C (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - uint32_t src, srca; - uint32_t *dstLine, *dst, d, dstMask; - uint32_t *maskLine, *mask, ma; + CARD32 src, srca; + CARD32 *dstLine, *dst, d, dstMask; + CARD32 *maskLine, *mask, ma; FbStride dstStride, maskStride; - uint16_t w; - uint32_t m, n, o, p; + CARD16 w; + CARD32 m, n, o, p; - fbComposeGetSolid(iSrc, src); + fbComposeGetSolid(pSrc, src); - dstMask = FbFullMask (iDst->pixels->depth); + dstMask = FbFullMask (pDst->pixels->depth); srca = src >> 24; if (src == 0) return; - fbComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); - fbComposeGetStart (iMask, xMask, yMask, uint32_t, maskStride, maskLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); while (height--) { @@ -245,13 +245,13 @@ pixman_compositeSolidMask_nx8888x8888C (pixman_operator_t op, { d = *dst; #define FbInOverC(src,srca,msk,dst,i,result) { \ - uint16_t __a = FbGet8(msk,i); \ - uint32_t __t, __ta; \ - uint32_t __i; \ + CARD16 __a = FbGet8(msk,i); \ + CARD32 __t, __ta; \ + CARD32 __i; \ __t = FbIntMult (FbGet8(src,i), __a,__i); \ - __ta = (uint8_t) ~FbIntMult (srca, __a,__i); \ + __ta = (CARD8) ~FbIntMult (srca, __a,__i); \ __t = __t + FbIntMult(FbGet8(dst,i),__ta,__i); \ - __t = (uint32_t) (uint8_t) (__t | (-(__t >> 8))); \ + __t = (CARD32) (CARD8) (__t | (-(__t >> 8))); \ result = __t << (i); \ } FbInOverC (src, srca, ma, d, 0, m); @@ -267,33 +267,33 @@ pixman_compositeSolidMask_nx8888x8888C (pixman_operator_t op, static void pixman_compositeSolidMask_nx8x0888 (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - uint32_t src, srca; - uint8_t *dstLine, *dst; - uint32_t d; - uint8_t *maskLine, *mask, m; + CARD32 src, srca; + CARD8 *dstLine, *dst; + CARD32 d; + CARD8 *maskLine, *mask, m; FbStride dstStride, maskStride; - uint16_t w; + CARD16 w; - fbComposeGetSolid(iSrc, src); + fbComposeGetSolid(pSrc, src); srca = src >> 24; if (src == 0) return; - fbComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 3); - fbComposeGetStart (iMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); + fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { @@ -329,33 +329,33 @@ pixman_compositeSolidMask_nx8x0888 (pixman_operator_t op, static void pixman_compositeSolidMask_nx8x0565 (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - uint32_t src, srca; - uint16_t *dstLine, *dst; - uint32_t d; - uint8_t *maskLine, *mask, m; + CARD32 src, srca; + CARD16 *dstLine, *dst; + CARD32 d; + CARD8 *maskLine, *mask, m; FbStride dstStride, maskStride; - uint16_t w; + CARD16 w; - fbComposeGetSolid(iSrc, src); + fbComposeGetSolid(pSrc, src); srca = src >> 24; if (src == 0) return; - fbComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); - fbComposeGetStart (iMask, xMask, yMask, uint8_t, maskStride, maskLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD8, maskStride, maskLine, 1); while (height--) { @@ -392,28 +392,28 @@ pixman_compositeSolidMask_nx8x0565 (pixman_operator_t op, static void pixman_compositeSolidMask_nx8888x0565C (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - uint32_t src, srca; - uint16_t src16; - uint16_t *dstLine, *dst; - uint32_t d; - uint32_t *maskLine, *mask, ma; + CARD32 src, srca; + CARD16 src16; + CARD16 *dstLine, *dst; + CARD32 d; + CARD32 *maskLine, *mask, ma; FbStride dstStride, maskStride; - uint16_t w; - uint32_t m, n, o; + CARD16 w; + CARD32 m, n, o; - fbComposeGetSolid(iSrc, src); + fbComposeGetSolid(pSrc, src); srca = src >> 24; if (src == 0) @@ -421,8 +421,8 @@ pixman_compositeSolidMask_nx8888x0565C (pixman_operator_t op, src16 = cvt8888to0565(src); - fbComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); - fbComposeGetStart (iMask, xMask, yMask, uint32_t, maskStride, maskLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); + fbComposeGetStart (pMask, xMask, yMask, CARD32, maskStride, maskLine, 1); while (height--) { @@ -465,28 +465,28 @@ pixman_compositeSolidMask_nx8888x0565C (pixman_operator_t op, static void pixman_compositeSrc_8888x8888 (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - uint32_t *dstLine, *dst, dstMask; - uint32_t *srcLine, *src, s; + CARD32 *dstLine, *dst, dstMask; + CARD32 *srcLine, *src, s; FbStride dstStride, srcStride; - uint8_t a; - uint16_t w; + CARD8 a; + CARD16 w; - fbComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); - fbComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); - dstMask = FbFullMask (iDst->pixels->depth); + dstMask = FbFullMask (pDst->pixels->depth); while (height--) { @@ -511,27 +511,27 @@ pixman_compositeSrc_8888x8888 (pixman_operator_t op, static void pixman_compositeSrc_8888x0888 (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - uint8_t *dstLine, *dst; - uint32_t d; - uint32_t *srcLine, *src, s; - uint8_t a; + CARD8 *dstLine, *dst; + CARD32 d; + CARD32 *srcLine, *src, s; + CARD8 a; FbStride dstStride, srcStride; - uint16_t w; + CARD16 w; - fbComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 3); - fbComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 3); + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); while (height--) { @@ -560,27 +560,27 @@ pixman_compositeSrc_8888x0888 (pixman_operator_t op, static void pixman_compositeSrc_8888x0565 (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - uint16_t *dstLine, *dst; - uint32_t d; - uint32_t *srcLine, *src, s; - uint8_t a; + CARD16 *dstLine, *dst; + CARD32 d; + CARD32 *srcLine, *src, s; + CARD8 a; FbStride dstStride, srcStride; - uint16_t w; + CARD16 w; - fbComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - fbComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); while (height--) { @@ -612,26 +612,26 @@ pixman_compositeSrc_8888x0565 (pixman_operator_t op, static void pixman_compositeSrc_0565x0565 (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - uint16_t *dstLine, *dst; - uint16_t *srcLine, *src; + CARD16 *dstLine, *dst; + CARD16 *srcLine, *src; FbStride dstStride, srcStride; - uint16_t w; + CARD16 w; - fbComposeGetStart (iSrc, xSrc, ySrc, uint16_t, srcStride, srcLine, 1); + fbComposeGetStart (pSrc, xSrc, ySrc, CARD16, srcStride, srcLine, 1); - fbComposeGetStart (iDst, xDst, yDst, uint16_t, dstStride, dstLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); while (height--) { @@ -648,27 +648,27 @@ pixman_compositeSrc_0565x0565 (pixman_operator_t op, static void pixman_compositeSrcAdd_8000x8000 (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - uint8_t *dstLine, *dst; - uint8_t *srcLine, *src; + CARD8 *dstLine, *dst; + CARD8 *srcLine, *src; FbStride dstStride, srcStride; - uint8_t w; - uint8_t s, d; - uint16_t t; + CARD16 w; + CARD8 s, d; + CARD16 t; - fbComposeGetStart (iSrc, xSrc, ySrc, uint8_t, srcStride, srcLine, 1); - fbComposeGetStart (iDst, xDst, yDst, uint8_t, dstStride, dstLine, 1); + fbComposeGetStart (pSrc, xSrc, ySrc, CARD8, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD8, dstStride, dstLine, 1); while (height--) { @@ -698,28 +698,28 @@ pixman_compositeSrcAdd_8000x8000 (pixman_operator_t op, static void pixman_compositeSrcAdd_8888x8888 (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { - uint32_t *dstLine, *dst; - uint32_t *srcLine, *src; + CARD32 *dstLine, *dst; + CARD32 *srcLine, *src; FbStride dstStride, srcStride; - uint16_t w; - uint32_t s, d; - uint16_t t; - uint32_t m,n,o,p; + CARD16 w; + CARD32 s, d; + CARD16 t; + CARD32 m,n,o,p; - fbComposeGetStart (iSrc, xSrc, ySrc, uint32_t, srcStride, srcLine, 1); - fbComposeGetStart (iDst, xDst, yDst, uint32_t, dstStride, dstLine, 1); + fbComposeGetStart (pSrc, xSrc, ySrc, CARD32, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD32, dstStride, dstLine, 1); while (height--) { @@ -755,17 +755,17 @@ pixman_compositeSrcAdd_8888x8888 (pixman_operator_t op, static void pixman_compositeSrcAdd_1000x1000 (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { FbBits *dstBits, *srcBits; FbStride dstStride, srcStride; @@ -773,9 +773,9 @@ pixman_compositeSrcAdd_1000x1000 (pixman_operator_t op, int dstXoff, dstYoff; int srcXoff, srcYoff; - FbGetPixels(iSrc->pixels, srcBits, srcStride, srcBpp, srcXoff, srcYoff); + FbGetPixels(pSrc->pixels, srcBits, srcStride, srcBpp, srcXoff, srcYoff); - FbGetPixels(iDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff); + FbGetPixels(pDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff); fbBlt (srcBits + srcStride * (ySrc + srcYoff), srcStride, @@ -792,23 +792,23 @@ pixman_compositeSrcAdd_1000x1000 (pixman_operator_t op, FB_ALLONES, srcBpp, - 0, - 0); + FALSE, + FALSE); } static void pixman_compositeSolidMask_nx1xn (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, - int16_t xSrc, - int16_t ySrc, - int16_t xMask, - int16_t yMask, - int16_t xDst, - int16_t yDst, - uint16_t width, - uint16_t height) + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) { FbBits *dstBits; FbStip *maskBits; @@ -818,17 +818,17 @@ pixman_compositeSolidMask_nx1xn (pixman_operator_t op, int maskXoff, maskYoff; FbBits src; - fbComposeGetSolid(iSrc, src); + fbComposeGetSolid(pSrc, src); if ((src & 0xff000000) != 0xff000000) { - pixman_compositeGeneral (op, iSrc, iMask, iDst, + pixman_compositeGeneral (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); return; } - FbGetStipPixels (iMask->pixels, maskBits, maskStride, maskBpp, maskXoff, maskYoff); - FbGetPixels (iDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff); + FbGetStipPixels (pMask->pixels, maskBits, maskStride, maskBpp, maskXoff, maskYoff); + FbGetPixels (pDst->pixels, dstBits, dstStride, dstBpp, dstXoff, dstYoff); switch (dstBpp) { case 32: @@ -862,9 +862,9 @@ pixman_compositeSolidMask_nx1xn (pixman_operator_t op, void pixman_composite (pixman_operator_t op, - pixman_image_t *iSrc, - pixman_image_t *iMask, - pixman_image_t *iDst, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, int xSrc, int ySrc, int xMask, @@ -878,39 +878,39 @@ pixman_composite (pixman_operator_t op, int n; pixman_box16_t *pbox; CompositeFunc func; - int srcRepeat = iSrc->repeat; - int maskRepeat = 0; - int srcAlphaMap = iSrc->alphaMap != 0; - int maskAlphaMap = 0; - int dstAlphaMap = iDst->alphaMap != 0; + int srcRepeat = pSrc->repeat; + int maskRepeat = FALSE; + int srcAlphaMap = pSrc->alphaMap != 0; + int maskAlphaMap = FALSE; + int dstAlphaMap = pDst->alphaMap != 0; int x_msk, y_msk, x_src, y_src, x_dst, y_dst; int w, h, w_this, h_this; - if (iSrc->pixels->width == 0 || - iSrc->pixels->height == 0) + if (pSrc->pixels->width == 0 || + pSrc->pixels->height == 0) { return; } - xDst += iDst->pixels->x; - yDst += iDst->pixels->y; - xSrc += iSrc->pixels->x; - ySrc += iSrc->pixels->y; - if (iMask) + xDst += pDst->pixels->x; + yDst += pDst->pixels->y; + xSrc += pSrc->pixels->x; + ySrc += pSrc->pixels->y; + if (pMask) { - xMask += iMask->pixels->x; - yMask += iMask->pixels->y; - maskRepeat = iMask->repeat; - maskAlphaMap = iMask->alphaMap != 0; + xMask += pMask->pixels->x; + yMask += pMask->pixels->y; + maskRepeat = pMask->repeat; + maskAlphaMap = pMask->alphaMap != 0; } region = pixman_region_create(); pixman_region_union_rect (region, region, xDst, yDst, width, height); if (!FbComputeCompositeRegion (region, - iSrc, - iMask, - iDst, + pSrc, + pMask, + pDst, xSrc, ySrc, xMask, @@ -922,21 +922,21 @@ pixman_composite (pixman_operator_t op, return; func = pixman_compositeGeneral; - if (!iSrc->transform && !(iMask && iMask->transform)) + if (!pSrc->transform && !(pMask && pMask->transform)) if (!maskAlphaMap && !srcAlphaMap && !dstAlphaMap) switch (op) { case PIXMAN_OPERATOR_OVER: - if (iMask) + if (pMask) { if (srcRepeat && - iSrc->pixels->width == 1 && - iSrc->pixels->height == 1) + pSrc->pixels->width == 1 && + pSrc->pixels->height == 1) { - srcRepeat = 0; - if (PICT_FORMAT_COLOR(iSrc->format_code)) { - switch (iMask->format_code) { + srcRepeat = FALSE; + if (PICT_FORMAT_COLOR(pSrc->format_code)) { + switch (pMask->format_code) { case PICT_a8: - switch (iDst->format_code) { + switch (pDst->format_code) { case PICT_r5g6b5: case PICT_b5g6r5: func = pixman_compositeSolidMask_nx8x0565; @@ -954,8 +954,8 @@ pixman_composite (pixman_operator_t op, } break; case PICT_a8r8g8b8: - if (iMask->componentAlpha) { - switch (iDst->format_code) { + if (pMask->componentAlpha) { + switch (pDst->format_code) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: func = pixman_compositeSolidMask_nx8888x8888C; @@ -967,8 +967,8 @@ pixman_composite (pixman_operator_t op, } break; case PICT_a8b8g8r8: - if (iMask->componentAlpha) { - switch (iDst->format_code) { + if (pMask->componentAlpha) { + switch (pDst->format_code) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: func = pixman_compositeSolidMask_nx8888x8888C; @@ -980,7 +980,7 @@ pixman_composite (pixman_operator_t op, } break; case PICT_a1: - switch (iDst->format_code) { + switch (pDst->format_code) { case PICT_r5g6b5: case PICT_b5g6r5: case PICT_r8g8b8: @@ -998,9 +998,9 @@ pixman_composite (pixman_operator_t op, } else { - switch (iSrc->format_code) { + switch (pSrc->format_code) { case PICT_a8r8g8b8: - switch (iDst->format_code) { + switch (pDst->format_code) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: func = pixman_compositeSrc_8888x8888; @@ -1014,7 +1014,7 @@ pixman_composite (pixman_operator_t op, } break; case PICT_a8b8g8r8: - switch (iDst->format_code) { + switch (pDst->format_code) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: func = pixman_compositeSrc_8888x8888; @@ -1028,14 +1028,14 @@ pixman_composite (pixman_operator_t op, } break; case PICT_r5g6b5: - switch (iDst->format_code) { + switch (pDst->format_code) { case PICT_r5g6b5: func = pixman_compositeSrc_0565x0565; break; } break; case PICT_b5g6r5: - switch (iDst->format_code) { + switch (pDst->format_code) { case PICT_b5g6r5: func = pixman_compositeSrc_0565x0565; break; @@ -1045,32 +1045,32 @@ pixman_composite (pixman_operator_t op, } break; case PIXMAN_OPERATOR_ADD: - if (iMask == 0) + if (pMask == 0) { - switch (iSrc->format_code) { + switch (pSrc->format_code) { case PICT_a8r8g8b8: - switch (iDst->format_code) { + switch (pDst->format_code) { case PICT_a8r8g8b8: func = pixman_compositeSrcAdd_8888x8888; break; } break; case PICT_a8b8g8r8: - switch (iDst->format_code) { + switch (pDst->format_code) { case PICT_a8b8g8r8: func = pixman_compositeSrcAdd_8888x8888; break; } break; case PICT_a8: - switch (iDst->format_code) { + switch (pDst->format_code) { case PICT_a8: func = pixman_compositeSrcAdd_8000x8000; break; } break; case PICT_a1: - switch (iDst->format_code) { + switch (pDst->format_code) { case PICT_a1: func = pixman_compositeSrcAdd_1000x1000; break; @@ -1086,9 +1086,9 @@ pixman_composite (pixman_operator_t op, /* if we are transforming, we handle repeats in * FbFetch[a]_transform */ - if (iSrc->transform) + if (pSrc->transform) srcRepeat = 0; - if (iMask && iMask->transform) + if (pMask && pMask->transform) maskRepeat = 0; n = pixman_region_num_rects (region); @@ -1108,32 +1108,32 @@ pixman_composite (pixman_operator_t op, x_dst = pbox->x1; if (maskRepeat) { - y_msk = MOD (y_msk, iMask->pixels->height); - if (h_this > iMask->pixels->height - y_msk) - h_this = iMask->pixels->height - y_msk; + y_msk = MOD (y_msk, pMask->pixels->height); + if (h_this > pMask->pixels->height - y_msk) + h_this = pMask->pixels->height - y_msk; } if (srcRepeat) { - y_src = MOD (y_src, iSrc->pixels->height); - if (h_this > iSrc->pixels->height - y_src) - h_this = iSrc->pixels->height - y_src; + y_src = MOD (y_src, pSrc->pixels->height); + if (h_this > pSrc->pixels->height - y_src) + h_this = pSrc->pixels->height - y_src; } while (w) { w_this = w; if (maskRepeat) { - x_msk = MOD (x_msk, iMask->pixels->width); - if (w_this > iMask->pixels->width - x_msk) - w_this = iMask->pixels->width - x_msk; + x_msk = MOD (x_msk, pMask->pixels->width); + if (w_this > pMask->pixels->width - x_msk) + w_this = pMask->pixels->width - x_msk; } if (srcRepeat) { - x_src = MOD (x_src, iSrc->pixels->width); - if (w_this > iSrc->pixels->width - x_src) - w_this = iSrc->pixels->width - x_src; + x_src = MOD (x_src, pSrc->pixels->width); + if (w_this > pSrc->pixels->width - x_src) + w_this = pSrc->pixels->width - x_src; } - (*func) (op, iSrc, iMask, iDst, + (*func) (op, pSrc, pMask, pDst, x_src, y_src, x_msk, y_msk, x_dst, y_dst, w_this, h_this); w -= w_this; -- cgit v1.2.3 From 1d48dc6cdb653b95c4353613399972663c71e68e Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Sat, 9 Jul 2005 18:13:14 +0000 Subject: More misc merging. Mostly s/pixman_composite/fbComposite/. --- pixman/ChangeLog | 12 ++++++++++ pixman/src/ic.c | 72 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 48 insertions(+), 36 deletions(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index cb494a5d8..1e4e6becb 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,15 @@ +2005-07-09 Jeff Muizelaar + + * src/ic.c: (fbCompositeSolidMask_nx8x8888), + (fbCompositeSolidMask_nx8888x8888C), + (fbCompositeSolidMask_nx8x0888), (fbCompositeSolidMask_nx8x0565), + (fbCompositeSolidMask_nx8888x0565C), (fbCompositeSrc_8888x8888), + (fbCompositeSrc_8888x0888), (fbCompositeSrc_8888x0565), + (fbCompositeSrc_0565x0565), (fbCompositeSrcAdd_8000x8000), + (fbCompositeSrcAdd_8888x8888), (fbCompositeSrcAdd_1000x1000), + (fbCompositeSolidMask_nx1xn), (pixman_composite): + More misc merging. Mostly s/pixman_composite/fbComposite/. + 2005-07-09 Jeff Muizelaar * src/ic.c: (fbOver), (fbOver24), (fbIn), diff --git a/pixman/src/ic.c b/pixman/src/ic.c index 8a9cb1d52..2bf7de881 100644 --- a/pixman/src/ic.c +++ b/pixman/src/ic.c @@ -100,13 +100,13 @@ fbIn (CARD32 x, CARD8 y) FbGetPixels((image)->pixels,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ switch (__bpp__) { \ case 32: \ - (bits) = *(uint32_t *) __bits__; \ + (bits) = *(CARD32 *) __bits__; \ break; \ case 24: \ - (bits) = Fetch24 ((uint8_t *) __bits__); \ + (bits) = Fetch24 ((CARD8 *) __bits__); \ break; \ case 16: \ - (bits) = *(uint16_t *) __bits__; \ + (bits) = *(CARD16 *) __bits__; \ (bits) = cvt0565to8888(bits); \ break; \ default: \ @@ -135,7 +135,7 @@ fbIn (CARD32 x, CARD8 y) */ static void -pixman_compositeSolidMask_nx8x8888 (pixman_operator_t op, +fbCompositeSolidMask_nx8x8888 (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -193,7 +193,7 @@ pixman_compositeSolidMask_nx8x8888 (pixman_operator_t op, } static void -pixman_compositeSolidMask_nx8888x8888C (pixman_operator_t op, +fbCompositeSolidMask_nx8888x8888C (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -266,7 +266,7 @@ pixman_compositeSolidMask_nx8888x8888C (pixman_operator_t op, } static void -pixman_compositeSolidMask_nx8x0888 (pixman_operator_t op, +fbCompositeSolidMask_nx8x0888 (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -328,7 +328,7 @@ pixman_compositeSolidMask_nx8x0888 (pixman_operator_t op, } static void -pixman_compositeSolidMask_nx8x0565 (pixman_operator_t op, +fbCompositeSolidMask_nx8x0565 (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -391,7 +391,7 @@ pixman_compositeSolidMask_nx8x0565 (pixman_operator_t op, } static void -pixman_compositeSolidMask_nx8888x0565C (pixman_operator_t op, +fbCompositeSolidMask_nx8888x0565C (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -464,7 +464,7 @@ pixman_compositeSolidMask_nx8888x0565C (pixman_operator_t op, } static void -pixman_compositeSrc_8888x8888 (pixman_operator_t op, +fbCompositeSrc_8888x8888 (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -510,7 +510,7 @@ pixman_compositeSrc_8888x8888 (pixman_operator_t op, } static void -pixman_compositeSrc_8888x0888 (pixman_operator_t op, +fbCompositeSrc_8888x0888 (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -559,7 +559,7 @@ pixman_compositeSrc_8888x0888 (pixman_operator_t op, } static void -pixman_compositeSrc_8888x0565 (pixman_operator_t op, +fbCompositeSrc_8888x0565 (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -611,7 +611,7 @@ pixman_compositeSrc_8888x0565 (pixman_operator_t op, } static void -pixman_compositeSrc_0565x0565 (pixman_operator_t op, +fbCompositeSrc_0565x0565 (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -647,7 +647,7 @@ pixman_compositeSrc_0565x0565 (pixman_operator_t op, } static void -pixman_compositeSrcAdd_8000x8000 (pixman_operator_t op, +fbCompositeSrcAdd_8000x8000 (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -697,7 +697,7 @@ pixman_compositeSrcAdd_8000x8000 (pixman_operator_t op, } static void -pixman_compositeSrcAdd_8888x8888 (pixman_operator_t op, +fbCompositeSrcAdd_8888x8888 (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -754,7 +754,7 @@ pixman_compositeSrcAdd_8888x8888 (pixman_operator_t op, } static void -pixman_compositeSrcAdd_1000x1000 (pixman_operator_t op, +fbCompositeSrcAdd_1000x1000 (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -797,7 +797,7 @@ pixman_compositeSrcAdd_1000x1000 (pixman_operator_t op, } static void -pixman_compositeSolidMask_nx1xn (pixman_operator_t op, +fbCompositeSolidMask_nx1xn (pixman_operator_t op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, @@ -939,17 +939,17 @@ pixman_composite (pixman_operator_t op, switch (pDst->format_code) { case PICT_r5g6b5: case PICT_b5g6r5: - func = pixman_compositeSolidMask_nx8x0565; + func = fbCompositeSolidMask_nx8x0565; break; case PICT_r8g8b8: case PICT_b8g8r8: - func = pixman_compositeSolidMask_nx8x0888; + func = fbCompositeSolidMask_nx8x0888; break; case PICT_a8r8g8b8: case PICT_x8r8g8b8: case PICT_a8b8g8r8: case PICT_x8b8g8r8: - func = pixman_compositeSolidMask_nx8x8888; + func = fbCompositeSolidMask_nx8x8888; break; } break; @@ -958,10 +958,10 @@ pixman_composite (pixman_operator_t op, switch (pDst->format_code) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: - func = pixman_compositeSolidMask_nx8888x8888C; + func = fbCompositeSolidMask_nx8888x8888C; break; case PICT_r5g6b5: - func = pixman_compositeSolidMask_nx8888x0565C; + func = fbCompositeSolidMask_nx8888x0565C; break; } } @@ -971,10 +971,10 @@ pixman_composite (pixman_operator_t op, switch (pDst->format_code) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: - func = pixman_compositeSolidMask_nx8888x8888C; + func = fbCompositeSolidMask_nx8888x8888C; break; case PICT_b5g6r5: - func = pixman_compositeSolidMask_nx8888x0565C; + func = fbCompositeSolidMask_nx8888x0565C; break; } } @@ -989,7 +989,7 @@ pixman_composite (pixman_operator_t op, case PICT_x8r8g8b8: case PICT_a8b8g8r8: case PICT_x8b8g8r8: - func = pixman_compositeSolidMask_nx1xn; + func = fbCompositeSolidMask_nx1xn; break; } } @@ -1003,13 +1003,13 @@ pixman_composite (pixman_operator_t op, switch (pDst->format_code) { case PICT_a8r8g8b8: case PICT_x8r8g8b8: - func = pixman_compositeSrc_8888x8888; + func = fbCompositeSrc_8888x8888; break; case PICT_r8g8b8: - func = pixman_compositeSrc_8888x0888; + func = fbCompositeSrc_8888x0888; break; case PICT_r5g6b5: - func = pixman_compositeSrc_8888x0565; + func = fbCompositeSrc_8888x0565; break; } break; @@ -1017,27 +1017,27 @@ pixman_composite (pixman_operator_t op, switch (pDst->format_code) { case PICT_a8b8g8r8: case PICT_x8b8g8r8: - func = pixman_compositeSrc_8888x8888; + func = fbCompositeSrc_8888x8888; break; case PICT_b8g8r8: - func = pixman_compositeSrc_8888x0888; + func = fbCompositeSrc_8888x0888; break; case PICT_b5g6r5: - func = pixman_compositeSrc_8888x0565; + func = fbCompositeSrc_8888x0565; break; } break; case PICT_r5g6b5: switch (pDst->format_code) { case PICT_r5g6b5: - func = pixman_compositeSrc_0565x0565; + func = fbCompositeSrc_0565x0565; break; } break; case PICT_b5g6r5: switch (pDst->format_code) { case PICT_b5g6r5: - func = pixman_compositeSrc_0565x0565; + func = fbCompositeSrc_0565x0565; break; } break; @@ -1051,28 +1051,28 @@ pixman_composite (pixman_operator_t op, case PICT_a8r8g8b8: switch (pDst->format_code) { case PICT_a8r8g8b8: - func = pixman_compositeSrcAdd_8888x8888; + func = fbCompositeSrcAdd_8888x8888; break; } break; case PICT_a8b8g8r8: switch (pDst->format_code) { case PICT_a8b8g8r8: - func = pixman_compositeSrcAdd_8888x8888; + func = fbCompositeSrcAdd_8888x8888; break; } break; case PICT_a8: switch (pDst->format_code) { case PICT_a8: - func = pixman_compositeSrcAdd_8000x8000; + func = fbCompositeSrcAdd_8000x8000; break; } break; case PICT_a1: switch (pDst->format_code) { case PICT_a1: - func = pixman_compositeSrcAdd_1000x1000; + func = fbCompositeSrcAdd_1000x1000; break; } break; -- cgit v1.2.3 From 2ff04df85219828c0058155ba7038a23bd264ebc Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Sat, 9 Jul 2005 19:00:36 +0000 Subject: Begin merging in newer fb code. The code comes from keithp: Initial import of Composite extension along with name change from Apportion. Added some accelerated code to fbpict to make this initial hack a bit faster. "real" extension bits to follow. --- pixman/ChangeLog | 12 ++++ pixman/src/ic.c | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 187 insertions(+), 2 deletions(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index 1e4e6becb..fe4e616e5 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,15 @@ +2005-07-09 Jeff Muizelaar + + * src/ic.c: (fbIn24), (fbCompositeTrans_0565xnx0565), + (fbCompositeSrcSrc_nxn), (pixman_composite): + Begin merging in newer fb code. + + The code comes from keithp: + Initial import of Composite extension along with + name change from Apportion. + Added some accelerated code to fbpict to make this initial + hack a bit faster. "real" extension bits to follow. + 2005-07-09 Jeff Muizelaar * src/ic.c: (fbCompositeSolidMask_nx8x8888), diff --git a/pixman/src/ic.c b/pixman/src/ic.c index 2bf7de881..9e9eadd47 100644 --- a/pixman/src/ic.c +++ b/pixman/src/ic.c @@ -91,6 +91,20 @@ fbIn (CARD32 x, CARD8 y) return m|n|o|p; } +static CARD32 +fbIn24 (CARD32 x, CARD8 y) +{ + CARD16 a = y; + CARD16 t; + CARD32 m,n,o,p; + + m = FbInU(x,0,a,t); + n = FbInU(x,8,a,t); + o = FbInU(x,16,a,t); + p = (y << 24); + return m|n|o|p; +} + #define fbComposeGetSolid(image, bits) { \ FbBits *__bits__; \ FbStride __stride__; \ @@ -109,6 +123,14 @@ fbIn (CARD32 x, CARD8 y) (bits) = *(CARD16 *) __bits__; \ (bits) = cvt0565to8888(bits); \ break; \ + case 8: \ + (bits) = *(CARD8 *) __bits__; \ + (bits) = (bits) << 24; \ + break; \ + case 1: \ + (bits) = *(CARD32 *) __bits__; \ + (bits) = FbLeftStipBits((bits),1) ? 0xff000000 : 0x00000000;\ + break; \ default: \ return; \ } \ @@ -125,7 +147,7 @@ fbIn (CARD32 x, CARD8 y) \ FbGetPixels((image)->pixels,__bits__,__stride__,__bpp__,__xoff__,__yoff__); \ (stride) = __stride__ * sizeof (FbBits) / sizeof (type); \ - (line) = ((type *) __bits__) + (stride) * ((y) - __yoff__) + (mul) * ((x) - __xoff__); \ + (line) = ((type *) __bits__) + (stride) * ((y) + __yoff__) + (mul) * ((x) + __xoff__); \ } /* @@ -860,6 +882,142 @@ fbCompositeSolidMask_nx1xn (pixman_operator_t op, 0x0); } +/* + * Apply a constant alpha value in an over computation + */ + +static void +fbCompositeTrans_0565xnx0565(pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + CARD16 *dstLine, *dst; + CARD16 *srcLine, *src; + FbStride dstStride, srcStride; + CARD16 w; + FbBits mask; + CARD8 maskAlpha; + CARD16 s_16, d_16, r_16; + CARD32 s_32, d_32, i_32, r_32; + + fbComposeGetSolid (pMask, mask); + maskAlpha = mask >> 24; + + if (!maskAlpha) + return; + if (maskAlpha == 0xff) + { + fbCompositeSrc_0565x0565 (op, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height); + return; + } + + fbComposeGetStart (pSrc, xSrc, ySrc, CARD16, srcStride, srcLine, 1); + fbComposeGetStart (pDst, xDst, yDst, CARD16, dstStride, dstLine, 1); + + while (height--) + { + dst = dstLine; + dstLine += dstStride; + src = srcLine; + srcLine += srcStride; + w = width; + + while (w--) + { + s_16 = *src++; + s_32 = cvt0565to8888(s_16); + d_16 = *dst; + d_32 = cvt0565to8888(d_16); + + i_32 = fbIn24 (s_32, maskAlpha); + r_32 = fbOver24 (i_32, d_32); + r_16 = cvt8888to0565(r_32); + *dst++ = r_16; + } + } +} + +/* + * Simple bitblt + */ + +static void +fbCompositeSrcSrc_nxn (pixman_operator_t op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + FbBits *dst; + FbBits *src; + FbStride dstStride, srcStride; + int srcXoff, srcYoff; + int dstXoff, dstYoff; + int srcBpp; + int dstBpp; + Bool reverse = FALSE; + Bool upsidedown = FALSE; + + FbGetPixels(pSrc->pixels,src,srcStride,srcBpp,srcXoff,srcYoff); + FbGetPixels(pDst->pixels,dst,dstStride,dstBpp,dstXoff,dstYoff); + + fbBlt (src + (ySrc + srcYoff) * srcStride, + srcStride, + (xSrc + srcXoff) * srcBpp, + + dst + (yDst + dstYoff) * dstStride, + dstStride, + (xDst + dstXoff) * dstBpp, + + (width) * dstBpp, + (height), + + GXcopy, + FB_ALLONES, + dstBpp, + + reverse, + upsidedown); +} + +/* + * Solid fill +void +fbCompositeSolidSrc_nxn (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + +} + */ + void pixman_composite (pixman_operator_t op, PicturePtr pSrc, @@ -932,7 +1090,6 @@ pixman_composite (pixman_operator_t op, pSrc->pixels->width == 1 && pSrc->pixels->height == 1) { - srcRepeat = FALSE; if (PICT_FORMAT_COLOR(pSrc->format_code)) { switch (pMask->format_code) { case PICT_a8: @@ -994,6 +1151,22 @@ pixman_composite (pixman_operator_t op, } } } + if (func != pixman_compositeGeneral) + srcRepeat = FALSE; + } + else if (maskRepeat && + pMask->pDrawable->width == 1 && + pMask->pDrawable->height == 1) + { + switch (pSrc->format_code) { + case PICT_r5g6b5: + case PICT_b5g6r5: + if (pDst->format_code == pSrc->format_code) + func = fbCompositeTrans_0565xnx0565; + break; + } + if (func != pixman_compositeGeneral) + maskRepeat = FALSE; } } else -- cgit v1.2.3 From 48e5806f1e30e1e46a18442a568ed99daab78f66 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 11 Jul 2005 13:29:45 +0000 Subject: Note that the cairo_content_t work is done. Note that this function is computing an incorrect result. --- ChangeLog | 7 +++++++ ROADMAP | 4 ++-- src/cairo-arc.c | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 931070235..f6f79b06b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-11 Carl Worth + + * ROADMAP: Note that the cairo_content_t work is done. + + * src/cairo-arc.c (_arc_segments_needed): Note that this function + is computing an incorrect result. + 2005-07-08 Carl Worth * src/cairo.h: Give enum tags an underscore prefix to match the diff --git a/ROADMAP b/ROADMAP index 385463e8f..ca0caa4e0 100644 --- a/ROADMAP +++ b/ROADMAP @@ -73,11 +73,11 @@ API Issues (more detail in TODO file) based on it Status: cworth has sent API proposal to list - A8. cairo_format_t: +✓A8. cairo_content_t: Difficulty: moderate. It's just going through and examining each use of cairo_format_t, but there are a lot of them. - Status: not started, there is a rough plan in TODO + Status: Done. A9. consistent error handling for all objects Difficulty: Easy to implement to get the API right. Hard to test. diff --git a/src/cairo-arc.c b/src/cairo-arc.c index d3302cdd5..e653fcda5 100644 --- a/src/cairo-arc.c +++ b/src/cairo-arc.c @@ -102,6 +102,8 @@ _arc_max_angle_for_tolerance_normalized (double tolerance) return angle; } +/* XXX: The computation here if bogus. Correct math (with proof!) is + * available in _cairo_pen_vertices_needed. */ static int _arc_segments_needed (double angle, double radius, -- cgit v1.2.3 From 9cddbaf8e6d4aef89017baf6bf10d8d34a47b0ef Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 11 Jul 2005 13:37:43 +0000 Subject: ROADMAP: Note progress on cairo_meta_surface_t, ARGB text, and group support. --- ChangeLog | 2 ++ ROADMAP | 11 ++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index f6f79b06b..dbb08b592 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ 2005-07-11 Carl Worth * ROADMAP: Note that the cairo_content_t work is done. + Note progress on cairo_meta_surface_t, ARGB text, and group + support. * src/cairo-arc.c (_arc_segments_needed): Note that this function is computing an incorrect result. diff --git a/ROADMAP b/ROADMAP index ca0caa4e0..5d30bf67b 100644 --- a/ROADMAP +++ b/ROADMAP @@ -24,10 +24,12 @@ Implementation work I2. Real PostScript/PDF fallbacks (cairo_meta_surface_t) Difficulty: hard - Status: krh has a patch that cworth has reviewed. Next version - should land. + Status: krh has committed cairo_meta_surface_t and a preliminary + version of cairo_ps_surface_t that uses it. I3. Add support for sub-pixel (ARGB) rendering of text. + Status: keithp walked cworth through this. Patch sent to the + list is almost complete. API Issues (more detail in TODO file) ------------------------------------- @@ -44,7 +46,10 @@ API Issues (more detail in TODO file) Difficulty: easy to hard (depending on how sophisticated an implementation is acceptable, and whether the cairo_meta_surface_t mentioned in [I2] is done) - Status: cworth has a posted a preliminary patch (still some open questions) + + Status: cworth has a posted a preliminary patch, and keithp, + krh, and otaylor answered all the tough questions it + raised. There's not much work left to finish this one. ✓A4. Make set_source consistent Difficulty: easy -- cgit v1.2.3 From e9d42ab9f9b6def69c8de976fb3482b9559ffb9c Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 11 Jul 2005 14:03:51 +0000 Subject: ROADMAP: Add recent API change proposals (cairo_ft_options_t, cairo_xlib_surface_create needs to be screen aware, and cairo_xlib_surface_set_drawable). --- ChangeLog | 3 +++ ROADMAP | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index dbb08b592..2fce4de46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * ROADMAP: Note that the cairo_content_t work is done. Note progress on cairo_meta_surface_t, ARGB text, and group support. + Add recent API change proposals (cairo_ft_options_t, + cairo_xlib_surface_create needs to be screen aware, and + cairo_xlib_surface_set_drawable). * src/cairo-arc.c (_arc_segments_needed): Note that this function is computing an incorrect result. diff --git a/ROADMAP b/ROADMAP index 5d30bf67b..846b682c6 100644 --- a/ROADMAP +++ b/ROADMAP @@ -90,6 +90,21 @@ API Issues (more detail in TODO file) Still need to do cairo_font_face_t, cairo_scaled_font_t, and cairo_surface_t. + A10. cairo_ft_options_t + Difficulty: Moderate + Status: Owen has done all the hard thinking, and we've got + consensus on the API now. Owen's working on a patch. + + A11. cairo_xlib_surface_create needs to be screen-aware + Difficulty: Easy + Status: Keith has cooked up a patch with an APi that should be + sufficient. It still needs testing on multi-screen X + server. + + A12. cairo_xlib_surface_set_drawable + Difficulty: Easy + Status: Keith has a patch sitting ready on the list. + Performance work ---------------- ✓P1. Make pixel-aligned rectangle compositing fast -- cgit v1.2.3 From abdaf7555f467e2df248430853e9dd8bf3c4056d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 11 Jul 2005 16:07:08 +0000 Subject: Add cache lock deadlock problem to roadmap for 0.5.2. Disable mutex locks, (making the caches non-thread-safe again, just like they were in the last snapshot and before). --- ChangeLog | 8 ++++++++ ROADMAP | 9 +++++++++ src/cairoint.h | 48 ++++++++++++++++++++++++++++++++++++------------ 3 files changed, 53 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2fce4de46..205ef08aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-07-11 Carl Worth + + * ROADMAP: Add cache lock deadlock problem to roadmap for 0.5.2. + + * src/cairoint.h: Disable mutex locks, (making the caches + non-thread-safe again, just like they were in the last snapshot + and before). + 2005-07-11 Carl Worth * ROADMAP: Note that the cairo_content_t work is done. diff --git a/ROADMAP b/ROADMAP index 846b682c6..a3ba3b546 100644 --- a/ROADMAP +++ b/ROADMAP @@ -13,6 +13,15 @@ cairo 0.5.2 Use XCopyArea when possible (integer translation) Otherwise make a copy of the source + Fix the cache lock deadlocking problems. + Difficulty: Hard + Status: The cache code was ugly enough that I ended up doing a + major rewrite rather than just reviewing the + locking. The upside is that the rewrite should also + add the missing metrics caches which will fix some + performance problems with text measurement. Almost + done now. + cairo 1.0 release requirements ============================== diff --git a/src/cairoint.h b/src/cairoint.h index 21d7bbfd7..53b08925e 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -120,19 +120,43 @@ #define __attribute__(x) #endif -#if HAVE_PTHREAD_H -#define CAIRO_MUTEX_DECLARE(name) static pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER -#define CAIRO_MUTEX_DECLARE_GLOBAL(name) pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER -#define CAIRO_MUTEX_LOCK(name) pthread_mutex_lock (&name) -#define CAIRO_MUTEX_UNLOCK(name) pthread_mutex_unlock (&name) -#endif +/* XXX: There's a bad bug in the cache locking code that attempts to + * recursively lock a mutex, (which we shouldn't actually need to ever + * do). This leads to deadlocks in even single-threaded applications, + * (if they link with -lpthread). + * + * For now, we're removing all mutex locking, which leaves things at + * the same level of non-thread-safeness that we've had in every + * snapshot since the cache code first landed. + * + * I'm rewriting the cache code now and plan to have thread-safe, + * locking caches working before the next snapshot. CDW. + */ + +#if CAIRO_CACHE_CODE_IS_FIXED_TO_NOT_DEADLOCK_SINGLE_THREADED_APPLICATIONS + +# if HAVE_PTHREAD_H +# define CAIRO_MUTEX_DECLARE(name) static pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER +# define CAIRO_MUTEX_DECLARE_GLOBAL(name) pthread_mutex_t name = PTHREAD_MUTEX_INITIALIZER +# define CAIRO_MUTEX_LOCK(name) pthread_mutex_lock (&name) +# define CAIRO_MUTEX_UNLOCK(name) pthread_mutex_unlock (&name) +# endif + +# ifndef CAIRO_MUTEX_DECLARE +# warning "No mutex declarations, assuming single-threaded code" +# define CAIRO_MUTEX_DECLARE(name) +# define CAIRO_MUTEX_DECLARE_GLOBAL(name) +# define CAIRO_MUTEX_LOCK(name) +# define CAIRO_MUTEX_UNLOCK(name) +# endif + +#else + +# define CAIRO_MUTEX_DECLARE(name) +# define CAIRO_MUTEX_DECLARE_GLOBAL(name) +# define CAIRO_MUTEX_LOCK(name) +# define CAIRO_MUTEX_UNLOCK(name) -#ifndef CAIRO_MUTEX_DECLARE -#warning "No mutex declarations, assuming single-threaded code" -#define CAIRO_MUTEX_DECLARE(name) -#define CAIRO_MUTEX_DECLARE_GLOBAL(name) -#define CAIRO_MUTEX_LOCK(name) -#define CAIRO_MUTEX_UNLOCK(name) #endif #define MIN(a, b) ((a) < (b) ? (a) : (b)) -- cgit v1.2.3 From 4329b709639c2dd3a6ec0cf113877323abfcbc2c Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 11 Jul 2005 16:09:55 +0000 Subject: Fix typo (cairo_ft_options_t -> cairo_font_options_t). --- ChangeLog | 1 + ROADMAP | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 205ef08aa..ab00701f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2005-07-11 Carl Worth * ROADMAP: Add cache lock deadlock problem to roadmap for 0.5.2. + Fix typo (cairo_ft_options_t -> cairo_font_options_t). * src/cairoint.h: Disable mutex locks, (making the caches non-thread-safe again, just like they were in the last snapshot diff --git a/ROADMAP b/ROADMAP index a3ba3b546..da59cbead 100644 --- a/ROADMAP +++ b/ROADMAP @@ -99,7 +99,7 @@ API Issues (more detail in TODO file) Still need to do cairo_font_face_t, cairo_scaled_font_t, and cairo_surface_t. - A10. cairo_ft_options_t + A10. cairo_font_options_t Difficulty: Moderate Status: Owen has done all the hard thinking, and we've got consensus on the API now. Owen's working on a patch. -- cgit v1.2.3 From efb413c084c51c08875ab2f356484718ff4f91dd Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 11 Jul 2005 16:24:19 +0000 Subject: Add note that glyph measurement performance needs to improve. --- ChangeLog | 1 + ROADMAP | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index ab00701f7..1cb185d02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ * ROADMAP: Add cache lock deadlock problem to roadmap for 0.5.2. Fix typo (cairo_ft_options_t -> cairo_font_options_t). + Add note that glyph measurement performance needs to improve. * src/cairoint.h: Disable mutex locks, (making the caches non-thread-safe again, just like they were in the last snapshot diff --git a/ROADMAP b/ROADMAP index da59cbead..9b79e9521 100644 --- a/ROADMAP +++ b/ROADMAP @@ -123,3 +123,6 @@ Performance work P2. Generate better trapezoids to go easier on the rasterizer Difficulty: moderate to hard Status: cworth drafted a plan to the list + + P3. Glyph measurement needs to be sped up. + Status: Now planned as part of "cache lock deadlock" above. -- cgit v1.2.3 From dda555de995e2af3cc49e3e2ed9e2444c8622a55 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 12 Jul 2005 14:43:37 +0000 Subject: Remove destroy notifier. This simplifies the implementation a bit, and no anticipated use of cairo_hash_table_t in cairo needs the destroy notifier. Most uses will be hash-backed object create/destroy functions. (_cairo_hash_table_destroy): Document that it is now a fatal error to call _cairo_hash_table_destroy on a non-empty hash table. (_cairo_hash_table_insert): Document that it is now a fatal error to insert an entry with a key that matches an existing entry. (_cairo_hash_table_random_entry): Add predicate function so that the user can select a random entry satisying the given predicate. (_cairo_hash_table_remove): Change return type to void since failure is really not possible here. --- ChangeLog | 22 +++++++++ src/cairo-hash-private.h | 25 +++++++---- src/cairo-hash.c | 115 +++++++++++++++++++++-------------------------- 3 files changed, 90 insertions(+), 72 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1cb185d02..dee6f5b6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2005-07-12 Carl Worth + + * src/cairo-hash-private.h: + * src/cairo-hash.c: + (_cairo_hash_table_create): Remove destroy notifier. This + simplifies the implementation a bit, and no anticipated use of + cairo_hash_table_t in cairo needs the destroy notifier. Most uses + will be hash-backed object create/destroy functions. + + (_cairo_hash_table_destroy): Document that it is now a fatal + error to call _cairo_hash_table_destroy on a non-empty hash table. + + (_cairo_hash_table_insert): Document that it is now a fatal + error to insert an entry with a key that matches an existing + entry. + + (_cairo_hash_table_random_entry): Add predicate function so that + the user can select a random entry satisying the given predicate. + + (_cairo_hash_table_remove): Change return type to void since + failure is really not possible here. + 2005-07-11 Carl Worth * ROADMAP: Add cache lock deadlock problem to roadmap for 0.5.2. diff --git a/src/cairo-hash-private.h b/src/cairo-hash-private.h index 190dc1087..6dc9c9073 100644 --- a/src/cairo-hash-private.h +++ b/src/cairo-hash-private.h @@ -39,7 +39,10 @@ #ifndef CAIRO_HASH_PRIVATE_H #define CAIRO_HASH_PRIVATE_H -#include "cairoint.h" +/* XXX: I'd like this file to be self-contained in terms of + * includeability, but that's not really possible with the current + * monolithic cairoint.h. So, for now, just include cairoint.h instead + * if you want to include this file. */ typedef struct _cairo_hash_table cairo_hash_table_t; @@ -63,8 +66,11 @@ typedef struct _cairo_hash_table cairo_hash_table_t; * _cairo_hash_table_insert (hash_table, &my_entry->base); * * IMPORTANT: The caller is reponsible for initializing - * my_entry->base.hash with a reasonable hash code derived from the - * key. + * my_entry->base.hash with a hash code derived from the key. The + * essential property of the hash code is that keys_equal must never + * return TRUE for two keys that have different hashes. The best hash + * code will reduce the frequency of two keys with the same code for + * which keys_equal returns FALSE. * * Which parts of the entry make up the "key" and which part make up * the value are entirely up to the caller, (as determined by the @@ -79,15 +85,17 @@ typedef struct _cairo_hash_entry { } cairo_hash_entry_t; typedef cairo_bool_t -(*cairo_hash_keys_equal_func_t) (void *entry_a, void *entry_b); +(*cairo_hash_keys_equal_func_t) (void *key_a, void *key_b); + +typedef cairo_bool_t +(*cairo_hash_predicate_func_t) (void *entry); typedef void (*cairo_hash_callback_func_t) (void *entry, void *closure); cairo_private cairo_hash_table_t * -_cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal, - cairo_destroy_func_t entry_destroy); +_cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal); cairo_private void _cairo_hash_table_destroy (cairo_hash_table_t *hash_table); @@ -98,13 +106,14 @@ _cairo_hash_table_lookup (cairo_hash_table_t *hash_table, cairo_hash_entry_t **entry_return); cairo_private void * -_cairo_hash_table_random_entry (cairo_hash_table_t *hash_table); +_cairo_hash_table_random_entry (cairo_hash_table_t *hash_table, + cairo_hash_predicate_func_t predicate); cairo_private cairo_status_t _cairo_hash_table_insert (cairo_hash_table_t *hash_table, cairo_hash_entry_t *entry); -cairo_private cairo_status_t +cairo_private void _cairo_hash_table_remove (cairo_hash_table_t *hash_table, cairo_hash_entry_t *key); diff --git a/src/cairo-hash.c b/src/cairo-hash.c index b46c90337..e44ab3025 100644 --- a/src/cairo-hash.c +++ b/src/cairo-hash.c @@ -36,7 +36,7 @@ * Carl Worth */ -#include "cairo-hash-private.h" +#include "cairoint.h" /* * An entry can be in one of three states: @@ -119,7 +119,6 @@ static const cairo_hash_table_arrangement_t hash_table_arrangements [] = { struct _cairo_hash_table { cairo_hash_keys_equal_func_t keys_equal; - cairo_destroy_func_t entry_destroy; const cairo_hash_table_arrangement_t *arrangement; cairo_hash_entry_t **entries; @@ -130,7 +129,6 @@ struct _cairo_hash_table { /** * _cairo_hash_table_create: * @keys_equal: a function to return TRUE if two keys are equal - * @entry_destroy: destroy notifier for hash entries * * Creates a new hash table which will use the keys_equal() function * to compare hash keys. Data is provided to the hash table in the @@ -145,8 +143,7 @@ struct _cairo_hash_table { * Return value: the new hash table or NULL if out of memory. **/ cairo_hash_table_t * -_cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal, - cairo_destroy_func_t entry_destroy) +_cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal) { cairo_hash_table_t *hash_table; @@ -155,7 +152,6 @@ _cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal, return NULL; hash_table->keys_equal = keys_equal; - hash_table->entry_destroy = entry_destroy; hash_table->arrangement = &hash_table_arrangements[0]; @@ -171,41 +167,27 @@ _cairo_hash_table_create (cairo_hash_keys_equal_func_t keys_equal, return hash_table; } -static void -_destroy_entry (cairo_hash_table_t *hash_table, cairo_hash_entry_t **entry) -{ - if (! ENTRY_IS_LIVE (*entry)) - return; - - if (hash_table->entry_destroy) - hash_table->entry_destroy (*entry); - *entry = DEAD_ENTRY; - hash_table->live_entries--; -} - /** * _cairo_hash_table_destroy: - * @hash_table: a hash table to destroy + * @hash_table: an empty hash table to destroy * * Immediately destroys the given hash table, freeing all resources - * associated with it. As part of this process, the entry_destroy() - * function, (as passed to cairo_hash_table_create), will be called - * for each live entry in the hash table. + * associated with it. + * + * WARNING: The hash_table must have no live entries in it before + * _cairo_hash_table_destroy is called. It is a fatal error otherwise, + * and this function will halt. The rationale for this behavior is to + * avoid memory leaks and to avoid needless complication of the API + * with destroy notifiy callbacks. **/ void _cairo_hash_table_destroy (cairo_hash_table_t *hash_table) { - unsigned long i; - cairo_hash_entry_t **entry; - if (hash_table == NULL) return; - - for (i = 0; i < hash_table->arrangement->size; i++) { - entry = &hash_table->entries[i]; - if (ENTRY_IS_LIVE(*entry)) - _destroy_entry (hash_table, entry); - } + + /* The hash table must be empty. Otherwise, halt. */ + assert (hash_table->live_entries == 0); free (hash_table->entries); hash_table->entries = NULL; @@ -366,7 +348,7 @@ _cairo_hash_table_resize (cairo_hash_table_t *hash_table) * * Performs a lookup in @hash_table looking for an entry which has a * key that matches @key, (as determined by the keys_equal() function - * passed to cairo_hash_table_create). + * passed to _cairo_hash_table_create). * * Return value: TRUE if there is an entry in the hash table that * matches the given key, (which will now be in *entry_return). FALSE @@ -393,24 +375,26 @@ _cairo_hash_table_lookup (cairo_hash_table_t *hash_table, /** * _cairo_hash_table_random_entry: * @hash_table: a hash table + * @predicate: a predicate function, or NULL for any entry. * - * Find a random entry in the hash table. + * Find a random entry in the hash table satisfying the given + * @predicate. A NULL @predicate is taken as equivalent to a function + * which always returns TRUE, (eg. any entry in the table will do). * * We use the same algorithm as the lookup algorithm to walk over the * entries in the hash table in a pseudo-random order. Walking * linearly would favor entries following gaps in the hash table. We * could also call rand() repeatedly, which works well for almost-full * tables, but degrades when the table is almost empty, or predicate - * returns false for most entries. + * returns TRUE for most entries. * - * NOTE: It'd be really easy to turn this into a find function with a - * predicate if anybody might want that. - * - * Return value: a random live entry or NULL if there are no live - * entries. + * Return value: a random live entry or NULL if there are no entries + * that match the given predicate. In particular, if predicate is + * NULL, a NULL return value indicates that the table is empty. **/ void * -_cairo_hash_table_random_entry (cairo_hash_table_t *hash_table) +_cairo_hash_table_random_entry (cairo_hash_table_t *hash_table, + cairo_hash_predicate_func_t predicate) { cairo_hash_entry_t **entry; unsigned long hash; @@ -426,8 +410,11 @@ _cairo_hash_table_random_entry (cairo_hash_table_t *hash_table) { entry = &hash_table->entries[idx]; - if (ENTRY_IS_LIVE (*entry)) + if (ENTRY_IS_LIVE (*entry) && + (predicate == NULL || predicate (*entry))) + { return *entry; + } if (step == 0) { step = hash % hash_table->arrangement->rehash; @@ -448,10 +435,14 @@ _cairo_hash_table_random_entry (cairo_hash_table_t *hash_table) * @hash_table: a hash table * @key_and_value: an entry to be inserted * - * Insert the entry #key_and_value into the hash table. If an existing - * exists in the hash table with a matching key, then the old entry - * will be removed first, (and the entry_destroy() callback will be - * called on it). + * Insert the entry #key_and_value into the hash table. + * + * WARNING: It is a fatal error if an entry exists in the hash table + * with a matching key, (this function will halt). + * + * Instead of using insert to replace an entry, consider just editing + * the entry obtained with _cairo_hash_table_lookup. Or if absolutely + * necessary, use _cairo_hash_table_remove first. * * Return value: CAIRO_STATUS_SUCCESS if successful or * CAIRO_STATUS_NO_MEMORY if insufficient memory is available. @@ -468,16 +459,12 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table, if (ENTRY_IS_LIVE(*entry)) { - if (hash_table->entry_destroy) - hash_table->entry_destroy (*entry); - *entry = key_and_value; + /* User is being bad, let's crash. */ + ASSERT_NOT_REACHED; } - else - { - *entry = key_and_value; - hash_table->live_entries++; - } + *entry = key_and_value; + hash_table->live_entries++; status = _cairo_hash_table_resize (hash_table); if (status) @@ -492,30 +479,30 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table, * @key: key of entry to be removed * * Remove an entry from the hash table which has a key that matches - * @key, (as determined by the keys_equal() function passed to - * _cairo_hash_table_create), if any. + * @key, if any (as determined by the keys_equal() function passed to + * _cairo_hash_table_create). * * Return value: CAIRO_STATUS_SUCCESS if successful or * CAIRO_STATUS_NO_MEMORY if out of memory. **/ -cairo_status_t +void _cairo_hash_table_remove (cairo_hash_table_t *hash_table, cairo_hash_entry_t *key) { - cairo_status_t status; cairo_hash_entry_t **entry; entry = _cairo_hash_table_lookup_internal (hash_table, key, FALSE); if (! ENTRY_IS_LIVE(*entry)) - return CAIRO_STATUS_SUCCESS; - - _destroy_entry (hash_table, entry); + return; - status = _cairo_hash_table_resize (hash_table); - if (status) - return status; + *entry = DEAD_ENTRY; + hash_table->live_entries--; - return CAIRO_STATUS_SUCCESS; + /* This call _can_ fail, but only in failing to allocate new + * memory to shrink the hash table. It does leave the table in a + * consistent state, and we've already succeeded in removing the + * entry, so we don't examine the failure status of this call. */ + _cairo_hash_table_resize (hash_table); } /** -- cgit v1.2.3 From 6725cc9d7f9b44f930478c337073d372272407de Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 13 Jul 2005 11:01:25 +0000 Subject: New predicates to allow checking for cairo_ft derivates of generic font type. Add explicit checks for cairo_ft derivatives of generic fonts rather than just blindly assuming that's what we get. --- ChangeLog | 15 +++++++++++++++ src/cairo-font-subset.c | 4 ++++ src/cairo-ft-font.c | 12 ++++++++++++ src/cairo-ft-private.h | 6 ++++++ src/cairo-pdf-surface.c | 8 ++++++++ src/cairo-ps-surface.c | 12 ++++++++++++ 6 files changed, 57 insertions(+) diff --git a/ChangeLog b/ChangeLog index dee6f5b6c..2def55a93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2005-07-13 Carl Worth + + * src/cairo-ft-private.h: + * src/cairo-ft-font.c: (_cairo_unscaled_font_is_ft), + (_cairo_scaled_font_is_ft): New predicates to allow checking for + cairo_ft derivates of generic font type. + + * src/cairo-ps-surface.c: (_cairo_ps_surface_get_font), + (_cairo_ps_surface_show_glyphs), (_ps_output_show_glyphs): + * src/cairo-pdf-surface.c: (_cairo_pdf_document_get_font), + (_cairo_pdf_surface_show_glyphs): + * src/cairo-font-subset.c: (_cairo_font_subset_create): + Add explicit checks for cairo_ft derivatives of generic fonts + rather than just blindly assuming that's what we get. + 2005-07-12 Carl Worth * src/cairo-hash-private.h: diff --git a/src/cairo-font-subset.c b/src/cairo-font-subset.c index 2fac7f3e8..e3a2784cf 100644 --- a/src/cairo-font-subset.c +++ b/src/cairo-font-subset.c @@ -139,6 +139,10 @@ _cairo_font_subset_create (cairo_unscaled_font_t *unscaled_font) unsigned long size; int i, j; + /* XXX: Need to fix this to work with a general cairo_unscaled_font_t. */ + if (! _cairo_unscaled_font_is_ft (unscaled_font)) + return NULL; + face = _cairo_ft_unscaled_font_lock_face (unscaled_font); /* We currently only support freetype truetype fonts. */ diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index f1d418f75..99776764b 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -129,6 +129,12 @@ _ft_unscaled_font_create_from_face (FT_Face face) return unscaled; } +cairo_bool_t +_cairo_unscaled_font_is_ft (cairo_unscaled_font_t *unscaled_font) +{ + return unscaled_font->backend == &cairo_ft_unscaled_font_backend; +} + static ft_unscaled_font_t * _ft_unscaled_font_create_from_filename (const char *filename, int id) @@ -1018,6 +1024,12 @@ _ft_scaled_font_create (ft_unscaled_font_t *unscaled, return (cairo_scaled_font_t *)f; } +cairo_bool_t +_cairo_scaled_font_is_ft (cairo_scaled_font_t *scaled_font) +{ + return scaled_font->backend == &cairo_ft_scaled_font_backend; +} + static cairo_status_t _cairo_ft_scaled_font_create (const char *family, cairo_font_slant_t slant, diff --git a/src/cairo-ft-private.h b/src/cairo-ft-private.h index 494d8369a..e92048b20 100644 --- a/src/cairo-ft-private.h +++ b/src/cairo-ft-private.h @@ -44,6 +44,12 @@ CAIRO_BEGIN_DECLS +cairo_bool_t +_cairo_unscaled_font_is_ft (cairo_unscaled_font_t *unscaled_font); + +cairo_bool_t +_cairo_scaled_font_is_ft (cairo_scaled_font_t *scaled_font); + /* These functions are needed by the PDF backend, which needs to keep track of the * the different fonts-on-disk used by a document, so it can embed them */ diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index bfb772170..f578fd623 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -1233,6 +1233,10 @@ _cairo_pdf_document_get_font (cairo_pdf_document_t *document, cairo_font_subset_t *pdf_font; unsigned int num_fonts, i; + /* XXX: Need to fix this to work with a general cairo_scaled_font_t. */ + if (! _cairo_scaled_font_is_ft (scaled_font)) + return NULL; + /* XXX Why is this an ft specific function? */ unscaled_font = _cairo_ft_scaled_font_get_unscaled_font (scaled_font); @@ -1279,6 +1283,10 @@ _cairo_pdf_surface_show_glyphs (cairo_scaled_font_t *scaled_font, cairo_font_subset_t *pdf_font; int i, index; + /* XXX: Need to fix this to work with a general cairo_scaled_font_t. */ + if (! _cairo_scaled_font_is_ft (scaled_font)) + return CAIRO_INT_STATUS_UNSUPPORTED; + pdf_font = _cairo_pdf_document_get_font (document, scaled_font); if (pdf_font == NULL) return CAIRO_STATUS_NO_MEMORY; diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 6684c6e68..140469323 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -368,6 +368,10 @@ _cairo_ps_surface_get_font (cairo_ps_surface_t *surface, cairo_font_subset_t *subset; unsigned int num_fonts, i; + /* XXX: Need to fix this to work with a general cairo_scaled_font_t. */ + if (! _cairo_scaled_font_is_ft (scaled_font)) + return NULL; + /* XXX Why is this an ft specific function? */ unscaled_font = _cairo_ft_scaled_font_get_unscaled_font (scaled_font); @@ -409,6 +413,10 @@ _cairo_ps_surface_show_glyphs (cairo_scaled_font_t *scaled_font, cairo_font_subset_t *subset; int i; + /* XXX: Need to fix this to work with a general cairo_scaled_font_t. */ + if (! _cairo_scaled_font_is_ft (scaled_font)) + return CAIRO_INT_STATUS_UNSUPPORTED; + /* Collect font subset info as we go. */ subset = _cairo_ps_surface_get_font (surface, scaled_font); if (subset == NULL) @@ -1039,6 +1047,10 @@ _ps_output_show_glyphs (cairo_scaled_font_t *scaled_font, cairo_font_subset_t *subset; int i, subset_index; + /* XXX: Need to fix this to work with a general cairo_scaled_font_t. */ + if (! _cairo_scaled_font_is_ft (scaled_font)) + return CAIRO_INT_STATUS_UNSUPPORTED; + _cairo_output_stream_printf (stream, "%% _ps_output_show_glyphs\n"); -- cgit v1.2.3 From aafc2e749725fab0684cce6e36b130f838696912 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 13 Jul 2005 11:34:37 +0000 Subject: Rename CAIRO_FONT_BACKEND_DEFAULT to the more accurate CAIRO_SCALED_FONT_BACKEND_DEFAULT. --- ChangeLog | 7 +++++++ src/cairo-font.c | 3 ++- src/cairoint.h | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2def55a93..81ee0a562 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-13 Carl Worth + + * src/cairoint.h: + * src/cairo-font.c: (_cairo_simple_font_face_create_font): Rename + CAIRO_FONT_BACKEND_DEFAULT to the more accurate + CAIRO_SCALED_FONT_BACKEND_DEFAULT. + 2005-07-13 Carl Worth * src/cairo-ft-private.h: diff --git a/src/cairo-font.c b/src/cairo-font.c index a241f9e80..137bc48d6 100644 --- a/src/cairo-font.c +++ b/src/cairo-font.c @@ -360,7 +360,8 @@ _cairo_simple_font_face_create_font (void *abstract_face, const cairo_matrix_t *ctm, cairo_scaled_font_t **scaled_font) { - const cairo_scaled_font_backend_t *backend = CAIRO_FONT_BACKEND_DEFAULT; + const cairo_scaled_font_backend_t * backend = CAIRO_SCALED_FONT_BACKEND_DEFAULT; + cairo_simple_font_face_t *simple_face = abstract_face; return backend->create (simple_face->family, simple_face->slant, simple_face->weight, diff --git a/src/cairoint.h b/src/cairoint.h index 53b08925e..a1b67f943 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -949,17 +949,17 @@ typedef struct _cairo_traps { #if CAIRO_HAS_WIN32_FONT #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_WIN32_FONT_FAMILY_DEFAULT -#define CAIRO_FONT_BACKEND_DEFAULT &cairo_win32_scaled_font_backend +#define CAIRO_SCALED_FONT_BACKEND_DEFAULT &cairo_win32_scaled_font_backend #elif CAIRO_HAS_ATSUI_FONT #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_ATSUI_FONT_FAMILY_DEFAULT -#define CAIRO_FONT_BACKEND_DEFAULT &cairo_atsui_scaled_font_backend +#define CAIRO_SCALED_FONT_BACKEND_DEFAULT &cairo_atsui_scaled_font_backend #elif CAIRO_HAS_FT_FONT #define CAIRO_FONT_FAMILY_DEFAULT CAIRO_FT_FONT_FAMILY_DEFAULT -#define CAIRO_FONT_BACKEND_DEFAULT &cairo_ft_scaled_font_backend +#define CAIRO_SCALED_FONT_BACKEND_DEFAULT &cairo_ft_scaled_font_backend #endif -- cgit v1.2.3 From 3a469446376eb23bd4a852417b0a319b914805b9 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Wed, 13 Jul 2005 12:32:51 +0000 Subject: Use the _cairo_surface_*() functions when replaying. Fold the "locate fallbacks" pass into the postscript output pass, and add a simple, first implementation of image fallbacks. --- ChangeLog | 9 ++ src/cairo-meta-surface-private.h | 1 + src/cairo-meta-surface.c | 35 +++-- src/cairo-ps-surface.c | 286 +++++++++++++++++++-------------------- 4 files changed, 163 insertions(+), 168 deletions(-) diff --git a/ChangeLog b/ChangeLog index 81ee0a562..497386c16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-07-13 Kristian Høgsberg + + * src/cairo-meta-surface.c: (_cairo_meta_surface_replay): Use + the _cairo_surface_*() functions when replaying. + + * src/cairo-ps-surface.c: Fold the "locate fallbacks" pass into + the postscript output pass, and add a simple, first implementation + of image fallbacks. + 2005-07-13 Carl Worth * src/cairoint.h: diff --git a/src/cairo-meta-surface-private.h b/src/cairo-meta-surface-private.h index 49cc45617..234c6ccfc 100644 --- a/src/cairo-meta-surface-private.h +++ b/src/cairo-meta-surface-private.h @@ -90,6 +90,7 @@ typedef struct _cairo_command_composite_trapezoids { typedef struct _cairo_command_set_clip_region { cairo_command_type_t type; pixman_region16_t *region; + unsigned int serial; } cairo_command_set_clip_region_t; typedef struct _cairo_command_intersect_clip_path { diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c index 182bb13f1..ae869f0ed 100644 --- a/src/cairo-meta-surface.c +++ b/src/cairo-meta-surface.c @@ -293,6 +293,8 @@ _cairo_meta_surface_set_clip_region (void *abstract_surface, command->region = NULL; } + command->serial = meta->base.current_clip_serial; + if (_cairo_array_append (&meta->commands, &command, 1) == NULL) { if (command->region) pixman_region_destroy (command->region); @@ -490,9 +492,7 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, command = elements[i]; switch (command->type) { case CAIRO_COMMAND_COMPOSITE: - if (target->backend->composite == NULL) - break; - status = target->backend->composite + status = _cairo_surface_composite (command->composite.operator, &command->composite.src_pattern.base, command->composite.mask_pattern_pointer, @@ -508,9 +508,7 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, break; case CAIRO_COMMAND_FILL_RECTANGLES: - if (target->backend->fill_rectangles == NULL) - break; - status = target->backend->fill_rectangles + status = _cairo_surface_fill_rectangles (target, command->fill_rectangles.operator, &command->fill_rectangles.color, @@ -519,9 +517,7 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, break; case CAIRO_COMMAND_COMPOSITE_TRAPEZOIDS: - if (target->backend->composite_trapezoids == NULL) - break; - status = target->backend->composite_trapezoids + status = _cairo_surface_composite_trapezoids (command->composite_trapezoids.operator, &command->composite_trapezoids.pattern.base, target, @@ -536,17 +532,19 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, break; case CAIRO_COMMAND_SET_CLIP_REGION: - if (target->backend->set_clip_region == NULL) - break; - status = target->backend->set_clip_region + status = _cairo_surface_set_clip_region (target, - command->set_clip_region.region); + command->set_clip_region.region, + command->set_clip_region.serial); break; case CAIRO_COMMAND_INTERSECT_CLIP_PATH: + /* XXX Meta surface clipping is broken and requires some + * cairo-gstate.c rewriting. Work around it for now. */ if (target->backend->intersect_clip_path == NULL) break; - status = target->backend->intersect_clip_path + + status = _cairo_surface_intersect_clip_path (target, command->intersect_clip_path.path_pointer, command->intersect_clip_path.fill_rule, @@ -554,9 +552,7 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, break; case CAIRO_COMMAND_SHOW_GLYPHS: - if (target->backend->show_glyphs == NULL) - break; - status = target->backend->show_glyphs + status = _cairo_surface_show_glyphs (command->show_glyphs.scaled_font, command->show_glyphs.operator, &command->show_glyphs.pattern.base, @@ -572,9 +568,12 @@ _cairo_meta_surface_replay (cairo_surface_t *surface, break; case CAIRO_COMMAND_FILL_PATH: + /* XXX Meta surface fill_path is broken and requires some + * cairo-gstate.c rewriting. Work around it for now. */ if (target->backend->fill_path == NULL) break; - status = target->backend->fill_path + + status = _cairo_surface_fill_path (command->fill_path.operator, &command->fill_path.pattern.base, target, diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 140469323..5e26e9418 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -81,11 +81,6 @@ static cairo_int_status_t _cairo_ps_surface_render_page (cairo_ps_surface_t *surface, cairo_surface_t *page, int page_number); -static cairo_int_status_t -_cairo_ps_surface_render_fallbacks (cairo_ps_surface_t *surface, - cairo_surface_t *page); - - static cairo_surface_t * _cairo_ps_surface_create_for_stream_internal (cairo_output_stream_t *stream, double width, @@ -550,11 +545,60 @@ _cairo_ps_surface_write_font_subsets (cairo_ps_surface_t *surface) return CAIRO_STATUS_SUCCESS; } +typedef struct _cairo_ps_fallback_area cairo_ps_fallback_area_t; +struct _cairo_ps_fallback_area { + int x, y; + unsigned int width, height; + cairo_ps_fallback_area_t *next; +}; + typedef struct _ps_output_surface { cairo_surface_t base; cairo_ps_surface_t *parent; + cairo_ps_fallback_area_t *fallback_areas; } ps_output_surface_t; +static cairo_int_status_t +_ps_output_add_fallback_area (ps_output_surface_t *surface, + int x, int y, + unsigned int width, + unsigned int height) +{ + cairo_ps_fallback_area_t *area; + + /* FIXME: Do a better job here. Ideally, we would use a 32 bit + * region type, but probably just computing bounding boxes would + * also work fine. */ + + area = malloc (sizeof (cairo_ps_fallback_area_t)); + if (area == NULL) + return CAIRO_STATUS_NO_MEMORY; + + area->x = x; + area->y = y; + area->width = width; + area->height = height; + area->next = surface->fallback_areas; + + surface->fallback_areas = area; + + return CAIRO_STATUS_SUCCESS; +} + +static cairo_status_t +_ps_output_finish (void *abstract_surface) +{ + ps_output_surface_t *surface = abstract_surface; + cairo_ps_fallback_area_t *area, *next; + + for (area = surface->fallback_areas; area != NULL; area = next) { + next = area->next; + free (area); + } + + return CAIRO_STATUS_SUCCESS; +} + static cairo_bool_t color_is_gray (cairo_color_t *color) { @@ -564,6 +608,24 @@ color_is_gray (cairo_color_t *color) fabs (color->red - color->blue) < epsilon); } +static cairo_bool_t +pattern_is_translucent (cairo_pattern_t *abstract_pattern) +{ + cairo_pattern_union_t *pattern; + + pattern = (cairo_pattern_union_t *) abstract_pattern; + switch (pattern->base.type) { + case CAIRO_PATTERN_SOLID: + return pattern->solid.color.alpha < 0.9; + case CAIRO_PATTERN_SURFACE: + case CAIRO_PATTERN_LINEAR: + case CAIRO_PATTERN_RADIAL: + return FALSE; + } + + ASSERT_NOT_REACHED; +} + /* PS Output - this section handles output of the parts of the meta * surface we can render natively in PS. */ @@ -872,6 +934,9 @@ _ps_output_composite_trapezoids (cairo_operator_t operator, cairo_output_stream_t *stream = surface->parent->stream; int i; + if (pattern_is_translucent (pattern)) + return _ps_output_add_fallback_area (surface, x_dst, y_dst, width, height); + _cairo_output_stream_printf (stream, "%% _ps_output_composite_trapezoids\n"); @@ -1051,6 +1116,9 @@ _ps_output_show_glyphs (cairo_scaled_font_t *scaled_font, if (! _cairo_scaled_font_is_ft (scaled_font)) return CAIRO_INT_STATUS_UNSUPPORTED; + if (pattern_is_translucent (pattern)) + return _ps_output_add_fallback_area (surface, dest_x, dest_y, width, height); + _cairo_output_stream_printf (stream, "%% _ps_output_show_glyphs\n"); @@ -1137,7 +1205,7 @@ _ps_output_fill_path (cairo_operator_t operator, static const cairo_surface_backend_t ps_output_backend = { NULL, /* create_similar */ - NULL, /* finish */ + _ps_output_finish, NULL, /* acquire_source_image */ NULL, /* release_source_image */ NULL, /* acquire_dest_image */ @@ -1156,177 +1224,95 @@ static const cairo_surface_backend_t ps_output_backend = { }; static cairo_int_status_t -_cairo_ps_surface_render_page (cairo_ps_surface_t *surface, - cairo_surface_t *page, int page_number) +_ps_output_render_fallbacks (cairo_surface_t *surface, + cairo_surface_t *page) { ps_output_surface_t *ps_output; + cairo_surface_t *image; cairo_int_status_t status; + cairo_matrix_t matrix; + int width, height; - _cairo_output_stream_printf (surface->stream, - "%%%%Page: %d\n" - "gsave\n", - page_number); + ps_output = (ps_output_surface_t *) surface; + if (ps_output->fallback_areas == NULL) + return CAIRO_STATUS_SUCCESS; - ps_output = malloc (sizeof (ps_output_surface_t)); - if (ps_output == NULL) + width = ps_output->parent->width * ps_output->parent->x_dpi / 72; + height = ps_output->parent->height * ps_output->parent->y_dpi / 72; + + image = cairo_image_surface_create (CAIRO_FORMAT_RGB24, width, height); + if (image == NULL) return CAIRO_STATUS_NO_MEMORY; - _cairo_surface_init (&ps_output->base, &ps_output_backend); - ps_output->parent = surface; - status = _cairo_meta_surface_replay (page, &ps_output->base); - cairo_surface_destroy (&ps_output->base); + status = _cairo_surface_fill_rectangle (image, + CAIRO_OPERATOR_SOURCE, + CAIRO_COLOR_WHITE, + 0, 0, width, height); + if (status) + goto bail; - _cairo_ps_surface_render_fallbacks (surface, page); + status = _cairo_meta_surface_replay (page, image); + if (status) + goto bail; - _cairo_output_stream_printf (surface->stream, - "showpage\n" - "grestore\n" - "%%%%EndPage\n"); - - return status; -} + matrix.xx = 1; + matrix.xy = 0; + matrix.yx = 0; + matrix.yy = 1; + matrix.x0 = 0; + matrix.y0 = 0; -typedef struct _cairo_ps_fallback_area cairo_ps_fallback_area_t; -struct _cairo_ps_fallback_area { - /* area */ - cairo_ps_fallback_area_t *next; -}; + status = emit_image (ps_output->parent, + (cairo_image_surface_t *) image, &matrix); -typedef struct _cairo_ps_fallback_info cairo_ps_fallback_info_t; -struct _cairo_ps_fallback_info { - cairo_ps_fallback_area_t *fallback_areas; -}; + bail: + cairo_surface_destroy (image); -/* XXX: This code is not compiling correctly (missing return values), - * but also appears to not be used currently. I'm turning it off for - * now. */ -#if 0 -static cairo_int_status_t -_cairo_ps_fallback_info_add_area (cairo_ps_fallback_info_t *info, - int x, int y, - unsigned int width, - unsigned int height) -{ - return CAIRO_STATUS_SUCCESS; + return status; } -static cairo_bool_t -_pattern_is_translucent (cairo_pattern_t *abstract_pattern) +static cairo_surface_t * +_ps_output_surface_create (cairo_ps_surface_t *parent) { - cairo_pattern_union_t *pattern; + ps_output_surface_t *ps_output; - pattern = (cairo_pattern_union_t *) abstract_pattern; - switch (pattern->base.type) { - case CAIRO_PATTERN_SOLID: - return pattern->solid.color.alpha < 0.999; - case CAIRO_PATTERN_SURFACE: - case CAIRO_PATTERN_LINEAR: - case CAIRO_PATTERN_RADIAL: - return FALSE; - } + ps_output = malloc (sizeof (ps_output_surface_t)); + if (ps_output == NULL) + return NULL; - ASSERT_NOT_REACHED; - return FALSE; -} + _cairo_surface_init (&ps_output->base, &ps_output_backend); + ps_output->parent = parent; + ps_output->fallback_areas = NULL; -static cairo_int_status_t -_ps_locate_fallbacks_composite (cairo_operator_t operator, - cairo_pattern_t *src_pattern, - cairo_pattern_t *mask_pattern, - void *abstract_dst, - int src_x, - int src_y, - int mask_x, - int mask_y, - int dst_x, - int dst_y, - unsigned int width, - unsigned int height) -{ + return &ps_output->base; } static cairo_int_status_t -_ps_locate_fallbacks_fill_rectangles (void *abstract_surface, - cairo_operator_t operator, - const cairo_color_t *color, - cairo_rectangle_t *rects, - int num_rects) +_cairo_ps_surface_render_page (cairo_ps_surface_t *surface, + cairo_surface_t *page, int page_number) { -} + cairo_surface_t *ps_output; + cairo_int_status_t status; -static cairo_int_status_t -_ps_locate_fallbacks_composite_trapezoids (cairo_operator_t operator, - cairo_pattern_t *pattern, - void *abstract_dst, - int x_src, - int y_src, - int x_dst, - int y_dst, - unsigned int width, - unsigned int height, - cairo_trapezoid_t *traps, - int num_traps) -{ - cairo_ps_fallback_info_t *info; + _cairo_output_stream_printf (surface->stream, + "%%%%Page: %d\n" + "gsave\n", + page_number); - info = abstract_dst; + ps_output = _ps_output_surface_create (surface); + if (ps_output == NULL) + return CAIRO_STATUS_NO_MEMORY; - if (_pattern_is_translucent (pattern)) - _cairo_ps_fallback_info_add_area (info, x_dst, y_dst, width, height); -} + status = _cairo_meta_surface_replay (page, ps_output); -static cairo_int_status_t -_ps_locate_fallbacks_show_glyphs (cairo_scaled_font_t *scaled_font, - cairo_operator_t operator, - cairo_pattern_t *pattern, - void *abstract_surface, - int source_x, - int source_y, - int dest_x, - int dest_y, - unsigned int width, - unsigned int height, - const cairo_glyph_t *glyphs, - int num_glyphs) -{ - return CAIRO_STATUS_SUCCESS; -} + _ps_output_render_fallbacks (ps_output, page); -static cairo_int_status_t -_ps_locate_fallbacks_fill_path (cairo_operator_t operator, - cairo_pattern_t *pattern, - void *abstract_dst, - cairo_path_fixed_t *path, - cairo_fill_rule_t fill_rule, - double tolerance) -{ - return CAIRO_STATUS_SUCCESS; -} + cairo_surface_destroy (ps_output); -static const cairo_surface_backend_t ps_locate_fallbacks_backend = { - NULL, /* create_similar */ - NULL, /* finish */ - NULL, /* acquire_source_image */ - NULL, /* release_source_image */ - NULL, /* acquire_dest_image */ - NULL, /* release_dest_image */ - NULL, /* clone_similar */ - _ps_locate_fallbacks_composite, - _ps_locate_fallbacks_fill_rectangles, - _ps_locate_fallbacks_composite_trapezoids, - NULL, /* copy_page */ - NULL, /* show_page */ - NULL, /* set_clip_region */ - NULL, /* intersect_clip_path */ - NULL, /* get_extents */ - _ps_locate_fallbacks_show_glyphs, - _ps_locate_fallbacks_fill_path -}; -#endif + _cairo_output_stream_printf (surface->stream, + "showpage\n" + "grestore\n" + "%%%%EndPage\n"); -static cairo_int_status_t -_cairo_ps_surface_render_fallbacks (cairo_ps_surface_t *surface, - cairo_surface_t *page) -{ - return CAIRO_STATUS_SUCCESS; + return status; } -- cgit v1.2.3 From c41e9d698f5dbc318819fb958618b704dbc5388a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 11:11:15 +0000 Subject: Patch a few memory leaks. --- ChangeLog | 6 ++++++ test/cairo-test.c | 47 ++++++++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 497386c16..e0945e304 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-07-14 Carl Worth + + * test/cairo-test.c: (cleanup_xcb), (cleanup_xlib), + (cairo_test_for_target), (cairo_test_real): Patch a few memory + leaks. + 2005-07-13 Kristian Høgsberg * src/cairo-meta-surface.c: (_cairo_meta_surface_replay): Use diff --git a/test/cairo-test.c b/test/cairo-test.c index a17cd6f8b..8c34f5ecf 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -338,6 +338,7 @@ cleanup_xcb (void *closure) XCBFreePixmap (xtc->c, xtc->drawable.pixmap); XCBDisconnect (xtc->c); + free (xtc); } #endif @@ -388,6 +389,7 @@ cleanup_xlib (void *closure) XFreePixmap (xtc->dpy, xtc->pixmap); XCloseDisplay (xtc->dpy); + free (xtc); } #endif @@ -401,7 +403,6 @@ cairo_test_for_target (cairo_test_t *test, cairo_t *cr; char *png_name, *ref_name, *diff_name; char *srcdir; - int pixels_changed; cairo_test_status_t ret; /* Get the strings ready that we'll need. */ @@ -420,7 +421,8 @@ cairo_test_for_target (cairo_test_t *test, &target->closure); if (surface == NULL) { cairo_test_log ("Error: Failed to set %s target\n", target->name); - return CAIRO_TEST_FAILURE; + ret = CAIRO_TEST_FAILURE; + goto UNWIND_STRINGS; } cr = cairo_create (surface); @@ -436,40 +438,42 @@ cairo_test_for_target (cairo_test_t *test, /* Then, check all the different ways it could fail. */ if (status) { cairo_test_log ("Error: Function under test failed\n"); - return status; + ret = status; + goto UNWIND_CAIRO; } if (cairo_status (cr) != CAIRO_STATUS_SUCCESS) { cairo_test_log ("Error: Function under test left cairo status in an error state: %s\n", cairo_status_to_string (cairo_status (cr))); - return CAIRO_TEST_FAILURE; + ret = CAIRO_TEST_FAILURE; + goto UNWIND_CAIRO; } + if (test->width > 0 && test->height > 0) + + /* Skip image check for tests with no image (width,height == 0,0) */ - if (test->width == 0 || test->height == 0) { - cairo_destroy (cr); - return CAIRO_TEST_SUCCESS; + if (test->width != 0 && test->height != 0) { + int pixels_changed; + cairo_surface_write_to_png (surface, png_name); + pixels_changed = image_diff (png_name, ref_name, diff_name); + if (pixels_changed) { + if (pixels_changed > 0) + cairo_test_log ("Error: %d pixels differ from reference image %s\n", + pixels_changed, ref_name); + ret = CAIRO_TEST_FAILURE; + goto UNWIND_CAIRO; + } } - cairo_surface_write_to_png (surface, png_name); + ret = CAIRO_TEST_SUCCESS; +UNWIND_CAIRO: cairo_destroy (cr); - cairo_surface_destroy (surface); - target->cleanup_target (target->closure); - pixels_changed = image_diff (png_name, ref_name, diff_name); - - if (pixels_changed) { - ret = CAIRO_TEST_FAILURE; - if (pixels_changed > 0) - cairo_test_log ("Error: %d pixels differ from reference image %s\n", - pixels_changed, ref_name); - } else { - ret = CAIRO_TEST_SUCCESS; - } - +UNWIND_STRINGS: free (png_name); free (ref_name); free (diff_name); @@ -511,6 +515,7 @@ cairo_test_real (cairo_test_t *test, cairo_test_draw_function_t draw) fprintf (stderr, "Error opening log file: %s\n", log_name); cairo_test_log_file = stderr; } + free (log_name); ret = CAIRO_TEST_SUCCESS; for (i=0; i < sizeof(targets)/sizeof(targets[0]); i++) { -- cgit v1.2.3 From 574b702029894f035791a99600130b16f30ddd55 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 11:17:12 +0000 Subject: Rename create-for-png test to create-from-png to match the naming of the cairo_image_surface_create_from_png function. --- ChangeLog | 10 +++++++ test/.cvsignore | 2 +- test/Makefile.am | 6 ++-- test/create-for-png-ref.png | Bin 100 -> 0 bytes test/create-for-png.c | 69 -------------------------------------------- test/create-from-png.c | 4 +-- 6 files changed, 16 insertions(+), 75 deletions(-) delete mode 100644 test/create-for-png-ref.png delete mode 100644 test/create-for-png.c diff --git a/ChangeLog b/ChangeLog index e0945e304..03ca82a38 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-07-14 Carl Worth + + * test/.cvsignore: + * test/Makefile.am: + * test/create-for-png-ref.png: + * test/create-for-png.c: + * test/create-from-png.c: (draw): Rename create-for-png test to + create-from-png to match the naming of the + cairo_image_surface_create_from_png function. + 2005-07-14 Carl Worth * test/cairo-test.c: (cleanup_xcb), (cleanup_xlib), diff --git a/test/.cvsignore b/test/.cvsignore index 0b4c1531c..5ce9bbd3a 100644 --- a/test/.cvsignore +++ b/test/.cvsignore @@ -5,7 +5,7 @@ Makefile.in clip-nesting clip-twice coverage -create-for-png +create-from-png fill-and-stroke fill-rule filter-nearest-offset diff --git a/test/Makefile.am b/test/Makefile.am index 17ac36a85..ecadb9602 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,7 +2,7 @@ TESTS = \ clip-nesting \ clip-twice \ -create-for-png \ +create-from-png \ fill-and-stroke \ fill-rule \ filter-nearest-offset \ @@ -52,7 +52,7 @@ endif EXTRA_DIST = \ clip-nesting-ref.png \ clip-twice-ref.png \ -create-for-png-ref.png \ +create-from-png-ref.png \ fill-and-stroke-ref.png \ fill-rule-ref.png \ filter-nearest-offset-ref.png \ @@ -133,7 +133,7 @@ LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la # from autogen.sh. My, but this is painful... clip_nesting_LDADD = $(LDADDS) clip_twice_LDADD = $(LDADDS) -create_for_png_LDADD = $(LDADDS) +create_from_png_LDADD = $(LDADDS) fill_and_stroke_LDADD = $(LDADDS) fill_rule_LDADD = $(LDADDS) filter_nearest_offset_LDADD = $(LDADDS) diff --git a/test/create-for-png-ref.png b/test/create-for-png-ref.png deleted file mode 100644 index 765adc4a4..000000000 Binary files a/test/create-for-png-ref.png and /dev/null differ diff --git a/test/create-for-png.c b/test/create-for-png.c deleted file mode 100644 index ef3b6f62e..000000000 --- a/test/create-for-png.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright © 2005 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without - * fee, provided that the above copyright notice appear in all copies - * and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of - * Red Hat, Inc. not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Red Hat, Inc. makes no representations about the - * suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR - * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Author: Carl Worth - */ - -#include "cairo-test.h" - -#include - -#define WIDTH 2 -#define HEIGHT 2 - -cairo_test_t test = { - "create-for-png", - "Tests the creation of an image surface from a PNG file", - WIDTH, HEIGHT -}; - -static cairo_test_status_t -draw (cairo_t *cr, int width, int height) -{ - char *srcdir = getenv ("srcdir"); - char *filename; - cairo_surface_t *surface; - - xasprintf (&filename, "%s/%s", srcdir ? srcdir : ".", - "create-for-png-ref.png"); - - surface = cairo_image_surface_create_from_png (filename); - free (filename); - - if (surface == NULL) { - cairo_test_log ("Error: failed to open file %s\n", filename); - return CAIRO_TEST_FAILURE; - } - - cairo_set_source_surface (cr, surface, 0, 0); - cairo_paint (cr); - - cairo_surface_destroy (surface); - - return CAIRO_TEST_SUCCESS; -} - -int -main (void) -{ - return cairo_test (&test, draw); -} diff --git a/test/create-from-png.c b/test/create-from-png.c index ef3b6f62e..f4fd1b934 100644 --- a/test/create-from-png.c +++ b/test/create-from-png.c @@ -31,7 +31,7 @@ #define HEIGHT 2 cairo_test_t test = { - "create-for-png", + "create-from-png", "Tests the creation of an image surface from a PNG file", WIDTH, HEIGHT }; @@ -44,7 +44,7 @@ draw (cairo_t *cr, int width, int height) cairo_surface_t *surface; xasprintf (&filename, "%s/%s", srcdir ? srcdir : ".", - "create-for-png-ref.png"); + "create-from-png-ref.png"); surface = cairo_image_surface_create_from_png (filename); free (filename); -- cgit v1.2.3 From 513e9e6fe5bbd8dda3e90c89d200f34104b27646 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 11:24:56 +0000 Subject: Patch memory leak of png_info object. --- ChangeLog | 5 +++++ src/cairo-png.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 03ca82a38..11de26953 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2005-07-14 Carl Worth + * src/cairo-png.c (read_png): Patch memory leak of png_info + object. + +2005-07-14 Carl Worth + * test/.cvsignore: * test/Makefile.am: * test/create-for-png-ref.png: diff --git a/src/cairo-png.c b/src/cairo-png.c index 1385bea04..532054e51 100644 --- a/src/cairo-png.c +++ b/src/cairo-png.c @@ -408,7 +408,7 @@ read_png (png_rw_ptr read_func, BAIL: free (row_pointers); free (data); - png_destroy_read_struct (&png, NULL, NULL); + png_destroy_read_struct (&png, &info, NULL); return surface; } -- cgit v1.2.3 From 171b053347c83d2a1f234b553510ef3f72f22f29 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 11:41:00 +0000 Subject: Whitespace fix. (pixman_image_destroy): Fix leak of the clip region associated with an image. (NOTE: xserver/render doesn't have the same bug since it has FreePicture that calls into both DestroyPicture and DestroyPictureClip separately). --- pixman/ChangeLog | 8 ++++++++ pixman/src/icimage.c | 4 +++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index fe4e616e5..0642e9590 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,11 @@ +2005-07-14 Carl Worth + + * src/icimage.c: (pixman_image_set_component_alpha): Whitespace fix. + (pixman_image_destroy): Fix leak of the clip region associated + with an image. (NOTE: xserver/render doesn't have the same bug + since it has FreePicture that calls into both DestroyPicture and + DestroyPictureClip separately). + 2005-07-09 Jeff Muizelaar * src/ic.c: (fbIn24), (fbCompositeTrans_0565xnx0565), diff --git a/pixman/src/icimage.c b/pixman/src/icimage.c index 1399def65..86db4416b 100644 --- a/pixman/src/icimage.c +++ b/pixman/src/icimage.c @@ -157,7 +157,7 @@ pixman_image_init (pixman_image_t *image) void pixman_image_set_component_alpha (pixman_image_t *image, - int component_alpha) + int component_alpha) { if (image) image->componentAlpha = component_alpha; @@ -254,6 +254,8 @@ pixman_image_get_data (pixman_image_t *image) void pixman_image_destroy (pixman_image_t *image) { + pixman_image_destroyClip (image); + if (image->freeCompClip) { pixman_region_destroy (image->pCompositeClip); image->pCompositeClip = NULL; -- cgit v1.2.3 From 14ea7b583b90142bcec829716a0077d969b847e3 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 11:45:39 +0000 Subject: Remove the copying of the region. This was a workaround for a missing copy bug in libpixman that has since been fixed. So now it was just a memory leak. --- ChangeLog | 7 +++++++ src/cairo-image-surface.c | 15 +-------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index 11de26953..fe6acdb03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-14 Carl Worth + + * src/cairo-image-surface.c: + (_cairo_image_surface_set_clip_region): Remove the copying of the + region. This was a workaround for a missing copy bug in libpixman + that has since been fixed. So now it was just a memory leak. + 2005-07-14 Carl Worth * src/cairo-png.c (read_png): Patch memory leak of png_info diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 8ee50e48e..209ee8f04 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -692,20 +692,7 @@ cairo_int_status_t _cairo_image_surface_set_clip_region (cairo_image_surface_t *surface, pixman_region16_t *region) { - if (region) { - pixman_region16_t *rcopy; - - rcopy = pixman_region_create(); - /* pixman_image_set_clip_region expects to take ownership of the - * passed-in region, so we create a copy to give it. */ - /* XXX: I think that's probably a bug in pixman. But its - * memory management issues need auditing anyway, so a - * workaround like this is fine for now. */ - pixman_region_copy (rcopy, region); - pixman_image_set_clip_region (surface->pixman_image, rcopy); - } else { - pixman_image_set_clip_region (surface->pixman_image, region); - } + pixman_image_set_clip_region (surface->pixman_image, region); return CAIRO_STATUS_SUCCESS; } -- cgit v1.2.3 From 0c3ee348f890879154089f23ea37bfaa2bfcd87a Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 11:48:40 +0000 Subject: Add missing (putatively unreachable) return value. --- ChangeLog | 5 +++++ src/cairo-ps-surface.c | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index fe6acdb03..1fad2f375 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-07-14 Carl Worth + + * src/cairo-ps-surface.c: (pattern_is_translucent): Add missing + (putatively unreachable) return value. + 2005-07-14 Carl Worth * src/cairo-image-surface.c: diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index 5e26e9418..0464b5a0a 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -624,6 +624,7 @@ pattern_is_translucent (cairo_pattern_t *abstract_pattern) } ASSERT_NOT_REACHED; + return FALSE; } /* PS Output - this section handles output of the parts of the meta -- cgit v1.2.3 From 456e3ffc4ddd496823dce6551b0545ce5c9530d4 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 12:20:42 +0000 Subject: Don't consider a test to fail if it can't create a surface at all (eg. no X server is available). Instead mark this backend as untested and only consider the overall test a success if all tested backend are successful. --- ChangeLog | 8 ++++++++ test/cairo-test.c | 31 ++++++++++++++++++++++++++----- test/cairo-test.h | 3 ++- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1fad2f375..91888e28c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-07-14 Carl Worth + + * test/cairo-test.c: (cairo_test_for_target), (cairo_test_real): + * test/cairo-test.h: Don't consider a test to fail if it can't + create a surface at all (eg. no X server is available). Instead + mark this backend as untested and only consider the overall test a + success if all tested backend are successful. + 2005-07-14 Carl Worth * src/cairo-ps-surface.c: (pattern_is_translucent): Add missing diff --git a/test/cairo-test.c b/test/cairo-test.c index 8c34f5ecf..871440336 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -421,7 +421,7 @@ cairo_test_for_target (cairo_test_t *test, &target->closure); if (surface == NULL) { cairo_test_log ("Error: Failed to set %s target\n", target->name); - ret = CAIRO_TEST_FAILURE; + ret = CAIRO_TEST_UNTESTED; goto UNWIND_STRINGS; } @@ -517,19 +517,40 @@ cairo_test_real (cairo_test_t *test, cairo_test_draw_function_t draw) } free (log_name); - ret = CAIRO_TEST_SUCCESS; + /* The intended logic here is that we return overall SUCCESS + * iff. all tested backends return SUCCESS. In other words: + * + * if any backend FAILURE + * -> FAILURE + * else if all backends UNTESTED + * -> FAILURE + * else (== some backend SUCCESS) + * -> SUCCESS + */ + ret = CAIRO_TEST_UNTESTED; for (i=0; i < sizeof(targets)/sizeof(targets[0]); i++) { cairo_test_target_t *target = &targets[i]; cairo_test_log ("Testing %s with %s target\n", test->name, target->name); printf ("%s-%s:\t", test->name, target->name); status = cairo_test_for_target (test, draw, target); - if (status) { + switch (status) { + case CAIRO_TEST_SUCCESS: + printf ("PASS\n"); + if (ret == CAIRO_TEST_UNTESTED) + ret = CAIRO_TEST_SUCCESS; + break; + case CAIRO_TEST_UNTESTED: + printf ("UNTESTED\n"); + break; + default: + case CAIRO_TEST_FAILURE: printf ("FAIL\n"); ret = status; - } else { - printf ("PASS\n"); + break; } } + if (ret == CAIRO_TEST_UNTESTED) + ret = CAIRO_TEST_FAILURE; fclose (cairo_test_log_file); diff --git a/test/cairo-test.h b/test/cairo-test.h index 6260daed1..1055a0c26 100644 --- a/test/cairo-test.h +++ b/test/cairo-test.h @@ -31,7 +31,8 @@ typedef enum cairo_test_status { CAIRO_TEST_SUCCESS = 0, - CAIRO_TEST_FAILURE + CAIRO_TEST_FAILURE, + CAIRO_TEST_UNTESTED } cairo_test_status_t; typedef struct cairo_test { -- cgit v1.2.3 From 6f6c9196c8248f469a9f3b54f886816430c86ac4 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 12:25:41 +0000 Subject: Fix comment describing test result. It's not enough that all tested backends are successful. We also require that at least one backend is actually tested. --- ChangeLog | 7 +++++++ test/cairo-test.c | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 91888e28c..c33342fed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-14 Carl Worth + + * test/cairo-test.c: (cairo_test_real): Fix comment describing + test result. It's not enough that all tested backends are + successful. We also require that at least one backend is actually + tested. + 2005-07-14 Carl Worth * test/cairo-test.c: (cairo_test_for_target), (cairo_test_real): diff --git a/test/cairo-test.c b/test/cairo-test.c index 871440336..43abc6f88 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -518,7 +518,8 @@ cairo_test_real (cairo_test_t *test, cairo_test_draw_function_t draw) free (log_name); /* The intended logic here is that we return overall SUCCESS - * iff. all tested backends return SUCCESS. In other words: + * iff. there is at least one tested backend and that all tested + * backends return SUCCESS. In other words: * * if any backend FAILURE * -> FAILURE -- cgit v1.2.3 From 288f0f7f49849c74c1025804ecb7076b3485b8f2 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 12:50:28 +0000 Subject: Make the per-backend test results print XFAIL rather than FAIL for expected failures. --- ChangeLog | 6 ++++++ test/cairo-test.c | 12 ++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c33342fed..a84fe8df1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-07-14 Carl Worth + + * test/cairo-test.c: (cairo_test_expecting), + (cairo_test_expect_failure), (cairo_test): Make the per-backend + test results print XFAIL rather than FAIL for expected failures. + 2005-07-14 Carl Worth * test/cairo-test.c: (cairo_test_real): Fix comment describing diff --git a/test/cairo-test.c b/test/cairo-test.c index 43abc6f88..49294512a 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -482,7 +482,8 @@ UNWIND_STRINGS: } static cairo_test_status_t -cairo_test_real (cairo_test_t *test, cairo_test_draw_function_t draw) +cairo_test_expecting (cairo_test_t *test, cairo_test_draw_function_t draw, + cairo_test_status_t expectation) { int i; cairo_test_status_t status, ret; @@ -545,7 +546,10 @@ cairo_test_real (cairo_test_t *test, cairo_test_draw_function_t draw) break; default: case CAIRO_TEST_FAILURE: - printf ("FAIL\n"); + if (expectation == CAIRO_TEST_FAILURE) + printf ("XFAIL\n"); + else + printf ("FAIL\n"); ret = status; break; } @@ -564,14 +568,14 @@ cairo_test_expect_failure (cairo_test_t *test, const char *because) { printf ("\n%s is expected to fail:\n\t%s\n", test->name, because); - return cairo_test_real (test, draw); + return cairo_test_expecting (test, draw, CAIRO_TEST_FAILURE); } cairo_test_status_t cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw) { printf ("\n"); - return cairo_test_real (test, draw); + return cairo_test_expecting (test, draw, CAIRO_TEST_SUCCESS); } cairo_pattern_t * -- cgit v1.2.3 From 3cd006bb2b3986aefaf6cf9002735c430e4bc172 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 15:10:47 +0000 Subject: Fix to accept a cairo_pattern_t rather than a cairo_surface_t as the primary argument. Track change in _cairo_pattern_release_surface and also pass the appropriate pattern for each acquired surface. The previous backend mismatch was causing memory leaks. Remove stale comment. Add missing fclose to keep valgrind happy about memory leaks. --- ChangeLog | 19 +++++++++++++++++++ src/cairo-image-surface.c | 6 +++--- src/cairo-pattern.c | 13 +++++++++---- src/cairo-xlib-surface.c | 1 - src/cairoint.h | 2 +- test/xlib-surface.c | 4 ++++ 6 files changed, 36 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a84fe8df1..18ae14640 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2005-07-14 Carl Worth + + * src/cairoint.h: + * src/cairo-pattern.c: (_cairo_pattern_release_surface): Fix to + accept a cairo_pattern_t rather than a cairo_surface_t as the + primary argument. + + * src/cairo-image-surface.c: (_cairo_image_surface_composite), + (_cairo_image_surface_composite_trapezoids): Track change in + _cairo_pattern_release_surface and also pass the appropriate + pattern for each acquired surface. The previous backend mismatch + was causing memory leaks. + + * src/cairo-xlib-surface.c: (_get_image_surface): Remove stale + comment. + + * test/xlib-surface.c: (main): Add missing fclose to keep valgrind + happy about memory leaks. + 2005-07-14 Carl Worth * test/cairo-test.c: (cairo_test_expecting), diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 209ee8f04..aff35ce3c 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -595,9 +595,9 @@ _cairo_image_surface_composite (cairo_operator_t operator, } if (mask) - _cairo_pattern_release_surface (&dst->base, &mask->base, &mask_attr); + _cairo_pattern_release_surface (mask_pattern, &mask->base, &mask_attr); - _cairo_pattern_release_surface (&dst->base, &src->base, &src_attr); + _cairo_pattern_release_surface (src_pattern, &src->base, &src_attr); return status; } @@ -674,7 +674,7 @@ _cairo_image_surface_composite_trapezoids (cairo_operator_t operator, render_src_y + attributes.y_offset, (pixman_trapezoid_t *) traps, num_traps); - _cairo_pattern_release_surface (&dst->base, &src->base, &attributes); + _cairo_pattern_release_surface (pattern, &src->base, &attributes); return status; } diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 5af55bf89..9c8ddff9f 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -1409,19 +1409,24 @@ _cairo_pattern_acquire_surface (cairo_pattern_t *pattern, /** * _cairo_pattern_release_surface: * @pattern: a #cairo_pattern_t - * @info: pointer to #cairo_surface_attributes_t filled in by - * _cairo_pattern_acquire_surface + * @surface: a surface obtained by _cairo_pattern_acquire_surface + * @attributes: attributes obtained by _cairo_pattern_acquire_surface * * Releases resources obtained by _cairo_pattern_acquire_surface. **/ void -_cairo_pattern_release_surface (cairo_surface_t *dst, +_cairo_pattern_release_surface (cairo_pattern_t *pattern, cairo_surface_t *surface, cairo_surface_attributes_t *attributes) { if (attributes->acquired) { - _cairo_surface_release_source_image (dst, + cairo_surface_pattern_t *surface_pattern; + + assert (pattern->type == CAIRO_PATTERN_SURFACE); + surface_pattern = (cairo_surface_pattern_t *) pattern; + + _cairo_surface_release_source_image (surface_pattern->surface, (cairo_image_surface_t *) surface, attributes->extra); } diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index c5b26e505..88f514dbe 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -450,7 +450,6 @@ _get_image_surface (cairo_xlib_surface_t *surface, } /* Let the surface take ownership of the data */ - /* XXX: Can probably come up with a cleaner API here. */ _cairo_image_surface_assume_ownership_of_data (image); ximage->data = NULL; XDestroyImage (ximage); diff --git a/src/cairoint.h b/src/cairoint.h index a1b67f943..bd8072c5d 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -1817,7 +1817,7 @@ _cairo_pattern_acquire_surface (cairo_pattern_t *pattern, cairo_surface_attributes_t *attributes); cairo_private void -_cairo_pattern_release_surface (cairo_surface_t *dst, +_cairo_pattern_release_surface (cairo_pattern_t *pattern, cairo_surface_t *surface, cairo_surface_attributes_t *attributes); diff --git a/test/xlib-surface.c b/test/xlib-surface.c index d8c241c8e..2921eb852 100644 --- a/test/xlib-surface.c +++ b/test/xlib-surface.c @@ -221,11 +221,13 @@ main (void) dpy = XOpenDisplay (NULL); if (!dpy) { fprintf (log_file, "xlib-surface: Cannot open display, skipping\n"); + fclose (log_file); return 0; } if (!check_visual (dpy)) { fprintf (log_file, "xlib-surface: default visual is not RGB24 or BGR24, skipping\n"); + fclose (log_file); return 0; } @@ -264,6 +266,8 @@ main (void) free (diff_data); XCloseDisplay (dpy); + + fclose (log_file); return result; } -- cgit v1.2.3 From d8500060a972de9ca0f202d9cfb73460446dfc17 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 15:47:18 +0000 Subject: Fix up one more call to _cairo_pattern_release_surface missed in the previous commit. --- ChangeLog | 6 ++++++ src/cairo-pattern.c | 50 ++++++++++++++++++++++++-------------------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 18ae14640..85ee99009 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-07-14 Carl Worth + + * src/cairo-pattern.c: (_cairo_pattern_acquire_surfaces): Fix up + one more call to _cairo_pattern_release_surface missed in the + previous commit. + 2005-07-14 Carl Worth * src/cairoint.h: diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 9c8ddff9f..b309e8e38 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -1452,7 +1452,7 @@ _cairo_pattern_acquire_surfaces (cairo_pattern_t *src, cairo_surface_attributes_t *mask_attributes) { cairo_int_status_t status; - cairo_pattern_union_t tmp; + cairo_pattern_union_t src_tmp, mask_tmp; if (src->status) return src->status; @@ -1475,46 +1475,44 @@ _cairo_pattern_acquire_surfaces (cairo_pattern_t *src, combined = src_solid->color; _cairo_color_multiply_alpha (&combined, mask_solid->color.alpha); - _cairo_pattern_init_solid (&tmp.solid, &combined); + _cairo_pattern_init_solid (&src_tmp.solid, &combined); mask = NULL; } else { - _cairo_pattern_init_copy (&tmp.base, src); + _cairo_pattern_init_copy (&src_tmp.base, src); } - status = _cairo_pattern_acquire_surface (&tmp.base, dst, + status = _cairo_pattern_acquire_surface (&src_tmp.base, dst, src_x, src_y, width, height, src_out, src_attributes); - - _cairo_pattern_fini (&tmp.base); - - if (status) + if (status) { + _cairo_pattern_fini (&src_tmp.base); return status; + } - if (mask) + if (mask == NULL) { - _cairo_pattern_init_copy (&tmp.base, mask); + _cairo_pattern_fini (&src_tmp.base); + *mask_out = NULL; + return CAIRO_STATUS_SUCCESS; + } + + _cairo_pattern_init_copy (&mask_tmp.base, mask); - status = _cairo_pattern_acquire_surface (&tmp.base, dst, - mask_x, mask_y, - width, height, - mask_out, mask_attributes); + status = _cairo_pattern_acquire_surface (&mask_tmp.base, dst, + mask_x, mask_y, + width, height, + mask_out, mask_attributes); - _cairo_pattern_fini (&tmp.base); + if (status) + _cairo_pattern_release_surface (&src_tmp.base, + *src_out, src_attributes); - if (status) - { - _cairo_pattern_release_surface (dst, *src_out, src_attributes); - return status; - } - } - else - { - *mask_out = NULL; - } + _cairo_pattern_fini (&src_tmp.base); + _cairo_pattern_fini (&mask_tmp.base); - return CAIRO_STATUS_SUCCESS; + return status; } -- cgit v1.2.3 From 40edca337e3976ddca98caafcbab950000e66880 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 16:18:39 +0000 Subject: Rewrite to use cairo_image_surface_create_from_png rather than custom read_png_argb32. In addition to being simpler, this eliminates the leak of the image data buffer. Add calls to cairo_pattern_destroy to close two memory leaks. --- ChangeLog | 10 ++++++++++ test/cairo-test.c | 19 ++++++++----------- test/trap-clip.c | 2 ++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 85ee99009..e84a78c6b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-07-14 Carl Worth + + * test/cairo-test.c: (cairo_test_create_png_pattern): Rewrite to + use cairo_image_surface_create_from_png rather than custom + read_png_argb32. In addition to being simpler, this eliminates the + leak of the image data buffer. + + * test/trap-clip.c: (set_gradient_pattern), (set_image_pattern): + Add calls to cairo_pattern_destroy to close two memory leaks. + 2005-07-14 Carl Worth * src/cairo-pattern.c: (_cairo_pattern_acquire_surfaces): Fix up diff --git a/test/cairo-test.c b/test/cairo-test.c index 49294512a..4274bef4b 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -583,28 +583,25 @@ cairo_test_create_png_pattern (cairo_t *cr, const char *filename) { cairo_surface_t *image; cairo_pattern_t *pattern; - unsigned char *buffer; - unsigned int w, h, stride; - read_png_status_t status; char *srcdir = getenv ("srcdir"); - status = read_png_argb32 (filename, &buffer, &w,&h, &stride); - if (status != READ_PNG_SUCCESS) { + image = cairo_image_surface_create_from_png (filename); + if (image == NULL) { if (srcdir) { char *srcdir_filename; xasprintf (&srcdir_filename, "%s/%s", srcdir, filename); - status = read_png_argb32 (srcdir_filename, &buffer, &w,&h, &stride); + image = cairo_image_surface_create_from_png (srcdir_filename); free (srcdir_filename); } + if (image == NULL) + return NULL; } - if (status != READ_PNG_SUCCESS) - return NULL; - - image = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_ARGB32, - w, h, stride); pattern = cairo_pattern_create_for_surface (image); + cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); + cairo_surface_destroy (image); + return pattern; } diff --git a/test/trap-clip.c b/test/trap-clip.c index 2ad43ea5f..dddb94cb2 100644 --- a/test/trap-clip.c +++ b/test/trap-clip.c @@ -55,6 +55,7 @@ set_gradient_pattern (cairo_t *cr, int x, int y) cairo_pattern_add_color_stop_rgba (pattern, 0, 1, 1, 1, 1); cairo_pattern_add_color_stop_rgba (pattern, 1, 0, 0, 0.4, 1); cairo_set_source (cr, pattern); + cairo_pattern_destroy (pattern); } static void @@ -64,6 +65,7 @@ set_image_pattern (cairo_t *cr, int x, int y) pattern = cairo_test_create_png_pattern (cr, png_filename); cairo_set_source (cr, pattern); + cairo_pattern_destroy (pattern); } static void -- cgit v1.2.3 From 174056f7364892b07177f9e7cbda2821ca6c9ac9 Mon Sep 17 00:00:00 2001 From: Stuart Parmenter Date: Thu, 14 Jul 2005 16:50:58 +0000 Subject: blue and green values were swapped in the DO_SOURCE case. --- ChangeLog | 5 +++++ src/cairo-win32-surface.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e84a78c6b..6b68dc82e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-14 Stuart Parmenter + + * src/cairo-win32-surface.c: (_cairo_win32_surface_fill_rectangles): + blue and green values were swapped in the DO_SOURCE case. + 2005-07-14 Carl Worth * test/cairo-test.c: (cairo_test_create_png_pattern): Rewrite to diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c index b58e6458d..148d22bcd 100644 --- a/src/cairo-win32-surface.c +++ b/src/cairo-win32-surface.c @@ -706,7 +706,7 @@ _cairo_win32_surface_fill_rectangles (void *abstract_surface, new_color = RGB (0, 0, 0); break; case DO_SOURCE: - new_color = RGB (color->red_short >> 8, color->blue_short >> 8, color->green_short >> 8); + new_color = RGB (color->red_short >> 8, color->green_short >> 8, color->blue_short >> 8); break; case DO_NOTHING: return CAIRO_STATUS_SUCCESS; -- cgit v1.2.3 From df181620c0e6ca889013435d1ae5d0ffddfeec9d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 16:56:08 +0000 Subject: Eek. Yet _more_ fixups for _cairo_pattern_release_surface missed earlier. --- ChangeLog | 7 +++++++ src/cairo-xlib-surface.c | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6b68dc82e..fd5fe48c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-14 Carl Worth + + * src/cairo-xlib-surface.c: (_cairo_xlib_surface_composite), + (_cairo_xlib_surface_composite_trapezoids), + (_cairo_xlib_surface_show_glyphs): Eek. Yet _more_ fixups for + _cairo_pattern_release_surface missed earlier. + 2005-08-14 Stuart Parmenter * src/cairo-win32-surface.c: (_cairo_win32_surface_fill_rectangles): diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 88f514dbe..95df4d298 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -1068,9 +1068,9 @@ _cairo_xlib_surface_composite (cairo_operator_t operator, FAIL: if (mask) - _cairo_pattern_release_surface (&dst->base, &mask->base, &mask_attr); + _cairo_pattern_release_surface (mask_pattern, &mask->base, &mask_attr); - _cairo_pattern_release_surface (&dst->base, &src->base, &src_attr); + _cairo_pattern_release_surface (src_pattern, &src->base, &src_attr); return status; } @@ -1168,7 +1168,7 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t operator, (XTrapezoid *) traps, num_traps); FAIL: - _cairo_pattern_release_surface (&dst->base, &src->base, &attributes); + _cairo_pattern_release_surface (pattern, &src->base, &attributes); return status; } @@ -2045,7 +2045,7 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, free (entries); FAIL: - _cairo_pattern_release_surface (&self->base, &src->base, &attributes); + _cairo_pattern_release_surface (pattern, &src->base, &attributes); return status; } -- cgit v1.2.3 From 6df1baa395ad11c1a22dd5279d6281b3ee149e94 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 17:52:17 +0000 Subject: Call _cairo_array_fini on the several array objects to patch memory leaks. --- ChangeLog | 6 ++++++ src/cairo-pdf-surface.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/ChangeLog b/ChangeLog index fd5fe48c4..a84397d95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-07-14 Carl Worth + + * src/cairo-pdf-surface.c: (_cairo_pdf_surface_finish), + (_cairo_pdf_document_finish): Call _cairo_array_fini on the + several array objects to patch memory leaks. + 2005-07-14 Carl Worth * src/cairo-xlib-surface.c: (_cairo_xlib_surface_composite), diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index f578fd623..1c5026ce3 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -485,6 +485,12 @@ _cairo_pdf_surface_finish (void *abstract_surface) _cairo_pdf_document_destroy (document); + _cairo_array_fini (&surface->streams); + _cairo_array_fini (&surface->patterns); + _cairo_array_fini (&surface->xobjects); + _cairo_array_fini (&surface->alphas); + _cairo_array_fini (&surface->fonts); + return status; } @@ -1688,6 +1694,10 @@ _cairo_pdf_document_finish (cairo_pdf_document_t *document) status = _cairo_output_stream_get_status (output); _cairo_output_stream_destroy (output); + _cairo_array_fini (&document->objects); + _cairo_array_fini (&document->pages); + _cairo_array_fini (&document->fonts); + document->finished = TRUE; return status; -- cgit v1.2.3 From 3e05319bf8584d88fc34825d79c138f0e9f8a297 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Thu, 14 Jul 2005 17:55:58 +0000 Subject: Fix leak of surface. --- ChangeLog | 4 ++++ test/surface-finish-twice.c | 2 ++ 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index a84397d95..8640b786d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-07-14 Carl Worth + + * test/surface-finish-twice.c: (draw): Fix leak of surface. + 2005-07-14 Carl Worth * src/cairo-pdf-surface.c: (_cairo_pdf_surface_finish), diff --git a/test/surface-finish-twice.c b/test/surface-finish-twice.c index 3f24e391c..68d49c928 100644 --- a/test/surface-finish-twice.c +++ b/test/surface-finish-twice.c @@ -63,6 +63,8 @@ draw (cairo_t *cr, int width, int height) if (status != CAIRO_STATUS_SURFACE_FINISHED) return CAIRO_TEST_FAILURE; + cairo_surface_destroy (surface); + return CAIRO_TEST_SUCCESS; } -- cgit v1.2.3 From 89a9771b60906092cca1b5e7582be3ae140b9bc2 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 15 Jul 2005 00:56:58 +0000 Subject: Remove errant line of code that was inadvertently committed recently. --- ChangeLog | 5 +++++ test/cairo-test.c | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8640b786d..c4b532df7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-07-15 Carl Worth + + * test/cairo-test.c (cairo_test_for_target): Remove errant line of + code that was inadvertently committed recently. + 2005-07-14 Carl Worth * test/surface-finish-twice.c: (draw): Fix leak of surface. diff --git a/test/cairo-test.c b/test/cairo-test.c index 4274bef4b..9917ac94a 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -449,9 +449,6 @@ cairo_test_for_target (cairo_test_t *test, goto UNWIND_CAIRO; } - if (test->width > 0 && test->height > 0) - - /* Skip image check for tests with no image (width,height == 0,0) */ if (test->width != 0 && test->height != 0) { int pixels_changed; -- cgit v1.2.3 From 3a053c1e58962c3fb9eae11954651270244cabae Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 15 Jul 2005 01:05:56 +0000 Subject: Fix memory leak, (missing _cairo_pattern_fini). --- ChangeLog | 5 +++++ src/cairo-gstate.c | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index c4b532df7..9bad8722c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-07-15 Carl Worth + + * src/cairo-gstate.c: (_cairo_gstate_mask): Fix memory leak, + (missing _cairo_pattern_fini). + 2005-07-15 Carl Worth * test/cairo-test.c (cairo_test_for_target): Remove errant line of diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index 2388900b3..ed6210cfb 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -952,6 +952,7 @@ _cairo_gstate_mask (cairo_gstate_t *gstate, if (gstate->clip.surface) _cairo_pattern_fini (&intermediate_pattern.base); + _cairo_pattern_fini (&pattern.base); return status; } -- cgit v1.2.3 From 07d09acf2a9a8341f281cfe235325a52a20cd750 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 15 Jul 2005 01:38:38 +0000 Subject: Fix a few memory leaks (missing cairo_pattern_destroy in 3 places). --- ChangeLog | 6 ++++++ test/mask.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9bad8722c..8295bd323 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-07-15 Carl Worth + + * test/mask.c: (set_gradient_pattern), (set_image_pattern), + (draw): Fix a few memory leaks (missing cairo_pattern_destroy in 3 + places). + 2005-07-15 Carl Worth * src/cairo-gstate.c: (_cairo_gstate_mask): Fix memory leak, diff --git a/test/mask.c b/test/mask.c index 89626167b..bf94f7163 100644 --- a/test/mask.c +++ b/test/mask.c @@ -56,6 +56,7 @@ set_gradient_pattern (cairo_t *cr, int x, int y) cairo_pattern_add_color_stop_rgba (pattern, 0, 1, 1, 1, 1); cairo_pattern_add_color_stop_rgba (pattern, 1, 0, 0, 0.4, 1); cairo_set_source (cr, pattern); + cairo_pattern_destroy (pattern); } static void @@ -65,6 +66,7 @@ set_image_pattern (cairo_t *cr, int x, int y) pattern = cairo_test_create_png_pattern (cr, png_filename); cairo_set_source (cr, pattern); + cairo_pattern_destroy (pattern); } static void @@ -202,6 +204,8 @@ draw (cairo_t *cr, int width, int height) tmp_pattern = cairo_pattern_create_for_surface (tmp_surface); cairo_set_source (cr, tmp_pattern); + cairo_pattern_destroy (tmp_pattern); + cairo_surface_destroy (tmp_surface); for (k = 0; k < ARRAY_SIZE (clip_funcs); k++) { for (j = 0; j < ARRAY_SIZE (mask_funcs); j++) { @@ -234,7 +238,6 @@ draw (cairo_t *cr, int width, int height) } cairo_destroy (cr2); - cairo_surface_destroy (tmp_surface); return CAIRO_TEST_SUCCESS; } -- cgit v1.2.3 From 2534057cb5df78eb5aa79c24317e4a97f6c0f2c6 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 15 Jul 2005 10:39:59 +0000 Subject: Add new check-valgrind target for running the test suite under the influence of valgrind. Fix memory leak when reference image is not found. --- ChangeLog | 8 ++++++++ test/Makefile.am | 3 +++ test/buffer-diff.c | 4 +++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8295bd323..508293e80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-07-15 Carl Worth + + * test/Makefile.am: Add new check-valgrind target for running the + test suite under the influence of valgrind. + + * test/buffer-diff.c: (image_diff): Fix memory leak when reference + image is not found. + 2005-07-15 Carl Worth * test/mask.c: (set_gradient_pattern), (set_image_pattern), diff --git a/test/Makefile.am b/test/Makefile.am index ecadb9602..118b298f0 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -179,3 +179,6 @@ CLEANFILES = \ ps-surface.ps \ pdf-surface.pdf \ pdf-clip.pdf + +check-valgrind: + TESTS_ENVIRONMENT="libtool --mode=execute valgrind --tool=memcheck --leak-check=yes --show-reachable=yes" $(MAKE) check \ No newline at end of file diff --git a/test/buffer-diff.c b/test/buffer-diff.c index e540d2f9b..e5ba513ac 100644 --- a/test/buffer-diff.c +++ b/test/buffer-diff.c @@ -112,8 +112,10 @@ image_diff (const char *filename_a, return -1; status = read_png_argb32 (filename_b, &buf_b, &width_b, &height_b, &stride_b); - if (status) + if (status) { + free (buf_a); return -1; + } if (width_a != width_b || height_a != height_b || -- cgit v1.2.3 From 8ad8aa63605610eaec78cdbfea321148c02be331 Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Fri, 15 Jul 2005 13:45:19 +0000 Subject: Use XCopyArea when possible, for optimization and bug workaround. Exercise XCopyArea, XRenderComposite, and XSetTile/XFillRectangle paths for _cairo_xlib_surface_composite --- ChangeLog | 10 ++ ROADMAP | 2 +- src/cairo-xlib-surface.c | 117 +++++++++++++++------ test/.cvsignore | 3 + test/Makefile.am | 11 +- test/composite-integer-translate-over-ref.png | Bin 0 -> 15397 bytes ...composite-integer-translate-over-repeat-ref.png | Bin 0 -> 401 bytes test/composite-integer-translate-over-repeat.c | 61 +++++++++++ test/composite-integer-translate-over.c | 42 ++++++++ test/composite-integer-translate-source-ref.png | Bin 0 -> 16385 bytes test/composite-integer-translate-source.c | 42 ++++++++ 11 files changed, 255 insertions(+), 33 deletions(-) create mode 100644 test/composite-integer-translate-over-ref.png create mode 100644 test/composite-integer-translate-over-repeat-ref.png create mode 100644 test/composite-integer-translate-over-repeat.c create mode 100644 test/composite-integer-translate-over.c create mode 100644 test/composite-integer-translate-source-ref.png create mode 100644 test/composite-integer-translate-source.c diff --git a/ChangeLog b/ChangeLog index 508293e80..7a3cbfe76 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-07-15 Vladimir Vukicevic + + * src/cairo-xlib-surface.c: (_cairo_xlib_surface_composite, + _recategorize_composite_repeat): Use XCopyArea when + possible, for optimization and bug workaround. + + * test/composite-integer-translate-{source,over,over-repeat}.c: + Exercise XCopyArea, XRenderComposite, and XSetTile/XFillRectangle + paths for _cairo_xlib_surface_composite + 2005-07-15 Carl Worth * test/Makefile.am: Add new check-valgrind target for running the diff --git a/ROADMAP b/ROADMAP index 9b79e9521..88fad3087 100644 --- a/ROADMAP +++ b/ROADMAP @@ -10,7 +10,7 @@ cairo 0.5.2 0.1.4 which is already fixed in libpixman 0.1.5) Add a workaround for Render's overlapping source/dest bug - Use XCopyArea when possible (integer translation) +✓ Use XCopyArea when possible (integer translation) Otherwise make a copy of the source Fix the cache lock deadlocking problems. diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index 95df4d298..caec2b9dd 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -829,17 +829,39 @@ _surface_has_alpha (cairo_xlib_surface_t *surface) } } +/* Returns true if the given operator and source-alpha combination + * requires alpha compositing to complete. + */ +static cairo_bool_t +_operator_needs_alpha_composite (cairo_operator_t operator, + cairo_bool_t surface_has_alpha) +{ + if (operator == CAIRO_OPERATOR_SOURCE || + (!surface_has_alpha && + (operator == CAIRO_OPERATOR_OVER || + operator == CAIRO_OPERATOR_ATOP || + operator == CAIRO_OPERATOR_IN))) + return FALSE; + + return TRUE; +} + /* There is a bug in most older X servers with compositing using a repeating * source pattern when the source is in off-screen video memory. When that * bug could be triggered, we need a fallback: in the common case where we have no * transformation and the source and destination have the same format/visual, * we can do the operation using the core protocol, otherwise, we need * a software fallback. + * + * We can also often optimize a compositing operation by calling XCopyArea + * for some common cases where there is no alpha compositing to be done. + * We figure that out here as well. */ typedef enum { - DO_RENDER, /* use render */ - DO_XLIB, /* core protocol fallback */ - DO_UNSUPPORTED /* software fallback */ + DO_RENDER, /* use render */ + DO_XCOPYAREA, /* core protocol XCopyArea optimization/fallback */ + DO_XTILE, /* core protocol XSetTile optimization/fallback */ + DO_UNSUPPORTED /* software fallback */ } composite_operation_t; /* Initial check for the bug; we need to recheck after we turn @@ -850,10 +872,10 @@ typedef enum { * hit the bug and won't be able to use a core protocol fallback. */ static composite_operation_t -_categorize_composite_repeat (cairo_xlib_surface_t *dst, - cairo_operator_t operator, - cairo_pattern_t *src_pattern, - cairo_bool_t have_mask) +_categorize_composite_operation (cairo_xlib_surface_t *dst, + cairo_operator_t operator, + cairo_pattern_t *src_pattern, + cairo_bool_t have_mask) { if (!dst->buggy_repeat) @@ -892,27 +914,43 @@ _categorize_composite_repeat (cairo_xlib_surface_t *dst, * If we end up returning DO_UNSUPPORTED here, we're throwing away work we * did to turn gradients into a pattern, but most of the time we can handle * that case with core protocol fallback. + * + * Also check here if we can just use XCopyArea, instead of going through + * Render. */ static composite_operation_t -_recategorize_composite_repeat (cairo_xlib_surface_t *dst, - cairo_operator_t operator, - cairo_xlib_surface_t *src, - cairo_surface_attributes_t *src_attr, - cairo_bool_t have_mask) +_recategorize_composite_operation (cairo_xlib_surface_t *dst, + cairo_operator_t operator, + cairo_xlib_surface_t *src, + cairo_surface_attributes_t *src_attr, + cairo_bool_t have_mask) { + cairo_bool_t is_integer_translation = + _cairo_matrix_is_integer_translation (&src_attr->matrix, NULL, NULL); + cairo_bool_t needs_alpha_composite = + _operator_needs_alpha_composite (operator, _surface_has_alpha (src)); + + if (!have_mask && + is_integer_translation && + src_attr->extend == CAIRO_EXTEND_NONE && + !needs_alpha_composite && + _surfaces_compatible(src, dst)) + { + return DO_XCOPYAREA; + } + if (!dst->buggy_repeat) return DO_RENDER; - if (_cairo_matrix_is_integer_translation (&src_attr->matrix, NULL, NULL) && + if (is_integer_translation && src_attr->extend == CAIRO_EXTEND_REPEAT && (src->width != 1 || src->height != 1)) { if (!have_mask && - (operator == CAIRO_OPERATOR_SOURCE || - (operator == CAIRO_OPERATOR_OVER && !_surface_has_alpha (src)))) + !needs_alpha_composite && + _surfaces_compatible (dst, src)) { - if (_surfaces_compatible (dst, src)) - return DO_XLIB; + return DO_XTILE; } return DO_UNSUPPORTED; @@ -981,12 +1019,13 @@ _cairo_xlib_surface_composite (cairo_operator_t operator, cairo_xlib_surface_t *mask; cairo_int_status_t status; composite_operation_t operation; + int itx, ity; if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE (dst)) return CAIRO_INT_STATUS_UNSUPPORTED; - operation = _categorize_composite_repeat (dst, operator, src_pattern, - mask_pattern != NULL); + operation = _categorize_composite_operation (dst, operator, src_pattern, + mask_pattern != NULL); if (operation == DO_UNSUPPORTED) return CAIRO_INT_STATUS_UNSUPPORTED; @@ -1001,8 +1040,8 @@ _cairo_xlib_surface_composite (cairo_operator_t operator, if (status) return status; - operation = _recategorize_composite_repeat (dst, operator, src, &src_attr, - mask_pattern != NULL); + operation = _recategorize_composite_operation (dst, operator, src, &src_attr, + mask_pattern != NULL); if (operation == DO_UNSUPPORTED) { status = CAIRO_INT_STATUS_UNSUPPORTED; goto FAIL; @@ -1012,8 +1051,9 @@ _cairo_xlib_surface_composite (cairo_operator_t operator, if (status) goto FAIL; - if (operation == DO_RENDER) + switch (operation) { + case DO_RENDER: _cairo_xlib_surface_ensure_dst_picture (dst); if (mask) { status = _cairo_xlib_surface_set_attributes (mask, &mask_attr); @@ -1041,17 +1081,28 @@ _cairo_xlib_surface_composite (cairo_operator_t operator, dst_x, dst_y, width, height); } - } - else /* DO_XLIB */ - { + break; + + case DO_XCOPYAREA: + _cairo_xlib_surface_ensure_gc (dst); + XCopyArea (dst->dpy, + src->drawable, + dst->drawable, + dst->gc, + src_x + src_attr.x_offset, + src_y + src_attr.y_offset, + width, height, + dst_x, dst_y); + break; + + case DO_XTILE: /* This case is only used for bug fallbacks, though it is theoretically * applicable to the case where we don't have the RENDER extension as * well. * * We've checked that we have a repeating unscaled source in - * _recategorize_composite_repeat. + * _recategorize_composite_operation. */ - int itx, ity; _cairo_xlib_surface_ensure_gc (dst); _cairo_matrix_is_integer_translation (&src_attr.matrix, &itx, &ity); @@ -1063,6 +1114,10 @@ _cairo_xlib_surface_composite (cairo_operator_t operator, XFillRectangle (dst->dpy, dst->drawable, dst->gc, dst_x, dst_y, width, height); + break; + + default: + ASSERT_NOT_REACHED; } FAIL: @@ -1127,7 +1182,7 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t operator, if (!CAIRO_SURFACE_RENDER_HAS_TRAPEZOIDS (dst)) return CAIRO_INT_STATUS_UNSUPPORTED; - operation = _categorize_composite_repeat (dst, operator, pattern, TRUE); + operation = _categorize_composite_operation (dst, operator, pattern, TRUE); if (operation == DO_UNSUPPORTED) return CAIRO_INT_STATUS_UNSUPPORTED; @@ -1138,7 +1193,7 @@ _cairo_xlib_surface_composite_trapezoids (cairo_operator_t operator, if (status) return status; - operation = _recategorize_composite_repeat (dst, operator, src, &attributes, TRUE); + operation = _recategorize_composite_operation (dst, operator, src, &attributes, TRUE); if (operation == DO_UNSUPPORTED) { status = CAIRO_INT_STATUS_UNSUPPORTED; goto FAIL; @@ -1959,7 +2014,7 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE_TEXT (self) || !self->format) return CAIRO_INT_STATUS_UNSUPPORTED; - operation = _categorize_composite_repeat (self, operator, pattern, TRUE); + operation = _categorize_composite_operation (self, operator, pattern, TRUE); if (operation == DO_UNSUPPORTED) return CAIRO_INT_STATUS_UNSUPPORTED; @@ -1970,7 +2025,7 @@ _cairo_xlib_surface_show_glyphs (cairo_scaled_font_t *scaled_font, if (status) return status; - operation = _recategorize_composite_repeat (self, operator, src, &attributes, TRUE); + operation = _recategorize_composite_operation (self, operator, src, &attributes, TRUE); if (operation == DO_UNSUPPORTED) { status = CAIRO_INT_STATUS_UNSUPPORTED; goto FAIL; diff --git a/test/.cvsignore b/test/.cvsignore index 5ce9bbd3a..00ed2feca 100644 --- a/test/.cvsignore +++ b/test/.cvsignore @@ -4,6 +4,9 @@ Makefile Makefile.in clip-nesting clip-twice +composite-integer-translate-source +composite-integer-translate-over +composite-integer-translate-over-repeat coverage create-from-png fill-and-stroke diff --git a/test/Makefile.am b/test/Makefile.am index 118b298f0..ee8d1b98d 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -2,6 +2,9 @@ TESTS = \ clip-nesting \ clip-twice \ +composite-integer-translate-source \ +composite-integer-translate-over \ +composite-integer-translate-over-repeat \ create-from-png \ fill-and-stroke \ fill-rule \ @@ -52,6 +55,9 @@ endif EXTRA_DIST = \ clip-nesting-ref.png \ clip-twice-ref.png \ +composite-integer-translate-source-ref.png \ +composite-integer-translate-over-ref.png \ +composite-integer-translate-over-repeat-ref.png \ create-from-png-ref.png \ fill-and-stroke-ref.png \ fill-rule-ref.png \ @@ -133,6 +139,9 @@ LDADDS = libcairotest.la $(top_builddir)/src/libcairo.la # from autogen.sh. My, but this is painful... clip_nesting_LDADD = $(LDADDS) clip_twice_LDADD = $(LDADDS) +composite_integer_translate_source_LDADD = $(LDADDS) +composite_integer_translate_over_LDADD = $(LDADDS) +composite_integer_translate_over_repeat_LDADD = $(LDADDS) create_from_png_LDADD = $(LDADDS) fill_and_stroke_LDADD = $(LDADDS) fill_rule_LDADD = $(LDADDS) @@ -181,4 +190,4 @@ CLEANFILES = \ pdf-clip.pdf check-valgrind: - TESTS_ENVIRONMENT="libtool --mode=execute valgrind --tool=memcheck --leak-check=yes --show-reachable=yes" $(MAKE) check \ No newline at end of file + TESTS_ENVIRONMENT="libtool --mode=execute valgrind --tool=memcheck --leak-check=yes --show-reachable=yes" $(MAKE) check diff --git a/test/composite-integer-translate-over-ref.png b/test/composite-integer-translate-over-ref.png new file mode 100644 index 000000000..1fbaaaa3b Binary files /dev/null and b/test/composite-integer-translate-over-ref.png differ diff --git a/test/composite-integer-translate-over-repeat-ref.png b/test/composite-integer-translate-over-repeat-ref.png new file mode 100644 index 000000000..c04db2631 Binary files /dev/null and b/test/composite-integer-translate-over-repeat-ref.png differ diff --git a/test/composite-integer-translate-over-repeat.c b/test/composite-integer-translate-over-repeat.c new file mode 100644 index 000000000..b681ac9c7 --- /dev/null +++ b/test/composite-integer-translate-over-repeat.c @@ -0,0 +1,61 @@ +#include +#include "cairo-test.h" +#include + +#define SIZE 100 +#define SIZE2 20 +#define OFFSET 10 + +cairo_test_t test = { + "composite-integer-translate-over-repeat", + "Test simple compositing: integer-translation 32->32 OVER, with repeat", + SIZE, SIZE +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_surface_t *image; + cairo_pattern_t *pat; + cairo_t *cr2; + + image = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, SIZE2, SIZE2); + + cr2 = cairo_create (image); + cairo_set_source_rgba (cr2, 1, 0, 0, 1); + cairo_rectangle (cr2, 0, 0, SIZE2/2, SIZE2/2); + cairo_fill (cr2); + cairo_set_source_rgba (cr2, 0, 1, 0, 1); + cairo_rectangle (cr2, SIZE2/2, 0, SIZE2/2, SIZE2/2); + cairo_fill (cr2); + cairo_set_source_rgba (cr2, 0, 0, 1, 1); + cairo_rectangle (cr2, 0, SIZE2/2, SIZE2/2, SIZE2/2); + cairo_fill (cr2); + cairo_set_source_rgba (cr2, 1, 1, 0, 1); + cairo_rectangle (cr2, SIZE2/2, SIZE2/2, SIZE2/2, SIZE2/2); + cairo_fill (cr2); + cairo_destroy (cr2); + + pat = cairo_pattern_create_for_surface (image); + cairo_pattern_set_extend (pat, CAIRO_EXTEND_REPEAT); + + cairo_set_source_rgba (cr, 0, 0, 0, 1); + cairo_rectangle (cr, 0, 0, SIZE, SIZE); + cairo_fill (cr); + + cairo_translate (cr, OFFSET, OFFSET); + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + cairo_set_source (cr, pat); + cairo_rectangle (cr, 0, 0, SIZE - OFFSET, SIZE - OFFSET); + cairo_fill (cr); + + cairo_surface_destroy (image); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test, draw); +} diff --git a/test/composite-integer-translate-over.c b/test/composite-integer-translate-over.c new file mode 100644 index 000000000..867448889 --- /dev/null +++ b/test/composite-integer-translate-over.c @@ -0,0 +1,42 @@ +#include +#include "cairo-test.h" +#include + +#define SIZE 100 +#define OFFSET 5.5 +#define SCALE 1.5 +const char png_filename[] = "romedalen.png"; + +cairo_test_t test = { + "composite-integer-translate-over", + "Test simple compositing: integer-translation 32->32 OVER", + SIZE, SIZE +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_surface_t *image; + + image = cairo_image_surface_create_from_png (png_filename); + + cairo_set_source_rgba (cr, 0, 0, 0, 1); + cairo_rectangle (cr, 0, 0, SIZE, SIZE); + cairo_fill (cr); + + cairo_translate (cr, OFFSET, OFFSET); + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + cairo_set_source_surface (cr, image, 0, 0); + cairo_rectangle (cr, 0, 0, (SIZE-OFFSET), (SIZE-OFFSET)); + cairo_fill (cr); + + cairo_surface_destroy (image); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test, draw); +} diff --git a/test/composite-integer-translate-source-ref.png b/test/composite-integer-translate-source-ref.png new file mode 100644 index 000000000..da9a3986a Binary files /dev/null and b/test/composite-integer-translate-source-ref.png differ diff --git a/test/composite-integer-translate-source.c b/test/composite-integer-translate-source.c new file mode 100644 index 000000000..a467f089a --- /dev/null +++ b/test/composite-integer-translate-source.c @@ -0,0 +1,42 @@ +#include +#include "cairo-test.h" +#include + +#define SIZE 100 +#define OFFSET 10 + +const char png_filename[] = "romedalen.png"; + +cairo_test_t test = { + "composite-integer-translate-source", + "Test simple compositing: integer-translation 32->32 SOURCE", + SIZE, SIZE +}; + +static cairo_test_status_t +draw (cairo_t *cr, int width, int height) +{ + cairo_surface_t *image; + + image = cairo_image_surface_create_from_png (png_filename); + + cairo_set_source_rgba (cr, 0, 0, 0, 1); + cairo_rectangle (cr, 0, 0, SIZE, SIZE); + cairo_fill (cr); + + cairo_translate (cr, OFFSET, OFFSET); + cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE); + cairo_set_source_surface (cr, image, 0, 0); + cairo_rectangle (cr, 0, 0, SIZE - OFFSET, SIZE - OFFSET); + cairo_fill (cr); + + cairo_surface_destroy (image); + + return CAIRO_TEST_SUCCESS; +} + +int +main (void) +{ + return cairo_test (&test, draw); +} -- cgit v1.2.3 From d3661b0d53bf0c3c4132d8d02f8527019d65fc6b Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 15 Jul 2005 13:59:47 +0000 Subject: Remove cairo_private qualifier from .c files, (we only need it in the .h files). --- ChangeLog | 6 ++++++ src/cairo-font.c | 2 +- src/cairo-surface.c | 18 +++++++++--------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7a3cbfe76..001727e8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-07-15 Carl Worth + + * src/cairo-font.c: + * src/cairo-surface.c: Remove cairo_private qualifier from .c + files, (we only need it in the .h files). + 2005-07-15 Vladimir Vukicevic * src/cairo-xlib-surface.c: (_cairo_xlib_surface_composite, diff --git a/src/cairo-font.c b/src/cairo-font.c index 137bc48d6..a74cac453 100644 --- a/src/cairo-font.c +++ b/src/cairo-font.c @@ -386,7 +386,7 @@ static const cairo_font_face_backend_t _cairo_simple_font_face_backend = { * Return value: a newly created #cairo_font_face_t, destroy with * cairo_font_face_destroy() **/ -cairo_private cairo_font_face_t * +cairo_font_face_t * _cairo_simple_font_face_create (const char *family, cairo_font_slant_t slant, cairo_font_weight_t weight) diff --git a/src/cairo-surface.c b/src/cairo-surface.c index 9f4764ca3..75f887c1f 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -300,7 +300,7 @@ cairo_surface_set_device_offset (cairo_surface_t *surface, * %CAIRO_INT_STATUS_UNSUPPORTED if an image cannot be retrieved for the specified * surface. Or %CAIRO_STATUS_NO_MEMORY. **/ -cairo_private cairo_status_t +cairo_status_t _cairo_surface_acquire_source_image (cairo_surface_t *surface, cairo_image_surface_t **image_out, void **image_extra) @@ -317,7 +317,7 @@ _cairo_surface_acquire_source_image (cairo_surface_t *surface, * * Releases any resources obtained with _cairo_surface_acquire_source_image() **/ -cairo_private void +void _cairo_surface_release_source_image (cairo_surface_t *surface, cairo_image_surface_t *image, void *image_extra) @@ -670,7 +670,7 @@ _cairo_surface_fill_rectangles (cairo_surface_t *surface, return _fallback_fill_rectangles (surface, operator, color, rects, num_rects); } -cairo_private cairo_int_status_t +cairo_int_status_t _cairo_surface_fill_path (cairo_operator_t operator, cairo_pattern_t *pattern, cairo_surface_t *dst, @@ -824,7 +824,7 @@ _cairo_surface_show_page (cairo_surface_t *surface) * verify that the correct clip is set in the surface before * invoking any surface drawing function */ -cairo_private unsigned int +unsigned int _cairo_surface_get_current_clip_serial (cairo_surface_t *surface) { return surface->current_clip_serial; @@ -839,7 +839,7 @@ _cairo_surface_get_current_clip_serial (cairo_surface_t *surface) * As zero is reserved for the special no-clipping case, * this function will not return that. */ -cairo_private unsigned int +unsigned int _cairo_surface_allocate_clip_serial (cairo_surface_t *surface) { unsigned int serial; @@ -858,7 +858,7 @@ _cairo_surface_allocate_clip_serial (cairo_surface_t *surface) * unclipped. It also sets the clip serial number * to zero. */ -cairo_private cairo_status_t +cairo_status_t _cairo_surface_reset_clip (cairo_surface_t *surface) { cairo_status_t status; @@ -895,7 +895,7 @@ _cairo_surface_reset_clip (cairo_surface_t *surface) * the specified region and sets the surface clipping * serial number to the associated serial number. */ -cairo_private cairo_status_t +cairo_status_t _cairo_surface_set_clip_region (cairo_surface_t *surface, pixman_region16_t *region, unsigned int serial) @@ -909,7 +909,7 @@ _cairo_surface_set_clip_region (cairo_surface_t *surface, return surface->backend->set_clip_region (surface, region); } -cairo_private cairo_int_status_t +cairo_int_status_t _cairo_surface_intersect_clip_path (cairo_surface_t *surface, cairo_path_fixed_t *path, cairo_fill_rule_t fill_rule, @@ -957,7 +957,7 @@ _cairo_surface_set_clip_path_recursive (cairo_surface_t *surface, * Sets the clipping path to be the intersection of the current * clipping path of the surface and the given path. **/ -cairo_private cairo_status_t +cairo_status_t _cairo_surface_set_clip_path (cairo_surface_t *surface, cairo_clip_path_t *clip_path, unsigned int serial) -- cgit v1.2.3 From c36fd95f6ed1dbdb9c7053f8ba5c58623d6095b8 Mon Sep 17 00:00:00 2001 From: Jeff Muizelaar Date: Sat, 16 Jul 2005 11:27:32 +0000 Subject: Add call to fbCompositeSrcSrc_nxn that I missed. --- pixman/ChangeLog | 5 +++++ pixman/src/ic.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/pixman/ChangeLog b/pixman/ChangeLog index 0642e9590..43ecf1695 100644 --- a/pixman/ChangeLog +++ b/pixman/ChangeLog @@ -1,3 +1,8 @@ +2005-07-16 Jeff Muizelaar + + * src/ic.c: (pixman_composite): + Add call to fbCompositeSrcSrc_nxn that I missed. + 2005-07-14 Carl Worth * src/icimage.c: (pixman_image_set_component_alpha): Whitespace fix. diff --git a/pixman/src/ic.c b/pixman/src/ic.c index 9e9eadd47..381afcd42 100644 --- a/pixman/src/ic.c +++ b/pixman/src/ic.c @@ -1252,6 +1252,12 @@ pixman_composite (pixman_operator_t op, } } break; + case PIXMAN_OPERATOR_SRC: + if (pMask == 0) + { + if (pSrc->format_code == pDst->format_code) + func = fbCompositeSrcSrc_nxn; + } default: func = pixman_compositeGeneral; break; -- cgit v1.2.3 From 584954859ead08491cd5ed04aec54aae6b1048b8 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Sun, 17 Jul 2005 22:15:57 +0000 Subject: Add note that Xlib caches need to be cleand up on close of display. --- BUGS | 7 +++++++ ChangeLog | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/BUGS b/BUGS index 6ebf534a0..ea529cb7d 100644 --- a/BUGS +++ b/BUGS @@ -1,3 +1,10 @@ +cairo-xlib-surface needs to do the Xlib register extension hack so +that it can listen for a Display close event. When it gets that, it +needs to run through its caches and eliminate anything associated with +that display. + +-- + cairo_show_surface fails when given a non-default CTM, see the show_surface.cairo snippet in: diff --git a/ChangeLog b/ChangeLog index 001727e8d..541a0d92e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-07-18 Carl Worth + + * BUGS: Add note that Xlib caches need to be cleand up on close + of display. + 2005-07-15 Carl Worth * src/cairo-font.c: -- cgit v1.2.3 From 751e059f5c506138c478fbcc2e9dfe8e92aaa3ab Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 18 Jul 2005 08:04:16 +0000 Subject: Note some progress. New helper function to help create an image surface from a PNG file, while taking the srcdir environment variable into consideration. Rename the pattern creating helper function to match. Use new cairo_test_create_surface_from_png so that non-srcdir builds work. Track change in cairo_test_create_pattern_from_png. --- ChangeLog | 19 +++++++++++++++++++ ROADMAP | 8 ++++---- test/cairo-test.c | 16 +++++++++++++--- test/cairo-test.h | 6 ++++-- test/composite-integer-translate-over.c | 2 +- test/composite-integer-translate-source.c | 2 +- test/mask.c | 2 +- test/trap-clip.c | 2 +- 8 files changed, 44 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 541a0d92e..6d8bece81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2005-07-18 Carl Worth + + * ROADMAP: Note some progress. + + * test/cairo-test.h: + * test/cairo-test.c: (cairo_test_create_surface_from_png), + (cairo_test_create_pattern_from_png): New helper function to help + create an image surface from a PNG file, while taking the srcdir + environment variable into consideration. Rename the pattern + creating helper function to match. + + * test/composite-integer-translate-over.c: (draw): + * test/composite-integer-translate-source.c: (draw): Use new + cairo_test_create_surface_from_png so that non-srcdir builds work. + + * test/mask.c: (set_image_pattern): + * test/trap-clip.c: (set_image_pattern): Track change in + cairo_test_create_pattern_from_png. + 2005-07-18 Carl Worth * BUGS: Add note that Xlib caches need to be cleand up on close diff --git a/ROADMAP b/ROADMAP index 88fad3087..d979adbbb 100644 --- a/ROADMAP +++ b/ROADMAP @@ -1,7 +1,7 @@ cairo 0.5.2 =========== - Get tor to sign off that the win32 stuff is up to snuff - glyph path patch reviewed and committed +✓ Get tor to sign off that the win32 stuff is up to snuff + ✓ glyph path patch reviewed and committed ✓ Fix the BadMatch error introduced between 0.5.0 and 0.5.1: https://bugs.freedesktop.org/show_bug.cgi?id=3604 @@ -10,8 +10,8 @@ cairo 0.5.2 0.1.4 which is already fixed in libpixman 0.1.5) Add a workaround for Render's overlapping source/dest bug -✓ Use XCopyArea when possible (integer translation) - Otherwise make a copy of the source + ✓ Use XCopyArea when possible (integer translation) + Otherwise make a copy of the source Fix the cache lock deadlocking problems. Difficulty: Hard diff --git a/test/cairo-test.c b/test/cairo-test.c index 9917ac94a..77cf48fd0 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -575,11 +575,10 @@ cairo_test (cairo_test_t *test, cairo_test_draw_function_t draw) return cairo_test_expecting (test, draw, CAIRO_TEST_SUCCESS); } -cairo_pattern_t * -cairo_test_create_png_pattern (cairo_t *cr, const char *filename) +cairo_surface_t * +cairo_test_create_surface_from_png (const char *filename) { cairo_surface_t *image; - cairo_pattern_t *pattern; char *srcdir = getenv ("srcdir"); image = cairo_image_surface_create_from_png (filename); @@ -594,6 +593,17 @@ cairo_test_create_png_pattern (cairo_t *cr, const char *filename) return NULL; } + return image; +} + +cairo_pattern_t * +cairo_test_create_pattern_from_png (const char *filename) +{ + cairo_surface_t *image; + cairo_pattern_t *pattern; + + image = cairo_test_create_surface_from_png (filename); + pattern = cairo_pattern_create_for_surface (image); cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); diff --git a/test/cairo-test.h b/test/cairo-test.h index 1055a0c26..beabc6a5e 100644 --- a/test/cairo-test.h +++ b/test/cairo-test.h @@ -53,8 +53,11 @@ cairo_test_expect_failure (cairo_test_t *test, cairo_test_draw_function_t draw, const char *reason); +cairo_surface_t * +cairo_test_create_surface_from_png (const char *filename); + cairo_pattern_t * -cairo_test_create_png_pattern (cairo_t *cr, const char *filename); +cairo_test_create_pattern_from_png (const char *filename); void cairo_test_log (const char *fmt, ...); @@ -63,4 +66,3 @@ void xasprintf (char **strp, const char *fmt, ...); #endif - diff --git a/test/composite-integer-translate-over.c b/test/composite-integer-translate-over.c index 867448889..52b4a6c47 100644 --- a/test/composite-integer-translate-over.c +++ b/test/composite-integer-translate-over.c @@ -18,7 +18,7 @@ draw (cairo_t *cr, int width, int height) { cairo_surface_t *image; - image = cairo_image_surface_create_from_png (png_filename); + image = cairo_test_create_surface_from_png (png_filename); cairo_set_source_rgba (cr, 0, 0, 0, 1); cairo_rectangle (cr, 0, 0, SIZE, SIZE); diff --git a/test/composite-integer-translate-source.c b/test/composite-integer-translate-source.c index a467f089a..d2f39a351 100644 --- a/test/composite-integer-translate-source.c +++ b/test/composite-integer-translate-source.c @@ -18,7 +18,7 @@ draw (cairo_t *cr, int width, int height) { cairo_surface_t *image; - image = cairo_image_surface_create_from_png (png_filename); + image = cairo_test_create_surface_from_png (png_filename); cairo_set_source_rgba (cr, 0, 0, 0, 1); cairo_rectangle (cr, 0, 0, SIZE, SIZE); diff --git a/test/mask.c b/test/mask.c index bf94f7163..a9414e046 100644 --- a/test/mask.c +++ b/test/mask.c @@ -64,7 +64,7 @@ set_image_pattern (cairo_t *cr, int x, int y) { cairo_pattern_t *pattern; - pattern = cairo_test_create_png_pattern (cr, png_filename); + pattern = cairo_test_create_pattern_from_png (png_filename); cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); } diff --git a/test/trap-clip.c b/test/trap-clip.c index dddb94cb2..75b06a83d 100644 --- a/test/trap-clip.c +++ b/test/trap-clip.c @@ -63,7 +63,7 @@ set_image_pattern (cairo_t *cr, int x, int y) { cairo_pattern_t *pattern; - pattern = cairo_test_create_png_pattern (cr, png_filename); + pattern = cairo_test_create_pattern_from_png (png_filename); cairo_set_source (cr, pattern); cairo_pattern_destroy (pattern); } -- cgit v1.2.3 From f0fae1d1bcde4f469cf6e00272fd4530875d283f Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 18 Jul 2005 08:23:21 +0000 Subject: Fix leak of pattern. --- ChangeLog | 5 +++++ test/composite-integer-translate-over-repeat.c | 1 + 2 files changed, 6 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6d8bece81..4ae5f000d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-07-18 Carl Worth + + * test/composite-integer-translate-over-repeat.c (draw): Fix leak + of pattern. + 2005-07-18 Carl Worth * ROADMAP: Note some progress. diff --git a/test/composite-integer-translate-over-repeat.c b/test/composite-integer-translate-over-repeat.c index b681ac9c7..ed55f63a6 100644 --- a/test/composite-integer-translate-over-repeat.c +++ b/test/composite-integer-translate-over-repeat.c @@ -50,6 +50,7 @@ draw (cairo_t *cr, int width, int height) cairo_fill (cr); cairo_surface_destroy (image); + cairo_pattern_destroy (pat); return CAIRO_TEST_SUCCESS; } -- cgit v1.2.3 From b65393917cade57d65ef92aa3510d7e3724f476d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 18 Jul 2005 08:31:24 +0000 Subject: Added notes for snapshot 0.5.2 Increment CAIRO_VERSION to 0.5.2 --- ChangeLog | 6 +++++ NEWS | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 2 +- 3 files changed, 81 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4ae5f000d..6068a2461 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-07-18 Carl Worth + + * NEWS: Added notes for snapshot 0.5.2 + + * configure.in: Increment CAIRO_VERSION to 0.5.2 + 2005-07-18 Carl Worth * test/composite-integer-translate-over-repeat.c (draw): Fix leak diff --git a/NEWS b/NEWS index f69bbd066..1859a71bc 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,77 @@ +Snapshot 0.5.2 (2005-07-18 Carl Worth ) +========================================================== +API changes +----------- +* New functions for creating patterns of a single color: + + cairo_pattern_create_rgb + cairo_pattern_create_rgba + +* Change cairo_surface_create_similar to accept a new type of + cairo_content_t rather than cairo_format_t: + + typedef enum _cairo_content { + CAIRO_CONTENT_COLOR = 0x1000, + CAIRO_CONTENT_ALPHA = 0x2000, + CAIRO_CONTENT_COLOR_ALPHA = 0x3000 + } cairo_content_t; + +* Add new CAIRO_FORMAT_VALID and CAIRO_CONTENT_VALID macros. + +* Remove unused status value: + + CAIRO_STATUS_NO_TARGET_SURFACE + +* Add new status values: + + CAIRO_STATUS_INVALID_STATUS + +* Require libpixman >= 0.1.5 (for necessary bug fixes) + +Bug fixes +--------- +* Fix cairo_surface_write_to_png for RGB24 images. + +* Fix broken metrics and rendering for bitmap fonts. Add mostly + useless bitmap glyph transformation. + +* Fix glyph caches to not eject entries that might be immediately + needed, (fixing intermittent crashes when rendering text). + +* Fix all memory leaks found by running "make check-valigrind". + +ATSUI backend changes +--------------------- +* Allow building against < 10.3 SDK. + +* Prevent crash on empty strings. + +Glitz backend changes +--------------------- +* Require glitz >= 0.4.4. + +* Use frame buffer objects instead of pbuffers for accelerated + offscreen drawing. + +* Minor improvement to gradient pattern creation. + +PostScript backend fixes +------------------------ +* Rewrite of the PS backend to generate more interesting output that + the old big-image implementation. + +Win32 backend fixes +------------------- +* Implement glyph path support. + +* Fix swap of blue and green values in the fill_rectangles path. + +Xlib backend fixes +------------------ +* Add optimization to use XCopyArea rather than XRenderComposite when + transforming only with an integer translation, and using SOURCE + operator or OVER with a source pattern without alpha. + Snapshot 0.5.1 (2005-06-20 Carl Worth ) ========================================================== API changes diff --git a/configure.in b/configure.in index e68f17cdd..7d6aa47d5 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_INIT(src/cairo.h) dnl =========================================================================== # Package version number, (as distinct from shared library version) -CAIRO_VERSION=0.5.1-head +CAIRO_VERSION=0.5.2 # libtool shared library version -- cgit v1.2.3 From 0e40baa9a7bd08abd15bfdc666c6e2d21d791e82 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Mon, 18 Jul 2005 09:23:33 +0000 Subject: Fix the quartz backend so that it at least compiles again. This change is slipped in before 0.5.2 was pushed out and tagged. --- ChangeLog | 8 ++++++++ src/cairo-quartz-surface.c | 11 ++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6068a2461..b7e6f2b91 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-07-18 Carl Worth + + * src/cairo-quartz-surface.c: + (_cairo_quartz_surface_acquire_source_image), + (_cairo_quartz_surface_set_clip_region): Fix the quartz backend so + that it at least compiles again. This change is slipped in before + 0.5.2 was pushed out and tagged. + 2005-07-18 Carl Worth * NEWS: Added notes for snapshot 0.5.2 diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c index d0b32d972..17d51303b 100644 --- a/src/cairo-quartz-surface.c +++ b/src/cairo-quartz-surface.c @@ -134,12 +134,6 @@ _cairo_quartz_surface_acquire_source_image(void *abstract_surface, surface->width, surface->height, rowBytes); - - // Set the image surface Cairo state to match our own. - _cairo_image_surface_set_repeat(surface->image, surface->base.repeat); - _cairo_image_surface_set_matrix(surface->image, - &(surface->base.matrix)); - *image_out = surface->image; *image_extra = NULL; @@ -193,8 +187,11 @@ _cairo_quartz_surface_set_clip_region(void *abstract_surface, pixman_region16_t * region) { cairo_quartz_surface_t *surface = abstract_surface; + unsigned int serial; - return _cairo_surface_set_clip_region(&surface->image->base, region); + serial = _cairo_surface_allocate_clip_serial (&surface->image->base); + return _cairo_surface_set_clip_region(&surface->image->base, + region, serial); } static cairo_int_status_t -- cgit v1.2.3