win32: assertion fails creating similar surface with 0 height
For win32 surfaces, an assertion fails in cairo_surface_create_similar()
when calling cairo_surface_create_similar()
with height=0.
This is an example:
#include <cairo/cairo.h>
#include <cairo/cairo-win32.h>
int main(int argc, char **argv) {
cairo_surface_t *surface = cairo_win32_surface_create_with_dib(CAIRO_FORMAT_ARGB32,
100,
100);
cairo_surface_t *similar_surface = cairo_surface_create_similar(surface,
CAIRO_CONTENT_ALPHA,
100,
0);
cairo_surface_destroy(similar_surface);
cairo_surface_destroy(surface);
return 0;
}
The problem doesn't happen when surface is a image surface.
Interestingly, creating a win32 surface with 0 height works:
#include <cairo/cairo.h>
#include <cairo/cairo-win32.h>
int main(int argc, char **argv) {
cairo_surface_t *surface = cairo_win32_surface_create_with_dib(CAIRO_FORMAT_ARGB32,
100,
0);
cairo_surface_destroy(surface);
return 0;
}
We get this error using gtk3 on windows. See the relevant issue
Cairo: version 1.15.8
OS: Win10