~mil/mepo

86355172726b158ed27c882f17f54c16494f1811 — Miles Alan 1 year, 4 months ago 395aba5 pin-texture-experiment
Experiment with setting the blend mode
1 files changed, 6 insertions(+), 2 deletions(-)

M src/Mepo.zig
M src/Mepo.zig => src/Mepo.zig +6 -2
@@ 261,7 261,7 @@ fn blit_pin(mepo: *@This(), pin: types.Pin, prev_pin: ?types.Pin, pin_group: u8,
    const prev_pin_y = if (prev_pin != null) mepo.convert_latlon_to_xy(.LatToY, prev_pin.?.lat) else undefined;
    const pg_color = types.Color{ .value = p.get(p.pingroup_prop(pin_group, .Color)).u24 };


    try utilsdl.errorcheck(sdl.SDL_SetRenderDrawBlendMode(mepo.renderer, sdl.SDL_BLENDMODE_BLEND));
    const text = sdl.SDL_CreateTexture(
        mepo.renderer,
        sdl.SDL_PIXELFORMAT_UNKNOWN,


@@ 269,6 269,7 @@ fn blit_pin(mepo: *@This(), pin: types.Pin, prev_pin: ?types.Pin, pin_group: u8,
        config.Tsize,
        config.Tsize,
    );
    try utilsdl.errorcheck(sdl.SDL_SetTextureBlendMode(text, sdl.SDL_BLENDMODE_BLEND));
    try utilsdl.errorcheck(sdl.SDL_SetRenderTarget(mepo.renderer, text));

    // Optimization to never drawoff-screen pins


@@ 343,8 344,11 @@ fn blit_pin(mepo: *@This(), pin: types.Pin, prev_pin: ?types.Pin, pin_group: u8,
        );
    }

    defer sdl.SDL_DestroyTexture(text);
    const from = sdl.SDL_Rect{ .x = 0, .y = 0, .w = 256, .h = 256 };
    try utilsdl.errorcheck(sdl.SDL_SetRenderTarget(mepo.renderer, null));
    try utilsdl.errorcheck(sdl.SDL_RenderCopy(mepo.renderer, text, &from, &from));
    try utilsdl.errorcheck(sdl.SDL_SetRenderDrawBlendMode(mepo.renderer, sdl.SDL_BLENDMODE_NONE));
    defer sdl.SDL_DestroyTexture(text);
}

fn blit_pins(mepo: *@This()) !void {