1/* 2 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26#ifndef OGLVertexCache_h_Included 27#define OGLVertexCache_h_Included 28 29#include "j2d_md.h" 30#include "OGLContext.h" 31 32/** 33 * Constants that control the size of the vertex cache. 34 */ 35#define OGLVC_MAX_INDEX 1024 36 37/** 38 * Constants that control the size of the texture tile cache used for 39 * mask operations. 40 */ 41#define OGLVC_MASK_CACHE_TILE_WIDTH 32 42#define OGLVC_MASK_CACHE_TILE_HEIGHT 32 43#define OGLVC_MASK_CACHE_TILE_SIZE \ 44 (OGLVC_MASK_CACHE_TILE_WIDTH * OGLVC_MASK_CACHE_TILE_HEIGHT) 45 46#define OGLVC_MASK_CACHE_WIDTH_IN_TILES 8 47#define OGLVC_MASK_CACHE_HEIGHT_IN_TILES 4 48 49#define OGLVC_MASK_CACHE_WIDTH_IN_TEXELS \ 50 (OGLVC_MASK_CACHE_TILE_WIDTH * OGLVC_MASK_CACHE_WIDTH_IN_TILES) 51#define OGLVC_MASK_CACHE_HEIGHT_IN_TEXELS \ 52 (OGLVC_MASK_CACHE_TILE_HEIGHT * OGLVC_MASK_CACHE_HEIGHT_IN_TILES) 53 54/* 55 * We reserve one (fully opaque) tile in the upper-right corner for 56 * operations where the mask is null. 57 */ 58#define OGLVC_MASK_CACHE_MAX_INDEX \ 59 ((OGLVC_MASK_CACHE_WIDTH_IN_TILES * OGLVC_MASK_CACHE_HEIGHT_IN_TILES) - 1) 60#define OGLVC_MASK_CACHE_SPECIAL_TILE_X \ 61 (OGLVC_MASK_CACHE_WIDTH_IN_TEXELS - OGLVC_MASK_CACHE_TILE_WIDTH) 62#define OGLVC_MASK_CACHE_SPECIAL_TILE_Y \ 63 (OGLVC_MASK_CACHE_HEIGHT_IN_TEXELS - OGLVC_MASK_CACHE_TILE_HEIGHT) 64 65/** 66 * Exported methods. 67 */ 68jboolean OGLVertexCache_InitVertexCache(OGLContext *oglc); 69void OGLVertexCache_FlushVertexCache(); 70void OGLVertexCache_RestoreColorState(OGLContext *oglc); 71 72void OGLVertexCache_EnableMaskCache(OGLContext *oglc); 73void OGLVertexCache_DisableMaskCache(OGLContext *oglc); 74void OGLVertexCache_AddMaskQuad(OGLContext *oglc, 75 jint srcx, jint srcy, 76 jint dstx, jint dsty, 77 jint width, jint height, 78 jint maskscan, void *mask); 79 80void OGLVertexCache_AddGlyphQuad(OGLContext *oglc, 81 jfloat tx1, jfloat ty1, 82 jfloat tx2, jfloat ty2, 83 jfloat dx1, jfloat dy1, 84 jfloat dx2, jfloat dy2); 85 86#endif /* OGLVertexCache_h_Included */ 87