jdk/src/share/classes/sun/java2d/opengl/OGLRenderer.java
changeset 11897 9e80dbac0293
parent 9653 6a1eff16874d
child 23010 6dadb192ad81
equal deleted inserted replaced
11896:eb4d5334fccf 11897:9e80dbac0293
    25 
    25 
    26 package sun.java2d.opengl;
    26 package sun.java2d.opengl;
    27 
    27 
    28 import java.awt.Transparency;
    28 import java.awt.Transparency;
    29 import java.awt.geom.Path2D;
    29 import java.awt.geom.Path2D;
       
    30 import sun.java2d.InvalidPipeException;
    30 import sun.java2d.SunGraphics2D;
    31 import sun.java2d.SunGraphics2D;
    31 import sun.java2d.loops.GraphicsPrimitive;
    32 import sun.java2d.loops.GraphicsPrimitive;
    32 import sun.java2d.pipe.BufferedRenderPipe;
    33 import sun.java2d.pipe.BufferedRenderPipe;
    33 import sun.java2d.pipe.ParallelogramPipe;
    34 import sun.java2d.pipe.ParallelogramPipe;
    34 import sun.java2d.pipe.RenderQueue;
    35 import sun.java2d.pipe.RenderQueue;
    44     @Override
    45     @Override
    45     protected void validateContext(SunGraphics2D sg2d) {
    46     protected void validateContext(SunGraphics2D sg2d) {
    46         int ctxflags =
    47         int ctxflags =
    47             sg2d.paint.getTransparency() == Transparency.OPAQUE ?
    48             sg2d.paint.getTransparency() == Transparency.OPAQUE ?
    48                 OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS;
    49                 OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS;
    49         OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData;
    50         OGLSurfaceData dstData;
       
    51         try {
       
    52             dstData = (OGLSurfaceData)sg2d.surfaceData;
       
    53         } catch (ClassCastException e) {
       
    54             throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
       
    55         }
    50         OGLContext.validateContext(dstData, dstData,
    56         OGLContext.validateContext(dstData, dstData,
    51                                    sg2d.getCompClip(), sg2d.composite,
    57                                    sg2d.getCompClip(), sg2d.composite,
    52                                    null, sg2d.paint, sg2d, ctxflags);
    58                                    null, sg2d.paint, sg2d, ctxflags);
    53     }
    59     }
    54 
    60 
    55     @Override
    61     @Override
    56     protected void validateContextAA(SunGraphics2D sg2d) {
    62     protected void validateContextAA(SunGraphics2D sg2d) {
    57         int ctxflags = OGLContext.NO_CONTEXT_FLAGS;
    63         int ctxflags = OGLContext.NO_CONTEXT_FLAGS;
    58         OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData;
    64         OGLSurfaceData dstData;
       
    65         try {
       
    66             dstData = (OGLSurfaceData)sg2d.surfaceData;
       
    67         } catch (ClassCastException e) {
       
    68             throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
       
    69         }
    59         OGLContext.validateContext(dstData, dstData,
    70         OGLContext.validateContext(dstData, dstData,
    60                                    sg2d.getCompClip(), sg2d.composite,
    71                                    sg2d.getCompClip(), sg2d.composite,
    61                                    null, sg2d.paint, sg2d, ctxflags);
    72                                    null, sg2d.paint, sg2d, ctxflags);
    62     }
    73     }
    63 
    74 
    67         rq.lock();
    78         rq.lock();
    68         try {
    79         try {
    69             int ctxflags =
    80             int ctxflags =
    70                 sg2d.surfaceData.getTransparency() == Transparency.OPAQUE ?
    81                 sg2d.surfaceData.getTransparency() == Transparency.OPAQUE ?
    71                     OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS;
    82                     OGLContext.SRC_IS_OPAQUE : OGLContext.NO_CONTEXT_FLAGS;
    72             OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData;
    83             OGLSurfaceData dstData;
       
    84             try {
       
    85                 dstData = (OGLSurfaceData)sg2d.surfaceData;
       
    86             } catch (ClassCastException e) {
       
    87                 throw new InvalidPipeException("wrong surface data type: " + sg2d.surfaceData);
       
    88             }
    73             OGLContext.validateContext(dstData, dstData,
    89             OGLContext.validateContext(dstData, dstData,
    74                                        sg2d.getCompClip(), sg2d.composite,
    90                                        sg2d.getCompClip(), sg2d.composite,
    75                                        null, null, null, ctxflags);
    91                                        null, null, null, ctxflags);
    76 
    92 
    77             rq.ensureCapacity(28);
    93             rq.ensureCapacity(28);