Showing the changes to java/pkg/sun/java2d/pipe/hw/AccelSurface.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,136 @@ | ||
| 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 | +package sun.java2d.pipe.hw; | |
| 27 | + | |
| 28 | +import java.awt.Rectangle; | |
| 29 | +import sun.java2d.Surface; | |
| 30 | + | |
| 31 | +/** | |
| 32 | + * Abstraction for a hardware accelerated surface. | |
| 33 | + */ | |
| 34 | +public interface AccelSurface extends BufferedContextProvider, Surface { | |
| 35 | + /** | |
| 36 | + * Undefined | |
| 37 | + */ | |
| 38 | + public static final int UNDEFINED = 0; | |
| 39 | + /** | |
| 40 | + * Window (or window substitute) surface | |
| 41 | + */ | |
| 42 | + public static final int WINDOW = 1; | |
| 43 | + /** | |
| 44 | + * Render-To Plain surface (pbuffer for OpenGL, Render Target surface | |
| 45 | + * for Direct3D) | |
| 46 | + */ | |
| 47 | + public static final int RT_PLAIN = 2; | |
| 48 | + /** | |
| 49 | + * Texture surface | |
| 50 | + */ | |
| 51 | + public static final int TEXTURE = 3; | |
| 52 | + /** | |
| 53 | + * A back-buffer surface (SwapChain surface for Direct3D, backbuffer for | |
| 54 | + * OpenGL) | |
| 55 | + */ | |
| 56 | + public static final int FLIP_BACKBUFFER = 4; | |
| 57 | + /** | |
| 58 | + * Render-To Texture surface (fbobject for OpenGL, texture with render-to | |
| 59 | + * attribute for Direct3D) | |
| 60 | + */ | |
| 61 | + public static final int RT_TEXTURE = 5; | |
| 62 | + | |
| 63 | + /** | |
| 64 | + * Returns {@code int} representing surface's type as defined by constants | |
| 65 | + * in this interface. | |
| 66 | + * | |
| 67 | + * @return an integer representing this surface's type | |
| 68 | + * @see AccelSurface#UNDEFINED | |
| 69 | + * @see AccelSurface#WINDOW | |
| 70 | + * @see AccelSurface#RT_PLAIN | |
| 71 | + * @see AccelSurface#TEXTURE | |
| 72 | + * @see AccelSurface#FLIP_BACKBUFFER | |
| 73 | + * @see AccelSurface#RT_TEXTURE | |
| 74 | + */ | |
| 75 | + public int getType(); | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * Returns a pointer to the native surface data associated with this | |
| 79 | + * surface. | |
| 80 | + * Note: this pointer is only valid on the rendering thread. | |
| 81 | + * | |
| 82 | + * @return pointer to the native surface's data | |
| 83 | + */ | |
| 84 | + public long getNativeOps(); | |
| 85 | + | |
| 86 | + /** | |
| 87 | + * Returns a pointer to the real native resource | |
| 88 | + * of the specified type associated with this AccelSurface. | |
| 89 | + * Note: this pointer is only valid on the rendering thread. | |
| 90 | + * | |
| 91 | + * @param resType the type of the requested resource | |
| 92 | + * @return a long containing a pointer to the native resource of the | |
| 93 | + * specified type or 0L if such resource doesn't exist for this surface | |
| 94 | + */ | |
| 95 | + public long getNativeResource(int resType); | |
| 96 | + | |
| 97 | + /** | |
| 98 | + * Marks this surface dirty. | |
| 99 | + */ | |
| 100 | + public void markDirty(); | |
| 101 | + | |
| 102 | + /** | |
| 103 | + * Returns whether the pipeline considers this surface valid. A surface | |
| 104 | + * may become invalid if it is disposed of, or resized. | |
| 105 | + * | |
| 106 | + * @return true if valid, false otherwise | |
| 107 | + */ | |
| 108 | + public boolean isValid(); | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * Returns whether this surface is lost. The return value is only valid | |
| 112 | + * on the render thread, meaning that even if this method returns | |
| 113 | + * {@code true} it could be lost in the next moment unless it is called | |
| 114 | + * on the rendering thread. | |
| 115 | + * | |
| 116 | + * @return true if the surface is known to be lost, false otherwise | |
| 117 | + */ | |
| 118 | + public boolean isSurfaceLost(); | |
| 119 | + | |
| 120 | + /** | |
| 121 | + * Returns the requested bounds of the destination surface. The real bounds | |
| 122 | + * of the native accelerated surface may differ. Use | |
| 123 | + * {@link #getNativeBounds} to get the bounds of the native surface. | |
| 124 | + * | |
| 125 | + * @return Rectangle representing java surface's bounds | |
| 126 | + */ | |
| 127 | + public Rectangle getBounds(); | |
| 128 | + | |
| 129 | + /** | |
| 130 | + * Returns real bounds of the native surface, which may differ from those | |
| 131 | + * returned by {@link #getBounds}. | |
| 132 | + * | |
| 133 | + * @return Rectangle representing native surface's bounds | |
| 134 | + */ | |
| 135 | + public Rectangle getNativeBounds(); | |
| 136 | +} | |