ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cf.schmorp.de/Deliantra-Client/pango-render.c
(Generate patch)

Comparing cf.schmorp.de/Deliantra-Client/pango-render.c (file contents):
Revision 1.19 by root, Sun Nov 18 00:52:22 2018 UTC vs.
Revision 1.20 by root, Sun Nov 18 03:06:13 2018 UTC

38 PangoRenderer parent_instance; 38 PangoRenderer parent_instance;
39 float r, g, b, a; // modulate 39 float r, g, b, a; // modulate
40 int flags; 40 int flags;
41 rc_t *rc; // rendercache 41 rc_t *rc; // rendercache
42 rc_key_t key; // current render key 42 rc_key_t key; // current render key
43 rc_array_t *arr; 43 rc_t::array_t *arr;
44}; 44};
45 45
46G_DEFINE_TYPE (PangoOpenGLRenderer, pango_opengl_renderer, PANGO_TYPE_RENDERER) 46G_DEFINE_TYPE (PangoOpenGLRenderer, pango_opengl_renderer, PANGO_TYPE_RENDERER)
47 47
48typedef struct 48typedef struct
242 y -= g->top; 242 y -= g->top;
243 243
244 if (g->tex.name != renderer->key.texname) 244 if (g->tex.name != renderer->key.texname)
245 { 245 {
246 renderer->key.texname = g->tex.name; 246 renderer->key.texname = g->tex.name;
247 renderer->arr = rc_array (renderer->rc, &renderer->key); 247 renderer->arr = &renderer->rc->array (renderer->key);
248 } 248 }
249 249
250 rc_glyph (renderer->arr, g->tex.x, g->tex.y, g->tex.w, g->tex.h, x, y); 250 renderer->arr->glyph (g->tex.x, g->tex.y, g->tex.w, g->tex.h, x, y);
251} 251}
252 252
253static void 253static void
254draw_trapezoid (PangoRenderer *renderer_, 254draw_trapezoid (PangoRenderer *renderer_,
255 PangoRenderPart part, 255 PangoRenderPart part,
260 double x12, 260 double x12,
261 double x22) 261 double x22)
262{ 262{
263 PangoOpenGLRenderer *renderer = (PangoOpenGLRenderer *)renderer_; 263 PangoOpenGLRenderer *renderer = (PangoOpenGLRenderer *)renderer_;
264 rc_key_t key = renderer->key; 264 rc_key_t key = renderer->key;
265 rc_array_t *arr;
266 265
267 key.mode = GL_QUADS; 266 key.mode = GL_QUADS;
268 key.format = GL_V2F; 267 key.format = GL_V2F;
269 key.texname = 0; 268 key.texname = 0;
270 269
271 arr = rc_array (renderer->rc, &key); 270 auto &arr = renderer->rc->array (key);
272 271
273 rc_v2f (arr, x11, y1); 272 arr.v2f (x11, y1);
274 rc_v2f (arr, x21, y1); 273 arr.v2f (x21, y1);
275 rc_v2f (arr, x22, y2); 274 arr.v2f (x22, y2);
276 rc_v2f (arr, x12, y2); 275 arr.v2f (x12, y2);
277} 276}
278 277
279void 278void
280pango_opengl_render_layout_subpixel (PangoLayout *layout, 279pango_opengl_render_layout_subpixel (PangoLayout *layout,
281 rc_t *rc, 280 rc_t *rc,
282 int x, int y, 281 int x, int y,
283 float r, float g, float b, float a, 282 float r, float g, float b, float a,
284 int flags) 283 int flags)
291 context = pango_layout_get_context (layout); 290 context = pango_layout_get_context (layout);
292 fontmap = pango_context_get_font_map (context); 291 fontmap = pango_context_get_font_map (context);
293 renderer = _pango_opengl_font_map_get_renderer (PANGO_OPENGL_FONT_MAP (fontmap)); 292 renderer = _pango_opengl_font_map_get_renderer (PANGO_OPENGL_FONT_MAP (fontmap));
294 gl = PANGO_OPENGL_RENDERER (renderer); 293 gl = PANGO_OPENGL_RENDERER (renderer);
295 294
296 gl->rc = rc; 295 gl->rc = rc;
297 gl->r = r; 296 gl->r = r;
298 gl->g = g; 297 gl->g = g;
299 gl->b = b; 298 gl->b = b;
300 gl->a = a; 299 gl->a = a;
301 gl->flags = flags; 300 gl->flags = flags;
302 301
303 pango_renderer_draw_layout (renderer, layout, x, y); 302 pango_renderer_draw_layout (renderer, layout, x, y);
304} 303}
305 304
306void 305void
307pango_opengl_render_layout (PangoLayout *layout, 306pango_opengl_render_layout (PangoLayout *layout,
308 rc_t *rc, 307 rc_t *rc,
309 int x, int y, 308 int x, int y,
310 float r, float g, float b, float a, 309 float r, float g, float b, float a,
311 int flags) 310 int flags)
368 { 367 {
369 r = fg->red * (255.f / 65535.f); 368 r = fg->red * (255.f / 65535.f);
370 g = fg->green * (255.f / 65535.f); 369 g = fg->green * (255.f / 65535.f);
371 b = fg->blue * (255.f / 65535.f); 370 b = fg->blue * (255.f / 65535.f);
372 } 371 }
373 else 372 else
374 { 373 {
375 r = gl->r * 255.f; 374 r = gl->r * 255.f;
376 g = gl->g * 255.f; 375 g = gl->g * 255.f;
377 b = gl->b * 255.f; 376 b = gl->b * 255.f;
378 } 377 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines