Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8242653: Lanai: SRC_OVER with extra alpha does not work for VI
  • Loading branch information
Alexey Ushakov committed Apr 16, 2020
1 parent 616100a commit ee7fee1d075ec8198e3e292bdf87d7dde275b012
@@ -487,7 +487,9 @@ jboolean clipDestCoords(
#ifdef TRACE_ISOBLIT
J2dTraceImpl(J2D_TRACE_VERBOSE, JNI_TRUE," [via sampling]");
#endif //TRACE_ISOBLIT
drawTex2Tex(mtlc, srcTex, dstTex, srcOps->isOpaque, dstOps->isOpaque, hint, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2);
drawTex2Tex(mtlc, srcTex, dstTex,
[mtlc isBlendingDisabled:srcOps->isOpaque],
dstOps->isOpaque, hint, sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2);
}

/**
@@ -141,13 +141,10 @@ - (NSString *)getDescription {
}

- (jboolean)isBlendingDisabled:(jboolean)isSrcOpaque {
if (_compositeRule == java_awt_AlphaComposite_SRC) {
const jfloat epsilon = 0.001f;
return fabs(_extraAlpha - 1.0f) < epsilon;
}
if (_compositeRule != java_awt_AlphaComposite_SRC_OVER) {
// J2dRlsTraceLn1(J2D_TRACE_VERBOSE, "\tuse blending for rule %d", alphaCompositeRule);
return JNI_FALSE;
if (_compositeRule == java_awt_AlphaComposite_SRC ||
_compositeRule == java_awt_AlphaComposite_SRC_OVER)
{
return FLT_LT(_extraAlpha, 1.0f);
}
return isSrcOpaque;
}
@@ -325,7 +325,7 @@ 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, interpolation};
struct TxtFrameUniforms uf = {RGBA_TO_V4(color), mode, srcFlags->isOpaque, dstFlags->isOpaque, extraAlpha};
[encoder setFragmentBytes:&uf length:sizeof(uf) atIndex:FrameUniformBuffer];

id<MTLSamplerState> sampler;
@@ -265,8 +265,9 @@ static void setBlendingFactors(
const SurfaceRasterFlags * srcFlags,
const SurfaceRasterFlags * dstFlags
) {
if (compositeRule == RULE_Src) {
J2dTraceLn(J2D_TRACE_VERBOSE, "set RULE_Src");
if (compositeRule == RULE_Src &&
(composite == nil || FLT_GE([composite getExtraAlpha], 1.0f))) {
J2dTraceLn(J2D_TRACE_VERBOSE, "set RULE_Src but blending is disabled because src is opaque");
return;
}

@@ -293,7 +294,7 @@ static void setBlendingFactors(
(composite == nil ||
FLT_GE([composite getExtraAlpha], 1.0f)))
{
J2dTraceLn(J2D_TRACE_VERBOSE, "rule=RULE_Src, but blending is disabled because src is opaque");
J2dTraceLn(J2D_TRACE_VERBOSE, "rule=RULE_SrcOver, but blending is disabled because src is opaque");
cad.blendingEnabled = NO;
return;
}

0 comments on commit ee7fee1

Please sign in to comment.