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 D3DMASKCACHE_H
430N/A#define D3DMASKCACHE_H
430N/A
430N/A#include "jni.h"
430N/A#include "D3DContext.h"
430N/A
430N/A/**
430N/A * Constants that control the size of the texture tile cache used for
430N/A * mask operations.
430N/A */
430N/A#define D3D_MASK_CACHE_TILE_WIDTH 32
430N/A#define D3D_MASK_CACHE_TILE_HEIGHT 32
430N/A#define D3D_MASK_CACHE_TILE_SIZE \
430N/A (D3D_MASK_CACHE_TILE_WIDTH * D3D_MASK_CACHE_TILE_HEIGHT)
430N/A
430N/A#define D3D_MASK_CACHE_WIDTH_IN_TILES 8
430N/A#define D3D_MASK_CACHE_HEIGHT_IN_TILES 4
430N/A
430N/A#define D3D_MASK_CACHE_WIDTH_IN_TEXELS \
430N/A (D3D_MASK_CACHE_TILE_WIDTH * D3D_MASK_CACHE_WIDTH_IN_TILES)
430N/A#define D3D_MASK_CACHE_HEIGHT_IN_TEXELS \
430N/A (D3D_MASK_CACHE_TILE_HEIGHT * D3D_MASK_CACHE_HEIGHT_IN_TILES)
430N/A
430N/A/*
430N/A * We reserve one (fully opaque) tile in the upper-right corner for
430N/A * operations where the mask is null.
430N/A */
430N/A#define D3D_MASK_CACHE_MAX_INDEX \
430N/A ((D3D_MASK_CACHE_WIDTH_IN_TILES * D3D_MASK_CACHE_HEIGHT_IN_TILES) - 1)
430N/A#define D3D_MASK_CACHE_SPECIAL_TILE_X \
430N/A (D3D_MASK_CACHE_WIDTH_IN_TEXELS - D3D_MASK_CACHE_TILE_WIDTH)
430N/A#define D3D_MASK_CACHE_SPECIAL_TILE_Y \
430N/A (D3D_MASK_CACHE_HEIGHT_IN_TEXELS - D3D_MASK_CACHE_TILE_HEIGHT)
430N/A
430N/Aclass D3DContext;
430N/A
430N/Aclass D3DMaskCache {
430N/Apublic:
430N/A HRESULT Init(D3DContext *pCtx);
430N/A void ReleaseDefPoolResources() {};
430N/A ~D3DMaskCache();
430N/A HRESULT Enable();
430N/A HRESULT Disable();
430N/A HRESULT AddMaskQuad(int srcx, int srcy,
430N/A int dstx, int dsty,
430N/A int width, int height,
430N/A int maskscan, void *mask);
430N/A
430N/Astatic
430N/A HRESULT CreateInstance(D3DContext *pCtx, D3DMaskCache **ppMaskCache);
430N/A
430N/Aprivate:
430N/A D3DMaskCache();
430N/A UINT maskCacheIndex;
430N/A D3DContext *pCtx;
430N/A};
430N/A
430N/A#endif // D3DMASKCACHE_H