author | ohair |
Tue, 28 Dec 2010 15:53:50 -0800 | |
changeset 7668 | d4a77089c587 |
parent 7487 | 9b031d062ede |
permissions | -rw-r--r-- |
7487
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
1 |
/* |
7668 | 2 |
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. |
7487
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
4 |
* |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
10 |
* |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
15 |
* accompanied this code). |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
16 |
* |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
20 |
* |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
23 |
* questions. |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
24 |
*/ |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
25 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
26 |
/* |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
27 |
* @author Jim Graham |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
28 |
*/ |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
29 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
30 |
package sun.java2d.loops; |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
31 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
32 |
import sun.java2d.loops.GraphicsPrimitive; |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
33 |
import sun.java2d.SunGraphics2D; |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
34 |
import sun.java2d.SurfaceData; |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
35 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
36 |
/** |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
37 |
* FillParallelogram |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
38 |
* 1) fill the area between the 4 edges of a parallelogram |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
39 |
* (as specified by an origin and 2 delta vectors) |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
40 |
*/ |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
41 |
public class FillParallelogram extends GraphicsPrimitive |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
42 |
{ |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
43 |
public final static String methodSignature = |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
44 |
"FillParallelogram(...)".toString(); |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
45 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
46 |
public final static int primTypeID = makePrimTypeID(); |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
47 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
48 |
public static FillParallelogram locate(SurfaceType srctype, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
49 |
CompositeType comptype, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
50 |
SurfaceType dsttype) |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
51 |
{ |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
52 |
return (FillParallelogram) |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
53 |
GraphicsPrimitiveMgr.locate(primTypeID, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
54 |
srctype, comptype, dsttype); |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
55 |
} |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
56 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
57 |
protected FillParallelogram(SurfaceType srctype, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
58 |
CompositeType comptype, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
59 |
SurfaceType dsttype) |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
60 |
{ |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
61 |
super(methodSignature, primTypeID, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
62 |
srctype, comptype, dsttype); |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
63 |
} |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
64 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
65 |
public FillParallelogram(long pNativePrim, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
66 |
SurfaceType srctype, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
67 |
CompositeType comptype, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
68 |
SurfaceType dsttype) |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
69 |
{ |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
70 |
super(pNativePrim, methodSignature, primTypeID, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
71 |
srctype, comptype, dsttype); |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
72 |
} |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
73 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
74 |
/** |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
75 |
* All FillParallelogram implementors must have this invoker method |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
76 |
*/ |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
77 |
public native void FillParallelogram(SunGraphics2D sg2d, SurfaceData dest, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
78 |
double x0, double y0, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
79 |
double dx1, double dy1, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
80 |
double dx2, double dy2); |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
81 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
82 |
public GraphicsPrimitive makePrimitive(SurfaceType srctype, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
83 |
CompositeType comptype, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
84 |
SurfaceType dsttype) |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
85 |
{ |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
86 |
// REMIND: iterate with a FillRect primitive? |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
87 |
throw new InternalError("FillParallelogram not implemented for "+ |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
88 |
srctype+" with "+comptype); |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
89 |
} |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
90 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
91 |
public GraphicsPrimitive traceWrap() { |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
92 |
return new TraceFillParallelogram(this); |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
93 |
} |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
94 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
95 |
private static class TraceFillParallelogram extends FillParallelogram { |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
96 |
FillParallelogram target; |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
97 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
98 |
public TraceFillParallelogram(FillParallelogram target) { |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
99 |
super(target.getSourceType(), |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
100 |
target.getCompositeType(), |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
101 |
target.getDestType()); |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
102 |
this.target = target; |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
103 |
} |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
104 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
105 |
public GraphicsPrimitive traceWrap() { |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
106 |
return this; |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
107 |
} |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
108 |
|
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
109 |
public void FillParallelogram(SunGraphics2D sg2d, SurfaceData dest, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
110 |
double x0, double y0, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
111 |
double dx1, double dy1, |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
112 |
double dx2, double dy2) |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
113 |
{ |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
114 |
tracePrimitive(target); |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
115 |
target.FillParallelogram(sg2d, dest, x0, y0, dx1, dy1, dx2, dy2); |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
116 |
} |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
117 |
} |
9b031d062ede
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines
flar
parents:
diff
changeset
|
118 |
} |