提交 1f5c4396 编写于 作者: B bagiras

7112642: Incorrect checking for graphics rendering object

Reviewed-by: art, bae
上级 7e566c46
...@@ -370,6 +370,17 @@ public final class SunGraphics2D ...@@ -370,6 +370,17 @@ public final class SunGraphics2D
} }
public void validatePipe() { public void validatePipe() {
/* This workaround is for the situation when we update the Pipelines
* for invalid SurfaceData and run further code when the current
* pipeline doesn't support the type of new SurfaceData created during
* the current pipeline's work (in place of the invalid SurfaceData).
* Usually SurfaceData and Pipelines are repaired (through revalidateAll)
* and called again in the exception handlers */
if (!surfaceData.isValid()) {
throw new InvalidPipeException("attempt to validate Pipe with invalid SurfaceData");
}
surfaceData.validatePipe(this); surfaceData.validatePipe(this);
} }
......
...@@ -27,6 +27,7 @@ package sun.java2d.opengl; ...@@ -27,6 +27,7 @@ package sun.java2d.opengl;
import java.awt.Transparency; import java.awt.Transparency;
import java.awt.geom.Path2D; import java.awt.geom.Path2D;
import sun.java2d.InvalidPipeException;
import sun.java2d.SunGraphics2D; import sun.java2d.SunGraphics2D;
import sun.java2d.loops.GraphicsPrimitive; import sun.java2d.loops.GraphicsPrimitive;
import sun.java2d.pipe.BufferedRenderPipe; import sun.java2d.pipe.BufferedRenderPipe;
...@@ -46,7 +47,12 @@ class OGLRenderer extends BufferedRenderPipe { ...@@ -46,7 +47,12 @@ class OGLRenderer extends BufferedRenderPipe {
int ctxflags = int ctxflags =
sg2d.paint.getTransparency() == Transparency.OPAQUE ? sg2d.paint.getTransparency() == Transparency.OPAQUE ?
OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS; OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS;
OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData; OGLSurfaceData dstData;
try {
dstData = (OGLSurfaceData)sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
OGLContext.validateContext(dstData, dstData, OGLContext.validateContext(dstData, dstData,
sg2d.getCompClip(), sg2d.composite, sg2d.getCompClip(), sg2d.composite,
null, sg2d.paint, sg2d, ctxflags); null, sg2d.paint, sg2d, ctxflags);
...@@ -55,7 +61,12 @@ class OGLRenderer extends BufferedRenderPipe { ...@@ -55,7 +61,12 @@ class OGLRenderer extends BufferedRenderPipe {
@Override @Override
protected void validateContextAA(SunGraphics2D sg2d) { protected void validateContextAA(SunGraphics2D sg2d) {
int ctxflags = OGLContext.NO_CONTEXT_FLAGS; int ctxflags = OGLContext.NO_CONTEXT_FLAGS;
OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData; OGLSurfaceData dstData;
try {
dstData = (OGLSurfaceData)sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
OGLContext.validateContext(dstData, dstData, OGLContext.validateContext(dstData, dstData,
sg2d.getCompClip(), sg2d.composite, sg2d.getCompClip(), sg2d.composite,
null, sg2d.paint, sg2d, ctxflags); null, sg2d.paint, sg2d, ctxflags);
...@@ -69,7 +80,12 @@ class OGLRenderer extends BufferedRenderPipe { ...@@ -69,7 +80,12 @@ class OGLRenderer extends BufferedRenderPipe {
int ctxflags = int ctxflags =
sg2d.surfaceData.getTransparency() == Transparency.OPAQUE ? sg2d.surfaceData.getTransparency() == Transparency.OPAQUE ?
OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS; OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS;
OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData; OGLSurfaceData dstData;
try {
dstData = (OGLSurfaceData)sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
OGLContext.validateContext(dstData, dstData, OGLContext.validateContext(dstData, dstData,
sg2d.getCompClip(), sg2d.composite, sg2d.getCompClip(), sg2d.composite,
null, null, null, ctxflags); null, null, null, ctxflags);
......
...@@ -111,6 +111,8 @@ public abstract class BufferedContext { ...@@ -111,6 +111,8 @@ public abstract class BufferedContext {
* *
* Note: must be called while the RenderQueue lock is held. * Note: must be called while the RenderQueue lock is held.
* *
* It's assumed that the type of surfaces has been checked by the Renderer
*
* @throws InvalidPipeException if either src or dest surface is not valid * @throws InvalidPipeException if either src or dest surface is not valid
* or lost * or lost
* @see RenderQueue#lock * @see RenderQueue#lock
...@@ -135,6 +137,8 @@ public abstract class BufferedContext { ...@@ -135,6 +137,8 @@ public abstract class BufferedContext {
* *
* Note: must be called while the RenderQueue lock is held. * Note: must be called while the RenderQueue lock is held.
* *
* It's assumed that the type of surfaces has been checked by the Renderer
*
* @throws InvalidPipeException if the surface is not valid * @throws InvalidPipeException if the surface is not valid
* or lost * or lost
* @see RenderQueue#lock * @see RenderQueue#lock
...@@ -160,6 +164,8 @@ public abstract class BufferedContext { ...@@ -160,6 +164,8 @@ public abstract class BufferedContext {
* *
* Note: must be called while the RenderQueue lock is held. * Note: must be called while the RenderQueue lock is held.
* *
* It's assumed that the type of surfaces has been checked by the Renderer
*
* @throws InvalidPipeException if either src or dest surface is not valid * @throws InvalidPipeException if either src or dest surface is not valid
* or lost * or lost
*/ */
......
...@@ -27,6 +27,7 @@ package sun.java2d.d3d; ...@@ -27,6 +27,7 @@ package sun.java2d.d3d;
import java.awt.Transparency; import java.awt.Transparency;
import java.awt.geom.Path2D; import java.awt.geom.Path2D;
import sun.java2d.InvalidPipeException;
import sun.java2d.SunGraphics2D; import sun.java2d.SunGraphics2D;
import sun.java2d.loops.GraphicsPrimitive; import sun.java2d.loops.GraphicsPrimitive;
import sun.java2d.pipe.BufferedPaints; import sun.java2d.pipe.BufferedPaints;
...@@ -47,7 +48,12 @@ class D3DRenderer extends BufferedRenderPipe { ...@@ -47,7 +48,12 @@ class D3DRenderer extends BufferedRenderPipe {
int ctxflags = int ctxflags =
sg2d.paint.getTransparency() == Transparency.OPAQUE ? sg2d.paint.getTransparency() == Transparency.OPAQUE ?
D3DContext.SRC_IS_OPAQUE : D3DContext.NO_CONTEXT_FLAGS; D3DContext.SRC_IS_OPAQUE : D3DContext.NO_CONTEXT_FLAGS;
D3DSurfaceData dstData = (D3DSurfaceData)sg2d.surfaceData; D3DSurfaceData dstData;
try {
dstData = (D3DSurfaceData)sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
D3DContext.validateContext(dstData, dstData, D3DContext.validateContext(dstData, dstData,
sg2d.getCompClip(), sg2d.composite, sg2d.getCompClip(), sg2d.composite,
null, sg2d.paint, sg2d, ctxflags); null, sg2d.paint, sg2d, ctxflags);
...@@ -56,7 +62,12 @@ class D3DRenderer extends BufferedRenderPipe { ...@@ -56,7 +62,12 @@ class D3DRenderer extends BufferedRenderPipe {
@Override @Override
protected void validateContextAA(SunGraphics2D sg2d) { protected void validateContextAA(SunGraphics2D sg2d) {
int ctxflags = D3DContext.NO_CONTEXT_FLAGS; int ctxflags = D3DContext.NO_CONTEXT_FLAGS;
D3DSurfaceData dstData = (D3DSurfaceData)sg2d.surfaceData; D3DSurfaceData dstData;
try {
dstData = (D3DSurfaceData)sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
D3DContext.validateContext(dstData, dstData, D3DContext.validateContext(dstData, dstData,
sg2d.getCompClip(), sg2d.composite, sg2d.getCompClip(), sg2d.composite,
null, sg2d.paint, sg2d, ctxflags); null, sg2d.paint, sg2d, ctxflags);
...@@ -70,7 +81,12 @@ class D3DRenderer extends BufferedRenderPipe { ...@@ -70,7 +81,12 @@ class D3DRenderer extends BufferedRenderPipe {
int ctxflags = int ctxflags =
sg2d.surfaceData.getTransparency() == Transparency.OPAQUE ? sg2d.surfaceData.getTransparency() == Transparency.OPAQUE ?
D3DContext.SRC_IS_OPAQUE : D3DContext.NO_CONTEXT_FLAGS; D3DContext.SRC_IS_OPAQUE : D3DContext.NO_CONTEXT_FLAGS;
D3DSurfaceData dstData = (D3DSurfaceData)sg2d.surfaceData; D3DSurfaceData dstData;
try {
dstData = (D3DSurfaceData)sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
D3DContext.validateContext(dstData, dstData, D3DContext.validateContext(dstData, dstData,
sg2d.getCompClip(), sg2d.composite, sg2d.getCompClip(), sg2d.composite,
null, null, null, ctxflags); null, null, null, ctxflags);
......
...@@ -29,6 +29,7 @@ import java.awt.Composite; ...@@ -29,6 +29,7 @@ import java.awt.Composite;
import java.awt.Shape; import java.awt.Shape;
import java.awt.geom.Path2D; import java.awt.geom.Path2D;
import java.awt.geom.PathIterator; import java.awt.geom.PathIterator;
import sun.java2d.InvalidPipeException;
import sun.java2d.SunGraphics2D; import sun.java2d.SunGraphics2D;
import sun.java2d.SurfaceData; import sun.java2d.SurfaceData;
import sun.java2d.pipe.Region; import sun.java2d.pipe.Region;
...@@ -45,7 +46,7 @@ public class GDIRenderer implements ...@@ -45,7 +46,7 @@ public class GDIRenderer implements
PixelFillPipe, PixelFillPipe,
ShapeDrawPipe ShapeDrawPipe
{ {
native void doDrawLine(SurfaceData sData, native void doDrawLine(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x1, int y1, int x2, int y2); int x1, int y1, int x2, int y2);
...@@ -54,24 +55,32 @@ public class GDIRenderer implements ...@@ -54,24 +55,32 @@ public class GDIRenderer implements
{ {
int transx = sg2d.transX; int transx = sg2d.transX;
int transy = sg2d.transY; int transy = sg2d.transY;
doDrawLine(sg2d.surfaceData, try {
doDrawLine((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
x1+transx, y1+transy, x2+transx, y2+transy); x1+transx, y1+transy, x2+transx, y2+transy);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
native void doDrawRect(SurfaceData sData, native void doDrawRect(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h); int x, int y, int w, int h);
public void drawRect(SunGraphics2D sg2d, public void drawRect(SunGraphics2D sg2d,
int x, int y, int width, int height) int x, int y, int width, int height)
{ {
doDrawRect(sg2d.surfaceData, try {
doDrawRect((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
x+sg2d.transX, y+sg2d.transY, width, height); x+sg2d.transX, y+sg2d.transY, width, height);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
native void doDrawRoundRect(SurfaceData sData, native void doDrawRoundRect(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h, int x, int y, int w, int h,
int arcW, int arcH); int arcW, int arcH);
...@@ -80,25 +89,33 @@ public class GDIRenderer implements ...@@ -80,25 +89,33 @@ public class GDIRenderer implements
int x, int y, int width, int height, int x, int y, int width, int height,
int arcWidth, int arcHeight) int arcWidth, int arcHeight)
{ {
doDrawRoundRect(sg2d.surfaceData, try {
doDrawRoundRect((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
x+sg2d.transX, y+sg2d.transY, width, height, x+sg2d.transX, y+sg2d.transY, width, height,
arcWidth, arcHeight); arcWidth, arcHeight);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
native void doDrawOval(SurfaceData sData, native void doDrawOval(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h); int x, int y, int w, int h);
public void drawOval(SunGraphics2D sg2d, public void drawOval(SunGraphics2D sg2d,
int x, int y, int width, int height) int x, int y, int width, int height)
{ {
doDrawOval(sg2d.surfaceData, try {
doDrawOval((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
x+sg2d.transX, y+sg2d.transY, width, height); x+sg2d.transX, y+sg2d.transY, width, height);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
native void doDrawArc(SurfaceData sData, native void doDrawArc(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h, int x, int y, int w, int h,
int angleStart, int angleExtent); int angleStart, int angleExtent);
...@@ -107,13 +124,17 @@ public class GDIRenderer implements ...@@ -107,13 +124,17 @@ public class GDIRenderer implements
int x, int y, int width, int height, int x, int y, int width, int height,
int startAngle, int arcAngle) int startAngle, int arcAngle)
{ {
doDrawArc(sg2d.surfaceData, try {
doDrawArc((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
x+sg2d.transX, y+sg2d.transY, width, height, x+sg2d.transX, y+sg2d.transY, width, height,
startAngle, arcAngle); startAngle, arcAngle);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
native void doDrawPoly(SurfaceData sData, native void doDrawPoly(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int transx, int transy, int transx, int transy,
int[] xpoints, int[] ypoints, int[] xpoints, int[] ypoints,
...@@ -123,33 +144,45 @@ public class GDIRenderer implements ...@@ -123,33 +144,45 @@ public class GDIRenderer implements
int xpoints[], int ypoints[], int xpoints[], int ypoints[],
int npoints) int npoints)
{ {
doDrawPoly(sg2d.surfaceData, try {
doDrawPoly((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
sg2d.transX, sg2d.transY, xpoints, ypoints, npoints, false); sg2d.transX, sg2d.transY, xpoints, ypoints, npoints, false);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
public void drawPolygon(SunGraphics2D sg2d, public void drawPolygon(SunGraphics2D sg2d,
int xpoints[], int ypoints[], int xpoints[], int ypoints[],
int npoints) int npoints)
{ {
doDrawPoly(sg2d.surfaceData, try {
doDrawPoly((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
sg2d.transX, sg2d.transY, xpoints, ypoints, npoints, true); sg2d.transX, sg2d.transY, xpoints, ypoints, npoints, true);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
native void doFillRect(SurfaceData sData, native void doFillRect(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h); int x, int y, int w, int h);
public void fillRect(SunGraphics2D sg2d, public void fillRect(SunGraphics2D sg2d,
int x, int y, int width, int height) int x, int y, int width, int height)
{ {
doFillRect(sg2d.surfaceData, try {
doFillRect((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
x+sg2d.transX, y+sg2d.transY, width, height); x+sg2d.transX, y+sg2d.transY, width, height);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
native void doFillRoundRect(SurfaceData sData, native void doFillRoundRect(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h, int x, int y, int w, int h,
int arcW, int arcH); int arcW, int arcH);
...@@ -158,25 +191,33 @@ public class GDIRenderer implements ...@@ -158,25 +191,33 @@ public class GDIRenderer implements
int x, int y, int width, int height, int x, int y, int width, int height,
int arcWidth, int arcHeight) int arcWidth, int arcHeight)
{ {
doFillRoundRect(sg2d.surfaceData, try {
doFillRoundRect((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
x+sg2d.transX, y+sg2d.transY, width, height, x+sg2d.transX, y+sg2d.transY, width, height,
arcWidth, arcHeight); arcWidth, arcHeight);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
native void doFillOval(SurfaceData sData, native void doFillOval(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h); int x, int y, int w, int h);
public void fillOval(SunGraphics2D sg2d, public void fillOval(SunGraphics2D sg2d,
int x, int y, int width, int height) int x, int y, int width, int height)
{ {
doFillOval(sg2d.surfaceData, try {
doFillOval((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
x+sg2d.transX, y+sg2d.transY, width, height); x+sg2d.transX, y+sg2d.transY, width, height);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
native void doFillArc(SurfaceData sData, native void doFillArc(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h, int x, int y, int w, int h,
int angleStart, int angleExtent); int angleStart, int angleExtent);
...@@ -185,13 +226,17 @@ public class GDIRenderer implements ...@@ -185,13 +226,17 @@ public class GDIRenderer implements
int x, int y, int width, int height, int x, int y, int width, int height,
int startAngle, int arcAngle) int startAngle, int arcAngle)
{ {
doFillArc(sg2d.surfaceData, try {
doFillArc((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
x+sg2d.transX, y+sg2d.transY, width, height, x+sg2d.transX, y+sg2d.transY, width, height,
startAngle, arcAngle); startAngle, arcAngle);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
native void doFillPoly(SurfaceData sData, native void doFillPoly(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int transx, int transy, int transx, int transy,
int[] xpoints, int[] ypoints, int[] xpoints, int[] ypoints,
...@@ -201,12 +246,16 @@ public class GDIRenderer implements ...@@ -201,12 +246,16 @@ public class GDIRenderer implements
int xpoints[], int ypoints[], int xpoints[], int ypoints[],
int npoints) int npoints)
{ {
doFillPoly(sg2d.surfaceData, try {
doFillPoly((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
sg2d.transX, sg2d.transY, xpoints, ypoints, npoints); sg2d.transX, sg2d.transY, xpoints, ypoints, npoints);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
native void doShape(SurfaceData sData, native void doShape(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int transX, int transY, int transX, int transY,
Path2D.Float p2df, boolean isfill); Path2D.Float p2df, boolean isfill);
...@@ -228,9 +277,13 @@ public class GDIRenderer implements ...@@ -228,9 +277,13 @@ public class GDIRenderer implements
transX = 0; transX = 0;
transY = 0; transY = 0;
} }
doShape(sg2d.surfaceData, try {
doShape((GDIWindowSurfaceData)sg2d.surfaceData,
sg2d.getCompClip(), sg2d.composite, sg2d.eargb, sg2d.getCompClip(), sg2d.composite, sg2d.eargb,
transX, transY, p2df, isfill); transX, transY, p2df, isfill);
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
} }
// REMIND: This is just a hack to get WIDE lines to honor the // REMIND: This is just a hack to get WIDE lines to honor the
...@@ -239,7 +292,12 @@ public class GDIRenderer implements ...@@ -239,7 +292,12 @@ public class GDIRenderer implements
// method that could be filled by the doShape method more quickly. // method that could be filled by the doShape method more quickly.
public void doFillSpans(SunGraphics2D sg2d, SpanIterator si) { public void doFillSpans(SunGraphics2D sg2d, SpanIterator si) {
int box[] = new int[4]; int box[] = new int[4];
SurfaceData sd = sg2d.surfaceData; GDIWindowSurfaceData sd;
try {
sd = (GDIWindowSurfaceData)sg2d.surfaceData;
} catch (ClassCastException e) {
throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
}
Region clip = sg2d.getCompClip(); Region clip = sg2d.getCompClip();
Composite comp = sg2d.composite; Composite comp = sg2d.composite;
int eargb = sg2d.eargb; int eargb = sg2d.eargb;
...@@ -268,7 +326,7 @@ public class GDIRenderer implements ...@@ -268,7 +326,7 @@ public class GDIRenderer implements
doShape(sg2d, s, true); doShape(sg2d, s, true);
} }
public native void devCopyArea(SurfaceData sData, public native void devCopyArea(GDIWindowSurfaceData sData,
int srcx, int srcy, int srcx, int srcy,
int dx, int dy, int dx, int dy,
int w, int h); int w, int h);
...@@ -278,21 +336,21 @@ public class GDIRenderer implements ...@@ -278,21 +336,21 @@ public class GDIRenderer implements
} }
public static class Tracer extends GDIRenderer { public static class Tracer extends GDIRenderer {
void doDrawLine(SurfaceData sData, void doDrawLine(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x1, int y1, int x2, int y2) int x1, int y1, int x2, int y2)
{ {
GraphicsPrimitive.tracePrimitive("GDIDrawLine"); GraphicsPrimitive.tracePrimitive("GDIDrawLine");
super.doDrawLine(sData, clip, comp, color, x1, y1, x2, y2); super.doDrawLine(sData, clip, comp, color, x1, y1, x2, y2);
} }
void doDrawRect(SurfaceData sData, void doDrawRect(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h) int x, int y, int w, int h)
{ {
GraphicsPrimitive.tracePrimitive("GDIDrawRect"); GraphicsPrimitive.tracePrimitive("GDIDrawRect");
super.doDrawRect(sData, clip, comp, color, x, y, w, h); super.doDrawRect(sData, clip, comp, color, x, y, w, h);
} }
void doDrawRoundRect(SurfaceData sData, void doDrawRoundRect(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h, int x, int y, int w, int h,
int arcW, int arcH) int arcW, int arcH)
...@@ -301,14 +359,14 @@ public class GDIRenderer implements ...@@ -301,14 +359,14 @@ public class GDIRenderer implements
super.doDrawRoundRect(sData, clip, comp, color, super.doDrawRoundRect(sData, clip, comp, color,
x, y, w, h, arcW, arcH); x, y, w, h, arcW, arcH);
} }
void doDrawOval(SurfaceData sData, void doDrawOval(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h) int x, int y, int w, int h)
{ {
GraphicsPrimitive.tracePrimitive("GDIDrawOval"); GraphicsPrimitive.tracePrimitive("GDIDrawOval");
super.doDrawOval(sData, clip, comp, color, x, y, w, h); super.doDrawOval(sData, clip, comp, color, x, y, w, h);
} }
void doDrawArc(SurfaceData sData, void doDrawArc(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h, int x, int y, int w, int h,
int angleStart, int angleExtent) int angleStart, int angleExtent)
...@@ -317,7 +375,7 @@ public class GDIRenderer implements ...@@ -317,7 +375,7 @@ public class GDIRenderer implements
super.doDrawArc(sData, clip, comp, color, x, y, w, h, super.doDrawArc(sData, clip, comp, color, x, y, w, h,
angleStart, angleExtent); angleStart, angleExtent);
} }
void doDrawPoly(SurfaceData sData, void doDrawPoly(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int transx, int transy, int transx, int transy,
int[] xpoints, int[] ypoints, int[] xpoints, int[] ypoints,
...@@ -327,14 +385,14 @@ public class GDIRenderer implements ...@@ -327,14 +385,14 @@ public class GDIRenderer implements
super.doDrawPoly(sData, clip, comp, color, transx, transy, super.doDrawPoly(sData, clip, comp, color, transx, transy,
xpoints, ypoints, npoints, isclosed); xpoints, ypoints, npoints, isclosed);
} }
void doFillRect(SurfaceData sData, void doFillRect(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h) int x, int y, int w, int h)
{ {
GraphicsPrimitive.tracePrimitive("GDIFillRect"); GraphicsPrimitive.tracePrimitive("GDIFillRect");
super.doFillRect(sData, clip, comp, color, x, y, w, h); super.doFillRect(sData, clip, comp, color, x, y, w, h);
} }
void doFillRoundRect(SurfaceData sData, void doFillRoundRect(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h, int x, int y, int w, int h,
int arcW, int arcH) int arcW, int arcH)
...@@ -343,14 +401,14 @@ public class GDIRenderer implements ...@@ -343,14 +401,14 @@ public class GDIRenderer implements
super.doFillRoundRect(sData, clip, comp, color, super.doFillRoundRect(sData, clip, comp, color,
x, y, w, h, arcW, arcH); x, y, w, h, arcW, arcH);
} }
void doFillOval(SurfaceData sData, void doFillOval(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h) int x, int y, int w, int h)
{ {
GraphicsPrimitive.tracePrimitive("GDIFillOval"); GraphicsPrimitive.tracePrimitive("GDIFillOval");
super.doFillOval(sData, clip, comp, color, x, y, w, h); super.doFillOval(sData, clip, comp, color, x, y, w, h);
} }
void doFillArc(SurfaceData sData, void doFillArc(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int x, int y, int w, int h, int x, int y, int w, int h,
int angleStart, int angleExtent) int angleStart, int angleExtent)
...@@ -359,7 +417,7 @@ public class GDIRenderer implements ...@@ -359,7 +417,7 @@ public class GDIRenderer implements
super.doFillArc(sData, clip, comp, color, x, y, w, h, super.doFillArc(sData, clip, comp, color, x, y, w, h,
angleStart, angleExtent); angleStart, angleExtent);
} }
void doFillPoly(SurfaceData sData, void doFillPoly(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int transx, int transy, int transx, int transy,
int[] xpoints, int[] ypoints, int[] xpoints, int[] ypoints,
...@@ -369,7 +427,7 @@ public class GDIRenderer implements ...@@ -369,7 +427,7 @@ public class GDIRenderer implements
super.doFillPoly(sData, clip, comp, color, transx, transy, super.doFillPoly(sData, clip, comp, color, transx, transy,
xpoints, ypoints, npoints); xpoints, ypoints, npoints);
} }
void doShape(SurfaceData sData, void doShape(GDIWindowSurfaceData sData,
Region clip, Composite comp, int color, Region clip, Composite comp, int color,
int transX, int transY, int transX, int transY,
Path2D.Float p2df, boolean isfill) Path2D.Float p2df, boolean isfill)
...@@ -380,7 +438,7 @@ public class GDIRenderer implements ...@@ -380,7 +438,7 @@ public class GDIRenderer implements
super.doShape(sData, clip, comp, color, super.doShape(sData, clip, comp, color,
transX, transY, p2df, isfill); transX, transY, p2df, isfill);
} }
public void devCopyArea(SurfaceData sData, public void devCopyArea(GDIWindowSurfaceData sData,
int srcx, int srcy, int srcx, int srcy,
int dx, int dy, int dx, int dy,
int w, int h) int w, int h)
......
...@@ -117,7 +117,7 @@ static POINT *TransformPoly(jint *xpoints, jint *ypoints, ...@@ -117,7 +117,7 @@ static POINT *TransformPoly(jint *xpoints, jint *ypoints,
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doDrawLine * Method: doDrawLine
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIII)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_doDrawLine Java_sun_java2d_windows_GDIRenderer_doDrawLine
...@@ -164,7 +164,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawLine ...@@ -164,7 +164,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawLine
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doDrawRect * Method: doDrawRect
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIII)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_doDrawRect Java_sun_java2d_windows_GDIRenderer_doDrawRect
...@@ -209,7 +209,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawRect ...@@ -209,7 +209,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawRect
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doDrawRoundRect * Method: doDrawRoundRect
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIIIII)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIIIII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_doDrawRoundRect Java_sun_java2d_windows_GDIRenderer_doDrawRoundRect
...@@ -253,7 +253,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawRoundRect ...@@ -253,7 +253,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawRoundRect
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doDrawOval * Method: doDrawOval
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIII)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_doDrawOval Java_sun_java2d_windows_GDIRenderer_doDrawOval
...@@ -291,7 +291,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawOval ...@@ -291,7 +291,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawOval
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doDrawArc * Method: doDrawArc
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIIIII)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIIIII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_doDrawArc Java_sun_java2d_windows_GDIRenderer_doDrawArc
...@@ -347,7 +347,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawArc ...@@ -347,7 +347,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawArc
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doDrawPoly * Method: doDrawPoly
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;III[I[IIZ)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;III[I[IIZ)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_doDrawPoly Java_sun_java2d_windows_GDIRenderer_doDrawPoly
...@@ -412,7 +412,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawPoly ...@@ -412,7 +412,7 @@ Java_sun_java2d_windows_GDIRenderer_doDrawPoly
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doFillRect * Method: doFillRect
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIII)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_doFillRect Java_sun_java2d_windows_GDIRenderer_doFillRect
...@@ -445,7 +445,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillRect ...@@ -445,7 +445,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillRect
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doFillRoundRect * Method: doFillRoundRect
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIIIII)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIIIII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_doFillRoundRect Java_sun_java2d_windows_GDIRenderer_doFillRoundRect
...@@ -488,7 +488,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillRoundRect ...@@ -488,7 +488,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillRoundRect
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doFillOval * Method: doFillOval
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIII)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_doFillOval Java_sun_java2d_windows_GDIRenderer_doFillOval
...@@ -555,7 +555,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillOval ...@@ -555,7 +555,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillOval
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doFillArc * Method: doFillArc
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIIIII)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;IIIIIII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_doFillArc Java_sun_java2d_windows_GDIRenderer_doFillArc
...@@ -615,7 +615,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillArc ...@@ -615,7 +615,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillArc
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doFillPoly * Method: doFillPoly
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;III[I[II)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;Ljava/awt/Composite;III[I[II)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_doFillPoly Java_sun_java2d_windows_GDIRenderer_doFillPoly
...@@ -680,7 +680,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillPoly ...@@ -680,7 +680,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillPoly
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: doShape * Method: doShape
* Signature: (Lsun/java2d/SurfaceData;Lsun/java2d/pipe/Region; * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;Lsun/java2d/pipe/Region;
* Ljava/awt/Composite;IIILjava/awt/geom/Path2D.Float;Z)V * Ljava/awt/Composite;IIILjava/awt/geom/Path2D.Float;Z)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
...@@ -863,7 +863,7 @@ INLINE BOOL RectInMonitorRect(RECT *rCheck, RECT *rContainer) ...@@ -863,7 +863,7 @@ INLINE BOOL RectInMonitorRect(RECT *rCheck, RECT *rContainer)
/* /*
* Class: sun_java2d_windows_GDIRenderer * Class: sun_java2d_windows_GDIRenderer
* Method: devCopyArea * Method: devCopyArea
* Signature: (Lsun/awt/windows/SurfaceData;IIIIII)V * Signature: (Lsun/java2d/windows/GDIWindowSurfaceData;IIIIII)V
*/ */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_java2d_windows_GDIRenderer_devCopyArea Java_sun_java2d_windows_GDIRenderer_devCopyArea
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册