< prev index next >

src/java.desktop/share/native/common/java2d/opengl/OGLSurfaceData.h

Print this page


   1 /*
   2  * Copyright (c) 2003, 2012, 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


 101  * to disable writes into the alpha channel) to ensure that the surface
 102  * remains fully opaque.
 103  *
 104  *     jboolean needsInit;
 105  * If true, the surface requires some one-time initialization, which should
 106  * be performed after a context has been made current to the surface for
 107  * the first time.
 108  *
 109  *     jint x/yOffset
 110  * The offset in pixels of the OpenGL viewport origin from the lower-left
 111  * corner of the heavyweight drawable.  For example, a top-level frame on
 112  * Windows XP has lower-left insets of (4,4).  The OpenGL viewport origin
 113  * would typically begin at the lower-left corner of the client region (inside
 114  * the frame decorations), but AWT/Swing will take the insets into account
 115  * when rendering into that window.  So in order to account for this, we
 116  * need to adjust the OpenGL viewport origin by an x/yOffset of (-4,-4).  On
 117  * X11, top-level frames typically don't have this insets issue, so their
 118  * x/yOffset would be (0,0) (the same applies to pbuffers).
 119  *
 120  *     jint width/height;
 121  * The cached surface bounds.  For offscreen surface types (OGLSD_PBUFFER,
 122  * OGLSD_TEXTURE, etc.) these values must remain constant.  Onscreen window
 123  * surfaces (OGLSD_WINDOW, OGLSD_FLIP_BACKBUFFER, etc.) may have their
 124  * bounds changed in response to a programmatic or user-initiated event, so
 125  * these values represent the last known dimensions.  To determine the true
 126  * current bounds of this surface, query the native Drawable through the
 127  * privOps field.
 128  *
 129  *     GLuint textureID;
 130  * The texture object handle, as generated by glGenTextures().  If this value
 131  * is zero, the texture has not yet been initialized.
 132  *
 133  *     jint textureWidth/Height;
 134  * The actual bounds of the texture object for this surface.  If the
 135  * GL_ARB_texture_non_power_of_two extension is not present, the dimensions
 136  * of an OpenGL texture object must be a power-of-two (e.g. 64x32 or 128x512).
 137  * The texture image that we care about has dimensions specified by the width
 138  * and height fields in this OGLSDOps structure.  For example, if the image
 139  * to be stored in the texture has dimensions 115x47, the actual OpenGL
 140  * texture we allocate will have dimensions 128x64 to meet the pow2
 141  * restriction.  The image bounds within the texture can be accessed using


 201     } while (0)
 202 
 203 #define GLRECT_BODY_XYWH(x, y, w, h) \
 204     GLRECT_BODY_XYXY(x, y, (x) + (w), (y) + (h))
 205 
 206 #define GLRECT_END j2d_glEnd()
 207 
 208 #define GLRECT(x, y, w, h) \
 209     do { \
 210         GLRECT_BEGIN; \
 211         GLRECT_BODY_XYWH(x, y, w, h); \
 212         GLRECT_END; \
 213     } while (0)
 214 
 215 /**
 216  * These are shorthand names for the surface type constants defined in
 217  * OGLSurfaceData.java.
 218  */
 219 #define OGLSD_UNDEFINED       sun_java2d_pipe_hw_AccelSurface_UNDEFINED
 220 #define OGLSD_WINDOW          sun_java2d_pipe_hw_AccelSurface_WINDOW
 221 #define OGLSD_PBUFFER         sun_java2d_pipe_hw_AccelSurface_RT_PLAIN
 222 #define OGLSD_TEXTURE         sun_java2d_pipe_hw_AccelSurface_TEXTURE
 223 #define OGLSD_FLIP_BACKBUFFER sun_java2d_pipe_hw_AccelSurface_FLIP_BACKBUFFER
 224 #define OGLSD_FBOBJECT        sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE
 225 
 226 /**
 227  * These are shorthand names for the filtering method constants used by
 228  * image transform methods.
 229  */
 230 #define OGLSD_XFORM_DEFAULT 0
 231 #define OGLSD_XFORM_NEAREST_NEIGHBOR \
 232     java_awt_image_AffineTransformOp_TYPE_NEAREST_NEIGHBOR
 233 #define OGLSD_XFORM_BILINEAR \
 234     java_awt_image_AffineTransformOp_TYPE_BILINEAR
 235 
 236 /**
 237  * Helper macros that update the current texture filter state only when
 238  * it needs to be changed, which helps reduce overhead for small texturing
 239  * operations.  The filter state is set on a per-texture (not per-context)
 240  * basis; for example, it is possible for one texture to be using GL_NEAREST
 241  * while another texture uses GL_LINEAR under the same context.


   1 /*
   2  * Copyright (c) 2003, 2015, 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


 101  * to disable writes into the alpha channel) to ensure that the surface
 102  * remains fully opaque.
 103  *
 104  *     jboolean needsInit;
 105  * If true, the surface requires some one-time initialization, which should
 106  * be performed after a context has been made current to the surface for
 107  * the first time.
 108  *
 109  *     jint x/yOffset
 110  * The offset in pixels of the OpenGL viewport origin from the lower-left
 111  * corner of the heavyweight drawable.  For example, a top-level frame on
 112  * Windows XP has lower-left insets of (4,4).  The OpenGL viewport origin
 113  * would typically begin at the lower-left corner of the client region (inside
 114  * the frame decorations), but AWT/Swing will take the insets into account
 115  * when rendering into that window.  So in order to account for this, we
 116  * need to adjust the OpenGL viewport origin by an x/yOffset of (-4,-4).  On
 117  * X11, top-level frames typically don't have this insets issue, so their
 118  * x/yOffset would be (0,0) (the same applies to pbuffers).
 119  *
 120  *     jint width/height;
 121  * The cached surface bounds.  For offscreen surface types (OGLSD_FBOBJECT,
 122  * OGLSD_TEXTURE, etc.) these values must remain constant.  Onscreen window
 123  * surfaces (OGLSD_WINDOW, OGLSD_FLIP_BACKBUFFER, etc.) may have their
 124  * bounds changed in response to a programmatic or user-initiated event, so
 125  * these values represent the last known dimensions.  To determine the true
 126  * current bounds of this surface, query the native Drawable through the
 127  * privOps field.
 128  *
 129  *     GLuint textureID;
 130  * The texture object handle, as generated by glGenTextures().  If this value
 131  * is zero, the texture has not yet been initialized.
 132  *
 133  *     jint textureWidth/Height;
 134  * The actual bounds of the texture object for this surface.  If the
 135  * GL_ARB_texture_non_power_of_two extension is not present, the dimensions
 136  * of an OpenGL texture object must be a power-of-two (e.g. 64x32 or 128x512).
 137  * The texture image that we care about has dimensions specified by the width
 138  * and height fields in this OGLSDOps structure.  For example, if the image
 139  * to be stored in the texture has dimensions 115x47, the actual OpenGL
 140  * texture we allocate will have dimensions 128x64 to meet the pow2
 141  * restriction.  The image bounds within the texture can be accessed using


 201     } while (0)
 202 
 203 #define GLRECT_BODY_XYWH(x, y, w, h) \
 204     GLRECT_BODY_XYXY(x, y, (x) + (w), (y) + (h))
 205 
 206 #define GLRECT_END j2d_glEnd()
 207 
 208 #define GLRECT(x, y, w, h) \
 209     do { \
 210         GLRECT_BEGIN; \
 211         GLRECT_BODY_XYWH(x, y, w, h); \
 212         GLRECT_END; \
 213     } while (0)
 214 
 215 /**
 216  * These are shorthand names for the surface type constants defined in
 217  * OGLSurfaceData.java.
 218  */
 219 #define OGLSD_UNDEFINED       sun_java2d_pipe_hw_AccelSurface_UNDEFINED
 220 #define OGLSD_WINDOW          sun_java2d_pipe_hw_AccelSurface_WINDOW

 221 #define OGLSD_TEXTURE         sun_java2d_pipe_hw_AccelSurface_TEXTURE
 222 #define OGLSD_FLIP_BACKBUFFER sun_java2d_pipe_hw_AccelSurface_FLIP_BACKBUFFER
 223 #define OGLSD_FBOBJECT        sun_java2d_pipe_hw_AccelSurface_RT_TEXTURE
 224 
 225 /**
 226  * These are shorthand names for the filtering method constants used by
 227  * image transform methods.
 228  */
 229 #define OGLSD_XFORM_DEFAULT 0
 230 #define OGLSD_XFORM_NEAREST_NEIGHBOR \
 231     java_awt_image_AffineTransformOp_TYPE_NEAREST_NEIGHBOR
 232 #define OGLSD_XFORM_BILINEAR \
 233     java_awt_image_AffineTransformOp_TYPE_BILINEAR
 234 
 235 /**
 236  * Helper macros that update the current texture filter state only when
 237  * it needs to be changed, which helps reduce overhead for small texturing
 238  * operations.  The filter state is set on a per-texture (not per-context)
 239  * basis; for example, it is possible for one texture to be using GL_NEAREST
 240  * while another texture uses GL_LINEAR under the same context.


< prev index next >