J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2003-2007 Sun Microsystems, Inc. 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. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | package sun.java2d.opengl; |
| 27 | |
| 28 | import java.awt.Composite; |
| 29 | import sun.java2d.SunGraphics2D; |
| 30 | import sun.java2d.loops.GraphicsPrimitive; |
| 31 | import sun.java2d.loops.GraphicsPrimitiveMgr; |
| 32 | import sun.java2d.loops.CompositeType; |
| 33 | import sun.java2d.loops.SurfaceType; |
| 34 | import sun.java2d.pipe.BufferedMaskFill; |
| 35 | import static sun.java2d.loops.CompositeType.*; |
| 36 | import static sun.java2d.loops.SurfaceType.*; |
| 37 | |
| 38 | class OGLMaskFill extends BufferedMaskFill { |
| 39 | |
| 40 | static void register() { |
| 41 | GraphicsPrimitive[] primitives = { |
| 42 | new OGLMaskFill(AnyColor, SrcOver), |
| 43 | new OGLMaskFill(OpaqueColor, SrcNoEa), |
| 44 | new OGLMaskFill(GradientPaint, SrcOver), |
| 45 | new OGLMaskFill(OpaqueGradientPaint, SrcNoEa), |
| 46 | new OGLMaskFill(LinearGradientPaint, SrcOver), |
| 47 | new OGLMaskFill(OpaqueLinearGradientPaint, SrcNoEa), |
| 48 | new OGLMaskFill(RadialGradientPaint, SrcOver), |
| 49 | new OGLMaskFill(OpaqueRadialGradientPaint, SrcNoEa), |
| 50 | new OGLMaskFill(TexturePaint, SrcOver), |
| 51 | new OGLMaskFill(OpaqueTexturePaint, SrcNoEa), |
| 52 | }; |
| 53 | GraphicsPrimitiveMgr.register(primitives); |
| 54 | } |
| 55 | |
| 56 | protected OGLMaskFill(SurfaceType srcType, CompositeType compType) { |
| 57 | super(OGLRenderQueue.getInstance(), |
| 58 | srcType, compType, OGLSurfaceData.OpenGLSurface); |
| 59 | } |
| 60 | |
| 61 | @Override |
| 62 | protected native void maskFill(int x, int y, int w, int h, |
| 63 | int maskoff, int maskscan, int masklen, |
| 64 | byte[] mask); |
| 65 | |
| 66 | @Override |
| 67 | protected void validateContext(SunGraphics2D sg2d, |
| 68 | Composite comp, int ctxflags) |
| 69 | { |
| 70 | OGLSurfaceData dstData = (OGLSurfaceData)sg2d.surfaceData; |
| 71 | OGLContext.validateContext(dstData, dstData, |
| 72 | sg2d.getCompClip(), comp, |
| 73 | null, sg2d.paint, sg2d, ctxflags); |
| 74 | } |
| 75 | } |