Skip to content
Permalink
Browse files

8255149: Lanai: DrawImage/IncorrectAlphaConversionBicubic.java failure

  • Loading branch information
Alexey Ushakov
Alexey Ushakov committed Oct 21, 2020
1 parent e47e233 commit fbc066e0a21c6381a0c8a1dd2d5175fd9a8f28ad
@@ -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);

0 comments on commit fbc066e

Please sign in to comment.