jdk/src/windows/native/sun/windows/awt_DrawingSurface.h
author tdv
Tue, 22 Jul 2008 11:24:32 -0700
changeset 888 c7009cf0001f
parent 887 0aab8d3fa11a
child 5506 202f599c92aa
permissions -rw-r--r--
6728492: typo in copyrights in some files touched by the d3d pipeline port Reviewed-by: prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
888
c7009cf0001f 6728492: typo in copyrights in some files touched by the d3d pipeline port
tdv
parents: 887
diff changeset
     2
 * Copyright 1997-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#ifndef AWT_DRAWING_SURFACE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define AWT_DRAWING_SURFACE_H
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "stdhdrs.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include <jawt.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include <jawt_md.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include "awt_Component.h"
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    33
#include <ddraw.h>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
class JAWTDrawingSurface;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
class JAWTOffscreenDrawingSurface;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
class JAWTOffscreenDrawingSurfaceInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * New structure for 1.4.1_02 release that allows access to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * offscreen drawing surfaces.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * This structure is slightly different from the old Win32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * structure because the type of information we pass back
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * to the caller is dependent upon runtime configuration.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * For example, we may have a DirectX7 surface pointer if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * the runtime system had DX7 installed, but we may only have
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * a DirectX5 surface if that was the latest version installed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * We may also, in the future, offer different types of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * surface, such as OpenGL surfaces, based on runtime
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * configuration and user options.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * Given this variability, the correct usage of this structure
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * involves checking the surfaceType variable to see what type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * of pointer we have returned and then casting the lpSurface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * variable and using it based on the surfaceType.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
typedef struct jawt_Win32OffscreenDrawingSurfaceInfo {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    IDirectDrawSurface  *dxSurface;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    IDirectDrawSurface7 *dx7Surface;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
} JAWT_Win32OffscreenDrawingSurfaceInfo;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * Drawing surface info houses the important drawing information.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * Here we multiply inherit from both structures, the platform-specific
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * and the platform-independent versions, so they are treated as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * same object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
class JAWTDrawingSurfaceInfo : public JAWT_Win32DrawingSurfaceInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public JAWT_DrawingSurfaceInfo {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    jint Init(JAWTDrawingSurface* parent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    JAWT_Rectangle clipRect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * Same as above except for offscreen surfaces instead of onscreen
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * Components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
class JAWTOffscreenDrawingSurfaceInfo :
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    public JAWT_Win32OffscreenDrawingSurfaceInfo,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    public JAWT_DrawingSurfaceInfo
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    jint Init(JAWTOffscreenDrawingSurface* parent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * The drawing surface wrapper.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
class JAWTDrawingSurface : public JAWT_DrawingSurface {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    JAWTDrawingSurface() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    JAWTDrawingSurface(JNIEnv* env, jobject rTarget);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    virtual ~JAWTDrawingSurface();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    JAWTDrawingSurfaceInfo info;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
// Static function pointers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    static jint JNICALL LockSurface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        (JAWT_DrawingSurface* ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    static JAWT_DrawingSurfaceInfo* JNICALL GetDSI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        (JAWT_DrawingSurface* ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    static void JNICALL FreeDSI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        (JAWT_DrawingSurfaceInfo* dsi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    static void JNICALL UnlockSurface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        (JAWT_DrawingSurface* ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * Same as above except for offscreen surfaces instead of onscreen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * Components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
class JAWTOffscreenDrawingSurface : public JAWTDrawingSurface {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    JAWTOffscreenDrawingSurface() {}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    JAWTOffscreenDrawingSurface(JNIEnv* env, jobject rTarget);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    virtual ~JAWTOffscreenDrawingSurface();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    JAWTOffscreenDrawingSurfaceInfo info;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
// Static function pointers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
public:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    static JAWT_DrawingSurfaceInfo* JNICALL GetDSI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
        (JAWT_DrawingSurface* ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    static void JNICALL FreeDSI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
        (JAWT_DrawingSurfaceInfo* dsi);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    static jint JNICALL LockSurface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
        (JAWT_DrawingSurface* ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    static void JNICALL UnlockSurface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
        (JAWT_DrawingSurface* ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
#ifdef __cplusplus
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
extern "C" {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    _JNI_IMPORT_OR_EXPORT_
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    JAWT_DrawingSurface* JNICALL DSGetDrawingSurface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        (JNIEnv* env, jobject target);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    _JNI_IMPORT_OR_EXPORT_
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    void JNICALL DSFreeDrawingSurface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        (JAWT_DrawingSurface* ds);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    _JNI_IMPORT_OR_EXPORT_
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    void JNICALL DSLockAWT(JNIEnv* env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    _JNI_IMPORT_OR_EXPORT_
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    void JNICALL DSUnlockAWT(JNIEnv* env);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    _JNI_IMPORT_OR_EXPORT_
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    jobject JNICALL DSGetComponent(JNIEnv* env, void* platformInfo);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
#ifdef __cplusplus
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
} /* extern "C" */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
#endif /* AWT_DRAWING_SURFACE_H */