/*
* 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.
*/
class OGLBlitLoops {
static void register() {
GraphicsPrimitive[] primitives = {
// surface->surface ops
new OGLSurfaceToSurfaceBlit(),
new OGLSurfaceToSurfaceScale(),
new OGLSurfaceToSurfaceTransform(),
// render-to-texture surface->surface ops
new OGLRTTSurfaceToSurfaceBlit(),
new OGLRTTSurfaceToSurfaceScale(),
// surface->sw ops
// sw->surface ops
// texture->surface ops
new OGLTextureToSurfaceBlit(),
new OGLTextureToSurfaceScale(),
new OGLTextureToSurfaceTransform(),
// sw->texture ops
};
}
/**
* The following offsets are used to pack the parameters in
* createPackedParams(). (They are also used at the native level when
* unpacking the params.)
*/
/**
* Packs the given parameters into a single int value in order to save
* space on the rendering queue.
*/
{
return
((srctype << OFFSET_SRCTYPE) |
(hint << OFFSET_HINT ) |
}
/**
* Enqueues a BLIT operation with the given parameters. Note that the
* RenderQueue lock must be held before calling this method.
*/
int packedParams,
{
// assert rq.lock.isHeldByCurrentThread();
}
{
int ctxflags = 0;
}
try {
// make sure the RenderQueue keeps a hard reference to the
// source (sysmem) SurfaceData to prevent it from being
// disposed while the operation is processed on the QFT
if (texture) {
// make sure we have a current context before uploading
// the sysmem data to the texture object
} else {
ctxflags);
}
// always flush immediately, since we (currently) have no means
// of tracking changes to the system memory surface
} finally {
}
}
/**
* Note: The srcImg and biop parameters are only used when invoked
* from the OGLBufImgOps.renderImageWithOp() method; in all other cases,
* this method can be called with null values for those two parameters,
* and they will be effectively ignored.
*/
boolean texture)
{
int ctxflags = 0;
}
try {
boolean rtt;
// the source is a regular texture object; we substitute
// the destination surface for the purposes of making a
// context current
rtt = false;
srcCtxData = oglDst;
} else {
// the source is a pbuffer, backbuffer, or render-to-texture
// surface; we set rtt to true to differentiate this kind
// of surface from a regular texture object
rtt = true;
srcCtxData = oglDst;
} else {
srcCtxData = oglSrc;
}
}
ctxflags);
}
}
// we only have to flush immediately when copying from a
// (non-texture) surface to the screen; otherwise Swing apps
// might appear unresponsive until the auto-flush completes
}
} finally {
}
}
}
super(OGLSurfaceData.OpenGLSurface,
}
{
false);
}
}
super(OGLSurfaceData.OpenGLSurface,
}
{
false);
}
}
super(OGLSurfaceData.OpenGLSurface,
}
int w, int h)
{
false);
}
}
super(OGLSurfaceData.OpenGLSurfaceRTT,
}
{
true);
}
}
super(OGLSurfaceData.OpenGLSurfaceRTT,
}
{
true);
}
}
super(OGLSurfaceData.OpenGLSurfaceRTT,
}
{
true);
}
}
private int typeval;
// REMIND: destination will actually be opaque/premultiplied...
super(OGLSurfaceData.OpenGLSurface,
dstType);
}
int w, int h)
{
try {
// make sure the RenderQueue keeps a hard reference to the
// destination (sysmem) SurfaceData to prevent it from being
// disposed while the operation is processed on the QFT
// always flush immediately
} finally {
}
}
}
private int typeval;
super(srcType,
}
{
typeval, false);
}
}
private int typeval;
super(srcType,
}
{
typeval, false);
}
}
private int typeval;
super(srcType,
}
{
typeval, false);
}
}
private int typeval;
super(srcType,
}
{
typeval, true);
}
}
super(OGLSurfaceData.OpenGLTexture,
}
{
true);
}
}
super(OGLSurfaceData.OpenGLTexture,
}
{
true);
}
}
super(OGLSurfaceData.OpenGLTexture,
}
int w, int h)
{
true);
}
}
/**
* This general Blit implemenation converts any source surface to an
* intermediate IntArgbPre surface, and then uses the more specific
* IntArgbPre->OpenGLSurface/Texture loop to get the intermediate
* (premultiplied) surface down to OpenGL.
*/
{
}
int w, int h)
{
// use cached intermediate surface, if available
}
// convert source to IntArgbPre
// copy IntArgbPre intermediate surface to OpenGL surface
// cache the intermediate surface
}
}
}
}
int w, int h)
{
// use cached intermediate surface, if available
}
// convert source to IntArgbPre
// cache the intermediate surface
}
// now blit the buffer back to the destination
dst.getSurfaceType());
}
}