comparison src/graph_engine_openvg.c @ 613:6a0be737a3f3 openvg

mbe_clear() use vgClear() to clear regions for OpenVG
author Thinker K.F. Li <thinker@branda.to>
date Wed, 07 Jul 2010 21:55:05 +0800
parents b1d1b6c5af90
children 9c5705da2495
comparison
equal deleted inserted replaced
612:b1d1b6c5af90 613:6a0be737a3f3
481 EGLDisplay display; 481 EGLDisplay display;
482 EGLConfig config; 482 EGLConfig config;
483 EGLContext ctx, shared; 483 EGLContext ctx, shared;
484 VGPath path; 484 VGPath path;
485 EGLint attrib_list[2] = {EGL_NONE}; 485 EGLint attrib_list[2] = {EGL_NONE};
486 static VGfloat clear_color[4] = {0, 0, 0, 1};
486 mbe_t *canvas; 487 mbe_t *canvas;
487 488
488 display = _VG_DISPLAY(); 489 display = _VG_DISPLAY();
489 ctx = eglCreateContext(display, config, shared, attrib_list); 490 ctx = eglCreateContext(display, config, shared, attrib_list);
490 if(ctx == EGL_NO_CONTEXT) 491 if(ctx == EGL_NO_CONTEXT)
508 canvas->paint = VG_INVALID_HANDLE; 509 canvas->paint = VG_INVALID_HANDLE;
509 canvas->paint_installed = 0; 510 canvas->paint_installed = 0;
510 canvas->tgt = surface; 511 canvas->tgt = surface;
511 canvas->ctx = ctx; 512 canvas->ctx = ctx;
512 canvas->path = path; 513 canvas->path = path;
514
515 /* Set clear color for the context */
516 _MK_CURRENT_CTX(canvas);
517 vgSetfv(VG_CLEAR_COLOR, 4, clear_color);
513 518
514 return canvas; 519 return canvas;
515 } 520 }
516 521
517 void 522 void
591 vgSeti(VG_SCISSORING, VG_TRUE); 596 vgSeti(VG_SCISSORING, VG_TRUE);
592 } 597 }
593 598
594 void 599 void
595 mbe_clear(mbe_t *canvas) { 600 mbe_clear(mbe_t *canvas) {
596 VGPaint paint; 601 EGLDisplay display;
602 EGLint w, h;
603 EGLBoolean r;
597 604
598 _MK_CURRENT_CTX(canvas); 605 _MK_CURRENT_CTX(canvas);
599 606
600 paint = vgCreatePaint(); 607 display = _VG_DISPLAY();
601 ASSERT(paint != VG_INVALID_HANDLE); 608
602 vgSetColor(paint, 0); 609 r = eglQuerySurface(display, canvas->tgt, EGL_WIDTH, &w);
603 610 ASSERT(r == EGL_TRUE);
604 vgSetPaint(paint, VG_FILL_PATH); 611 r = eglQuerySurface(display, canvas->tgt, EGL_HEIGHT, &h);
605 vgSeti(VG_BLEND_MODE, VG_BLEND_SRC); 612 ASSERT(r == EGL_TRUE);
606 vgDrawPath(canvas->path, VG_FILL_PATH); 613
607 vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER); 614 /* Clear regions to the color specified by mbe_create() */
608 615 vgClear(0, 0, w, h);
609 vgDestroyPaint(paint); 616 }
610
611 canvas->paint_installed = 0;
612 }