src/java.desktop/share/classes/sun/java2d/opengl/OGLPaints.java

Print this page




 134                     dstData.getSourceSurfaceData(bi,
 135                                                  SunGraphics2D.TRANSFORM_ISIDENT,
 136                                                  CompositeType.SrcOver, null);
 137                 if (!(srcData instanceof OGLSurfaceData)) {
 138                     return false;
 139                 }
 140             }
 141 
 142             // verify that the source surface is actually a texture
 143             OGLSurfaceData oglData = (OGLSurfaceData)srcData;
 144             if (oglData.getType() != OGLSurfaceData.TEXTURE) {
 145                 return false;
 146             }
 147 
 148             return true;
 149         }
 150     }
 151 
 152 /****************** Shared MultipleGradientPaint support ********************/
 153 
 154     private static abstract class MultiGradient extends OGLPaints {
 155         protected MultiGradient() {}
 156 
 157         /**
 158          * Returns true if the given MultipleGradientPaint instance can be
 159          * used by the accelerated OGLPaints.MultiGradient implementation.
 160          * A MultipleGradientPaint is considered valid if the following
 161          * conditions are met:
 162          *   - the number of gradient "stops" is <= MAX_FRACTIONS
 163          *   - the destination has support for fragment shaders
 164          */
 165         @Override
 166         boolean isPaintValid(SunGraphics2D sg2d) {
 167             MultipleGradientPaint paint = (MultipleGradientPaint)sg2d.paint;
 168             // REMIND: ugh, this creates garbage; would be nicer if
 169             // we had a MultipleGradientPaint.getNumStops() method...
 170             if (paint.getFractions().length > MULTI_MAX_FRACTIONS) {
 171                 return false;
 172             }
 173 
 174             OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData;




 134                     dstData.getSourceSurfaceData(bi,
 135                                                  SunGraphics2D.TRANSFORM_ISIDENT,
 136                                                  CompositeType.SrcOver, null);
 137                 if (!(srcData instanceof OGLSurfaceData)) {
 138                     return false;
 139                 }
 140             }
 141 
 142             // verify that the source surface is actually a texture
 143             OGLSurfaceData oglData = (OGLSurfaceData)srcData;
 144             if (oglData.getType() != OGLSurfaceData.TEXTURE) {
 145                 return false;
 146             }
 147 
 148             return true;
 149         }
 150     }
 151 
 152 /****************** Shared MultipleGradientPaint support ********************/
 153 
 154     private abstract static class MultiGradient extends OGLPaints {
 155         protected MultiGradient() {}
 156 
 157         /**
 158          * Returns true if the given MultipleGradientPaint instance can be
 159          * used by the accelerated OGLPaints.MultiGradient implementation.
 160          * A MultipleGradientPaint is considered valid if the following
 161          * conditions are met:
 162          *   - the number of gradient "stops" is <= MAX_FRACTIONS
 163          *   - the destination has support for fragment shaders
 164          */
 165         @Override
 166         boolean isPaintValid(SunGraphics2D sg2d) {
 167             MultipleGradientPaint paint = (MultipleGradientPaint)sg2d.paint;
 168             // REMIND: ugh, this creates garbage; would be nicer if
 169             // we had a MultipleGradientPaint.getNumStops() method...
 170             if (paint.getFractions().length > MULTI_MAX_FRACTIONS) {
 171                 return false;
 172             }
 173 
 174             OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData;