blob: 4ba229ac66ff43cc9cd0b388a78998ec67437af5 [file] [log] [blame]
J. Duke319a3b92007-12-01 00:00:00 +00001/*
2 * Copyright 2007 Sun Microsystems, Inc. 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. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any 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();
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 */