summaryrefslogtreecommitdiff
path: root/legacy/evas/src/modules/engines/gl_x11/evas_engine.c
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2009-12-30 11:35:40 +0000
committerCarsten Haitzler <raster@rasterman.com>2009-12-30 11:35:40 +0000
commitfa435074e0c78c50d49434f10707715af63521f1 (patch)
tree26d07082312d1b8a4530de8551a6746e03ad7d5d /legacy/evas/src/modules/engines/gl_x11/evas_engine.c
parent65c4336b0b6f436300c83c345ac999a6c3dc22f9 (diff)
1. line support in gl engine - as if anyone uses lines
2. fix clipping for gl maps - was setting them when it shouldnt. SVN revision: 44782
Diffstat (limited to '')
-rw-r--r--legacy/evas/src/modules/engines/gl_x11/evas_engine.c206
1 files changed, 164 insertions, 42 deletions
diff --git a/legacy/evas/src/modules/engines/gl_x11/evas_engine.c b/legacy/evas/src/modules/engines/gl_x11/evas_engine.c
index f8630c0622..f989aac2d9 100644
--- a/legacy/evas/src/modules/engines/gl_x11/evas_engine.c
+++ b/legacy/evas/src/modules/engines/gl_x11/evas_engine.c
@@ -354,7 +354,7 @@ eng_line_draw(void *data, void *context, void *surface, int x1, int y1, int x2,
354 eng_window_use(re->win); 354 eng_window_use(re->win);
355 evas_gl_common_context_target_surface_set(re->win->gl_context, surface); 355 evas_gl_common_context_target_surface_set(re->win->gl_context, surface);
356 re->win->gl_context->dc = context; 356 re->win->gl_context->dc = context;
357//-// evas_gl_common_line_draw(re->win->gl_context, x1, y1, x2, y2); 357 evas_gl_common_line_draw(re->win->gl_context, x1, y1, x2, y2);
358} 358}
359 359
360static void * 360static void *
@@ -390,55 +390,76 @@ eng_polygon_draw(void *data, void *context, void *surface, void *polygon)
390static void 390static void
391eng_gradient2_color_np_stop_insert(void *data __UNUSED__, void *gradient __UNUSED__, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__, float pos __UNUSED__) 391eng_gradient2_color_np_stop_insert(void *data __UNUSED__, void *gradient __UNUSED__, int r __UNUSED__, int g __UNUSED__, int b __UNUSED__, int a __UNUSED__, float pos __UNUSED__)
392{ 392{
393 evas_common_gradient2_color_np_stop_insert(gradient, r, g, b, a, pos);
393} 394}
394 395
395static void 396static void
396eng_gradient2_clear(void *data __UNUSED__, void *gradient __UNUSED__) 397eng_gradient2_clear(void *data __UNUSED__, void *gradient __UNUSED__)
397{ 398{
399 evas_common_gradient2_clear(gradient);
398} 400}
399 401
400static void 402static void
401eng_gradient2_fill_transform_set(void *data __UNUSED__, void *gradient __UNUSED__, void *transform __UNUSED__) 403eng_gradient2_fill_transform_set(void *data __UNUSED__, void *gradient __UNUSED__, void *transform __UNUSED__)
402{ 404{
405 evas_common_gradient2_fill_transform_set(gradient, transform);
403} 406}
404 407
405static void 408static void
406eng_gradient2_fill_spread_set 409eng_gradient2_fill_spread_set(void *data __UNUSED__, void *gradient __UNUSED__, int spread __UNUSED__)
407(void *data __UNUSED__, void *gradient __UNUSED__, int spread __UNUSED__)
408{ 410{
411 evas_common_gradient2_fill_spread_set(gradient, spread);
409} 412}
410 413
411static void * 414static void *
412eng_gradient2_linear_new(void *data __UNUSED__) 415eng_gradient2_linear_new(void *data __UNUSED__)
413{ 416{
414 return NULL; 417 return evas_common_gradient2_linear_new();
415} 418}
416 419
417static void 420static void
418eng_gradient2_linear_free(void *data __UNUSED__, void *linear_gradient __UNUSED__) 421eng_gradient2_linear_free(void *data __UNUSED__, void *linear_gradient __UNUSED__)
419{ 422{
423 evas_common_gradient2_free(linear_gradient);
420} 424}
421 425
422static void 426static void
423eng_gradient2_linear_fill_set(void *data __UNUSED__, void *linear_gradient __UNUSED__, float x0 __UNUSED__, float y0 __UNUSED__, float x1 __UNUSED__, float y1 __UNUSED__) 427eng_gradient2_linear_fill_set(void *data __UNUSED__, void *linear_gradient __UNUSED__, float x0 __UNUSED__, float y0 __UNUSED__, float x1 __UNUSED__, float y1 __UNUSED__)
424{ 428{
429 evas_common_gradient2_linear_fill_set(linear_gradient, x0, y0, x1, y1);
425} 430}
426 431
427static int 432static int
428eng_gradient2_linear_is_opaque(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) 433eng_gradient2_linear_is_opaque(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
429{ 434{
430 return 1; 435 RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
436 RGBA_Gradient2 *gr = (RGBA_Gradient2 *)linear_gradient;
437
438 if (!dc || !gr || !gr->type.geometer) return 0;
439 return !(gr->type.geometer->has_alpha(gr, dc->render_op) |
440 gr->type.geometer->has_mask(gr, dc->render_op));
431} 441}
432 442
433static int 443static int
434eng_gradient2_linear_is_visible(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) 444eng_gradient2_linear_is_visible(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
435{ 445{
446 RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
447
448 if (!dc || !linear_gradient) return 0;
436 return 1; 449 return 1;
437} 450}
438 451
439static void 452static void
440eng_gradient2_linear_render_pre(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__) 453eng_gradient2_linear_render_pre(void *data __UNUSED__, void *context __UNUSED__, void *linear_gradient __UNUSED__)
441{ 454{
455 RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
456 RGBA_Gradient2 *gr = (RGBA_Gradient2 *)linear_gradient;
457 int len;
458
459 if (!dc || !gr || !gr->type.geometer) return;
460 gr->type.geometer->geom_update(gr);
461 len = gr->type.geometer->get_map_len(gr);
462 evas_common_gradient2_map(dc, gr, len);
442} 463}
443 464
444static void 465static void
@@ -449,39 +470,86 @@ eng_gradient2_linear_render_post(void *data __UNUSED__, void *linear_gradient __
449static void 470static void
450eng_gradient2_linear_draw(void *data __UNUSED__, void *context __UNUSED__, void *surface __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) 471eng_gradient2_linear_draw(void *data __UNUSED__, void *context __UNUSED__, void *surface __UNUSED__, void *linear_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
451{ 472{
473 Render_Engine *re;
474
475 re = (Render_Engine *)data;
476 eng_window_use(re->win);
477 re->win->gl_context->dc = context;
478 {
479 Evas_GL_Image *gim;
480 RGBA_Image *im;
481 RGBA_Draw_Context *dc = context;
482 int op = dc->render_op, cuse = dc->clip.use;
483
484 im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
485 im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h);
486
487 dc->render_op = _EVAS_RENDER_FILL;
488 dc->clip.use = 0;
489
490 // draw to buf, copy to tex, draw tex
491 evas_common_gradient2_draw(im, dc, 0, 0, w, h, linear_gradient);
492
493 gim = evas_gl_common_image_new_from_data(re->win->gl_context, w, h,
494 im->image.data, 1,
495 EVAS_COLORSPACE_ARGB8888);
496 dc->render_op = op;
497 dc->clip.use = cuse;
498 evas_gl_common_image_draw(re->win->gl_context, gim, 0, 0, w, h, x, y, w, h, 0);
499 evas_cache_image_drop(&im->cache_entry);
500 evas_gl_common_image_free(gim);
501 }
452} 502}
453 503
454static void * 504static void *
455eng_gradient2_radial_new(void *data __UNUSED__) 505eng_gradient2_radial_new(void *data __UNUSED__)
456{ 506{
457 return NULL; 507 return evas_common_gradient2_radial_new();
458} 508}
459 509
460static void 510static void
461eng_gradient2_radial_free(void *data __UNUSED__, void *radial_gradient __UNUSED__) 511eng_gradient2_radial_free(void *data __UNUSED__, void *radial_gradient __UNUSED__)
462{ 512{
513 evas_common_gradient2_free(radial_gradient);
463} 514}
464 515
465static void 516static void
466eng_gradient2_radial_fill_set(void *data __UNUSED__, void *radial_gradient __UNUSED__, float cx __UNUSED__, float cy __UNUSED__, float rx __UNUSED__, float ry __UNUSED__) 517eng_gradient2_radial_fill_set(void *data __UNUSED__, void *radial_gradient __UNUSED__, float cx __UNUSED__, float cy __UNUSED__, float rx __UNUSED__, float ry __UNUSED__)
467{ 518{
519 evas_common_gradient2_radial_fill_set(radial_gradient, cx, cy, rx, ry);
468} 520}
469 521
470static int 522static int
471eng_gradient2_radial_is_opaque(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) 523eng_gradient2_radial_is_opaque(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
472{ 524{
473 return 1; 525 RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
526 RGBA_Gradient2 *gr = (RGBA_Gradient2 *)radial_gradient;
527
528 if (!dc || !gr || !gr->type.geometer) return 0;
529 return !(gr->type.geometer->has_alpha(gr, dc->render_op) |
530 gr->type.geometer->has_mask(gr, dc->render_op));
474} 531}
475 532
476static int 533static int
477eng_gradient2_radial_is_visible(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) 534eng_gradient2_radial_is_visible(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
478{ 535{
536 RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
537
538 if (!dc || !radial_gradient) return 0;
479 return 1; 539 return 1;
480} 540}
481 541
482static void 542static void
483eng_gradient2_radial_render_pre(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__) 543eng_gradient2_radial_render_pre(void *data __UNUSED__, void *context __UNUSED__, void *radial_gradient __UNUSED__)
484{ 544{
545 RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
546 RGBA_Gradient2 *gr = (RGBA_Gradient2 *)radial_gradient;
547 int len;
548
549 if (!dc || !gr || !gr->type.geometer) return;
550 gr->type.geometer->geom_update(gr);
551 len = gr->type.geometer->get_map_len(gr);
552 evas_common_gradient2_map(dc, gr, len);
485} 553}
486 554
487static void 555static void
@@ -492,126 +560,157 @@ eng_gradient2_radial_render_post(void *data __UNUSED__, void *radial_gradient __
492static void 560static void
493eng_gradient2_radial_draw(void *data __UNUSED__, void *context __UNUSED__, void *surface __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) 561eng_gradient2_radial_draw(void *data __UNUSED__, void *context __UNUSED__, void *surface __UNUSED__, void *radial_gradient __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__)
494{ 562{
563 Render_Engine *re;
564
565 re = (Render_Engine *)data;
566 eng_window_use(re->win);
567 re->win->gl_context->dc = context;
568 {
569 Evas_GL_Image *gim;
570 RGBA_Image *im;
571 RGBA_Draw_Context *dc = context;
572 int op = dc->render_op, cuse = dc->clip.use;
573
574 im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
575 im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h);
576
577 dc->render_op = _EVAS_RENDER_FILL;
578 dc->clip.use = 0;
579
580 // draw to buf, copy to tex, draw tex
581 evas_common_gradient2_draw(im, dc, 0, 0, w, h, radial_gradient);
582
583 gim = evas_gl_common_image_new_from_data(re->win->gl_context, w, h,
584 im->image.data, 1,
585 EVAS_COLORSPACE_ARGB8888);
586 dc->render_op = op;
587 dc->clip.use = cuse;
588 evas_gl_common_image_draw(re->win->gl_context, gim, 0, 0, w, h, x, y, w, h, 0);
589 evas_cache_image_drop(&im->cache_entry);
590 evas_gl_common_image_free(gim);
591 }
495} 592}
496 593
497static void * 594static void *
498eng_gradient_new(void *data __UNUSED__) 595eng_gradient_new(void *data __UNUSED__)
499{ 596{
500//--// return evas_gl_common_gradient_new(); 597 return evas_common_gradient_new();
501 return NULL;
502} 598}
503 599
504static void 600static void
505eng_gradient_color_stop_add(void *data __UNUSED__, void *gradient, int r, int g, int b, int a, int delta) 601eng_gradient_free(void *data __UNUSED__, void *gradient)
506{ 602{
507//--// evas_gl_common_gradient_color_stop_add(gradient, r, g, b, a, delta); 603 evas_common_gradient_free(gradient);
508} 604}
509 605
510static void 606static void
511eng_gradient_alpha_stop_add(void *data __UNUSED__, void *gradient, int a, int delta) 607eng_gradient_color_stop_add(void *data __UNUSED__, void *gradient, int r, int g, int b, int a, int delta)
512{ 608{
513//--// evas_gl_common_gradient_alpha_stop_add(gradient, a, delta); 609 evas_common_gradient_color_stop_add(gradient, r, g, b, a, delta);
514} 610}
515 611
516static void 612static void
517eng_gradient_clear(void *data __UNUSED__, void *gradient) 613eng_gradient_alpha_stop_add(void *data __UNUSED__, void *gradient, int a, int delta)
518{ 614{
519//--// evas_gl_common_gradient_clear(gradient); 615 evas_common_gradient_alpha_stop_add(gradient, a, delta);
520} 616}
521 617
522static void 618static void
523eng_gradient_color_data_set(void *data __UNUSED__, void *gradient, void *map, int len, int has_alpha) 619eng_gradient_color_data_set(void *data __UNUSED__, void *gradient, void *map, int len, int has_alpha)
524{ 620{
525//--// evas_gl_common_gradient_color_data_set(gradient, map, len, has_alpha); 621 evas_common_gradient_color_data_set(gradient, map, len, has_alpha);
526} 622}
527 623
528static void 624static void
529eng_gradient_alpha_data_set(void *data __UNUSED__, void *gradient, void *alpha_map, int len) 625eng_gradient_alpha_data_set(void *data __UNUSED__, void *gradient, void *alpha_map, int len)
530{ 626{
531//--// evas_gl_common_gradient_alpha_data_set(gradient, alpha_map, len); 627 evas_common_gradient_alpha_data_set(gradient, alpha_map, len);
532} 628}
533 629
534static void 630static void
535eng_gradient_free(void *data __UNUSED__, void *gradient) 631eng_gradient_clear(void *data __UNUSED__, void *gradient)
536{ 632{
537//--// evas_gl_common_gradient_free(gradient); 633 evas_common_gradient_clear(gradient);
538} 634}
539 635
540static void 636static void
541eng_gradient_fill_set(void *data __UNUSED__, void *gradient, int x, int y, int w, int h) 637eng_gradient_fill_set(void *data __UNUSED__, void *gradient, int x, int y, int w, int h)
542{ 638{
543//--// evas_gl_common_gradient_fill_set(gradient, x, y, w, h); 639 evas_common_gradient_fill_set(gradient, x, y, w, h);
544} 640}
545 641
546static void 642static void
547eng_gradient_fill_angle_set(void *data __UNUSED__, void *gradient, double angle) 643eng_gradient_fill_angle_set(void *data __UNUSED__, void *gradient, double angle)
548{ 644{
549//--// evas_gl_common_gradient_fill_angle_set(gradient, angle); 645 evas_common_gradient_fill_angle_set(gradient, angle);
550} 646}
551 647
552static void 648static void
553eng_gradient_fill_spread_set(void *data __UNUSED__, void *gradient, int spread) 649eng_gradient_fill_spread_set(void *data __UNUSED__, void *gradient, int spread)
554{ 650{
555//--// evas_gl_common_gradient_fill_spread_set(gradient, spread); 651 evas_common_gradient_fill_spread_set(gradient, spread);
556} 652}
557 653
558static void 654static void
559eng_gradient_angle_set(void *data __UNUSED__, void *gradient, double angle) 655eng_gradient_angle_set(void *data __UNUSED__, void *gradient, double angle)
560{ 656{
561//--// evas_gl_common_gradient_map_angle_set(gradient, angle); 657 evas_common_gradient_map_angle_set(gradient, angle);
562} 658}
563 659
564static void 660static void
565eng_gradient_offset_set(void *data __UNUSED__, void *gradient, float offset) 661eng_gradient_offset_set(void *data __UNUSED__, void *gradient, float offset)
566{ 662{
567//--// evas_gl_common_gradient_map_offset_set(gradient, offset); 663 evas_common_gradient_map_offset_set(gradient, offset);
568} 664}
569 665
570static void 666static void
571eng_gradient_direction_set(void *data __UNUSED__, void *gradient, int direction) 667eng_gradient_direction_set(void *data __UNUSED__, void *gradient, int direction)
572{ 668{
573//--// evas_gl_common_gradient_map_direction_set(gradient, direction); 669 evas_common_gradient_map_direction_set(gradient, direction);
574} 670}
575 671
576static void 672static void
577eng_gradient_type_set(void *data __UNUSED__, void *gradient, char *name, char *params) 673eng_gradient_type_set(void *data __UNUSED__, void *gradient, char *name, char *params)
578{ 674{
579//--// evas_gl_common_gradient_type_set(gradient, name, params); 675 evas_common_gradient_type_set(gradient, name, params);
580} 676}
581 677
582static int 678static int
583eng_gradient_is_opaque(void *data, void *context, void *gradient, int x, int y, int w, int h) 679eng_gradient_is_opaque(void *data, void *context, void *gradient, int x, int y, int w, int h)
584{ 680{
585 Render_Engine *re = (Render_Engine *)data; 681 RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
586 682 RGBA_Gradient *gr = (RGBA_Gradient *)gradient;
587 re->win->gl_context->dc = context; 683
588//--// return evas_gl_common_gradient_is_opaque(re->win->gl_context, gradient, x, y, w, h); 684 if (!dc || !gr || !gr->type.geometer) return 0;
589 return 0; 685 return !(gr->type.geometer->has_alpha(gr, dc->render_op) |
686 gr->type.geometer->has_mask(gr, dc->render_op));
590} 687}
591 688
592static int 689static int
593eng_gradient_is_visible(void *data, void *context, void *gradient, int x, int y, int w, int h) 690eng_gradient_is_visible(void *data, void *context, void *gradient, int x, int y, int w, int h)
594{ 691{
595 Render_Engine *re = (Render_Engine *)data; 692 RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
596 693
597 re->win->gl_context->dc = context; 694 if (!dc || !gradient) return 0;
598//--// return evas_gl_common_gradient_is_visible(re->win->gl_context, gradient, x, y, w, h); 695 return 1;
599 return 0;
600} 696}
601 697
602static void 698static void
603eng_gradient_render_pre(void *data, void *context, void *gradient) 699eng_gradient_render_pre(void *data, void *context, void *gradient)
604{ 700{
605 Render_Engine *re = (Render_Engine *)data; 701 RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
606 702 RGBA_Gradient *gr = (RGBA_Gradient *)gradient;
607 re->win->gl_context->dc = context; 703 int len;
608//--// evas_gl_common_gradient_render_pre(re->win->gl_context, gradient); 704
705 if (!dc || !gr || !gr->type.geometer) return;
706 gr->type.geometer->geom_set(gr);
707 len = gr->type.geometer->get_map_len(gr);
708 evas_common_gradient_map(dc, gr, len);
609} 709}
610 710
611static void 711static void
612eng_gradient_render_post(void *data __UNUSED__, void *gradient) 712eng_gradient_render_post(void *data __UNUSED__, void *gradient)
613{ 713{
614//--// evas_gl_common_gradient_render_post(gradient);
615} 714}
616 715
617static void 716static void
@@ -622,7 +721,30 @@ eng_gradient_draw(void *data, void *context, void *surface __UNUSED__, void *gra
622 re = (Render_Engine *)data; 721 re = (Render_Engine *)data;
623 eng_window_use(re->win); 722 eng_window_use(re->win);
624 re->win->gl_context->dc = context; 723 re->win->gl_context->dc = context;
625//--// evas_gl_common_gradient_draw(re->win->gl_context, gradient, x, y, w, h); 724 {
725 Evas_GL_Image *gim;
726 RGBA_Image *im;
727 RGBA_Draw_Context *dc = context;
728 int op = dc->render_op, cuse = dc->clip.use;
729
730 im = (RGBA_Image *)evas_cache_image_empty(evas_common_image_cache_get());
731 im = (RGBA_Image *)evas_cache_image_size_set(&im->cache_entry, w, h);
732
733 dc->render_op = _EVAS_RENDER_FILL;
734 dc->clip.use = 0;
735
736 // draw to buf, copy to tex, draw tex
737 evas_common_gradient_draw(im, dc, 0, 0, w, h, gradient);
738
739 gim = evas_gl_common_image_new_from_data(re->win->gl_context, w, h,
740 im->image.data, 1,
741 EVAS_COLORSPACE_ARGB8888);
742 dc->render_op = op;
743 dc->clip.use = cuse;
744 evas_gl_common_image_draw(re->win->gl_context, gim, 0, 0, w, h, x, y, w, h, 0);
745 evas_cache_image_drop(&im->cache_entry);
746 evas_gl_common_image_free(gim);
747 }
626} 748}
627 749
628static int 750static int