1 /*
2 * Copyright (c) 2004, 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
23 * questions.
24 */
25
26 package sun.java2d.opengl;
27
28 import java.awt.AWTException;
29 import java.awt.BufferCapabilities;
30 import java.awt.BufferCapabilities.FlipContents;
31 import java.awt.Color;
32 import java.awt.Component;
33 import java.awt.Graphics;
34 import java.awt.Graphics2D;
35 import java.awt.ImageCapabilities;
36 import java.awt.Transparency;
37 import java.awt.color.ColorSpace;
38 import java.awt.image.ColorModel;
39 import java.awt.image.DataBuffer;
40 import java.awt.image.DirectColorModel;
41 import java.awt.image.VolatileImage;
42 import sun.awt.Win32GraphicsConfig;
43 import sun.awt.Win32GraphicsDevice;
44 import sun.awt.image.SunVolatileImage;
45 import sun.awt.image.SurfaceManager;
46 import sun.awt.windows.WComponentPeer;
47 import sun.java2d.Disposer;
48 import sun.java2d.DisposerRecord;
49 import sun.java2d.SunGraphics2D;
50 import sun.java2d.Surface;
408 public boolean isTrueVolatile() {
409 return true;
410 }
411 }
412
413 @Override
414 public ImageCapabilities getImageCapabilities() {
415 return imageCaps;
416 }
417
418 /**
419 * {@inheritDoc}
420 *
421 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
422 */
423 @Override
424 public VolatileImage
425 createCompatibleVolatileImage(int width, int height,
426 int transparency, int type)
427 {
428 if (type == FLIP_BACKBUFFER || type == WINDOW || type == UNDEFINED ||
429 transparency == Transparency.BITMASK)
430 {
431 return null;
432 }
433
434 if (type == FBOBJECT) {
435 if (!isCapPresent(CAPS_EXT_FBOBJECT)) {
436 return null;
437 }
438 } else if (type == PBUFFER) {
439 boolean isOpaque = transparency == Transparency.OPAQUE;
440 if (!isOpaque && !isCapPresent(CAPS_STORED_ALPHA)) {
441 return null;
442 }
443 }
444
445 SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
446 transparency, type);
447 Surface sd = vi.getDestSurface();
448 if (!(sd instanceof AccelSurface) ||
449 ((AccelSurface)sd).getType() != type)
450 {
451 vi.flush();
452 vi = null;
453 }
454
455 return vi;
456 }
457
458 /**
459 * {@inheritDoc}
460 *
461 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities
462 */
463 @Override
464 public ContextCapabilities getContextCapabilities() {
|
1 /*
2 * Copyright (c) 2004, 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
23 * questions.
24 */
25
26 package sun.java2d.opengl;
27
28 import java.awt.AWTException;
29 import java.awt.BufferCapabilities;
30 import java.awt.Color;
31 import java.awt.Component;
32 import java.awt.Graphics;
33 import java.awt.Graphics2D;
34 import java.awt.ImageCapabilities;
35 import java.awt.Transparency;
36 import java.awt.color.ColorSpace;
37 import java.awt.image.ColorModel;
38 import java.awt.image.DataBuffer;
39 import java.awt.image.DirectColorModel;
40 import java.awt.image.VolatileImage;
41 import sun.awt.Win32GraphicsConfig;
42 import sun.awt.Win32GraphicsDevice;
43 import sun.awt.image.SunVolatileImage;
44 import sun.awt.image.SurfaceManager;
45 import sun.awt.windows.WComponentPeer;
46 import sun.java2d.Disposer;
47 import sun.java2d.DisposerRecord;
48 import sun.java2d.SunGraphics2D;
49 import sun.java2d.Surface;
407 public boolean isTrueVolatile() {
408 return true;
409 }
410 }
411
412 @Override
413 public ImageCapabilities getImageCapabilities() {
414 return imageCaps;
415 }
416
417 /**
418 * {@inheritDoc}
419 *
420 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#createCompatibleVolatileImage
421 */
422 @Override
423 public VolatileImage
424 createCompatibleVolatileImage(int width, int height,
425 int transparency, int type)
426 {
427 if ((type != FBOBJECT && type != TEXTURE)
428 || transparency == Transparency.BITMASK
429 || type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) {
430 return null;
431 }
432 SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
433 transparency, type);
434 Surface sd = vi.getDestSurface();
435 if (!(sd instanceof AccelSurface) ||
436 ((AccelSurface)sd).getType() != type)
437 {
438 vi.flush();
439 vi = null;
440 }
441
442 return vi;
443 }
444
445 /**
446 * {@inheritDoc}
447 *
448 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities
449 */
450 @Override
451 public ContextCapabilities getContextCapabilities() {
|