From 7fc60f66077af1bbb090895b9bd1b221c1d13fca Mon Sep 17 00:00:00 2001 From: Nunuhara Cabbage Date: Tue, 3 May 2022 20:48:21 -0700 Subject: [PATCH] Implement DrawGraph.ScreenDA_DAxSA --- include/gfx/gfx.h | 1 + src/draw.c | 10 ++++++++++ src/hll/DrawGraph.c | 7 +++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/include/gfx/gfx.h b/include/gfx/gfx.h index f5c6a06..32f1164 100644 --- a/include/gfx/gfx.h +++ b/include/gfx/gfx.h @@ -133,6 +133,7 @@ void gfx_fill_amap_gradation_ud(Texture *dst, int x, int y, int w, int h, int up void gfx_fill_screen(Texture *dst, int x, int y, int w, int h, int r, int g, int b); void gfx_fill_multiply(Texture *dst, int x, int y, int w, int h, int r, int g, int b); void gfx_satur_dp_dpxsa(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h); +void gfx_screen_da_daxsa(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h); void gfx_add_da_daxsa(struct texture *dst, int dx, int dy, struct texture *src, int sx, int sy, int w, int h); void gfx_blend_da_daxsa(struct texture *dst, int dx, int dy, struct texture *src, int sx, int sy, int w, int h); void gfx_sub_da_daxsa(struct texture *dst, int dx, int dy, struct texture *src, int sx, int sy, int w, int h); diff --git a/src/draw.c b/src/draw.c index 7850d0c..de0401c 100644 --- a/src/draw.c +++ b/src/draw.c @@ -603,6 +603,16 @@ void gfx_satur_dp_dpxsa(Texture *dst, int dx, int dy, Texture *src, int sx, int restore_blend_mode(); } +void gfx_screen_da_daxsa(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h) +{ + glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_ONE, GL_ONE); + + struct copy_data data = COPY_DATA(dx, dy, sx, sy, w, h); + run_copy_shader(©_shader.s, dst, src, &data); + + restore_blend_mode(); +} + void gfx_add_da_daxsa(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h) { // color = dst_color diff --git a/src/hll/DrawGraph.c b/src/hll/DrawGraph.c index f548633..680e907 100644 --- a/src/hll/DrawGraph.c +++ b/src/hll/DrawGraph.c @@ -196,7 +196,10 @@ static void DrawGraph_SaturDP_DPxSA(int dst, int dx, int dy, int src, int sx, in gfx_satur_dp_dpxsa(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h); } -//void DrawGraph_ScreenDA_DAxSA(int dst, int dx, int dy, int src, int sx, int sy, int w, int h); +static void DrawGraph_ScreenDA_DAxSA(int dst, int dx, int dy, int src, int sx, int sy, int w, int h) +{ + gfx_screen_da_daxsa(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h); +} static void DrawGraph_AddDA_DAxSA(int dst, int dx, int dy, int src, int sx, int sy, int w, int h) { @@ -425,7 +428,7 @@ HLL_LIBRARY(DrawGraph, HLL_EXPORT(FillScreen, DrawGraph_FillScreen), HLL_EXPORT(FillMultiply, DrawGraph_FillMultiply), HLL_EXPORT(SaturDP_DPxSA, DrawGraph_SaturDP_DPxSA), - //HLL_EXPORT(ScreenDA_DAxSA, DrawGraph_ScreenDA_DAxSA), + HLL_EXPORT(ScreenDA_DAxSA, DrawGraph_ScreenDA_DAxSA), HLL_EXPORT(AddDA_DAxSA, DrawGraph_AddDA_DAxSA), HLL_EXPORT(SpriteCopyAMap, DrawGraph_SpriteCopyAMap), HLL_EXPORT(BlendDA_DAxSA, DrawGraph_BlendDA_DAxSA),