/*
* 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.
*/
#ifndef HEADLESS
#include <stdlib.h>
#include <string.h>
#include "sun_java2d_SunGraphics2D.h"
#include "OGLPaints.h"
#include "OGLVertexCache.h"
typedef struct _J2DVertex {
jubyte r, g, b, a;
} J2DVertex;
do { \
v->r = R; \
v->g = G; \
v->b = B; \
v->a = A; \
} while (0)
do { \
} while (0)
{
if (vertexCache == NULL) {
if (vertexCache == NULL) {
return JNI_FALSE;
}
}
if (!oglc->vertexCacheEnabled) {
sizeof(J2DVertex), vertexCache);
}
return JNI_TRUE;
}
void
{
if (vertexCacheIndex > 0) {
}
vertexCacheIndex = 0;
}
/**
* This method is somewhat hacky, but necessary for the foreseeable future.
* The problem is the way OpenGL handles color values in vertex arrays. When
* a vertex in a vertex array contains a color, and then the vertex array
* is rendered via glDrawArrays(), the global OpenGL color state is actually
* modified each time a vertex is rendered. This means that after all
* vertices have been flushed, the global OpenGL color state will be set to
* the color of the most recently rendered element in the vertex array.
*
* The reason this is a problem for us is that we do not want to flush the
* (in the case of non-antialiased primitives) everytime the current color
* changes, which would defeat any benefit from batching in the first place.
* We handle this in practice by not calling CHECK/RESET_PREVIOUS_OP() when
* the simple color state is changing in OGLPaints_SetColor(). This is
* problematic for vertex caching because we may end up with the following
* situation, for example:
* SET_COLOR (orange)
* MASK_FILL
* MASK_FILL
* SET_COLOR (blue; remember, this won't cause a flush)
* FILL_RECT (this will cause the vertex array to be flushed)
*
* In this case, we would actually end up rendering an orange FILL_RECT,
* not a blue one as intended, because flushing the vertex cache flush would
* override the color state from the most recent SET_COLOR call.
*
* Long story short, the easiest way to resolve this problem is to call
* that the appropriate color state is restored.
*/
void
{
}
}
static jboolean
{
// init special fully opaque tile in the upper-right corner of
// the mask cache texture
{
}
return JNI_TRUE;
}
void
{
if (!OGLVertexCache_InitVertexCache(oglc)) {
return;
}
if (maskCacheTexID == 0) {
if (!OGLVertexCache_InitMaskCache()) {
return;
}
}
}
void
{
maskCacheIndex = 0;
}
void
{
if (maskCacheIndex >= OGLVC_MASK_CACHE_MAX_INDEX ||
{
maskCacheIndex = 0;
}
// update the source pointer offsets
// copy alpha mask into texture tile
} else {
// use special fully opaque tile
}
}
void
{
if (vertexCacheIndex >= OGLVC_MAX_INDEX) {
}
}
#endif /* !HEADLESS */