< prev index next >

src/java.desktop/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java

Print this page


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


 362     }
 363 
 364     private static class CGLImageCaps extends ImageCapabilities {
 365         private CGLImageCaps() {
 366             super(true);
 367         }
 368         public boolean isTrueVolatile() {
 369             return true;
 370         }
 371     }
 372 
 373     @Override
 374     public ImageCapabilities getImageCapabilities() {
 375         return imageCaps;
 376     }
 377 
 378     @Override
 379     public VolatileImage createCompatibleVolatileImage(int width, int height,
 380                                                        int transparency,
 381                                                        int type) {
 382         if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
 383             transparency == Transparency.BITMASK)
 384         {
 385             return null;
 386         }
 387 
 388         if (type == FBOBJECT) {
 389             if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
 390                 return null;
 391             }
 392         } else if (type == PBUFFER) {
 393             boolean isOpaque = transparency == Transparency.OPAQUE;
 394             if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
 395                 return null;
 396             }
 397         }
 398 
 399         SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
 400                                                           transparency, type);
 401         Surface sd = vi.getDestSurface();
 402         if (!(sd instanceof AccelSurface) ||
 403             ((AccelSurface)sd).getType() != type)
 404         {
 405             vi.flush();
 406             vi = null;
 407         }
 408 
 409         return vi;
 410     }
 411 
 412     /**
 413      * {@inheritDoc}
 414      *
 415      * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities
 416      */


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


 362     }
 363 
 364     private static class CGLImageCaps extends ImageCapabilities {
 365         private CGLImageCaps() {
 366             super(true);
 367         }
 368         public boolean isTrueVolatile() {
 369             return true;
 370         }
 371     }
 372 
 373     @Override
 374     public ImageCapabilities getImageCapabilities() {
 375         return imageCaps;
 376     }
 377 
 378     @Override
 379     public VolatileImage createCompatibleVolatileImage(int width, int height,
 380                                                        int transparency,
 381                                                        int type) {
 382         if ((type != FBOBJECT && type != TEXTURE)
 383                 || transparency == Transparency.BITMASK) {

 384             return null;
 385         }

 386         if (type == FBOBJECT) {
 387             if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
 388                 return null;
 389             }





 390         }
 391 
 392         SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
 393                                                           transparency, type);
 394         Surface sd = vi.getDestSurface();
 395         if (!(sd instanceof AccelSurface) ||
 396             ((AccelSurface)sd).getType() != type)
 397         {
 398             vi.flush();
 399             vi = null;
 400         }
 401 
 402         return vi;
 403     }
 404 
 405     /**
 406      * {@inheritDoc}
 407      *
 408      * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities
 409      */


< prev index next >