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

8273946: Move clearQuad method to BaseShaderGraphics superclass #628

Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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,