-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest_lcdalign.c
58 lines (50 loc) · 1.74 KB
/
test_lcdalign.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
* Screentest - CRT/LCD monitor testing utility.
* https://tobix.github.io/screentest/
* Copyright (C) 2011-2017 Tobias Gruetzmacher <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*/
#include <config.h>
#include <gtk/gtk.h>
#include "callbacks.h"
#include "screentest_colors.h"
static void lcdalign_draw(GtkWidget *widget, cairo_t *cr) {
GdkWindow *win = gtk_widget_get_window(widget);
gint w, h;
gint i;
static const double d[] = {1.0};
h = gdk_window_get_height(win);
w = gdk_window_get_width(win);
/* Background/Border */
screentest_set_color_fg(cr);
cairo_paint(cr);
/* Pattern */
screentest_set_color_bg(cr);
cairo_set_line_width(cr, 1.0);
cairo_set_dash(cr, d, 1, 0);
for (i = 1; i < h - 1; i += 2) {
cairo_move_to(cr, 1, i + 0.5);
cairo_line_to(cr, w - 1, i + 0.5);
}
cairo_stroke(cr);
cairo_set_dash(cr, d, 1, 1);
for (i = 2; i < h - 1; i += 2) {
cairo_move_to(cr, 1, i + 0.5);
cairo_line_to(cr, w - 1, i + 0.5);
}
cairo_stroke(cr);
}
G_MODULE_EXPORT struct test_ops lcdalign_ops = {
.init = NULL, .draw = lcdalign_draw, .cycle = NULL, .close = NULL};