1 /*
2  * Copyright (c) 2007, 2008, 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 _D3DSURFACEDATA_H_
27 #define _D3DSURFACEDATA_H_
28 
29 #include "java_awt_image_AffineTransformOp.h"
30 #include "sun_java2d_d3d_D3DSurfaceData.h"
31 #include "sun_java2d_pipe_hw_AccelSurface.h"
32 #include "SurfaceData.h"
33 #include <d3d9.h>
34 
35 typedef struct _D3DSDOps D3DSDOps;
36 
37 class D3DResource;
38 
39 struct _D3DSDOps {
40     SurfaceDataOps sdOps;
41 
42     // the ordinal of the d3d adapter this surface belongs to
43     // (may be different from GDI display number)
44     jint adapter;
45     jint width, height;
46 
47     // backbuffer-related data
48     jint xoff, yoff;
49     D3DSWAPEFFECT swapEffect;
50 
51     D3DResource  *pResource;
52 };
53 
54 #define UNDEFINED       sun_java2d_pipe_hw_AccelSurface_UNDEFINED
55 #define RT_PLAIN        sun_java2d_pipe_hw_AccelSurface_RT_PLAIN
56 #define TEXTURE         sun_java2d_pipe_hw_AccelSurface_TEXTURE
57 #define RT_TEXTURE      sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE
58 #define FLIP_BACKBUFFER sun_java2d_pipe_hw_AccelSurface_FLIP_BACKBUFFER
59 #define D3D_DEVICE_RESOURCE \
60                         sun_java2d_d3d_D3DSurfaceData_D3D_DEVICE_RESOURCE
61 
62 #define ST_INT_ARGB        sun_java2d_d3d_D3DSurfaceData_ST_INT_ARGB
63 #define ST_INT_ARGB_PRE    sun_java2d_d3d_D3DSurfaceData_ST_INT_ARGB_PRE
64 #define ST_INT_ARGB_BM     sun_java2d_d3d_D3DSurfaceData_ST_INT_ARGB_BM
65 #define ST_INT_RGB         sun_java2d_d3d_D3DSurfaceData_ST_INT_RGB
66 #define ST_INT_BGR         sun_java2d_d3d_D3DSurfaceData_ST_INT_BGR
67 #define ST_USHORT_565_RGB  sun_java2d_d3d_D3DSurfaceData_ST_USHORT_565_RGB
68 #define ST_USHORT_555_RGB  sun_java2d_d3d_D3DSurfaceData_ST_USHORT_555_RGB
69 #define ST_BYTE_INDEXED    sun_java2d_d3d_D3DSurfaceData_ST_BYTE_INDEXED
70 #define ST_BYTE_INDEXED_BM sun_java2d_d3d_D3DSurfaceData_ST_BYTE_INDEXED_BM
71 #define ST_3BYTE_BGR       sun_java2d_d3d_D3DSurfaceData_ST_3BYTE_BGR
72 
73 /**
74  * These are defined to be the same as ExtendedBufferCapabilities.VSyncType
75  * enum.
76  */
77 #define VSYNC_DEFAULT 0
78 #define VSYNC_ON      1
79 #define VSYNC_OFF     2
80 
81 /**
82  * These are shorthand names for the filtering method constants used by
83  * image transform methods.
84  */
85 #define D3DSD_XFORM_DEFAULT 0
86 #define D3DSD_XFORM_NEAREST_NEIGHBOR \
87     java_awt_image_AffineTransformOp_TYPE_NEAREST_NEIGHBOR
88 #define D3DSD_XFORM_BILINEAR \
89     java_awt_image_AffineTransformOp_TYPE_BILINEAR
90 
91 void D3DSD_Flush(void *pData);
92 void D3DSD_MarkLost(void *pData);
93 
94 #endif /* _D3DSURFACEDATA_H_ */
95