/* -*- Mode: c; c-basic-offset: 4; indent-tabs-mode: t; tab-width: 8; -*- */ /* * Copyright 2011 Andrea Canciani * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Author: Andrea Canciani */ #include "cairo-test.h" #include "cairo-win32.h" static cairo_test_status_t draw (cairo_t *cr, int width, int height) { HDC hdc; cairo_surface_t *base, *subsurf; cairo_t *cr2; int i; char s[32]; base = cairo_win32_surface_create_with_dib (CAIRO_FORMAT_RGB24, 60, 60); hdc = cairo_win32_surface_get_dc (base); IntersectClipRect (hdc, 15, 15, 55, 55); subsurf = cairo_win32_surface_create (hdc); cr2 = cairo_create (subsurf); cairo_set_source_rgb (cr2, 1, 1, 1); cairo_paint (cr2); cairo_set_source_rgb (cr2, 0, 0, 0); cairo_rectangle (cr2, 20, 20, 30, 30); cairo_stroke (cr2); for (i = 0; i < 10; i++) { snprintf (s, sizeof(s), "%d", i); cairo_move_to (cr2, i*10, i*10); cairo_show_text (cr2, s); } cairo_destroy (cr2); cairo_set_source_surface (cr, cairo_win32_surface_get_image (base), 2, 2); cairo_paint (cr); cairo_surface_destroy (subsurf); cairo_surface_destroy (base); return CAIRO_TEST_SUCCESS; } CAIRO_TEST (win32_clip_bug, "Test Win32 surfaces on HDC with non-(0,0) top-left corner", "win32", /* keywords */ NULL, /* requirements */ 64, 64, NULL, draw)