308N/A/*
2362N/A * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
308N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
308N/A *
308N/A * This code is free software; you can redistribute it and/or modify it
308N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
308N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
308N/A *
308N/A * This code is distributed in the hope that it will be useful, but WITHOUT
308N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308N/A * version 2 for more details (a copy is included in the LICENSE file that
308N/A * accompanied this code).
308N/A *
308N/A * You should have received a copy of the GNU General Public License version
308N/A * 2 along with this work; if not, write to the Free Software Foundation,
308N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
308N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
308N/A */
308N/A
308N/Apackage sun.java2d;
308N/A
308N/Aimport java.awt.GraphicsConfiguration;
430N/Aimport sun.awt.image.BufImgVolatileSurfaceManager;
308N/Aimport sun.awt.image.SunVolatileImage;
308N/Aimport sun.awt.image.VolatileSurfaceManager;
430N/Aimport sun.java2d.d3d.D3DGraphicsConfig;
430N/Aimport sun.java2d.d3d.D3DVolatileSurfaceManager;
308N/Aimport sun.java2d.opengl.WGLGraphicsConfig;
308N/Aimport sun.java2d.opengl.WGLVolatileSurfaceManager;
308N/A
308N/A/**
308N/A * The SurfaceManagerFactory that creates VolatileSurfaceManager
308N/A * implementations for the Windows volatile images.
308N/A */
308N/Apublic class WindowsSurfaceManagerFactory extends SurfaceManagerFactory {
308N/A
308N/A /**
308N/A * Creates a new instance of a VolatileSurfaceManager given any
308N/A * arbitrary SunVolatileImage. An optional context Object can be supplied
308N/A * as a way for the caller to pass pipeline-specific context data to
308N/A * the VolatileSurfaceManager (such as a backbuffer handle, for example).
308N/A *
308N/A * For Windows platforms, this method returns a Windows-specific
308N/A * VolatileSurfaceManager.
308N/A */
308N/A public VolatileSurfaceManager createVolatileManager(SunVolatileImage vImg,
308N/A Object context)
308N/A {
308N/A GraphicsConfiguration gc = vImg.getGraphicsConfig();
430N/A if (gc instanceof D3DGraphicsConfig) {
430N/A return new D3DVolatileSurfaceManager(vImg, context);
430N/A } else if (gc instanceof WGLGraphicsConfig) {
308N/A return new WGLVolatileSurfaceManager(vImg, context);
308N/A } else {
430N/A return new BufImgVolatileSurfaceManager(vImg, context);
308N/A }
308N/A }
308N/A
308N/A}