modules/graphics/src/main/java/com/sun/prism/impl/ps/BaseShaderGraphics.java
Print this page
@@ -411,11 +411,11 @@
context.flushVertexBuffer();
// The following is safe; this method does not mutate the transform
BaseTransform xform = getTransformNoClone();
MaskData maskData =
- ShapeUtil.rasterizeShape(shape, stroke, getFinalClipNoClone(), xform, true);
+ ShapeUtil.rasterizeShape(shape, stroke, getFinalClipNoClone(), xform, true, isAntialiasedShape());
int maskW = maskData.getWidth();
int maskH = maskData.getHeight();
float dx1 = maskData.getOriginX();
float dy1 = maskData.getOriginY();
@@ -461,11 +461,11 @@
context.flushVertexBuffer();
// The following is safe; this method does not mutate the transform
BaseTransform xform = getTransformNoClone();
MaskData maskData =
- ShapeUtil.rasterizeShape(shape, stroke, getFinalClipNoClone(), xform, true);
+ ShapeUtil.rasterizeShape(shape, stroke, getFinalClipNoClone(), xform, true, isAntialiasedShape());
Texture maskTex = context.getMaskTexture(maskData, false);
int maskW = maskData.getWidth();
int maskH = maskData.getHeight();
float dx1 = maskData.getOriginX();
@@ -1487,10 +1487,14 @@
public void fillRect(float x, float y, float w, float h) {
if (w <= 0 || h <= 0) {
return;
}
+ if (!isAntialiasedShape()) {
+ fillQuad(x, y, x + w, y + h);
+ return;
+ }
if (isComplexPaint) {
scratchRRect.setRoundRect(x, y, w, h, 0, 0);
renderWithComplexPaint(scratchRRect, null, x, y, w, h);
return;
}
@@ -1513,10 +1517,15 @@
if (isComplexPaint) {
scratchEllipse.setFrame(x, y, w, h);
renderWithComplexPaint(scratchEllipse, null, x, y, w, h);
return;
}
+ if (!isAntialiasedShape()) {
+ scratchEllipse.setFrame(x, y, w, h);
+ renderShape(scratchEllipse, null, x, y, w, h);
+ return;
+ }
if (PrismSettings.primTextureSize != 0) {
if (fillPrimRect(x, y, w, h,
context.getOvalTexture(),
null,
x, y, w, h))
@@ -1540,10 +1549,15 @@
if (isComplexPaint) {
scratchRRect.setRoundRect(x, y, w, h, arcw, arch);
renderWithComplexPaint(scratchRRect, null, x, y, w, h);
return;
}
+ if (!isAntialiasedShape()) {
+ scratchRRect.setRoundRect(x, y, w, h, arcw, arch);
+ renderShape(scratchRRect, null, x, y, w, h);
+ return;
+ }
renderGeneralRoundedRect(x, y, w, h, arcw, arch,
MaskType.FILL_ROUNDRECT, null);
}
public void fillQuad(float x1, float y1, float x2, float y2) {
@@ -1638,10 +1652,15 @@
if (isComplexPaint) {
scratchRRect.setRoundRect(x, y, w, h, 0, 0);
renderWithComplexPaint(scratchRRect, stroke, x, y, w, h);
return;
}
+ if (!isAntialiasedShape()) {
+ scratchRRect.setRoundRect(x, y, w, h, 0, 0);
+ renderShape(scratchRRect, stroke, x, y, w, h);
+ return;
+ }
if (canUseStrokeShader(stroke)) {
if (PrismSettings.primTextureSize != 0 &&
stroke.getLineJoin() != BasicStroke.CAP_ROUND)
{
if (drawPrimRect(x, y, w, h)) {
@@ -1677,11 +1696,11 @@
public void drawEllipse(float x, float y, float w, float h) {
if (w < 0 || h < 0) {
return;
}
if (!isComplexPaint && !stroke.isDashed() &&
- checkInnerCurvature(w, h))
+ checkInnerCurvature(w, h) && isAntialiasedShape())
{
renderGeneralRoundedRect(x, y, w, h, w, h,
MaskType.DRAW_ELLIPSE, stroke);
return;
}
@@ -1697,11 +1716,11 @@
if (w < 0 || h < 0) {
return;
}
if (!isComplexPaint && !stroke.isDashed() &&
- checkInnerCurvature(arcw, arch))
+ checkInnerCurvature(arcw, arch) && isAntialiasedShape())
{
renderGeneralRoundedRect(x, y, w, h, arcw, arch,
MaskType.DRAW_ROUNDRECT, stroke);
return;
}
@@ -1736,10 +1755,15 @@
if (isComplexPaint) {
scratchLine.setLine(x1, y1, x2, y2);
renderWithComplexPaint(scratchLine, stroke, bx, by, bw, bh);
return;
}
+ if (!isAntialiasedShape()) {
+ scratchLine.setLine(x1, y1, x2, y2);
+ renderShape(scratchLine, stroke, bx, by, bw, bh);
+ return;
+ }
int cap = stroke.getEndCap();
if (stroke.isDashed()) {
// NOTE: we could construct the GeneralPath directly
// for CAP_ROUND and save a lot of processing in that case...
// And again, we would need to deal with dropout control...