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 */
417 @Override
418 public ContextCapabilities getContextCapabilities() {
|
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 || type == FBOBJECT && !isCapPresent(CAPS_EXT_FBOBJECT)) {
385 return null;
386 }
387 SunVolatileImage vi = new AccelTypedVolatileImage(this, width, height,
388 transparency, type);
389 Surface sd = vi.getDestSurface();
390 if (!(sd instanceof AccelSurface) ||
391 ((AccelSurface)sd).getType() != type)
392 {
393 vi.flush();
394 vi = null;
395 }
396
397 return vi;
398 }
399
400 /**
401 * {@inheritDoc}
402 *
403 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities
404 */
405 @Override
406 public ContextCapabilities getContextCapabilities() {
|