MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / onScreenDraw

Function onScreenDraw

modules/piu/PC/Screen/lin/piuScreen.c:92–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90};
91
92gboolean onScreenDraw(GtkWidget *widget, cairo_t *cr, gpointer data)
93{
94 PiuScreen* self = (PiuScreen*)data;
95 cairo_surface_t *surface = (*self)->surface;
96 double dstWidth = (*self)->bounds.width;
97 double dstHeight = (*self)->bounds.height;
98 double srcWidth = cairo_image_surface_get_width(surface);
99 double srcHeight = cairo_image_surface_get_height(surface);
100 PiuRectangle hole = &(*self)->hole;
101 if (!PiuRectangleIsEmpty(hole)) {
102 cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
103 cairo_rectangle(cr, 0, 0, dstWidth, dstHeight);
104 cairo_rectangle(cr, hole->x, hole->y, hole->width, hole->height);
105 cairo_clip(cr);
106 }
107 cairo_translate(cr,dstWidth/2,dstHeight/2);
108 cairo_rotate(cr,(*self)->rotation * (M_PI/180.0));
109 cairo_translate(cr,-srcWidth/2,-srcHeight/2);
110 cairo_set_source_surface(cr, surface, 0, 0);
111 if ((*self)->transparency)
112 cairo_paint_with_alpha(cr, 1.0 - (*self)->transparency);
113 else
114 cairo_paint(cr);
115
116 if ((*self)->flags & piuDisplayFingerprint) {
117 PiuSkin* skin = (*self)->skin;
118 if (skin) {
119 PiuTexture* texture = (*skin)->data.pattern.texture;
120 if (skin) {
121 cairo_surface_t* image = (*texture)->image;
122 if (image) {
123 PiuDimension width = (*texture)->width;
124 PiuDimension height = (*texture)->height;
125 PiuDimension x = (*self)->fingerprint.x - (width / 2);
126 PiuDimension y = (*self)->fingerprint.y - (height / 2);
127 cairo_set_source_surface(cr, image, 0, 0);
128 cairo_pattern_t *pattern = cairo_get_source(cr);
129 cairo_matrix_t matrix;
130 cairo_matrix_init_identity(&matrix);
131 cairo_matrix_translate(&matrix, 0 - x, 0 - y);
132 cairo_pattern_set_matrix (pattern, &matrix);
133 cairo_rectangle(cr, x, y, width, height);
134 cairo_fill(cr);
135 }
136 }
137 }
138 }
139
140
141
142 return TRUE;
143}
144
145gboolean onScreenMouseDown(GtkWidget *widget, GdkEvent *event, gpointer data)
146{

Callers

nothing calls this directly

Calls 1

PiuRectangleIsEmptyFunction · 0.85

Tested by

no test coverage detected