Tizen 2.0 Release
[framework/graphics/cairo.git] / src / win32 / cairo-win32-debug.c
1 /* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
2 /* Cairo - a vector graphics library with display and print output
3  *
4  * Copyright © 2005 Red Hat, Inc.
5  * Copyright © 2012 Intel Corporation
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it either under the terms of the GNU Lesser General Public
9  * License version 2.1 as published by the Free Software Foundation
10  * (the "LGPL") or, at your option, under the terms of the Mozilla
11  * Public License Version 1.1 (the "MPL"). If you do not alter this
12  * notice, a recipient may use your version of this file under either
13  * the MPL or the LGPL.
14  *
15  * You should have received a copy of the LGPL along with this library
16  * in the file COPYING-LGPL-2.1; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA
18  * You should have received a copy of the MPL along with this library
19  * in the file COPYING-MPL-1.1
20  *
21  * The contents of this file are subject to the Mozilla Public License
22  * Version 1.1 (the "License"); you may not use this file except in
23  * compliance with the License. You may obtain a copy of the License at
24  * http://www.mozilla.org/MPL/
25  *
26  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
27  * OF ANY KIND, either express or implied. See the LGPL or the MPL for
28  * the specific language governing rights and limitations.
29  *
30  * The Original Code is the cairo graphics library.
31  *
32  * The Initial Developer of the Original Code is Red Hat, Inc.
33  *
34  * Contributor(s):
35  *      Owen Taylor <otaylor@redhat.com>
36  *      Stuart Parmenter <stuart@mozilla.com>
37  *      Vladimir Vukicevic <vladimir@pobox.com>
38  */
39
40 #define WIN32_LEAN_AND_MEAN
41 /* We require Windows 2000 features such as ETO_PDY */
42 #if !defined(WINVER) || (WINVER < 0x0500)
43 # define WINVER 0x0500
44 #endif
45 #if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
46 # define _WIN32_WINNT 0x0500
47 #endif
48
49 #include "cairoint.h"
50 #include "cairo-win32-private.h"
51
52 #include <wchar.h>
53 #include <windows.h>
54
55 void
56 _cairo_win32_debug_dump_hrgn (HRGN rgn, char *header)
57 {
58     RGNDATA *rd;
59     unsigned int z;
60
61     if (header)
62         fprintf (stderr, "%s\n", header);
63
64     if (rgn == NULL) {
65         fprintf (stderr, " NULL\n");
66     }
67
68     z = GetRegionData(rgn, 0, NULL);
69     rd = (RGNDATA*) malloc(z);
70     z = GetRegionData(rgn, z, rd);
71
72     fprintf (stderr, " %ld rects, bounds: %ld %ld %ld %ld\n",
73              rd->rdh.nCount,
74              rd->rdh.rcBound.left,
75              rd->rdh.rcBound.top,
76              rd->rdh.rcBound.right - rd->rdh.rcBound.left,
77              rd->rdh.rcBound.bottom - rd->rdh.rcBound.top);
78
79     for (z = 0; z < rd->rdh.nCount; z++) {
80         RECT r = ((RECT*)rd->Buffer)[z];
81         fprintf (stderr, " [%d]: [%ld %ld %ld %ld]\n",
82                  z, r.left, r.top, r.right - r.left, r.bottom - r.top);
83     }
84
85     free(rd);
86     fflush (stderr);
87 }