1 /* 2 * Copyright (c) 2009, 2013, 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.impl.ps; 27 28 import com.sun.prism.Image; 29 import com.sun.prism.Texture; 30 import com.sun.prism.impl.BaseResourceFactory; 31 import com.sun.prism.impl.shape.BasicEllipseRep; 32 import com.sun.prism.impl.shape.BasicRoundRectRep; 33 import com.sun.prism.impl.shape.BasicShapeRep; 34 import com.sun.prism.ps.ShaderFactory; 35 import com.sun.prism.shape.ShapeRep; 36 import com.sun.prism.impl.PrismSettings; 37 import java.util.Map; 38 39 public abstract class BaseShaderFactory extends BaseResourceFactory 40 implements ShaderFactory 41 { 42 public BaseShaderFactory() { 43 super(); 44 } 45 46 public BaseShaderFactory(Map<Image, Texture> clampTexCache, 47 Map<Image, Texture> repeatTexCache, 48 Map<Image, Texture> mipmapTexCache) 49 { 50 super(clampTexCache, repeatTexCache, mipmapTexCache); 51 } 52 53 public ShapeRep createPathRep() { 54 return PrismSettings.cacheComplexShapes ? 55 new CachingShapeRep() : new BasicShapeRep(); 56 } 57 58 public ShapeRep createRoundRectRep() { 59 return PrismSettings.cacheSimpleShapes ? 60 new CachingRoundRectRep() : new BasicRoundRectRep(); 61 } 62 63 public ShapeRep createEllipseRep() { 64 return PrismSettings.cacheSimpleShapes ? 65 new CachingEllipseRep() : new BasicEllipseRep(); 66 } 67 68 public ShapeRep createArcRep() { 69 return PrismSettings.cacheComplexShapes ? 70 new CachingShapeRep() : new BasicShapeRep(); 71 } 72 }