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 23 * questions. 24 */ 25 26 package com.sun.prism.null3d; 27 28 import com.sun.glass.ui.Screen; 29 import com.sun.javafx.geom.Rectangle; 30 import com.sun.prism.Graphics; 31 import com.sun.prism.Presentable; 32 import com.sun.prism.PresentableState; 33 34 class DummySwapChain extends DummyResource implements Presentable { 35 36 private final PresentableState pState; 37 private final DummyRTTexture texBackBuffer; 38 private int w,h; 39 private boolean opaque; 40 41 DummySwapChain(DummyContext context, PresentableState pState, DummyRTTexture rtt) { 42 super(context); 43 this.pState = pState; 44 this.w = pState.getWidth(); 45 this.h = pState.getHeight(); 46 texBackBuffer = rtt; 47 } 48 49 @Override 50 public void dispose() { 51 texBackBuffer.dispose(); 52 super.dispose(); 53 } 54 55 public boolean lockResources(PresentableState pState) { 56 texBackBuffer.lock(); 57 return false; 58 } 59 60 public boolean prepare(Rectangle clip) { 61 texBackBuffer.unlock(); 62 return true; 63 } 64 65 public boolean present() { 66 return true; 67 } 68 69 public int getPhysicalWidth() { 70 return w; 71 } 72 73 public int getPhysicalHeight() { 74 return h; 75 } 76 77 public int getContentWidth() { 78 return getPhysicalWidth(); 79 } 80 81 public int getContentHeight() { 82 return getPhysicalHeight(); 83 } 84 85 public int getContentX() { 86 return 0; 87 } 88 89 public int getContentY() { 90 return 0; 91 } 92 93 @Override 94 public float getPixelScaleFactorX() { 95 return 1.0f; 96 } 97 98 @Override 99 public float getPixelScaleFactorY() { 100 return 1.0f; 101 } 102 103 public Graphics createGraphics() { 104 return DummyGraphics.create(texBackBuffer, context); 105 } 106 107 public Screen getAssociatedScreen() { 108 return context.getAssociatedScreen(); 109 } 110 111 public boolean isOpaque() { 112 return opaque; 113 } 114 115 public void setOpaque(boolean opaque) { 116 this.opaque = opaque; 117 } 118 119 @Override 120 public boolean isMSAA() { 121 return false; 122 } 123 }