~hp/canvas.lv2

f65fb205c4336559da9b1a56e2738622683b639a — Hanspeter Portner 5 years ago ac87653
improve prototype of nanovg backend.
1 files changed, 21 insertions(+), 16 deletions(-)

M canvas.lv2/render_nanovg.h
M canvas.lv2/render_nanovg.h => canvas.lv2/render_nanovg.h +21 -16
@@ 21,10 21,25 @@
#include <assert.h>

#include <nanovg.h>
#define NANOVG_GL3_IMPLEMENTATION
#include <GL/glew.h>
#define NANOVG_GL2_IMPLEMENTATION
#include <GL/gl.h>
#include <nanovg_gl.h>

#if defined(NANOVG_GL2_IMPLEMENTATION)
#	define nvgCreate nvgCreateGL2
#	define nvgDelete nvgDeleteGL2
#elif defined(NANOVG_GL3_IMPLEMENTATION)
#	define nvgCreate nvgCreateGL3
#	define nvgDelete nvgDeleteGL3
#elif defined(NANOVG_GLES2_IMPLEMENTATION)
#	define nvgCreate nvgCreateGLES2
#	define nvgDelete nvgDeleteGLES2
#elif defined(NANOVG_GLES3_IMPLEMENTATION)
#	define nvgCreate nvgCreateGLES3
#	define nvgDelete nvgDeleteGLES3
#endif

#ifdef __cplusplus
extern "C" {
#endif


@@ 523,15 538,11 @@ lv2_canvas_render(LV2_Canvas *canvas, NVGcontext *ctx, const LV2_Atom_Tuple *tup
	nvgSave(ctx);

	// clear surface
	/* FIXME
	cairo_set_operator(ctx, CAIRO_OPERATOR_CLEAR);
	cairo_paint(ctx);
	*/

	// default attributes
	/* FIXME
	cairo_set_operator(ctx, CAIRO_OPERATOR_SOURCE);
	*/
	nvgBeginPath(ctx);
	nvgRect(ctx, 0, 0, 1.f, 1.f);
	nvgFillColor(ctx, nvgRGBA(0x1e, 0x1e, 0x1e, 0xff));
	nvgFill(ctx);

	nvgFontSize(ctx, 0.1);
	nvgStrokeWidth(ctx, 0.01);
	nvgStrokeColor(ctx, nvgRGBA(0xff, 0xff, 0xff, 0xff));


@@ 559,12 570,6 @@ lv2_canvas_render(LV2_Canvas *canvas, NVGcontext *ctx, const LV2_Atom_Tuple *tup
	// save state
	nvgRestore(ctx);

	// flush
	/* FIXME
	cairo_surface_t *surface = cairo_get_target(ctx);
	cairo_surface_flush(surface);
	*/

	return true;
}