Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/java2d/pipe/hw/AccelSurface.java
38918 views
/*1* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.java2d.pipe.hw;2627import java.awt.Rectangle;28import sun.java2d.Surface;2930import java.lang.annotation.Native;3132/**33* Abstraction for a hardware accelerated surface.34*/35public interface AccelSurface extends BufferedContextProvider, Surface {36/**37* Undefined38*/39@Native public static final int UNDEFINED = 0;40/**41* Window (or window substitute) surface42*/43@Native public static final int WINDOW = 1;44/**45* Render-To Plain surface (pbuffer for OpenGL, Render Target surface46* for Direct3D)47*/48@Native public static final int RT_PLAIN = 2;49/**50* Texture surface51*/52@Native public static final int TEXTURE = 3;53/**54* A back-buffer surface (SwapChain surface for Direct3D, backbuffer for55* OpenGL)56*/57@Native public static final int FLIP_BACKBUFFER = 4;58/**59* Render-To Texture surface (fbobject for OpenGL, texture with render-to60* attribute for Direct3D)61*/62@Native public static final int RT_TEXTURE = 5;6364/**65* Returns {@code int} representing surface's type as defined by constants66* in this interface.67*68* @return an integer representing this surface's type69* @see AccelSurface#UNDEFINED70* @see AccelSurface#WINDOW71* @see AccelSurface#RT_PLAIN72* @see AccelSurface#TEXTURE73* @see AccelSurface#FLIP_BACKBUFFER74* @see AccelSurface#RT_TEXTURE75*/76public int getType();7778/**79* Returns a pointer to the native surface data associated with this80* surface.81* Note: this pointer is only valid on the rendering thread.82*83* @return pointer to the native surface's data84*/85public long getNativeOps();8687/**88* Returns a pointer to the real native resource89* of the specified type associated with this AccelSurface.90* Note: this pointer is only valid on the rendering thread.91*92* @param resType the type of the requested resource93* @return a long containing a pointer to the native resource of the94* specified type or 0L if such resource doesn't exist for this surface95*/96public long getNativeResource(int resType);9798/**99* Marks this surface dirty.100*/101public void markDirty();102103/**104* Returns whether the pipeline considers this surface valid. A surface105* may become invalid if it is disposed of, or resized.106*107* @return true if valid, false otherwise108*/109public boolean isValid();110111/**112* Returns whether this surface is lost. The return value is only valid113* on the render thread, meaning that even if this method returns114* {@code true} it could be lost in the next moment unless it is called115* on the rendering thread.116*117* @return true if the surface is known to be lost, false otherwise118*/119public boolean isSurfaceLost();120121/**122* Returns the requested bounds of the destination surface. The real bounds123* of the native accelerated surface may differ. Use124* {@link #getNativeBounds} to get the bounds of the native surface.125*126* @return Rectangle representing java surface's bounds127*/128public Rectangle getBounds();129130/**131* Returns real bounds of the native surface, which may differ from those132* returned by {@link #getBounds}.133*134* @return Rectangle representing native surface's bounds135*/136public Rectangle getNativeBounds();137}138139140