jdk/src/share/classes/sun/java2d/loops/MaskFill.java
author ohair
Wed, 06 Apr 2011 22:06:11 -0700
changeset 9035 1255eb81cc2f
parent 7745 ebd6382e93fd
child 17888 e92f93856c8f
permissions -rw-r--r--
7033660: Update copyright year to 2011 on any files changed in 2011 Reviewed-by: dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
9035
1255eb81cc2f 7033660: Update copyright year to 2011 on any files changed in 2011
ohair
parents: 7745
diff changeset
     2
 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package sun.java2d.loops;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.Paint;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.PaintContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.Composite;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.Rectangle;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.image.ColorModel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.awt.image.BufferedImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.awt.image.WritableRaster;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.awt.image.BufImgSurfaceData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import sun.java2d.loops.GraphicsPrimitive;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import sun.java2d.SunGraphics2D;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import sun.java2d.SurfaceData;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * MaskFill
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * 1) fills rectangles of pixels on a surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * 2) performs compositing of colors based upon a Composite
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *    parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * 3) blends result of composite with destination using an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *    alpha coverage mask
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * 4) the mask may be null in which case it should be treated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *    as if it were an array of all opaque values (0xff)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
public class MaskFill extends GraphicsPrimitive
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    public static final String methodSignature = "MaskFill(...)".toString();
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
    53
    public static final String fillPgramSignature =
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
    54
        "FillAAPgram(...)".toString();
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
    55
    public static final String drawPgramSignature =
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
    56
        "DrawAAPgram(...)".toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    public static final int primTypeID = makePrimTypeID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    private static RenderCache fillcache = new RenderCache(10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    public static MaskFill locate(SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                                  CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                                  SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        return (MaskFill)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
            GraphicsPrimitiveMgr.locate(primTypeID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                                        srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    public static MaskFill locatePrim(SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                                      CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                                      SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        return (MaskFill)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
            GraphicsPrimitiveMgr.locatePrim(primTypeID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                                            srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * Note that this uses locatePrim, not locate, so it can return
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * null if there is no specific loop to handle this op...
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    public static MaskFill getFromCache(SurfaceType src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                                        CompositeType comp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                                        SurfaceType dst)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        Object o = fillcache.get(src, comp, dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        if (o != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            return (MaskFill) o;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        MaskFill fill = locatePrim(src, comp, dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        if (fill != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            fillcache.put(src, comp, dst, fill);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        return fill;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
    99
    protected MaskFill(String alternateSignature,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   100
                       SurfaceType srctype,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   101
                       CompositeType comptype,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   102
                       SurfaceType dsttype)
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   103
    {
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   104
        super(alternateSignature, primTypeID, srctype, comptype, dsttype);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   105
    }
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   106
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    protected MaskFill(SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                       CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                       SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
        super(methodSignature, primTypeID, srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    public MaskFill(long pNativePrim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                    SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                    CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                    SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        super(pNativePrim, methodSignature, primTypeID, srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * All MaskFill implementors must have this invoker method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    public native void MaskFill(SunGraphics2D sg2d, SurfaceData sData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                                Composite comp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                                int x, int y, int w, int h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                                byte[] mask, int maskoff, int maskscan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   130
    public native void FillAAPgram(SunGraphics2D sg2d, SurfaceData sData,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   131
                                   Composite comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   132
                                   double x, double y,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   133
                                   double dx1, double dy1,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   134
                                   double dx2, double dy2);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   135
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   136
    public native void DrawAAPgram(SunGraphics2D sg2d, SurfaceData sData,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   137
                                   Composite comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   138
                                   double x, double y,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   139
                                   double dx1, double dy1,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   140
                                   double dx2, double dy2,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   141
                                   double lw1, double lw2);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   142
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   143
    public boolean canDoParallelograms() {
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   144
        return (getNativePrim() != 0);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   145
    }
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   146
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        GraphicsPrimitiveMgr.registerGeneral(new MaskFill(null, null, null));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    public GraphicsPrimitive makePrimitive(SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                                           CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                                           SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        if (SurfaceType.OpaqueColor.equals(srctype) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
            SurfaceType.AnyColor.equals(srctype))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            if (CompositeType.Xor.equals(comptype)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                throw new InternalError("Cannot construct MaskFill for " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                                        "XOR mode");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                return new General(srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
            throw new InternalError("MaskFill can only fill with colors");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    private static class General extends MaskFill {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        FillRect fillop;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        MaskBlit maskop;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        public General(SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                       CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                       SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            super(srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            fillop = FillRect.locate(srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                                     CompositeType.SrcNoEa,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                                     SurfaceType.IntArgb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            maskop = MaskBlit.locate(SurfaceType.IntArgb, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        public void MaskFill(SunGraphics2D sg2d,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                             SurfaceData sData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                             Composite comp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                             int x, int y, int w, int h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                             byte mask[], int offset, int scan)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
            BufferedImage dstBI =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
            SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
            // REMIND: This is not pretty.  It would be nicer if we
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            // passed a "FillData" object to the Pixel loops, instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            // of a SunGraphics2D parameter...
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            int pixel = sg2d.pixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
            sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
            fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            sg2d.pixel = pixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            maskop.MaskBlit(tmpData, sData, comp, null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
                            0, 0, x, y, w, h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
                            mask, offset, scan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    public GraphicsPrimitive traceWrap() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        return new TraceMaskFill(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    private static class TraceMaskFill extends MaskFill {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        MaskFill target;
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   214
        MaskFill fillPgramTarget;
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   215
        MaskFill drawPgramTarget;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        public TraceMaskFill(MaskFill target) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
            super(target.getSourceType(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                  target.getCompositeType(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                  target.getDestType());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
            this.target = target;
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   222
            this.fillPgramTarget = new MaskFill(fillPgramSignature,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   223
                                                target.getSourceType(),
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   224
                                                target.getCompositeType(),
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   225
                                                target.getDestType());
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   226
            this.drawPgramTarget = new MaskFill(drawPgramSignature,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   227
                                                target.getSourceType(),
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   228
                                                target.getCompositeType(),
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   229
                                                target.getDestType());
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        public GraphicsPrimitive traceWrap() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        public void MaskFill(SunGraphics2D sg2d, SurfaceData sData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
                             Composite comp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
                             int x, int y, int w, int h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
                             byte[] mask, int maskoff, int maskscan)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
            tracePrimitive(target);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
            target.MaskFill(sg2d, sData, comp, x, y, w, h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                            mask, maskoff, maskscan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        }
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   245
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   246
        public void FillAAPgram(SunGraphics2D sg2d, SurfaceData sData,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   247
                                Composite comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   248
                                double x, double y,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   249
                                double dx1, double dy1,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   250
                                double dx2, double dy2)
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   251
        {
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   252
            tracePrimitive(fillPgramTarget);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   253
            target.FillAAPgram(sg2d, sData, comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   254
                               x, y, dx1, dy1, dx2, dy2);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   255
        }
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   256
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   257
        public void DrawAAPgram(SunGraphics2D sg2d, SurfaceData sData,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   258
                                Composite comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   259
                                double x, double y,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   260
                                double dx1, double dy1,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   261
                                double dx2, double dy2,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   262
                                double lw1, double lw2)
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   263
        {
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   264
            tracePrimitive(drawPgramTarget);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   265
            target.DrawAAPgram(sg2d, sData, comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   266
                               x, y, dx1, dy1, dx2, dy2, lw1, lw2);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   267
        }
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   268
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   269
        public boolean canDoParallelograms() {
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   270
            return target.canDoParallelograms();
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   271
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
}