1 /*****************************************************************************
2 * This file is part of gfxprim library. *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
19 * Copyright (C) 2009-2013 Cyril Hrubis <metan@ucw.cz> *
21 *****************************************************************************/
27 #include <core/GP_Context.h>
28 #include <gfx/GP_PutPixelAA.h>
35 /* pixel description */
44 static int test_pixel(const struct testcase
*t
)
49 c
= GP_ContextAlloc(t
->w
, t
->h
, GP_PIXEL_G8
);
52 tst_err("Failed to allocate context");
56 /* zero the pixels buffer */
57 memset(c
->pixels
, 0, c
->w
* c
->h
);
59 GP_PutPixelAA(c
, t
->x
, t
->y
, 0xff);
61 err
= compare_buffers(t
->pixmap
, c
);
69 static struct testcase testcase_pixel_center
= {
83 static struct testcase testcase_pixel_hcenter
= {
98 static struct testcase testcase_pixel_vcenter
= {
106 0x00, 0x00, 0x00, 0x00,
107 0x00, 0x80, 0x80, 0x00,
108 0x00, 0x00, 0x00, 0x00,
112 static struct testcase testcase_pixel
= {
113 .x
= (1<<8) + (1<<7),
114 .y
= (1<<8) + (1<<7),
120 0x00, 0x00, 0x00, 0x00,
121 0x00, 0x40, 0x40, 0x00,
122 0x00, 0x40, 0x40, 0x00,
123 0x00, 0x00, 0x00, 0x00,
127 const struct tst_suite tst_suite
= {
128 .suite_name
= "PutPixelAA Testsuite",
130 {.name
= "PutPixelAA center",
131 .tst_fn
= test_pixel
,
132 .data
= &testcase_pixel_center
},
134 {.name
= "PutPixelAA hcenter",
135 .tst_fn
= test_pixel
,
136 .data
= &testcase_pixel_hcenter
},
138 {.name
= "PutPixelAA vcenter",
139 .tst_fn
= test_pixel
,
140 .data
= &testcase_pixel_vcenter
},
142 {.name
= "PutPixelAA",
143 .tst_fn
= test_pixel
,
144 .data
= &testcase_pixel
},