@Override boolean isPaintValid(SunGraphics2D sg2d){
  TexturePaint paint=(TexturePaint)sg2d.paint;
  OGLSurfaceData dstData=(OGLSurfaceData)sg2d.surfaceData;
  BufferedImage bi=paint.getImage();
  if (!dstData.isTexNonPow2Available()) {
    int imgw=bi.getWidth();
    int imgh=bi.getHeight();
    if ((imgw & (imgw - 1)) != 0 || (imgh & (imgh - 1)) != 0) {
      return false;
    }
  }
  SurfaceData srcData=dstData.getSourceSurfaceData(bi,SunGraphics2D.TRANSFORM_ISIDENT,CompositeType.SrcOver,null);
  if (!(srcData instanceof OGLSurfaceData)) {
    srcData=dstData.getSourceSurfaceData(bi,SunGraphics2D.TRANSFORM_ISIDENT,CompositeType.SrcOver,null);
    if (!(srcData instanceof OGLSurfaceData)) {
      return false;
    }
  }
  OGLSurfaceData oglData=(OGLSurfaceData)srcData;
  if (oglData.getType() != OGLSurfaceData.TEXTURE) {
    return false;
  }
  return true;
}

@ Override boolean isPaintValid ( SunGraphics2D sg2d ) { TexturePaint paint = ( TexturePaint ) sg2d . paint ; OGLSurfaceData dstData = ( OGLSurfaceData ) sg2d . surfaceData ; BufferedImage bi = paint . getImage ( ) ; if ( ! dstData . isTexNonPow2Available ( ) ) { int imgw = bi . getWidth ( ) ; int imgh = bi . getHeight ( ) ; if ( ( imgw & ( imgw - 1 ) ) != 0 || ( imgh & ( imgh - 1 ) ) != 0 ) { return false ; } } SurfaceData srcData = dstData . getSourceSurfaceData ( bi , SunGraphics2D . TRANSFORM_ISIDENT , CompositeType . SrcOver , null ) ; if ( ! ( srcData instanceof OGLSurfaceData ) ) { srcData = dstData . getSourceSurfaceData ( bi , SunGraphics2D . TRANSFORM_ISIDENT , CompositeType . SrcOver , null ) ; if ( ! ( srcData instanceof OGLSurfaceData ) ) { return false ; } } OGLSurfaceData oglData = ( OGLSurfaceData ) srcData ; if ( oglData . getType ( ) != OGLSurfaceData . TEXTURE ) { return false ; } return true ; }
returns true if the given texturepaint instance can be used by the accelerated oglpaints . texture implementation . a texturepaint is considered valid if the following conditions are met : - the texture image dimensions are power - of - two ( or the gl_arb_texture_non_power_of_two extension is present ) - the texture image can be ( or is already ) cached in an opengl texture object
