Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/native/sun/java2d/d3d/D3DGlyphCache.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 D3DGLYPHCACHE_H26#define D3DGLYPHCACHE_H2728#include "AccelGlyphCache.h"29#include "D3DContext.h"30#include "D3DResourceManager.h"3132typedef enum {33CACHE_GRAY,34CACHE_LCD35} GlyphCacheType;3637class D3DContext;38class D3DResource;3940class D3DGlyphCache {41public:42// creates accel. glyph cache if it wasn't created, and the glyph43// cache texure44HRESULT Init(D3DContext *pCtx);45// releases the glyph cache texture, invalidates the accel. glyph cache46void ReleaseDefPoolResources();47// releases texture and deletes the accel. glyph cache48~D3DGlyphCache();4950// adds the glyph to the accel. glyph cache and uploads it into the glyph51// cache texture52HRESULT AddGlyph(GlyphInfo *glyph);5354GlyphCacheInfo* GetGlyphCache() { return pGlyphCache; }55D3DResource* GetGlyphCacheTexture() { return pGlyphCacheRes; }5657// Note: only applicable to CACHE_LCD type of the cache58// if the new rgb order doesn't match the current one, invalidates59// the accel. glyph cache, also resets the current tileFormat60HRESULT CheckGlyphCacheByteOrder(jboolean rgbOrder);6162static63HRESULT CreateInstance(D3DContext *pCtx,64GlyphCacheType gcType,65D3DGlyphCache **ppGlyphCache);6667private:68D3DGlyphCache(GlyphCacheType gcType);6970D3DContext *pCtx;71GlyphCacheType gcType;72D3DResource *pGlyphCacheRes;73GlyphCacheInfo *pGlyphCache;74TileFormat tileFormat;75/**76* Relevant only for the CACHE_LCD cache type.77*78* This value tracks the previous LCD rgbOrder setting, so if the rgbOrder79* value has changed since the last time, it indicates that we need to80* invalidate the cache, which may already store glyph images in the81* reverse order. Note that in most real world applications this value82* will not change over the course of the application, but tests like83* Font2DTest allow for changing the ordering at runtime, so we need to84* handle that case.85*/86jboolean lastRGBOrder;87};88#endif // D3DGLYPHCACHE_H899091