1 /* 2 * Copyright (c) 2019, 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 MTLVertexCache_h_Included 27 #define MTLVertexCache_h_Included 28 29 #include "j2d_md.h" 30 #include "MTLContext.h" 31 32 /** 33 * Constants that control the size of the vertex cache. 34 */ 35 #define MTLVC_MAX_INDEX 1024 36 37 /** 38 * Constants that control the size of the texture tile cache used for 39 * mask operations. 40 */ 41 #define MTLVC_MASK_CACHE_TILE_WIDTH 32 42 #define MTLVC_MASK_CACHE_TILE_HEIGHT 32 43 #define MTLVC_MASK_CACHE_TILE_SIZE \ 44 (MTLVC_MASK_CACHE_TILE_WIDTH * MTLVC_MASK_CACHE_TILE_HEIGHT) 45 46 #define MTLVC_MASK_CACHE_WIDTH_IN_TILES 8 47 #define MTLVC_MASK_CACHE_HEIGHT_IN_TILES 4 48 49 #define MTLVC_MASK_CACHE_WIDTH_IN_TEXELS \ 50 (MTLVC_MASK_CACHE_TILE_WIDTH * MTLVC_MASK_CACHE_WIDTH_IN_TILES) 51 #define MTLVC_MASK_CACHE_HEIGHT_IN_TEXELS \ 52 (MTLVC_MASK_CACHE_TILE_HEIGHT * MTLVC_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 MTLVC_MASK_CACHE_MAX_INDEX \ 59 ((MTLVC_MASK_CACHE_WIDTH_IN_TILES * MTLVC_MASK_CACHE_HEIGHT_IN_TILES) - 1) 60 #define MTLVC_MASK_CACHE_SPECIAL_TILE_X \ 61 (MTLVC_MASK_CACHE_WIDTH_IN_TEXELS - MTLVC_MASK_CACHE_TILE_WIDTH) 62 #define MTLVC_MASK_CACHE_SPECIAL_TILE_Y \ 63 (MTLVC_MASK_CACHE_HEIGHT_IN_TEXELS - MTLVC_MASK_CACHE_TILE_HEIGHT) 64 65 /** 66 * Exported methods. 67 */ 68 jboolean MTLVertexCache_InitVertexCache(MTLContext *mtlc); 69 void MTLVertexCache_FlushVertexCache(); 70 void MTLVertexCache_RestoreColorState(MTLContext *mtlc); 71 72 void MTLVertexCache_EnableMaskCache(MTLContext *mtlc); 73 void MTLVertexCache_DisableMaskCache(MTLContext *mtlc); 74 void MTLVertexCache_AddMaskQuad(MTLContext *mtlc, 75 jint srcx, jint srcy, 76 jint dstx, jint dsty, 77 jint width, jint height, 78 jint maskscan, void *mask); 79 80 void MTLVertexCache_AddGlyphQuad(MTLContext *mtlc, 81 jfloat tx1, jfloat ty1, 82 jfloat tx2, jfloat ty2, 83 jfloat dx1, jfloat dy1, 84 jfloat dx2, jfloat dy2); 85 86 #endif /* MTLVertexCache_h_Included */