Skip to content
This repository has been archived by the owner. It is now read-only.

8255149: Lanai: DrawImage/IncorrectAlphaConversionBicubic.java failure #121

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -102,6 +102,7 @@ struct TxtFrameUniforms {
vector_float4 color;
int mode; // NOTE: consider to use bit fields
int isSrcOpaque;
int isSrcPremult;
int isDstOpaque;
float extraAlpha;
};
@@ -177,6 +177,10 @@ fragment half4 frag_txt(
return half4(c.r, c.g, c.b , c.a);
}

if (uniforms.isSrcPremult) {
pixelColor.rgb /= srcA;
}

return half4(pixelColor.r,
pixelColor.g,
pixelColor.b, srcA)*uniforms.extraAlpha;
@@ -858,7 +858,9 @@ static void setTxtUniforms(
id<MTLRenderCommandEncoder> encoder, int color, int mode, int interpolation, bool repeat, jfloat extraAlpha,
const SurfaceRasterFlags * srcFlags, const SurfaceRasterFlags * dstFlags
) {
struct TxtFrameUniforms uf = {RGBA_TO_V4(color), mode, srcFlags->isOpaque, dstFlags->isOpaque, extraAlpha};
struct TxtFrameUniforms uf = {
RGBA_TO_V4(color), mode, srcFlags->isOpaque, srcFlags->isPremultiplied,
dstFlags->isOpaque, extraAlpha};
[encoder setFragmentBytes:&uf length:sizeof(uf) atIndex:FrameUniformBuffer];

setSampler(encoder, interpolation, repeat);