/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
abstract class D3DPaints {
/**
* Holds all registered implementations, using the corresponding
* SunGraphics2D.PAINT_* constant as the hash key.
*/
static {
}
/**
* Attempts to locate an implementation corresponding to the paint state
* of the provided SunGraphics2D object. If no implementation can be
* found, or if the paint cannot be accelerated under the conditions
* of the SunGraphics2D, this method returns false; otherwise, returns
* true.
*/
}
/**
* Returns true if this implementation is able to accelerate the
* Paint object associated with, and under the conditions of, the
* provided SunGraphics2D instance; otherwise returns false.
*/
/************************* GradientPaint support ****************************/
private Gradient() {}
/**
* Returns true if the given GradientPaint instance can be
* used by the accelerated D3DPaints.Gradient implementation.
* A GradientPaint is considered valid only if the destination
* has support for fragment shaders.
*/
}
}
/************************** TexturePaint support ****************************/
private Texture() {}
/**
* Returns true if the given TexturePaint instance can be used by the
* accelerated BufferedPaints.Texture implementation.
*
* A TexturePaint is considered valid if the following conditions
* are met:
* - the texture image dimensions are power-of-two
* - the texture image can be (or is already) cached in a D3D
* texture object
*/
// verify that the texture image dimensions are pow2
return false;
}
}
// verify that the texture image is square if it has to be
{
return false;
}
if (!(srcData instanceof D3DSurfaceData)) {
// REMIND: this is a hack that attempts to cache the system
// memory image from the TexturePaint instance into a
// D3D texture...
srcData =
if (!(srcData instanceof D3DSurfaceData)) {
return false;
}
}
// verify that the source surface is actually a texture
return false;
}
return true;
}
}
/****************** Shared MultipleGradientPaint support ********************/
/**
* Note that this number is lower than the MULTI_MAX_FRACTIONS
* defined in the superclass. The D3D pipeline now uses a
* slightly more complicated shader (to avoid the gradient banding
* issues), which has a higher instruction count. To ensure that
* all versions of the shader can be compiled for PS 2.0 hardware,
* we need to cap this maximum value at 8.
*/
protected MultiGradient() {}
/**
* Returns true if the given MultipleGradientPaint instance can be
* used by the accelerated D3DPaints.MultiGradient implementation.
* A MultipleGradientPaint is considered valid if the following
* conditions are met:
* - the number of gradient "stops" is <= MAX_FRACTIONS
* - the destination has support for fragment shaders
*/
// REMIND: ugh, this creates garbage; would be nicer if
// we had a MultipleGradientPaint.getNumStops() method...
return false;
}
return false;
}
return true;
}
}
/********************** LinearGradientPaint support *************************/
private LinearGradient() {}
{
// we can delegate to the optimized two-color gradient
// codepath, which should be faster
return true;
}
}
return super.isPaintValid(sg2d);
}
}
/********************** RadialGradientPaint support *************************/
private RadialGradient() {}
}
}