Skip to content
Permalink
Browse files
8273946: Move clearQuad method to BaseShaderGraphics superclass
Reviewed-by: jpereda, nlisker
  • Loading branch information
kevinrushforth committed Sep 22, 2021
1 parent 5c355fa commit 338b999414ed5dc8fea19c12bd3e656fd9cab6f4
@@ -26,17 +26,15 @@
package com.sun.prism.d3d;

import com.sun.javafx.geom.transform.Affine3D;
import com.sun.prism.CompositeMode;
import com.sun.prism.Graphics;
import com.sun.prism.RenderTarget;
import com.sun.prism.impl.PrismSettings;
import com.sun.prism.impl.ps.BaseShaderGraphics;
import com.sun.prism.paint.Color;
import com.sun.prism.paint.Paint;

class D3DGraphics extends BaseShaderGraphics implements D3DContextSource {

private D3DContext context;
private final D3DContext context;

private D3DGraphics(D3DContext context, RenderTarget target) {
super(context, target);
@@ -65,24 +63,6 @@ static Graphics create(RenderTarget target, D3DContext context) {
return new D3DGraphics(context, target);
}

@Override
public void clearQuad(float x1, float y1, float x2, float y2) {
// note that unlike clear(), this method does not currently
// attempt to clear the depth buffer...
context.setRenderTarget(this);
context.flushVertexBuffer();
// set the blend mode to CLEAR and any regular Color as paint
CompositeMode oldMode = getCompositeMode();
setCompositeMode(CompositeMode.CLEAR);
Paint oldPaint = getPaint();
setPaint(Color.BLACK); // any color will do...
fillQuad(x1, y1, x2, y2);
context.flushVertexBuffer();
// restore prior paint and blend mode
setPaint(oldPaint);
setCompositeMode(oldMode);
}

@Override
public void clear(Color color) {
context.validateClearOp(this);
@@ -27,12 +27,10 @@

import com.sun.javafx.geom.transform.BaseTransform;
import com.sun.javafx.sg.prism.NGCamera;
import com.sun.prism.CompositeMode;
import com.sun.prism.GraphicsPipeline;
import com.sun.prism.RenderTarget;
import com.sun.prism.impl.ps.BaseShaderGraphics;
import com.sun.prism.paint.Color;
import com.sun.prism.paint.Paint;

public class ES2Graphics extends BaseShaderGraphics {

@@ -57,24 +55,6 @@ static void clearBuffers(ES2Context context, Color color, boolean clearColor,

}

@Override
public void clearQuad(float x1, float y1, float x2, float y2) {
// note that unlike clear(), this method does not currently
// attempt to clear the depth buffer...
context.setRenderTarget(this);
context.flushVertexBuffer();
CompositeMode mode = getCompositeMode();
// set the blend mode to CLEAR
setCompositeMode(CompositeMode.CLEAR);
Paint oldPaint = getPaint();
setPaint(Color.BLACK); // any color will do...
fillQuad(x1, y1, x2, y2);
context.flushVertexBuffer();
setPaint(oldPaint);
// restore default blend mode
setCompositeMode(mode);
}

@Override
public void clear(Color color) {
context.validateClearOp(this);
@@ -125,6 +125,24 @@ public void setPaint(Paint paint) {

public final NGLightBase[] getLights() { return this.lights; }

@Override
public void clearQuad(float x1, float y1, float x2, float y2) {
// note that unlike clear(), this method does not currently
// attempt to clear the depth buffer...
context.setRenderTarget(this);
context.flushVertexBuffer();
// set the blend mode to CLEAR and any regular Color as paint
CompositeMode oldMode = getCompositeMode();
setCompositeMode(CompositeMode.CLEAR);
Paint oldPaint = getPaint();
setPaint(Color.BLACK); // any color will do...
fillQuad(x1, y1, x2, y2);
context.flushVertexBuffer();
// restore prior paint and blend mode
setPaint(oldPaint);
setCompositeMode(oldMode);
}

@Override
public void drawTexture(Texture tex,
float dx1, float dy1, float dx2, float dy2,

1 comment on commit 338b999

@openjdk-notifier

This comment has been minimized.

Copy link

@openjdk-notifier openjdk-notifier bot commented on 338b999 Sep 22, 2021

Please sign in to comment.