Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8242653: Lanai: SRC_OVER with extra alpha does not work for VI #27

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -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;
}
ProTip! Use n and p to navigate between commits in a pull request.