Commit graph

12679 commits

Author SHA1 Message Date
Fujii Hironori
950e3fb45d Change the workaround of MinGW dwrite_3.h problem
The DWRITE_COLOR_GLYPH_RUN1 struct definition of the old MinGW
dwrite_3.h was invalid. To work around the problem, dw-extra.h defined
the correct struct definition and all necessary API from dwrite_3.h.
This approach needed to redefine all necessary API.

This change added DWRITE_COLOR_GLYPH_RUN1_WORKAROUND struct and use it
for IDWriteColorGlyphRunEnumerator1::GetCurrentRun.
2023-02-27 11:55:30 +09:00
Adrian Johnson
6a5f2140d7 Merge branch 'issue-569-dwrite-inflate-glyph-bounds' into 'master'
DWrite: Inflate glyph bounds 1px vertically too

Closes #569

See merge request cairo/cairo!461
2023-02-20 22:07:16 +00:00
Adrian Johnson
7a8aa5eb97 Merge branch 'fix-doc-for-cairo_matrix_transform_distance' into 'master'
Fix cairo_matrix_transform_distance documentation

See merge request cairo/cairo!462
2023-02-20 08:27:55 +00:00
Fujii Hironori
5ae029c2cc DWrite: Inflate glyph bounds 1px vertically too
The most top and bottom lines of glyphs were clipped in some fonts and
conditions. The glyph bounds were inflated 1px horizontally. It should
inflate vertically too.

Fixes cairo/cairo#569
2023-02-20 14:16:30 +09:00
Uli Schlachter
83db2efe0a Merge branch 'quartz-colorspace' into 'master'
Better color management for improved performance on some apps.

Closes #330

See merge request cairo/cairo!290
2023-02-18 14:00:56 +00:00
Fujii Hironori
26fe448be3 Fix cairo_matrix_transform_distance documentation
* Use dx and dy instead of dx1 and dy1 to match with the arguments
* Use dx_new and dy_new instead of dx2 and dy2 to match with other parts of the documentation
* Use xx, yx, xy, yy instead of a, b, c, d to match with other parts of the documentation
* Remove the last two sentences that doesn't make sense
2023-02-18 15:33:28 +09:00
John Ralls
951a3dd9a7 [quartz]Conditionally Use Main Display ColorSpace instead of kCGColorSpaceDefaultRGB.
The default RGB colorspace must be converted to the GPU's colorspace
    using CGColorTransformConvertUsingCMSConverter. Profiling has shown this
    function to consume as much as 48% of a redraw cycle in gdk-quartz.

    There seems to be no named colorspace that matches the one stored on the
    display, so we use the one associated with the main display. This has
    some risks for users with multiple monitors but in testing with my own
    two-monitor setup, one of which is HDR and the other not, the colorspace
    was the same for both.

    This is applied to quartz surfaces created with
    cairo_quartz_surface_create(); surfaces created with
    cairo_quartz_surface_create_for_cg_context will inherit the colorspace
    from the context.

    In order to generate PNGs that look right I've converted the
    existing debugging functions for writing a quartz surface to png
    into private functions and wired cairo-boilerplate-quartz to use
    them. Using the generic cairo routine produced washed-out PNGs.

    Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/330
2023-02-17 10:25:14 -08:00
Uli Schlachter
d7b9695ee4 Merge branch 'quartz-image-surface' into 'master'
[quartz] Cleanup and make better use of cairo_quartz_image_surface_t.

See merge request cairo/cairo!317
2023-02-17 16:56:55 +00:00
Adrian Johnson
b7d8da7d1f Merge branch 'issue-641-glyph-bounds' into 'master'
DWrite: clipped glyphs in win32 compositor

Closes #641

See merge request cairo/cairo!459
2023-02-16 10:14:07 +00:00
Adrian Johnson
44d83d206e Merge branch 'dwrite-glyph-phase' into 'master'
DWrite: glyph surfaces should take subpixel positions into account

Closes #597

See merge request cairo/cairo!456
2023-02-16 09:49:54 +00:00
John Ralls
e5ed09a1ab [quartz] Replace surface-pattern xfail with latest CI fail image. 2023-02-14 11:53:02 -08:00
John Ralls
6b1b14a236 [quartz] Pretty up the surface-type and zero-size tests. 2023-02-14 11:53:02 -08:00
John Ralls
198d1792cf [quartz] Cleanup and make better use of cairo_quartz_image_surface_t.
Use a CGBitmapContext mapping the underlying image surface's data instead
of maintaining a CGImage. Generalize the quartz surface snapshot mechanism
to work with both cairo_quartz_surface_t and cairo_quartz_image_surface_t
and to use the latter to get a CGContext around non-quartz surfaces.
Use this snapshot machanism to get a CGImageRef when needed from a
cairo_quartz_image_surface_t.
2023-02-14 11:52:57 -08:00
Fujii Hironori
cce89abbb9 DWrite: clipped glyphs in win32 compositor
The win32 compositor is using _cairo_dwrite_show_glyphs_on_surface for
DWrite. It was assuming that a glyph was painted inside 3x3 of the em
square. It should take the actual glyph bounding box by using
GetAlphaTextureBounds.

Fixes cairo/cairo#641
2023-02-14 05:29:47 +09:00
Adrian Johnson
6b5519626c Merge branch 'ft-use-outline-glyph-for-path' into 'master'
FT: Always use the outline glyph to get the path

See merge request cairo/cairo!455
2023-02-11 04:18:18 +00:00
Adrian Johnson
7f6526e652 Merge branch 'enable-colorv1-fonts' into 'master'
Enable COLRv1 fonts

See merge request cairo/cairo!454
2023-02-11 04:18:09 +00:00
Adrian Johnson
f2f2d20a36 Merge branch 'fix-valgrind-errors' into 'master'
Fix some problems found by valgrind

See merge request cairo/cairo!452
2023-02-11 04:18:03 +00:00
Fujii Hironori
adcd1e7325 DWrite: glyph surfaces should take subpixel positions into account
Shift the glyph position by phases taken
by _cairo_scaled_glyph_xphase and _cairo_scaled_glyph_yphase.

Fixes #597
2023-02-10 10:05:57 +09:00
Adrian Johnson
876ee0bb49 Merge branch 'dwrite-argb-glyph-mask' into 'master'
DWrite: Don't convert subpixel antialiasing to grayscale

See merge request cairo/cairo!453
2023-02-09 20:47:44 +00:00
Adrian Johnson
3fc3d8b8f0 FT: Always use the outline glyph to get the path
Trying to extract the path from a color recording does not work in all
cases such as paths in groups.
2023-02-09 20:46:04 +10:30
Adrian Johnson
d01222a693 Enable COLRv1 fonts
Now that FreeType 2.13.0 has been released with a stable COLRv1 API,
the meson configuration can be updated to enable COLRv1 when this
version is available.
2023-02-09 20:09:08 +10:30
Fujii Hironori
1d8032c406 DWrite: Don't convert subpixel antialiasing to grayscale
Reuse the win32 font code to create a glyph mask for a dwrite font.
Renamed a function _compute_mask in cairo-win32-font.c to
_cairo_compute_glyph_mask.
2023-02-09 13:19:36 +09:00
Adrian Johnson
cae2376dd0 Merge branch 'doc-fixes' into 'master'
More random doc fixes

See merge request cairo/cairo!437
2023-02-08 09:53:29 +00:00
Adrian Johnson
a23af71c9d Merge branch 'remove-unused-tee-function' into 'master'
Remove unused _cairo_tee_surface_find_match

See merge request cairo/cairo!447
2023-02-08 09:48:29 +00:00
Adrian Johnson
fe7f1d8cb4 Merge branch 'warnings' into 'master'
Fix some compiler warnings

See merge request cairo/cairo!427
2023-02-08 09:47:42 +00:00
Adrian Johnson
e85c242f0a Implement a font options compare function and use it in gstate
Valgrind is not happy with the memcmp() to compare font options and it
won't work correctly with variations and custom_palette.
2023-02-08 20:09:15 +10:30
Adrian Johnson
4fbc2ea386 truetype: revert use of _cairo_strndup
3d102f25 changed the malloc/memcpy to _cairo_strndup but it won't work
in this case as the string may be UTF-16.
2023-02-08 20:05:52 +10:30
Adrian Johnson
f706ad5aa3 Merge branch 'bug-611-glyph-path' into 'master'
DWrite: More accurate glyph paths for small fonts

Closes #611

See merge request cairo/cairo!451
2023-02-07 21:21:19 +00:00
Fujii Hironori
db4c941c34 DWrite: More accurate glyph paths for small fonts
Applying a transformation matrix to a glyph path after converting
floats to fixed point numbers caused caluculation errors. Apply the
transform before the conversion.

Fixes cairo/cairo#611
2023-02-08 05:41:07 +09:00
Emmanuele Bassi
7f334e0479 Merge branch 'fix-error-handling-docs' into 'master'
Docs: Remove out of date remarks

See merge request cairo/cairo!450
2023-02-07 11:20:56 +00:00
Adrian Johnson
5ede164a61 doc: remove out of date remarks 2023-02-07 21:10:28 +10:30
Khaled Hosny
59c195dc82 Fix -Wlogical-not-parentheses
The code is doing "if (!double_buf_equal () != 0)" which seems to be a
convoluted way to do "if (!double_buf_equal ())". Fixes:

../test/pattern-getters.c:153:6: warning: logical not is only applied to the left hand side of this comparison [-Wlogical-not-parentheses]
        if (!double_buf_equal (ctx, new_buf, expected_values,
            ^
../test/pattern-getters.c:153:6: note: add parentheses after the '!' to evaluate the comparison first
        if (!double_buf_equal (ctx, new_buf, expected_values,
            ^
             (
../test/pattern-getters.c:153:6: note: add parentheses around left hand side expression to silence this warning
        if (!double_buf_equal (ctx, new_buf, expected_values,
            ^
            (
2023-02-06 11:39:08 +02:00
Khaled Hosny
c6a27dc28b Fix -Wuninitialized
../perf/cairo-perf-chart.c:232:4: warning: variable 'sum' is uninitialized when used here [-Wuninitialized]
                        sum += v/100;
                        ^~~
../perf/cairo-perf-chart.c:142:43: note: initialize the variable 'sum' to silence this warning
    double slow_sum = 0, fast_sum = 0, sum;
                                          ^
                                           = 0.0
2023-02-06 11:39:08 +02:00
Khaled Hosny
b588a43fcd Fix -Wunused-variable
../src/cairo-quartz-image-surface.c:149:24: warning: unused variable 'size' [-Wunused-variable]
    const unsigned int size = surface->imageSurface->height * surface->imageSurface->stride;
2023-02-06 11:39:08 +02:00
Khaled Hosny
288843ef5d Fix -Wsometimes-uninitialized warning
../src/cairo-pdf-surface.c:2505:9: warning: variable 'status' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
    if (surface->base.status != CAIRO_STATUS_SUCCESS)
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/cairo-pdf-surface.c:2573:9: note: uninitialized use occurs here
    if (status == CAIRO_STATUS_SUCCESS)
        ^~~~~~
../src/cairo-pdf-surface.c:2505:5: note: remove the 'if' if its condition is always false
    if (surface->base.status != CAIRO_STATUS_SUCCESS)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/cairo-pdf-surface.c:2497:5: note: variable 'status' is declared here
    cairo_status_t status, status2;
    ^
2023-02-06 11:39:08 +02:00
Uli Schlachter
6f205ed28f Remove unused _cairo_tee_surface_find_match
A little history digging shows that we only ever had one caller of
_cairo_tee_surface_find_match. Commit 658cdc7c9a "Introduce
cairo_tee_surface_t" added this code to _cairo_surface_clone_similar():

    if (src->type == CAIRO_SURFACE_TYPE_TEE) {
       cairo_surface_t *match;

       match = _cairo_tee_surface_find_match (src,
                                              surface->backend,
                                              content);
       if (match != NULL)
           src = match;
    }

Then, two years later in 2011, commit af9fbd176b "Introduce a new compositor
architecture" removed _cairo_surface_clone_similar() and thus this code became
unused.

This commit drops this unused code.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2023-02-05 16:15:25 +01:00
Uli Schlachter
23e2718bd7 Merge branch 'unused-code' into 'master'
Drop some unused or dead code

See merge request cairo/cairo!443
2023-02-05 15:00:05 +00:00
Khaled Hosny
7980301fe4 Remove dead code
This is no-op as the functions always return TRUE and the code is never
executed.
2023-02-04 10:59:41 +02:00
Khaled Hosny
c1564baf61 Fix -Wunused-but-set-parameter
../test/cairo-test-runner.c:730:48: warning: parameter 'str' set but not used [-Wunused-but-set-parameter]
_has_required_ghostscript_version (const char *str)
2023-02-04 10:58:13 +02:00
Khaled Hosny
c2ce4d421d Fix -Wparentheses-equality warnings
warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
2023-02-04 10:58:13 +02:00
Adrian Johnson
338eca4342 Merge branch 'issue-634' into 'master'
tee: Fix cairo wrapper functions

Closes #634

See merge request cairo/cairo!442
2023-02-03 20:47:16 +00:00
Emmanuele Bassi
4b1e075171 util: Fix compiler warnings in cairo-sphinx
Though I'm not sure how useful this tool is.
2023-02-03 15:45:11 +01:00
Emmanuele Bassi
5e42a5277e tee: Fix cairo wrapper functions
Follow-up to !391 to apply the same changes to the (disabled by default)
tee surface.

Fixes: #634
2023-02-03 15:40:12 +01:00
Khaled Hosny
bd608ab72c doc: fix cairo_dwrite_font_face_set_rendering_params docs
Gtk-doc wants the header and code parameter names to match.

src/win32/cairo-dwrite-font.cpp:1484: warning: Parameter description for cairo_dwrite_font_face_set_rendering_params::params is not used from source code comment block.
src/win32/cairo-dwrite-font.cpp:1484: warning: Parameter description for cairo_dwrite_font_face_set_rendering_params::param is missing in source code comment block.
2023-02-02 14:19:08 +02:00
Khaled Hosny
379cb6a672 doc: Document the deprecated status of more surface types 2023-02-02 14:13:56 +02:00
Khaled Hosny
bc0139fd1a doc: Fix external links 2023-02-02 14:13:56 +02:00
Khaled Hosny
06cda058f2 doc: Escape percent sign
Otherwise gtk-doc will eat one of them.
2023-02-02 14:13:56 +02:00
Khaled Hosny
3c6727ee5c doc: Fix internal links 2023-02-02 14:13:56 +02:00
Khaled Hosny
bc2f9b956b doc: Don’t mention non-existent cairo_stroke_to_path()
The code for it is commented out and unimplemented.
2023-02-02 14:13:56 +02:00
Khaled Hosny
086e013e06 doc: Include surface observer documentation
Mostly empty, though.
2023-02-02 14:13:56 +02:00