Skip to content

Commit

Permalink
Added test for JDK-8312603
Browse files Browse the repository at this point in the history
Merged with latest OpenJFX
  • Loading branch information
bourgesl committed Jan 24, 2024
1 parent 82d3d73 commit 2b6b81f
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 87 deletions.
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<groupId>org.marlin</groupId>
<artifactId>marlinfx</artifactId>
<packaging>jar</packaging>
<version>0.9.4.6-Unsafe-OpenJFX11</version>
<version>0.9.4.8-Unsafe-OpenJFX11</version>
<name>Marlin software rasterizer</name>

<url>https://github.com/bourgesl/marlin-renderer</url>
Expand Down Expand Up @@ -78,9 +78,9 @@
<arg>--patch-module</arg>
<arg>javafx.graphics=src</arg>
<arg>--add-modules</arg>
<arg>jdk.unsupported,java.logging</arg>
<arg>jdk.unsupported,java.logging,javafx.controls</arg>
<arg>--add-reads</arg>
<arg>javafx.graphics=jdk.unsupported,java.logging</arg>
<arg>javafx.graphics=jdk.unsupported,java.logging,javafx.controls</arg>
</compilerArgs>
</configuration>
<executions>
Expand All @@ -97,9 +97,9 @@
<arg>--module-path</arg>
<arg>${project.build.directory}/test-libs</arg>
<arg>--add-modules</arg>
<arg>jdk.unsupported,java.logging,junit,hamcrest.core,javafx.swing</arg>
<arg>jdk.unsupported,java.logging,junit,hamcrest.core,javafx.swing,javafx.controls</arg>
<arg>--add-reads</arg>
<arg>javafx.graphics=jdk.unsupported,java.logging,junit,hamcrest.core,javafx.swing</arg>
<arg>javafx.graphics=jdk.unsupported,java.logging,junit,hamcrest.core,javafx.swing,javafx.controls</arg>
</compilerArgs>
</configuration>
</execution>
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/sun/marlin/DMarlinRenderingEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ private DMarlinRenderingEngine() {
}

if (USE_THREAD_LOCAL) {
RDR_CTX_PROVIDER = new ReentrantContextProviderTL<RendererContext>(REF_TYPE)
RDR_CTX_PROVIDER = new ReentrantContextProviderTL<>(REF_TYPE)
{
@Override
protected RendererContext newContext() {
return RendererContext.createContext();
}
};
} else {
RDR_CTX_PROVIDER = new ReentrantContextProviderCLQ<RendererContext>(REF_TYPE)
RDR_CTX_PROVIDER = new ReentrantContextProviderCLQ<>(REF_TYPE)
{
@Override
protected RendererContext newContext() {
Expand Down Expand Up @@ -257,7 +257,6 @@ public static void logSettings(final String reClass) {
* Get the RendererContext instance dedicated to the current thread
* @return RendererContext instance
*/
@SuppressWarnings({"unchecked"})
public static RendererContext getRendererContext() {
final RendererContext rdrCtx = RDR_CTX_PROVIDER.acquire();
if (DO_MONITORS) {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/sun/marlin/Renderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ private void addLine(double x1, double y1, double x2, double y2) {
blkFlags = blkFlags_ref.initial;
}

@Override
public Renderer init(final int pix_boundsX, final int pix_boundsY,
final int pix_boundsWidth, final int pix_boundsHeight,
final int windingRule)
Expand Down Expand Up @@ -591,6 +592,7 @@ public Renderer init(final int pix_boundsX, final int pix_boundsY,
/**
* Disposes this renderer and recycle it clean up before reusing this instance
*/
@Override
public void dispose() {
if (DO_STATS) {
rdrCtx.stats.stat_rdr_activeEdges.add(activeEdgeMaxUsed);
Expand Down Expand Up @@ -1531,6 +1533,7 @@ void initConsumer(int minx, int miny, int maxx, int maxy)

private int bbox_spminX, bbox_spmaxX, bbox_spminY, bbox_spmaxY;

@Override
public void produceAlphas(final MarlinAlphaConsumer ac) {
ac.setMaxAlpha(MAX_AA_ALPHA);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/sun/marlin/RendererContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public Path2D getPath2D() {
p2d = new Path2D(WIND_NON_ZERO, INITIAL_EDGES_COUNT); // 32K

// update weak reference:
refPath2D = new WeakReference<Path2D>(p2d);
refPath2D = new WeakReference<>(p2d);
}
// reset the path anyway:
p2d.reset();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/com/sun/marlin/RendererNoAA.java
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@ private void addLine(double x1, double y1, double x2, double y2) {
blkFlags = blkFlags_ref.initial;
}

@Override
public RendererNoAA init(final int pix_boundsX, final int pix_boundsY,
final int pix_boundsWidth, final int pix_boundsHeight,
final int windingRule)
Expand Down Expand Up @@ -580,6 +581,7 @@ public RendererNoAA init(final int pix_boundsX, final int pix_boundsY,
/**
* Disposes this renderer and recycle it clean up before reusing this instance
*/
@Override
public void dispose() {
if (DO_STATS) {
rdrCtx.stats.stat_rdr_activeEdges.add(activeEdgeMaxUsed);
Expand Down Expand Up @@ -1443,6 +1445,7 @@ void initConsumer(int minx, int miny, int maxx, int maxy)

private int bbox_spminX, bbox_spmaxX, bbox_spminY, bbox_spmaxY;

@Override
public void produceAlphas(final MarlinAlphaConsumer ac) {
ac.setMaxAlpha(1);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/sun/marlin/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public final class Version {

private static final String VERSION = "marlinFX-0.9.4.6-Unsafe-OpenJFX";
private static final String VERSION = "marlinFX-0.9.4.8-Unsafe-OpenJFX";

public static String getVersion() {
return VERSION;
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/sun/prism/impl/PrismSettings.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -93,6 +93,7 @@ public static enum RasterizerType {
private RasterizerType(String publicname) {
this.publicName = publicname;
}
@Override
public String toString() {
return publicName;
}
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/com/sun/prism/impl/shape/ShapeUtil.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,14 +25,11 @@

package com.sun.prism.impl.shape;

import com.sun.javafx.geom.Path2D;
import com.sun.javafx.geom.PathConsumer2D;
import com.sun.javafx.geom.RectBounds;
import com.sun.javafx.geom.Shape;
import com.sun.javafx.geom.transform.BaseTransform;
import com.sun.prism.BasicStroke;
import com.sun.prism.impl.PrismSettings;
import com.sun.prism.impl.PrismSettings.RasterizerType;

public class ShapeUtil {

Expand Down
9 changes: 2 additions & 7 deletions src/main/java/com/sun/prism/sw/SWContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,19 @@
import com.sun.javafx.geom.Rectangle;
import com.sun.javafx.geom.Shape;
import com.sun.javafx.geom.transform.BaseTransform;
import com.sun.javafx.util.Logging;
import com.sun.marlin.ArrayCacheIntClean;
import com.sun.marlin.DMarlinRenderingEngine;
import com.sun.marlin.RendererContext;
import com.sun.marlin.MarlinAlphaConsumer;
import com.sun.marlin.MarlinConst;
import com.sun.marlin.MarlinRenderer;
import com.sun.marlin.RendererContext;
import com.sun.pisces.PiscesRenderer;
import com.sun.prism.BasicStroke;
import com.sun.prism.PixelFormat;
import com.sun.prism.ResourceFactory;
import com.sun.prism.Texture;
import com.sun.prism.impl.PrismSettings;
import com.sun.prism.impl.shape.DMarlinPrismUtils;
import com.sun.prism.impl.shape.MaskData;
import com.sun.prism.impl.shape.ShapeUtil;

import java.lang.ref.SoftReference;

final class SWContext {
Expand Down Expand Up @@ -215,7 +210,7 @@ void renderShape(PiscesRenderer pr, Shape shape, BasicStroke stroke, BaseTransfo

private SWRTTexture initRBBuffer(int width, int height) {
final SWRTTexture tex = (SWRTTexture)factory.createRTTexture(width, height, Texture.WrapMode.CLAMP_NOT_NEEDED);
readBackBufferRef = new SoftReference<SWRTTexture>(tex);
readBackBufferRef = new SoftReference<>(tex);
return tex;
}

Expand Down Expand Up @@ -248,7 +243,7 @@ SWRTTexture validateRBBuffer(int width, int height) {
private SWArgbPreTexture initImagePaintTexture(int width, int height) {
final SWArgbPreTexture tex = (SWArgbPreTexture)factory.createTexture(PixelFormat.INT_ARGB_PRE,
Texture.Usage.DEFAULT, Texture.WrapMode.REPEAT, width, height);
imagePaintTextureRef = new SoftReference<SWArgbPreTexture>(tex);
imagePaintTextureRef = new SoftReference<>(tex);
return tex;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -137,14 +137,14 @@ protected final Reference<K> getOrCreateReference(final K ctx) {
// Create the reference:
switch (refType) {
case REF_HARD:
ctx.reference = new HardReference<K>(ctx);
ctx.reference = new HardReference<>(ctx);
break;
case REF_SOFT:
ctx.reference = new SoftReference<K>(ctx);
ctx.reference = new SoftReference<>(ctx);
break;
default:
case REF_WEAK:
ctx.reference = new WeakReference<K>(ctx);
ctx.reference = new WeakReference<>(ctx);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -43,7 +43,7 @@ public abstract class ReentrantContextProviderCLQ<K extends ReentrantContext>
{
// ReentrantContext queue to store all contexts
private final ConcurrentLinkedQueue<Reference<K>> ctxQueue
= new ConcurrentLinkedQueue<Reference<K>>();
= new ConcurrentLinkedQueue<>();

/**
* Create a new ReentrantContext provider using the given reference type
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -43,7 +43,7 @@ public abstract class ReentrantContextProviderTL<K extends ReentrantContext>
{
// Thread-local storage:
private final ThreadLocal<Reference<K>> ctxTL
= new ThreadLocal<Reference<K>>();
= new ThreadLocal<>();

// ReentrantContext CLQ provider for child contexts:
private final ReentrantContextProviderCLQ<K> ctxProviderCLQ;
Expand Down Expand Up @@ -72,7 +72,7 @@ public ReentrantContextProviderTL(final int refTypeTL, final int refTypeCLQ)

final ReentrantContextProviderTL<K> parent = this;

this.ctxProviderCLQ = new ReentrantContextProviderCLQ<K>(refTypeCLQ) {
this.ctxProviderCLQ = new ReentrantContextProviderCLQ<>(refTypeCLQ) {
@Override
protected K newContext() {
return parent.newContext();
Expand Down
Loading

0 comments on commit 2b6b81f

Please sign in to comment.