Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preserve the pre-skia-update C API for some simple cases #110

Open
wants to merge 1 commit into
base: skiasharp
Choose a base branch
from

Conversation

Mis012
Copy link

@Mis012 Mis012 commented Sep 1, 2023

This doesn't cover all the API changes, just the most trivial cases for now.

the new, incompatible versions of functions were renamed to *_v2 unless otherwise noted

all-zero sk_sampling_options_t seems to work as a reasonable default, so in some places where it wasn't passed before that's what we will pass to the C++ API

sk_filter_quality_t seems to have no trivial replacement, so it will be ignored.

the canvas functions which were changed to matrix44 seemingly didn't need to be, the new ones were renamed to *_m44

enums and structs which had entries added in the middle were reordered so that the new additions are at the end, in order to not change the values assigned to the existing entries.

--

Related to mono/SkiaSharp#2585

API Changes

described in the commit message, more explicitly below:

include/c/sk_bitmap.h:
-SK_C_API sk_shader_t* sk_bitmap_make_shader(sk_bitmap_t* cbitmap, sk_shader_tilemode_t tmx, sk_shader_tilemode_t tmy, sk_sampling_options_t* sampling, const sk_matrix_t* cmatrix);
+SK_C_API sk_shader_t* sk_bitmap_make_shader(sk_bitmap_t* cbitmap, sk_shader_tilemode_t tmx, sk_shader_tilemode_t tmy, const sk_matrix_t* cmatrix);
+SK_C_API sk_shader_t* sk_bitmap_make_shader_v2(sk_bitmap_t* cbitmap, sk_shader_tilemode_t tmx, sk_shader_tilemode_t tmy, sk_sampling_options_t* sampling, const sk_matrix_t* cmatrix);
include/c/sk_canvas.h:
-SK_C_API void sk_canvas_set_matrix(sk_canvas_t* ccanvas, const sk_matrix44_t* cmatrix);
-SK_C_API void sk_canvas_get_matrix(sk_canvas_t* ccanvas, sk_matrix44_t* cmatrix);
+SK_C_API void sk_canvas_set_matrix(sk_canvas_t* ccanvas, const sk_matrix_t* cmatrix);
+SK_C_API void sk_canvas_set_matrix_44(sk_canvas_t* ccanvas, const sk_matrix44_t* cmatrix);
+SK_C_API void sk_canvas_get_matrix(sk_canvas_t* ccanvas, sk_matrix_t* cmatrix);
+SK_C_API void sk_canvas_get_matrix_44(sk_canvas_t* ccanvas, sk_matrix44_t* cmatrix);
-SK_C_API void sk_canvas_concat(sk_canvas_t* ccanvas, const sk_matrix44_t* cmatrix);
+SK_C_API void sk_canvas_concat(sk_canvas_t* ccanvas, const sk_matrix_t* cmatrix);
+SK_C_API void sk_canvas_concat_m44(sk_canvas_t* ccanvas, const sk_matrix44_t* cmatrix);
-SK_C_API void sk_canvas_draw_image(sk_canvas_t* ccanvas, const sk_image_t* cimage, float x, float y, const sk_sampling_options_t* sampling, const sk_paint_t* cpaint);
-SK_C_API void sk_canvas_draw_image_rect(sk_canvas_t* ccanvas, const sk_image_t* cimage, const sk_rect_t* csrcR, const sk_rect_t* cdstR, const sk_sampling_options_t* sampling, const sk_paint_t* cpaint);
+SK_C_API void sk_canvas_draw_image(sk_canvas_t* ccanvas, const sk_image_t* cimage, float x, float y, const sk_paint_t* cpaint);
+SK_C_API void sk_canvas_draw_image_v2(sk_canvas_t* ccanvas, const sk_image_t* cimage, float x, float y, const sk_sampling_options_t* sampling, const sk_paint_t* cpaint);
+SK_C_API void sk_canvas_draw_image_rect(sk_canvas_t* ccanvas, const sk_image_t* cimage, const sk_rect_t* csrcR, const sk_rect_t* cdstR, const sk_paint_t* cpaint);
+SK_C_API void sk_canvas_draw_image_rect_v2(sk_canvas_t* ccanvas, const sk_image_t* cimage, const sk_rect_t* csrcR, const sk_rect_t* cdstR, const sk_sampling_options_t* sampling, const sk_paint_t* cpaint);
-SK_C_API void sk_canvas_draw_image_lattice(sk_canvas_t* ccanvas, const sk_image_t* image, const sk_lattice_t* lattice, const sk_rect_t* dst, sk_filter_mode_t mode, const sk_paint_t* paint);
-SK_C_API void sk_canvas_draw_image_nine(sk_canvas_t* ccanvas, const sk_image_t* image, const sk_irect_t* center, const sk_rect_t* dst, sk_filter_mode_t mode, const sk_paint_t* paint);
+SK_C_API void sk_canvas_draw_image_lattice(sk_canvas_t* ccanvas, const sk_image_t* image, const sk_lattice_t* lattice, const sk_rect_t* dst, const sk_paint_t* paint);
+SK_C_API void sk_canvas_draw_image_lattice_v2(sk_canvas_t* ccanvas, const sk_image_t* image, const sk_lattice_t* lattice, const sk_rect_t* dst, sk_filter_mode_t mode, const sk_paint_t* paint);
+SK_C_API void sk_canvas_draw_image_nine(sk_canvas_t* ccanvas, const sk_image_t* image, const sk_irect_t* center, const sk_rect_t* dst, const sk_paint_t* paint);
+SK_C_API void sk_canvas_draw_image_nine_v2(sk_canvas_t* ccanvas, const sk_image_t* image, const sk_irect_t* center, const sk_rect_t* dst, sk_filter_mode_t mode, const sk_paint_t* paint);
-SK_C_API void sk_canvas_draw_atlas(sk_canvas_t* ccanvas, const sk_image_t* atlas, const sk_rsxform_t* xform, const sk_rect_t* tex, const sk_color_t* colors, int count, sk_blendmode_t mode, const sk_sampling_options_t* sampling, const sk_rect_t* cullRect, const sk_paint_t* paint);
+SK_C_API void sk_canvas_draw_atlas(sk_canvas_t* ccanvas, const sk_image_t* atlas, const sk_rsxform_t* xform, const sk_rect_t* tex, const sk_color_t* colors, int count, sk_blendmode_t mode, const sk_rect_t* cullRect, const sk_paint_t* paint);
+SK_C_API void sk_canvas_draw_atlas_v2(sk_canvas_t* ccanvas, const sk_image_t* atlas, const sk_rsxform_t* xform, const sk_rect_t* tex, const sk_color_t* colors, int count, sk_blendmode_t mode, const sk_sampling_options_t* sampling, const sk_rect_t* cullRect, const sk_paint_t* paint);
include/c/sk_image.h:
-SK_C_API sk_shader_t* sk_image_make_shader(const sk_image_t* image, sk_shader_tilemode_t tileX, sk_shader_tilemode_t tileY, const sk_sampling_options_t* sampling, const sk_matrix_t* cmatrix);
+SK_C_API sk_shader_t* sk_image_make_shader(const sk_image_t* image, sk_shader_tilemode_t tileX, sk_shader_tilemode_t tileY, int /*unused*/, const sk_matrix_t* cmatrix);
+SK_C_API sk_shader_t* sk_image_make_shader_v2(const sk_image_t* image, sk_shader_tilemode_t tileX, sk_shader_tilemode_t tileY, const sk_sampling_options_t* sampling, const sk_matrix_t* cmatrix);
-SK_C_API bool sk_image_scale_pixels(const sk_image_t* image, const sk_pixmap_t* dst, const sk_sampling_options_t* sampling, sk_image_caching_hint_t cachingHint);
+SK_C_API bool sk_image_scale_pixels(const sk_image_t* image, const sk_pixmap_t* dst, sk_image_caching_hint_t cachingHint);
+SK_C_API bool sk_image_scale_pixels_v2(const sk_image_t* image, const sk_pixmap_t* dst, const sk_sampling_options_t* sampling, sk_image_caching_hint_t cachingHint);

Behavioral Changes

None.

This doesn't cover all the API changes, just the most trivial
cases for now.

the new, incompatible versions of functions were renamed to *_v2
unless otherwise noted

all-zero sk_sampling_options_t seems to work as a reasonable default,
so in some places where it wasn't passed before that's what we will
pass to the C++ API

sk_filter_quality_t seems to have no trivial replacement, so it will
be ignored.

the canvas functions which were changed to matrix44 seemingly didn't
need to be, the new ones were renamed to *_m44

enums and structs which had entries added in the middle  were reordered
so that the new additions are at the end, in order to not change the values
assigned to the existing entries.
@Mis012
Copy link
Author

Mis012 commented Sep 1, 2023

I don't see any CLA and I don't think any Microsoft CLA would necessarily apply to a fork of a google project, so I'm not sure what the "CLA check" is about

@mattleibow
Copy link

mattleibow commented Sep 1, 2023

https://github.com/microsoft/contributorlicenseagreement

To accept the agreement, the user can issue one of the following two commands as a comment on the pull request.

If you are contributing on behalf of yourself:

@microsoft-github-policy-service agree

If you are contributing on behalf of a company:

@microsoft-github-policy-service agree company="your company"

Terminating
A user can choose to terminate the signed agreement by issuing the following command by commenting under a pull request that was opened by the same user.

@microsoft-github-policy-service terminate

@Mis012
Copy link
Author

Mis012 commented Sep 1, 2023

I see... now, where do I read the CLA
it says it should be in a policy folder, but I don't see any such

oh, found it... https://github.com/mono/.github/blob/main/policies/cla.yml
the CI check should probably provide a direct link to that, rather than telling you to find it yourself... is that something I should report to https://github.com/microsoft/ContributorLicenseAgreement/?

hm, it seems that it provided proper context on another pull request, not sure if that's a recent fix or it was just bugged and it's supposed to do that always?

@Mis012
Copy link
Author

Mis012 commented Sep 2, 2023

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants