cairo-windows icon indicating copy to clipboard operation
cairo-windows copied to clipboard

Enable Tee Surface ?

Open stuaxo opened this issue 4 years ago • 15 comments

Is there an easy way to see which features cairo-windows had enabled when Cairo was built?

stuaxo avatar Aug 20 '20 16:08 stuaxo

Maybe include\cairo-features.h in the zipfile contains the info you're looking for?

preshing avatar Aug 21 '20 03:08 preshing

Thanks, that is helpful.

I was comparing cairo-windows to the MingW version and it looks like they enable TeeSurface. Can we enable it here (or is there a blocker, like it's not actually implemented on Windows) ?

This would make it possible to use with pycairo without updating one of the unit tests there that expects TeeSurface to exist.

TBH, I have no idea if there are any issues with TeeSurface, pycairo only started assuming it was there after 0.16.0 so maybe it just wasn't a default here.

cairo-windows include\features.h

#define CAIRO_HAS_WIN32_SURFACE 1
#define CAIRO_HAS_WIN32_FONT 1
#define CAIRO_HAS_PNG_FUNCTIONS 1
#define CAIRO_HAS_SCRIPT_SURFACE 1
#define CAIRO_HAS_FT_FONT 1
#define CAIRO_HAS_PS_SURFACE 1
#define CAIRO_HAS_PDF_SURFACE 1
#define CAIRO_HAS_SVG_SURFACE 1
#define CAIRO_HAS_IMAGE_SURFACE 1
#define CAIRO_HAS_MIME_SURFACE 1
#define CAIRO_HAS_RECORDING_SURFACE 1
#define CAIRO_HAS_OBSERVER_SURFACE 1
#define CAIRO_HAS_USER_FONT 1
#define CAIRO_HAS_INTERPRETER 1

https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-cairo/PKGBUILD#L59-L76

CFLAGS=...
    --enable-win32 \
    --enable-win32-font \
    --enable-png \
    --enable-shared \
    --enable-static \
    --enable-gobject \
    --enable-tee \
    --disable-xlib \
    --disable-xcb \
    --enable-fc \
    --enable-ft \
    --disable-silent-rules \
...

stuaxo avatar Aug 21 '20 14:08 stuaxo

I guess it's a matter of adding --enable-tee somewhere?

preshing avatar Aug 25 '20 20:08 preshing

Yep, and adding the header file.

Though I'm wondering now, why msys gets this and this project doesn't, maybe they are using two different Makefiles with different defaults.

Maybe we it should change in the upstream Makefile for Windows (Assuming Msys doesn't manually enable it).

stuaxo avatar Aug 25 '20 20:08 stuaxo

Looks like changing build\Makefile.win32.features in the downloaded folder changing CAIRO_HAS_TEE_SURFACE=0 in the line 35 to CAIRO_HAS_TEE_SURFACE=1 will work. I think. @stuaxo

naveen521kk avatar Aug 27 '20 07:08 naveen521kk

Thanks - I'll try it when I next get a bit of time - I'm on VS2017 now so should be more straightforward.

stuaxo avatar Aug 27 '20 09:08 stuaxo

@stuaxo or @preshing Have you tried the one I told?

naveen521kk avatar Aug 28 '20 07:08 naveen521kk

I should be able to try it later, but not going to have time to work on it until at least 9PM BST

stuaxo avatar Aug 28 '20 08:08 stuaxo

@preshing If you could, and problably have some time, can you try the option I told here ? And upload the dll file in release if there was no errors? Kinda I'm interested to know whether thank works and we can solve this problem. :)

naveen521kk avatar Aug 29 '20 17:08 naveen521kk

Sure. I made the changes here. And the release is here. I didn't test it, but let me know if it works for you! If all goes well I'll merge it into the main branch.

preshing avatar Aug 29 '20 23:08 preshing

I didn't test it, but let me know if it works for you!

I will test in an hour or so and thanks for your help.

naveen521kk avatar Aug 30 '20 03:08 naveen521kk

@preshing Looks like it is working with test I run in GitHub Actions. https://github.com/naveen521kk/pycairo/actions/runs/230850470 Let @stuaxo again confirm it. Finally, make it so that the last version released to have that. Because we are using CI for building it and we would just get it from version. Thank You for that. @preshing

naveen521kk avatar Aug 30 '20 05:08 naveen521kk

Impressive work, I'll catch up on all this later and have a proper look :)

stuaxo avatar Aug 30 '20 11:08 stuaxo

@stuaxo Can the tee surface work be merged in master?

naveen521kk avatar Sep 01 '20 17:09 naveen521kk

Yes, I tested the pycairo wheel that uses this in a fresh install of python, so LGTM.

stuaxo avatar Sep 01 '20 23:09 stuaxo