430N/A/*
2362N/A * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
430N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
430N/A *
430N/A * This code is free software; you can redistribute it and/or modify it
430N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
430N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
430N/A *
430N/A * This code is distributed in the hope that it will be useful, but WITHOUT
430N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
430N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
430N/A * version 2 for more details (a copy is included in the LICENSE file that
430N/A * accompanied this code).
430N/A *
430N/A * You should have received a copy of the GNU General Public License version
430N/A * 2 along with this work; if not, write to the Free Software Foundation,
430N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
430N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
430N/A */
430N/A
430N/A#ifndef D3DGLYPHCACHE_H
430N/A#define D3DGLYPHCACHE_H
430N/A
430N/A#include "AccelGlyphCache.h"
430N/A#include "D3DContext.h"
430N/A#include "D3DResourceManager.h"
430N/A
430N/Atypedef enum {
430N/A CACHE_GRAY,
430N/A CACHE_LCD
430N/A} GlyphCacheType;
430N/A
430N/Aclass D3DContext;
430N/Aclass D3DResource;
430N/A
430N/Aclass D3DGlyphCache {
430N/Apublic:
430N/A // creates accel. glyph cache if it wasn't created, and the glyph
430N/A // cache texure
430N/A HRESULT Init(D3DContext *pCtx);
430N/A // releases the glyph cache texture, invalidates the accel. glyph cache
430N/A void ReleaseDefPoolResources();
430N/A // releases texture and deletes the accel. glyph cache
430N/A ~D3DGlyphCache();
430N/A
430N/A // adds the glyph to the accel. glyph cache and uploads it into the glyph
430N/A // cache texture
430N/A HRESULT AddGlyph(GlyphInfo *glyph);
430N/A
430N/A GlyphCacheInfo* GetGlyphCache() { return pGlyphCache; }
430N/A D3DResource* GetGlyphCacheTexture() { return pGlyphCacheRes; }
430N/A
430N/A // Note: only applicable to CACHE_LCD type of the cache
430N/A // if the new rgb order doesn't match the current one, invalidates
430N/A // the accel. glyph cache, also resets the current tileFormat
430N/A HRESULT CheckGlyphCacheByteOrder(jboolean rgbOrder);
430N/A
430N/Astatic
430N/A HRESULT CreateInstance(D3DContext *pCtx,
430N/A GlyphCacheType gcType,
430N/A D3DGlyphCache **ppGlyphCache);
430N/A
430N/Aprivate:
430N/A D3DGlyphCache(GlyphCacheType gcType);
430N/A
430N/A D3DContext *pCtx;
430N/A GlyphCacheType gcType;
430N/A D3DResource *pGlyphCacheRes;
430N/A GlyphCacheInfo *pGlyphCache;
430N/A TileFormat tileFormat;
430N/A /**
430N/A * Relevant only for the CACHE_LCD cache type.
430N/A *
430N/A * This value tracks the previous LCD rgbOrder setting, so if the rgbOrder
430N/A * value has changed since the last time, it indicates that we need to
430N/A * invalidate the cache, which may already store glyph images in the
430N/A * reverse order. Note that in most real world applications this value
430N/A * will not change over the course of the application, but tests like
430N/A * Font2DTest allow for changing the ordering at runtime, so we need to
430N/A * handle that case.
430N/A */
430N/A jboolean lastRGBOrder;
430N/A};
430N/A#endif // D3DGLYPHCACHE_H