jdk/src/share/classes/sun/java2d/pipe/hw/AccelSurface.java
author erikj
Thu, 07 Jun 2012 18:05:09 -0700
changeset 12813 c10ab96dcf41
parent 5506 202f599c92aa
child 16734 da1901d79073
permissions -rw-r--r--
7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI Reviewed-by: ohair, ohrstrom, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 887
diff changeset
     2
 * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     4
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 887
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 887
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    10
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    15
 * accompanied this code).
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    16
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 887
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 887
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 887
diff changeset
    23
 * questions.
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    24
 */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    25
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    26
package sun.java2d.pipe.hw;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    27
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    28
import java.awt.Rectangle;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    29
import sun.java2d.Surface;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    30
12813
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    31
import javax.tools.annotation.GenerateNativeHeader;
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    32
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    33
/**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    34
 * Abstraction for a hardware accelerated surface.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    35
 */
12813
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    36
/* No native methods here, but the constants are needed in the supporting JNI code */
c10ab96dcf41 7170969: Add @GenerateNativeHeader to classes whose fields need to be exported for JNI
erikj
parents: 5506
diff changeset
    37
@GenerateNativeHeader
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    38
public interface AccelSurface extends BufferedContextProvider, Surface {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    39
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    40
     * Undefined
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    41
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    42
    public static final int UNDEFINED       = 0;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    43
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    44
     * Window (or window substitute) surface
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    45
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    46
    public static final int WINDOW          = 1;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    47
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    48
     * Render-To Plain surface (pbuffer for OpenGL, Render Target surface
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    49
     * for Direct3D)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    50
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    51
    public static final int RT_PLAIN        = 2;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    52
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    53
     * Texture surface
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    54
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    55
    public static final int TEXTURE         = 3;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    56
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    57
     * A back-buffer surface (SwapChain surface for Direct3D, backbuffer for
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    58
     * OpenGL)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    59
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    60
    public static final int FLIP_BACKBUFFER = 4;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    61
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    62
     * Render-To Texture surface (fbobject for OpenGL, texture with render-to
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    63
     * attribute for Direct3D)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    64
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    65
    public static final int RT_TEXTURE      = 5;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    66
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    67
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    68
     * Returns {@code int} representing surface's type as defined by constants
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    69
     * in this interface.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    70
     *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    71
     * @return an integer representing this surface's type
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    72
     * @see AccelSurface#UNDEFINED
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    73
     * @see AccelSurface#WINDOW
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    74
     * @see AccelSurface#RT_PLAIN
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    75
     * @see AccelSurface#TEXTURE
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    76
     * @see AccelSurface#FLIP_BACKBUFFER
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    77
     * @see AccelSurface#RT_TEXTURE
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    78
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    79
    public int getType();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    80
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    81
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    82
     * Returns a pointer to the native surface data associated with this
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    83
     * surface.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    84
     * Note: this pointer is only valid on the rendering thread.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    85
     *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    86
     * @return pointer to the native surface's data
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    87
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    88
    public long getNativeOps();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    89
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    90
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    91
     * Returns a pointer to the real native resource
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    92
     * of the specified type associated with this AccelSurface.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    93
     * Note: this pointer is only valid on the rendering thread.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    94
     *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    95
     * @param resType the type of the requested resource
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    96
     * @return a long containing a pointer to the native resource of the
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    97
     * specified type or 0L if such resource doesn't exist for this surface
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    98
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
    99
    public long getNativeResource(int resType);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   100
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   101
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   102
     * Marks this surface dirty.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   103
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   104
    public void markDirty();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   105
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   106
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   107
     * Returns whether the pipeline considers this surface valid. A surface
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   108
     * may become invalid if it is disposed of, or resized.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   109
     *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   110
     * @return true if valid, false otherwise
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   111
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   112
    public boolean isValid();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   113
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   114
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   115
     * Returns whether this surface is lost. The return value is only valid
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   116
     * on the render thread, meaning that even if this method returns
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   117
     * {@code true} it could be lost in the next moment unless it is called
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   118
     * on the rendering thread.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   119
     *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   120
     * @return true if the surface is known to be lost, false otherwise
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   121
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   122
    public boolean isSurfaceLost();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   123
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   124
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   125
     * Returns the requested bounds of the destination surface. The real bounds
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   126
     * of the native accelerated surface may differ. Use
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   127
     * {@link #getNativeBounds} to get the bounds of the native surface.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   128
     *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   129
     * @return Rectangle representing java surface's bounds
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   130
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   131
    public Rectangle getBounds();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   132
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   133
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   134
     * Returns real bounds of the native surface, which may differ from those
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   135
     * returned by {@link #getBounds}.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   136
     *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   137
     * @return Rectangle representing native surface's bounds
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   138
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   139
    public Rectangle getNativeBounds();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents:
diff changeset
   140
}