mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
parent
1cbc11cadd
commit
596de01b12
6 changed files with 9 additions and 7 deletions
|
@ -349,7 +349,7 @@ struct GlWindow : Window
|
||||||
void resize() override
|
void resize() override
|
||||||
{
|
{
|
||||||
//Set the canvas target and draw on it.
|
//Set the canvas target and draw on it.
|
||||||
verify(static_cast<tvg::GlCanvas*>(canvas)->target(0, width, height, tvg::ColorSpace::ABGR8888S));
|
verify(static_cast<tvg::GlCanvas*>(canvas)->target(context, 0, width, height, tvg::ColorSpace::ABGR8888S));
|
||||||
}
|
}
|
||||||
|
|
||||||
void refresh() override
|
void refresh() override
|
||||||
|
|
|
@ -218,7 +218,7 @@ void runGl()
|
||||||
auto canvas = unique_ptr<tvg::GlCanvas>(tvg::GlCanvas::gen());
|
auto canvas = unique_ptr<tvg::GlCanvas>(tvg::GlCanvas::gen());
|
||||||
|
|
||||||
// Pass the framebuffer id to the GlCanvas
|
// Pass the framebuffer id to the GlCanvas
|
||||||
tvgexam::verify(canvas->target(glFbo.fbo, SIZE, SIZE, tvg::ColorSpace::ABGR8888S));
|
tvgexam::verify(canvas->target(context, glFbo.fbo, SIZE, SIZE, tvg::ColorSpace::ABGR8888S));
|
||||||
|
|
||||||
content(canvas.get());
|
content(canvas.get());
|
||||||
if (tvgexam::verify(canvas->draw())) {
|
if (tvgexam::verify(canvas->draw())) {
|
||||||
|
|
|
@ -1750,6 +1750,7 @@ public:
|
||||||
* This function specifies the drawing target where the rasterization will occur. It can target
|
* This function specifies the drawing target where the rasterization will occur. It can target
|
||||||
* a specific framebuffer object (FBO) or the main surface.
|
* a specific framebuffer object (FBO) or the main surface.
|
||||||
*
|
*
|
||||||
|
* @param[in] context The GL context assigning to the current canvas rendering.
|
||||||
* @param[in] id The GL target ID, usually indicating the FBO ID. A value of @c 0 specifies the main surface.
|
* @param[in] id The GL target ID, usually indicating the FBO ID. A value of @c 0 specifies the main surface.
|
||||||
* @param[in] w The width (in pixels) of the raster image.
|
* @param[in] w The width (in pixels) of the raster image.
|
||||||
* @param[in] h The height (in pixels) of the raster image.
|
* @param[in] h The height (in pixels) of the raster image.
|
||||||
|
@ -1763,7 +1764,7 @@ public:
|
||||||
*
|
*
|
||||||
* @note Experimental API
|
* @note Experimental API
|
||||||
*/
|
*/
|
||||||
Result target(int32_t id, uint32_t w, uint32_t h, ColorSpace cs) noexcept;
|
Result target(void* context, int32_t id, uint32_t w, uint32_t h, ColorSpace cs) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a new GlCanvas object.
|
* @brief Creates a new GlCanvas object.
|
||||||
|
|
|
@ -519,6 +519,7 @@ TVG_API Tvg_Canvas* tvg_glcanvas_create(void);
|
||||||
* This function specifies the drawing target where the rasterization will occur. It can target
|
* This function specifies the drawing target where the rasterization will occur. It can target
|
||||||
* a specific framebuffer object (FBO) or the main surface.
|
* a specific framebuffer object (FBO) or the main surface.
|
||||||
*
|
*
|
||||||
|
* @param[in] context The GL context assigning to the current canvas rendering.
|
||||||
* @param[in] id The GL target ID, usually indicating the FBO ID. A value of @c 0 specifies the main surface.
|
* @param[in] id The GL target ID, usually indicating the FBO ID. A value of @c 0 specifies the main surface.
|
||||||
* @param[in] w The width (in pixels) of the raster image.
|
* @param[in] w The width (in pixels) of the raster image.
|
||||||
* @param[in] h The height (in pixels) of the raster image.
|
* @param[in] h The height (in pixels) of the raster image.
|
||||||
|
@ -530,7 +531,7 @@ TVG_API Tvg_Canvas* tvg_glcanvas_create(void);
|
||||||
*
|
*
|
||||||
* @note Experimental API
|
* @note Experimental API
|
||||||
*/
|
*/
|
||||||
TVG_API Tvg_Result tvg_glcanvas_set_target(Tvg_Canvas* canvas, int32_t id, uint32_t w, uint32_t h, Tvg_Colorspace cs);
|
TVG_API Tvg_Result tvg_glcanvas_set_target(Tvg_Canvas* canvas, void* context, int32_t id, uint32_t w, uint32_t h, Tvg_Colorspace cs);
|
||||||
|
|
||||||
/** \} */ // end defgroup ThorVGCapi_GlCanvas
|
/** \} */ // end defgroup ThorVGCapi_GlCanvas
|
||||||
|
|
||||||
|
|
|
@ -102,10 +102,10 @@ TVG_API Tvg_Result tvg_swcanvas_set_target(Tvg_Canvas* canvas, uint32_t* buffer,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TVG_API Tvg_Result tvg_glcanvas_set_target(Tvg_Canvas* canvas, int32_t id, uint32_t w, uint32_t h, Tvg_Colorspace cs)
|
TVG_API Tvg_Result tvg_glcanvas_set_target(Tvg_Canvas* canvas, void* context, int32_t id, uint32_t w, uint32_t h, Tvg_Colorspace cs)
|
||||||
{
|
{
|
||||||
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
if (!canvas) return TVG_RESULT_INVALID_ARGUMENT;
|
||||||
return (Tvg_Result) reinterpret_cast<GlCanvas*>(canvas)->target(id, w, h, static_cast<ColorSpace>(cs));
|
return (Tvg_Result) reinterpret_cast<GlCanvas*>(canvas)->target(context, id, w, h, static_cast<ColorSpace>(cs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ GlCanvas::~GlCanvas()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result GlCanvas::target(int32_t id, uint32_t w, uint32_t h, ColorSpace cs) noexcept
|
Result GlCanvas::target(void* context, int32_t id, uint32_t w, uint32_t h, ColorSpace cs) noexcept
|
||||||
{
|
{
|
||||||
#ifdef THORVG_GL_RASTER_SUPPORT
|
#ifdef THORVG_GL_RASTER_SUPPORT
|
||||||
if (cs != ColorSpace::ABGR8888S) return Result::NonSupport;
|
if (cs != ColorSpace::ABGR8888S) return Result::NonSupport;
|
||||||
|
|
Loading…
Add table
Reference in a new issue