1 /* 2 * Copyright (c) 2003, 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.awt.image; 27 28 import sun.java2d.SurfaceData; 29 30 /** 31 * This SurfaceManager variant manages an unaccelerated volatile surface. 32 * This class is created in the event that someone requested a VolatileImage 33 * to be created from a BufferedImageGraphicsConfig, which is not platform- 34 * or hardware-based, thus the resulting surface and surface manager 35 * are unaccelerated. All we do in this class is implement the abstract 36 * methods of VolatileSurfaceManager to return values that indicate that 37 * we cannot accelerate surfaces through this SurfaceManager, thus the 38 * parent class will handle things through the unaccelerated backup mechanism. 39 */ 40 public class BufImgVolatileSurfaceManager extends VolatileSurfaceManager { 41 42 /** 43 * This constructor simply defers to the superclass since all of the real 44 * functionality of this class is implemented in VolatileSurfaceManager. 45 */ BufImgVolatileSurfaceManager(SunVolatileImage vImg, Object context)46 public BufImgVolatileSurfaceManager(SunVolatileImage vImg, Object context) { 47 super(vImg, context); 48 } 49 50 /** 51 * Returns false to indicate that this surface manager cannot accelerate 52 * the image. 53 */ isAccelerationEnabled()54 protected boolean isAccelerationEnabled() { 55 return false; 56 } 57 58 /** 59 * Returns null to indicate failure in creating the accelerated surface. 60 * Note that this method should not ever be called since creation of 61 * accelerated surfaces should be preceded by calls to the above 62 * isAccelerationEnabled() method. But we need to override this method 63 * since it is abstract in our parent class. 64 */ initAcceleratedSurface()65 protected SurfaceData initAcceleratedSurface() { 66 return null; 67 } 68 } 69