Skip to content

Commit

Permalink
Add plutovg_canvas_get_surface
Browse files Browse the repository at this point in the history
  • Loading branch information
sammycage committed Aug 10, 2024
1 parent 345129c commit 44bce5e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions include/plutovg.h
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,8 @@ PLUTOVG_API plutovg_canvas_t* plutovg_canvas_reference(plutovg_canvas_t* canvas)
PLUTOVG_API void plutovg_canvas_destroy(plutovg_canvas_t* canvas);
PLUTOVG_API int plutovg_canvas_get_reference_count(const plutovg_canvas_t* canvas);

PLUTOVG_API plutovg_surface_t* plutovg_canvas_get_surface(const plutovg_canvas_t* canvas);

PLUTOVG_API void plutovg_canvas_save(plutovg_canvas_t* canvas);
PLUTOVG_API void plutovg_canvas_restore(plutovg_canvas_t* canvas);

Expand Down
5 changes: 5 additions & 0 deletions source/plutovg-canvas.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ int plutovg_canvas_get_reference_count(const plutovg_canvas_t* canvas)
return canvas->ref_count;
}

plutovg_surface_t* plutovg_canvas_get_surface(const plutovg_canvas_t* canvas)
{
return canvas->surface;
}

void plutovg_canvas_save(plutovg_canvas_t* canvas)
{
plutovg_state_t* new_state = canvas->freed_state;
Expand Down
5 changes: 2 additions & 3 deletions source/plutovg-surface.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ static plutovg_surface_t* plutovg_surface_create_uninitialized(int width, int he
plutovg_surface_t* plutovg_surface_create(int width, int height)
{
plutovg_surface_t* surface = plutovg_surface_create_uninitialized(width, height);
if(surface == NULL)
return NULL;
memset(surface->data, 0, surface->height * surface->stride);
if(surface)
memset(surface->data, 0, surface->height * surface->stride);
return surface;
}

Expand Down

0 comments on commit 44bce5e

Please sign in to comment.