Fix T60415: wrong font preview image alpha blending.

This commit is contained in:
Brecht Van Lommel 2019-01-11 17:00:03 +01:00
parent a1764cedbd
commit 6abbab5b53
Notes: blender-bot 2023-02-14 09:48:23 +01:00
Referenced by issue #60415, Font preview is grey on a white background
1 changed files with 4 additions and 2 deletions

View File

@ -391,8 +391,10 @@ static void file_draw_preview(
UI_GetThemeColor4fv(TH_TEXT, col);
}
/* Preview images use premultiplied alpha. */
GPU_blend_set_func_separate(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
if (!is_icon && typeflags & FILE_TYPE_BLENDERLIB) {
/* Datablock preview images use premultiplied alpha. */
GPU_blend_set_func_separate(GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA);
}
IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR);
immDrawPixelsTexScaled(&state, (float)xco, (float)yco, imb->x, imb->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, imb->rect,