diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cairo-array.c | 14 | ||||
-rw-r--r-- | src/cairo-cache.c | 3 | ||||
-rw-r--r-- | src/cairo-dwrite.h | 2 | ||||
-rw-r--r-- | src/cairo-font-options.c | 2 | ||||
-rw-r--r-- | src/cairo-pattern.c | 3 | ||||
-rw-r--r-- | src/cairo-pdf-surface.c | 2 | ||||
-rw-r--r-- | src/cairo-ps-surface.c | 2 | ||||
-rw-r--r-- | src/cairo-quartz-image-surface.c | 22 | ||||
-rwxr-xr-x | src/cairo-scaled-font.c | 4 | ||||
-rw-r--r-- | src/cairo-surface-observer.c | 9 | ||||
-rw-r--r-- | src/cairo-surface.c | 1 | ||||
-rw-r--r-- | src/cairo-svg.h | 6 | ||||
-rw-r--r-- | src/cairo-tee-surface-private.h | 47 | ||||
-rw-r--r-- | src/cairo-tee-surface.c | 41 | ||||
-rw-r--r-- | src/cairo.c | 26 | ||||
-rw-r--r-- | src/cairo.h | 30 | ||||
-rw-r--r-- | src/win32/cairo-dwrite-font.cpp | 52 | ||||
-rw-r--r-- | src/win32/cairo-win32-font.c | 8 | ||||
-rw-r--r-- | src/win32/cairo-win32-private.h | 4 |
19 files changed, 98 insertions, 180 deletions
diff --git a/src/cairo-array.c b/src/cairo-array.c index db7b6de7a..1c91b7c73 100644 --- a/src/cairo-array.c +++ b/src/cairo-array.c @@ -143,7 +143,6 @@ _cairo_array_truncate (cairo_array_t *array, unsigned int num_elements) /** * _cairo_array_index: * @array: a #cairo_array_t - * Returns: A pointer to the object stored at @index. * * If the resulting value is assigned to a pointer to an object of the same * element_size as initially passed to _cairo_array_init() then that @@ -161,6 +160,8 @@ _cairo_array_truncate (cairo_array_t *array, unsigned int num_elements) * for (i = 0; i < _cairo_array_num_elements (&array); i++) * ... use values[i] here ... * </programlisting></informalexample> + * + * Returns: A pointer to the object stored at @index. **/ void * _cairo_array_index (cairo_array_t *array, unsigned int index) @@ -187,7 +188,6 @@ _cairo_array_index (cairo_array_t *array, unsigned int index) /** * _cairo_array_index_const: * @array: a #cairo_array_t - * Returns: A pointer to the object stored at @index. * * If the resulting value is assigned to a pointer to an object of the same * element_size as initially passed to _cairo_array_init() then that @@ -205,6 +205,8 @@ _cairo_array_index (cairo_array_t *array, unsigned int index) * for (i = 0; i < _cairo_array_num_elements (&array); i++) * ... read values[i] here ... * </programlisting></informalexample> + * + * Returns: A pointer to the object stored at @index. **/ const void * _cairo_array_index_const (const cairo_array_t *array, unsigned int index) @@ -330,9 +332,10 @@ _cairo_array_allocate (cairo_array_t *array, /** * _cairo_array_num_elements: * @array: a #cairo_array_t - * Returns: The number of elements stored in @array. * * This space was left intentionally blank, but gtk-doc filled it. + * + * Returns: The number of elements stored in @array. **/ unsigned int _cairo_array_num_elements (const cairo_array_t *array) @@ -343,10 +346,11 @@ _cairo_array_num_elements (const cairo_array_t *array) /** * _cairo_array_size: * @array: a #cairo_array_t - * Returns: The number of elements for which there is currently space - * allocated in @array. * * This space was left intentionally blank, but gtk-doc filled it. + * + * Returns: The number of elements for which there is currently space + * allocated in @array. **/ unsigned int _cairo_array_size (const cairo_array_t *array) diff --git a/src/cairo-cache.c b/src/cairo-cache.c index be1285a20..afdca984e 100644 --- a/src/cairo-cache.c +++ b/src/cairo-cache.c @@ -56,7 +56,6 @@ _cairo_cache_entry_is_non_zero (const void *entry) * @keys_equal: a function to return %TRUE if two keys are equal * @entry_destroy: destroy notifier for cache entries * @max_size: the maximum size for this cache - * Returns: the newly created #cairo_cache_t * * Creates a new cache using the keys_equal() function to determine * the equality of entries. @@ -84,6 +83,8 @@ _cairo_cache_entry_is_non_zero (const void *entry) * _cairo_cache_freeze() and _cairo_cache_thaw() calls can be * used to establish a window during which no automatic removal of * entries will occur. + * + * Returns: the newly created #cairo_cache_t **/ cairo_status_t _cairo_cache_init (cairo_cache_t *cache, diff --git a/src/cairo-dwrite.h b/src/cairo-dwrite.h index 630fcf280..b1ff718a0 100644 --- a/src/cairo-dwrite.h +++ b/src/cairo-dwrite.h @@ -51,7 +51,7 @@ cairo_public IDWriteRenderingParams * cairo_dwrite_font_face_get_rendering_params (cairo_font_face_t *font_face); cairo_public void -cairo_dwrite_font_face_set_rendering_params (cairo_font_face_t *font_face, IDWriteRenderingParams *param); +cairo_dwrite_font_face_set_rendering_params (cairo_font_face_t *font_face, IDWriteRenderingParams *params); cairo_public DWRITE_MEASURING_MODE cairo_dwrite_font_face_get_measuring_mode (cairo_font_face_t *font_face); diff --git a/src/cairo-font-options.c b/src/cairo-font-options.c index 8876d9265..33ee617b8 100644 --- a/src/cairo-font-options.c +++ b/src/cairo-font-options.c @@ -697,7 +697,7 @@ cairo_font_options_get_variations (cairo_font_options_t *options) /** * cairo_font_options_set_color_mode: * @options: a #cairo_font_options_t - * @font_color: the new color mode + * @color_mode: the new color mode * * Sets the color mode for the font options object. This controls * whether color fonts are to be rendered in color or as outlines. diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index d16ed2836..2c0ba31f8 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -3439,9 +3439,10 @@ use_bilinear(double x, double y, double t) /** * _cairo_pattern_analyze_filter: * @pattern: surface pattern - * Returns: the optimized #cairo_filter_t to use with @pattern. * * Possibly optimize the filter to a simpler value depending on transformation + * + * Returns: the optimized #cairo_filter_t to use with @pattern. **/ cairo_filter_t _cairo_pattern_analyze_filter (const cairo_pattern_t *pattern) diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index 772828eb8..2b1bf72e4 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -2556,7 +2556,7 @@ _cairo_pdf_surface_finish (void *abstract_surface) cairo_pdf_surface_t *surface = abstract_surface; long long offset; cairo_pdf_resource_t catalog; - cairo_status_t status, status2; + cairo_status_t status = CAIRO_STATUS_SUCCESS, status2; int size, i; cairo_pdf_jbig2_global_t *global; char *label; diff --git a/src/cairo-ps-surface.c b/src/cairo-ps-surface.c index abc9407ee..381b4cf75 100644 --- a/src/cairo-ps-surface.c +++ b/src/cairo-ps-surface.c @@ -148,7 +148,7 @@ static char *ctime_r(const time_t *timep, char *buf) * ury]" that specifies the bounding box (in PS coordinates) of the * EPS graphics. The parameters are: lower left x, lower left y, upper * right x, upper right y. Normally the bbox data is identical to the - * %%%BoundingBox data in the EPS file. + * \%\%\%BoundingBox data in the EPS file. * **/ diff --git a/src/cairo-quartz-image-surface.c b/src/cairo-quartz-image-surface.c index 30d92d6be..e05523459 100644 --- a/src/cairo-quartz-image-surface.c +++ b/src/cairo-quartz-image-surface.c @@ -146,7 +146,7 @@ _cairo_quartz_image_surface_flush (void *asurface, CGImageRef oldImage = surface->image; CGImageRef newImage = NULL; void *image_data; - const unsigned int size = surface->imageSurface->height * surface->imageSurface->stride; + if (flags) return CAIRO_STATUS_SUCCESS; @@ -377,15 +377,27 @@ cairo_quartz_image_surface_create (cairo_surface_t *surface) } +/** + * cairo_quartz_image_surface_get_image: + * @surface: a #cairo_surface_t + * + * Returns a #cairo_surface_t image surface that refers to the same bits + * as the image of the quartz surface. + * + * Return value: a #cairo_surface_t (owned by the quartz #cairo_surface_t), + * or %NULL if the quartz surface is not an image surface. + * + * Since: 1.6 + */ cairo_surface_t * -cairo_quartz_image_surface_get_image (cairo_surface_t *asurface) +cairo_quartz_image_surface_get_image (cairo_surface_t *surface) { - cairo_quartz_image_surface_t *surface = (cairo_quartz_image_surface_t*) asurface; + cairo_quartz_image_surface_t *qsurface = (cairo_quartz_image_surface_t*) surface; /* Throw an error for a non-quartz surface */ - if (! _cairo_surface_is_quartz (asurface)) { + if (! _cairo_surface_is_quartz (surface)) { return SURFACE_ERROR_TYPE_MISMATCH; } - return (cairo_surface_t*) surface->imageSurface; + return (cairo_surface_t*) qsurface->imageSurface; } diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c index 415b45f78..75640f723 100755 --- a/src/cairo-scaled-font.c +++ b/src/cairo-scaled-font.c @@ -2660,6 +2660,8 @@ _cairo_scaled_glyph_set_path (cairo_scaled_glyph_t *scaled_glyph, * @recording_surface: The recording surface * @foreground_color: The foreground color that was used to record the * glyph, or NULL if foreground color not required. + * + * Sets the surface that was used to record the glyph. */ void _cairo_scaled_glyph_set_recording_surface (cairo_scaled_glyph_t *scaled_glyph, @@ -2691,6 +2693,8 @@ _cairo_scaled_glyph_set_recording_surface (cairo_scaled_glyph_t *scaled_glyph, * @foreground_marker_color: The foreground color that was used to * substitute the foreground_marker, or NULL if foreground_marker not * used when rendering the surface color. + * + * Sets the color surface of the glyph. */ void _cairo_scaled_glyph_set_color_surface (cairo_scaled_glyph_t *scaled_glyph, diff --git a/src/cairo-surface-observer.c b/src/cairo-surface-observer.c index 9c4432e24..bf29d4219 100644 --- a/src/cairo-surface-observer.c +++ b/src/cairo-surface-observer.c @@ -54,6 +54,15 @@ #include "cairo-script-private.h" #endif +/** + * SECTION:cairo-surface-observer + * @Title: Surface Observer + * @Short_Description: Observing other surfaces + * @See_Also: #cairo_surface_t + * + * A surface that exists solely to watch another is doing. + */ + static const cairo_surface_backend_t _cairo_surface_observer_backend; /* observation/stats */ diff --git a/src/cairo-surface.c b/src/cairo-surface.c index 609eb9ccf..f1292e0bb 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -49,7 +49,6 @@ #include "cairo-recording-surface-private.h" #include "cairo-region-private.h" #include "cairo-surface-inline.h" -#include "cairo-tee-surface-private.h" /** * SECTION:cairo-surface diff --git a/src/cairo-svg.h b/src/cairo-svg.h index 5328cb583..7745eec90 100644 --- a/src/cairo-svg.h +++ b/src/cairo-svg.h @@ -73,9 +73,9 @@ typedef enum _cairo_svg_version { * lengths in the SVG specification. * * See also: - * https://www.w3.org/TR/SVG/coords.html#Units - * https://www.w3.org/TR/SVG/types.html#DataTypeLength - * https://www.w3.org/TR/css-values-3/#lengths + * - [SVG Units](https://www.w3.org/TR/SVG/coords.html#Units) + * - [SVG Types](https://www.w3.org/TR/SVG/types.html#DataTypeLength) + * - [CSS Length](https://www.w3.org/TR/css-values-3/#lengths) * * Since: 1.16 **/ diff --git a/src/cairo-tee-surface-private.h b/src/cairo-tee-surface-private.h deleted file mode 100644 index a83cfc959..000000000 --- a/src/cairo-tee-surface-private.h +++ /dev/null @@ -1,47 +0,0 @@ -/* cairo - a vector graphics library with display and print output - * - * Copyright © 2009 Chris Wilson - * - * 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., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, 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 University of Southern - * California. - * - * Contributor(s): - * Chris Wilson <chris@chris-wilson.co.uk> - */ - -#ifndef CAIRO_TEE_SURFACE_PRIVATE_H -#define CAIRO_TEE_SURFACE_PRIVATE_H - -#include "cairoint.h" - -cairo_private cairo_surface_t * -_cairo_tee_surface_find_match (void *abstract_surface, - const cairo_surface_backend_t *backend, - cairo_content_t content); - -#endif /* CAIRO_TEE_SURFACE_PRIVATE_H */ diff --git a/src/cairo-tee-surface.c b/src/cairo-tee-surface.c index 4994a5a60..1d075a29c 100644 --- a/src/cairo-tee-surface.c +++ b/src/cairo-tee-surface.c @@ -44,7 +44,6 @@ #include "cairo-default-context-private.h" #include "cairo-error-private.h" -#include "cairo-tee-surface-private.h" #include "cairo-recording-surface-inline.h" #include "cairo-surface-wrapper-private.h" #include "cairo-array-private.h" @@ -565,43 +564,3 @@ cairo_tee_surface_index (cairo_surface_t *abstract_surface, return slave->target; } } - -cairo_surface_t * -_cairo_tee_surface_find_match (void *abstract_surface, - const cairo_surface_backend_t *backend, - cairo_content_t content) -{ - cairo_tee_surface_t *surface = abstract_surface; - cairo_surface_wrapper_t *slaves; - int num_slaves, n; - - /* exact match first */ - if (surface->master.target->backend == backend && - surface->master.target->content == content) - { - return surface->master.target; - } - - num_slaves = _cairo_array_num_elements (&surface->slaves); - slaves = _cairo_array_index (&surface->slaves, 0); - for (n = 0; n < num_slaves; n++) { - if (slaves[n].target->backend == backend && - slaves[n].target->content == content) - { - return slaves[n].target; - } - } - - /* matching backend? */ - if (surface->master.target->backend == backend) - return surface->master.target; - - num_slaves = _cairo_array_num_elements (&surface->slaves); - slaves = _cairo_array_index (&surface->slaves, 0); - for (n = 0; n < num_slaves; n++) { - if (slaves[n].target->backend == backend) - return slaves[n].target; - } - - return NULL; -} diff --git a/src/cairo.c b/src/cairo.c index bff1b86af..3d4fea601 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -1166,9 +1166,8 @@ cairo_set_fill_rule (cairo_t *cr, cairo_fill_rule_t fill_rule) * cairo_set_line_width() and ignore this note. * * As with the other stroke parameters, the current line width is - * examined by cairo_stroke(), cairo_stroke_extents(), and - * cairo_stroke_to_path(), but does not have any effect during path - * construction. + * examined by cairo_stroke(), and cairo_stroke_extents(), but does not have + * any effect during path construction. * * The default line width value is 2.0. * @@ -1242,9 +1241,8 @@ slim_hidden_def (cairo_set_hairline); * styles are drawn. * * As with the other stroke parameters, the current line cap style is - * examined by cairo_stroke(), cairo_stroke_extents(), and - * cairo_stroke_to_path(), but does not have any effect during path - * construction. + * examined by cairo_stroke(), and cairo_stroke_extents(), but does not have + * any effect during path construction. * * The default line cap style is %CAIRO_LINE_CAP_BUTT. * @@ -1274,9 +1272,8 @@ slim_hidden_def (cairo_set_line_cap); * styles are drawn. * * As with the other stroke parameters, the current line join style is - * examined by cairo_stroke(), cairo_stroke_extents(), and - * cairo_stroke_to_path(), but does not have any effect during path - * construction. + * examined by cairo_stroke(), and cairo_stroke_extents(), but does not have + * any effect during path construction. * * The default line join style is %CAIRO_LINE_JOIN_MITER. * @@ -1411,9 +1408,8 @@ cairo_get_dash (cairo_t *cr, * converted to a bevel. * * As with the other stroke parameters, the current line miter limit is - * examined by cairo_stroke(), cairo_stroke_extents(), and - * cairo_stroke_to_path(), but does not have any effect during path - * construction. + * examined by cairo_stroke(), and cairo_stroke_extents(), but does not have + * any effect during path construction. * * The default miter limit value is 10.0, which will convert joins * with interior angles less than 11 degrees to bevels instead of @@ -2941,7 +2937,7 @@ cairo_copy_clip_rectangle_list (cairo_t *cr) * CAIRO_TAG_DEST: * * Create a destination for a hyperlink. Destination tag attributes - * are detailed at [Destinations][dests]. + * are detailed at [Destinations][dest]. * * Since: 1.16 **/ @@ -2950,7 +2946,7 @@ cairo_copy_clip_rectangle_list (cairo_t *cr) * CAIRO_TAG_LINK: * * Create hyperlink. Link tag attributes are detailed at - * [Links][links]. + * [Links][link]. * * Since: 1.16 **/ @@ -4044,7 +4040,7 @@ slim_hidden_def (cairo_has_current_point); * cairo_move_to(), cairo_line_to(), cairo_curve_to(), * cairo_rel_move_to(), cairo_rel_line_to(), cairo_rel_curve_to(), * cairo_arc(), cairo_arc_negative(), cairo_rectangle(), - * cairo_text_path(), cairo_glyph_path(), cairo_stroke_to_path(). + * cairo_text_path(), cairo_glyph_path(). * * Some functions use and alter the current point but do not * otherwise change current path: diff --git a/src/cairo.h b/src/cairo.h index 78a958476..eef4c442b 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -295,6 +295,7 @@ typedef struct _cairo_user_data_key { * @CAIRO_STATUS_WIN32_GDI_ERROR: error occurred in the Windows Graphics Device Interface (Since 1.16) * @CAIRO_STATUS_TAG_ERROR: invalid tag name, attributes, or nesting (Since 1.16) * @CAIRO_STATUS_DWRITE_ERROR: error occurred in the Windows Direct Write API (Since 1.18) + * @CAIRO_STATUS_SVG_FONT_ERROR: error occurred in OpenType-SVG font rendering (Since 1.18) * @CAIRO_STATUS_LAST_STATUS: this is a special value indicating the number of * status values defined in this enumeration. When using this value, note * that the version of cairo at run-time may have additional status values @@ -2448,26 +2449,37 @@ cairo_surface_status (cairo_surface_t *surface); * @CAIRO_SURFACE_TYPE_PS: The surface is of type ps, since 1.2 * @CAIRO_SURFACE_TYPE_XLIB: The surface is of type xlib, since 1.2 * @CAIRO_SURFACE_TYPE_XCB: The surface is of type xcb, since 1.2 - * @CAIRO_SURFACE_TYPE_GLITZ: The surface is of type glitz, since 1.2 + * @CAIRO_SURFACE_TYPE_GLITZ: The surface is of type glitz, since 1.2, deprecated 1.18 + * (glitz support have been removed, this surface type will never be set by cairo) * @CAIRO_SURFACE_TYPE_QUARTZ: The surface is of type quartz, since 1.2 * @CAIRO_SURFACE_TYPE_WIN32: The surface is of type win32, since 1.2 - * @CAIRO_SURFACE_TYPE_BEOS: The surface is of type beos, since 1.2 - * @CAIRO_SURFACE_TYPE_DIRECTFB: The surface is of type directfb, since 1.2 + * @CAIRO_SURFACE_TYPE_BEOS: The surface is of type beos, since 1.2, deprecated 1.18 + * (beos support have been removed, this surface type will never be set by cairo) + * @CAIRO_SURFACE_TYPE_DIRECTFB: The surface is of type directfb, since 1.2, deprecated 1.18 + * (directfb support have been removed, this surface type will never be set by cairo) * @CAIRO_SURFACE_TYPE_SVG: The surface is of type svg, since 1.2 - * @CAIRO_SURFACE_TYPE_OS2: The surface is of type os2, since 1.4 + * @CAIRO_SURFACE_TYPE_OS2: The surface is of type os2, since 1.4, deprecated 1.18 + * (os2 support have been removed, this surface type will never be set by cairo) * @CAIRO_SURFACE_TYPE_WIN32_PRINTING: The surface is a win32 printing surface, since 1.6 * @CAIRO_SURFACE_TYPE_QUARTZ_IMAGE: The surface is of type quartz_image, since 1.6 * @CAIRO_SURFACE_TYPE_SCRIPT: The surface is of type script, since 1.10 - * @CAIRO_SURFACE_TYPE_QT: The surface is of type Qt, since 1.10 + * @CAIRO_SURFACE_TYPE_QT: The surface is of type Qt, since 1.10, deprecated 1.18 + * (Ot support have been removed, this surface type will never be set by cairo) * @CAIRO_SURFACE_TYPE_RECORDING: The surface is of type recording, since 1.10 - * @CAIRO_SURFACE_TYPE_VG: The surface is a OpenVG surface, since 1.10 - * @CAIRO_SURFACE_TYPE_GL: The surface is of type OpenGL, since 1.10 - * @CAIRO_SURFACE_TYPE_DRM: The surface is of type Direct Render Manager, since 1.10 + * @CAIRO_SURFACE_TYPE_VG: The surface is a OpenVG surface, since 1.10, deprecated 1.18 + * (OpenVG support have been removed, this surface type will never be set by cairo) + * @CAIRO_SURFACE_TYPE_GL: The surface is of type OpenGL, since 1.10, deprecated 1.18 + * (OpenGL support have been removed, this surface type will never be set by cairo) + * @CAIRO_SURFACE_TYPE_DRM: The surface is of type Direct Render Manager, since 1.10, deprecated 1.18 + * (DRM support have been removed, this surface type will never be set by cairo) * @CAIRO_SURFACE_TYPE_TEE: The surface is of type 'tee' (a multiplexing surface), since 1.10 * @CAIRO_SURFACE_TYPE_XML: The surface is of type XML (for debugging), since 1.10 + * @CAIRO_SURFACE_TYPE_SKIA: The surface is of type Skia, since 1.10, deprecated 1.18 + * (Skia support have been removed, this surface type will never be set by cairo) * @CAIRO_SURFACE_TYPE_SUBSURFACE: The surface is a subsurface created with * cairo_surface_create_for_rectangle(), since 1.10 - * @CAIRO_SURFACE_TYPE_COGL: This surface is of type Cogl, since 1.12 + * @CAIRO_SURFACE_TYPE_COGL: This surface is of type Cogl, since 1.12, deprecated 1.18 + * (Cogl support have been removed, this surface type will never be set by cairo) * * #cairo_surface_type_t is used to describe the type of a given * surface. The surface types are also known as "backends" or "surface diff --git a/src/win32/cairo-dwrite-font.cpp b/src/win32/cairo-dwrite-font.cpp index 8346e4856..edd606abe 100644 --- a/src/win32/cairo-dwrite-font.cpp +++ b/src/win32/cairo-dwrite-font.cpp @@ -923,7 +923,7 @@ _cairo_dwrite_scaled_font_init_glyph_color_surface(cairo_dwrite_scaled_font_t *s RefPtr<IDWriteColorGlyphRunEnumerator1> run_enumerator; HRESULT hr; - /** + /* * We transform by the inverse transformation here. This will put our glyph * locations in the space in which we draw. Which is later transformed by * the transformation matrix that we use. This will transform the @@ -932,7 +932,7 @@ _cairo_dwrite_scaled_font_init_glyph_color_surface(cairo_dwrite_scaled_font_t *s */ cairo_matrix_transform_point(&scaled_font->mat_inverse, &x, &y); offset.advanceOffset = (FLOAT)x; - /** Y-axis is inverted */ + /* Y-axis is inverted */ offset.ascenderOffset = -(FLOAT)y; run.fontFace = dwrite_font_face->dwriteface; @@ -1126,42 +1126,6 @@ _cairo_dwrite_scaled_font_init_glyph_color_surface(cairo_dwrite_scaled_font_t *s return CAIRO_INT_STATUS_SUCCESS; } -/* Helper function adapted from _compute_mask in cairo-win32-font.c */ - -/* Compute an alpha-mask from a monochrome RGB24 image - */ -static cairo_surface_t * -_compute_a8_mask (cairo_surface_t *surface) -{ - cairo_image_surface_t *glyph; - cairo_image_surface_t *mask; - int i, j; - - glyph = (cairo_image_surface_t *)cairo_surface_map_to_image (surface, NULL); - if (unlikely (glyph->base.status)) - return &glyph->base; - - /* No quality param, just use the non-ClearType path */ - - /* Compute an alpha-mask by using the green channel of a (presumed monochrome) - * RGB24 image. - */ - mask = (cairo_image_surface_t *) - cairo_image_surface_create (CAIRO_FORMAT_A8, glyph->width, glyph->height); - if (likely (mask->base.status == CAIRO_STATUS_SUCCESS)) { - for (i = 0; i < glyph->height; i++) { - uint32_t *p = (uint32_t *) (glyph->data + i * glyph->stride); - uint8_t *q = (uint8_t *) (mask->data + i * mask->stride); - - for (j = 0; j < glyph->width; j++) - *q++ = 255 - ((*p++ & 0x0000ff00) >> 8); - } - } - - cairo_surface_unmap_image (surface, &glyph->base); - return &mask->base; -} - static cairo_int_status_t _cairo_dwrite_scaled_font_init_glyph_surface(cairo_dwrite_scaled_font_t *scaled_font, cairo_scaled_glyph_t *scaled_glyph) @@ -1205,7 +1169,7 @@ _cairo_dwrite_scaled_font_init_glyph_surface(cairo_dwrite_scaled_font_t *scaled_ if (status) goto FAIL; - /** + /* * We transform by the inverse transformation here. This will put our glyph * locations in the space in which we draw. Which is later transformed by * the transformation matrix that we use. This will transform the @@ -1214,7 +1178,7 @@ _cairo_dwrite_scaled_font_init_glyph_surface(cairo_dwrite_scaled_font_t *scaled_ */ cairo_matrix_transform_point(&scaled_font->mat_inverse, &x, &y); offset.advanceOffset = (FLOAT)x; - /** Y-axis is inverted */ + /* Y-axis is inverted */ offset.ascenderOffset = -(FLOAT)y; area.top = 0; @@ -1240,7 +1204,7 @@ _cairo_dwrite_scaled_font_init_glyph_surface(cairo_dwrite_scaled_font_t *scaled_ GdiFlush(); - image = _compute_a8_mask (&surface->base); + image = _cairo_compute_glyph_mask (&surface->base, CLEARTYPE_QUALITY); status = (cairo_int_status_t)image->status; if (status) goto FAIL; @@ -1573,7 +1537,7 @@ _dwrite_draw_glyphs_to_gdi_surface_gdi(cairo_win32_surface_t *surface, else params = DWriteFactory::DefaultRenderingParams(); - /** + /* * We set the number of pixels per DIP to 1.0. This is because we always want * to draw in device pixels, and not device independent pixels. On high DPI * systems this value will be higher than 1.0 and automatically upscale @@ -1716,7 +1680,7 @@ _cairo_dwrite_show_glyphs_on_surface(void *surface, largestY = (INT32)glyphs[i].y; } } - /** + /* * Here we try to get a rough estimate of the area that this glyph run will * cover on the surface. Since we use GDI interop to draw we will be copying * data around the size of the area of the surface that we map. We will want @@ -1776,7 +1740,7 @@ _cairo_dwrite_show_glyphs_on_surface(void *surface, double x = glyphs[i].x - fontArea.left + EPSILON; double y = glyphs[i].y - fontArea.top; cairo_matrix_transform_point(&dwritesf->mat_inverse, &x, &y); - /** + /* * Since we will multiply by our ctm matrix later for rotation effects * and such, adjust positions by the inverse matrix now. The Y-axis * is inverted so the offset becomes negative. diff --git a/src/win32/cairo-win32-font.c b/src/win32/cairo-win32-font.c index 6bc8bef94..fd9461363 100644 --- a/src/win32/cairo-win32-font.c +++ b/src/win32/cairo-win32-font.c @@ -1335,9 +1335,9 @@ _cairo_win32_scaled_font_load_type1_data (void *abstract_font, length); } -static cairo_surface_t * -_compute_mask (cairo_surface_t *surface, - int quality) +cairo_surface_t * +_cairo_compute_glyph_mask (cairo_surface_t *surface, + int quality) { cairo_image_surface_t *glyph; cairo_image_surface_t *mask; @@ -1421,7 +1421,7 @@ _cairo_win32_scaled_font_init_glyph_surface (cairo_win32_scaled_font_t *scaled_f if (status) goto FAIL; - image = _compute_mask (surface, scaled_font->quality); + image = _cairo_compute_glyph_mask (surface, scaled_font->quality); status = image->status; if (status) goto FAIL; diff --git a/src/win32/cairo-win32-private.h b/src/win32/cairo-win32-private.h index 486b12811..6af09c0e1 100644 --- a/src/win32/cairo-win32-private.h +++ b/src/win32/cairo-win32-private.h @@ -214,6 +214,10 @@ cairo_bool_t _cairo_win32_surface_get_extents (void *abstract_surface, cairo_rectangle_int_t *rectangle); +cairo_surface_t * +_cairo_compute_glyph_mask (cairo_surface_t *surface, + int quality); + uint32_t _cairo_win32_flags_for_dc (HDC dc, cairo_format_t format); |