2
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
|
2
|
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
|
5506
|
7 |
* published by the Free Software Foundation. Oracle designates this
|
2
|
8 |
* particular file as subject to the "Classpath" exception as provided
|
5506
|
9 |
* by Oracle in the LICENSE file that accompanied this code.
|
2
|
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 |
*
|
5506
|
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.
|
2
|
24 |
*/
|
|
25 |
|
|
26 |
package sun.java2d.d3d;
|
|
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;
|
887
|
34 |
import sun.java2d.pipe.BufferedMaskFill;
|
|
35 |
import static sun.java2d.loops.CompositeType.*;
|
|
36 |
import static sun.java2d.loops.SurfaceType.*;
|
2
|
37 |
|
887
|
38 |
class D3DMaskFill extends BufferedMaskFill {
|
2
|
39 |
|
887
|
40 |
static void register() {
|
|
41 |
GraphicsPrimitive[] primitives = {
|
|
42 |
new D3DMaskFill(AnyColor, SrcOver),
|
|
43 |
new D3DMaskFill(OpaqueColor, SrcNoEa),
|
|
44 |
new D3DMaskFill(GradientPaint, SrcOver),
|
|
45 |
new D3DMaskFill(OpaqueGradientPaint, SrcNoEa),
|
|
46 |
new D3DMaskFill(LinearGradientPaint, SrcOver),
|
|
47 |
new D3DMaskFill(OpaqueLinearGradientPaint, SrcNoEa),
|
|
48 |
new D3DMaskFill(RadialGradientPaint, SrcOver),
|
|
49 |
new D3DMaskFill(OpaqueRadialGradientPaint, SrcNoEa),
|
|
50 |
new D3DMaskFill(TexturePaint, SrcOver),
|
|
51 |
new D3DMaskFill(OpaqueTexturePaint, SrcNoEa),
|
2
|
52 |
};
|
|
53 |
GraphicsPrimitiveMgr.register(primitives);
|
|
54 |
}
|
|
55 |
|
887
|
56 |
protected D3DMaskFill(SurfaceType srcType, CompositeType compType) {
|
|
57 |
super(D3DRenderQueue.getInstance(),
|
|
58 |
srcType, compType, D3DSurfaceData.D3DSurface);
|
2
|
59 |
}
|
|
60 |
|
|
61 |
@Override
|
887
|
62 |
protected native void maskFill(int x, int y, int w, int h,
|
|
63 |
int maskoff, int maskscan, int masklen,
|
|
64 |
byte[] mask);
|
2
|
65 |
|
887
|
66 |
@Override
|
|
67 |
protected void validateContext(SunGraphics2D sg2d,
|
|
68 |
Composite comp, int ctxflags)
|
|
69 |
{
|
|
70 |
D3DSurfaceData dstData = (D3DSurfaceData)sg2d.surfaceData;
|
|
71 |
D3DContext.validateContext(dstData, dstData,
|
|
72 |
sg2d.getCompClip(), comp,
|
|
73 |
null, sg2d.paint, sg2d, ctxflags);
|
2
|
74 |
}
|
|
75 |
}
|