Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/native/sun/java2d/d3d/D3DTextRenderer.h
32288 views
/*1* Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef D3DTextRenderer_h_Included26#define D3DTextRenderer_h_Included2728#include <jni.h>29#include <jlong.h>30#include "sun_java2d_pipe_BufferedTextPipe.h"31#include "AccelGlyphCache.h"32#include "D3DContext.h"33#include "D3DSurfaceData.h"3435/**36* The following constants define the inner and outer bounds of the37* accelerated glyph cache.38*/39#define D3DTR_CACHE_WIDTH 51240#define D3DTR_CACHE_HEIGHT 51241#define D3DTR_CACHE_CELL_WIDTH 1642#define D3DTR_CACHE_CELL_HEIGHT 164344/**45* This constant defines the size of the tile to use in the46* D3DTR_DrawLCDGlyphNoCache() method. See below for more on why we47* restrict this value to a particular size.48*/49#define D3DTR_NOCACHE_TILE_SIZE 325051/**52* These constants define the size of the "cached destination" texture.53* This texture is only used when rendering LCD-optimized text, as that54* codepath needs direct access to the destination. There is no way to55* access the framebuffer directly from a Direct3D shader, so we need to first56* copy the destination region corresponding to a particular glyph into57* this cached texture, and then that texture will be accessed inside the58* shader. Copying the destination into this cached texture can be a very59* expensive operation (accounting for about half the rendering time for60* LCD text), so to mitigate this cost we try to bulk read a horizontal61* region of the destination at a time. (These values are empirically62* derived for the common case where text runs horizontally.)63*64* Note: It is assumed in various calculations below that:65* (D3DTR_CACHED_DEST_WIDTH >= D3DTR_CACHE_CELL_WIDTH) &&66* (D3DTR_CACHED_DEST_WIDTH >= D3DTR_NOCACHE_TILE_SIZE) &&67* (D3DTR_CACHED_DEST_HEIGHT >= D3DTR_CACHE_CELL_HEIGHT) &&68* (D3DTR_CACHED_DEST_HEIGHT >= D3DTR_NOCACHE_TILE_SIZE)69*/70#define D3DTR_CACHED_DEST_WIDTH 51271#define D3DTR_CACHED_DEST_HEIGHT 327273#define BYTES_PER_GLYPH_IMAGE \74sun_java2d_pipe_BufferedTextPipe_BYTES_PER_GLYPH_IMAGE75#define BYTES_PER_GLYPH_POSITION \76sun_java2d_pipe_BufferedTextPipe_BYTES_PER_GLYPH_POSITION77#define BYTES_PER_POSITIONED_GLYPH \78(BYTES_PER_GLYPH_IMAGE + BYTES_PER_GLYPH_POSITION)7980#define OFFSET_CONTRAST sun_java2d_pipe_BufferedTextPipe_OFFSET_CONTRAST81#define OFFSET_RGBORDER sun_java2d_pipe_BufferedTextPipe_OFFSET_RGBORDER82#define OFFSET_SUBPIXPOS sun_java2d_pipe_BufferedTextPipe_OFFSET_SUBPIXPOS83#define OFFSET_POSITIONS sun_java2d_pipe_BufferedTextPipe_OFFSET_POSITIONS8485HRESULT D3DTR_EnableGlyphVertexCache(D3DContext *d3dc);86HRESULT D3DTR_DisableGlyphVertexCache(D3DContext *d3dc);8788HRESULT D3DTR_DrawGlyphList(D3DContext *d3dc, D3DSDOps *dstOps,89jint totalGlyphs, jboolean usePositions,90jboolean subPixPos, jboolean rgbOrder,91jint lcdContrast,92jfloat glyphListOrigX, jfloat glyphListOrigY,93unsigned char *images, unsigned char *positions);9495#endif /* D3DTextRenderer_h_Included */969798