jdk/src/share/classes/sun/java2d/loops/MaskFill.java
author lana
Thu, 26 Dec 2013 12:04:16 -0800
changeset 23010 6dadb192ad81
parent 17888 e92f93856c8f
permissions -rw-r--r--
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013 Summary: updated files with 2011, 2012 and 2013 years according to the file's last updated date Reviewed-by: tbell, lancea, chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
23010
6dadb192ad81 8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013
lana
parents: 17888
diff changeset
     2
 * Copyright (c) 1999, 2013, 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;
17888
e92f93856c8f 8015606: Text is not rendered correctly if destination buffer is custom
bae
parents: 9035
diff changeset
    39
import sun.java2d.pipe.Region;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * MaskFill
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * 1) fills rectangles of pixels on a surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * 2) performs compositing of colors based upon a Composite
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *    parameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * 3) blends result of composite with destination using an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *    alpha coverage mask
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * 4) the mask may be null in which case it should be treated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *    as if it were an array of all opaque values (0xff)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
public class MaskFill extends GraphicsPrimitive
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    public static final String methodSignature = "MaskFill(...)".toString();
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
    54
    public static final String fillPgramSignature =
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
    55
        "FillAAPgram(...)".toString();
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
    56
    public static final String drawPgramSignature =
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
    57
        "DrawAAPgram(...)".toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    public static final int primTypeID = makePrimTypeID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    private static RenderCache fillcache = new RenderCache(10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    public static MaskFill locate(SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                                  CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                                  SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        return (MaskFill)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
            GraphicsPrimitiveMgr.locate(primTypeID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                                        srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    public static MaskFill locatePrim(SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                                      CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                                      SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        return (MaskFill)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
            GraphicsPrimitiveMgr.locatePrim(primTypeID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
                                            srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * Note that this uses locatePrim, not locate, so it can return
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * null if there is no specific loop to handle this op...
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    public static MaskFill getFromCache(SurfaceType src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                                        CompositeType comp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                                        SurfaceType dst)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        Object o = fillcache.get(src, comp, dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        if (o != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            return (MaskFill) o;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
        MaskFill fill = locatePrim(src, comp, dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
        if (fill != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            fillcache.put(src, comp, dst, fill);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        return fill;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   100
    protected MaskFill(String alternateSignature,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   101
                       SurfaceType srctype,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   102
                       CompositeType comptype,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   103
                       SurfaceType dsttype)
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   104
    {
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   105
        super(alternateSignature, primTypeID, srctype, comptype, dsttype);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   106
    }
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   107
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    protected MaskFill(SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                       CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
                       SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        super(methodSignature, primTypeID, srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    public MaskFill(long pNativePrim,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                    SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                    CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
                    SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        super(pNativePrim, methodSignature, primTypeID, srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * All MaskFill implementors must have this invoker method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    public native void MaskFill(SunGraphics2D sg2d, SurfaceData sData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
                                Composite comp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
                                int x, int y, int w, int h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                                byte[] mask, int maskoff, int maskscan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   131
    public native void FillAAPgram(SunGraphics2D sg2d, SurfaceData sData,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   132
                                   Composite comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   133
                                   double x, double y,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   134
                                   double dx1, double dy1,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   135
                                   double dx2, double dy2);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   136
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   137
    public native void DrawAAPgram(SunGraphics2D sg2d, SurfaceData sData,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   138
                                   Composite comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   139
                                   double x, double y,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   140
                                   double dx1, double dy1,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   141
                                   double dx2, double dy2,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   142
                                   double lw1, double lw2);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   143
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   144
    public boolean canDoParallelograms() {
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   145
        return (getNativePrim() != 0);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   146
    }
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   147
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        GraphicsPrimitiveMgr.registerGeneral(new MaskFill(null, null, null));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    public GraphicsPrimitive makePrimitive(SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                                           CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                                           SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        if (SurfaceType.OpaqueColor.equals(srctype) ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            SurfaceType.AnyColor.equals(srctype))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            if (CompositeType.Xor.equals(comptype)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                throw new InternalError("Cannot construct MaskFill for " +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                                        "XOR mode");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                return new General(srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
            throw new InternalError("MaskFill can only fill with colors");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    private static class General extends MaskFill {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        FillRect fillop;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        MaskBlit maskop;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        public General(SurfaceType srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                       CompositeType comptype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                       SurfaceType dsttype)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            super(srctype, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            fillop = FillRect.locate(srctype,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                                     CompositeType.SrcNoEa,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                                     SurfaceType.IntArgb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
            maskop = MaskBlit.locate(SurfaceType.IntArgb, comptype, dsttype);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        public void MaskFill(SunGraphics2D sg2d,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
                             SurfaceData sData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                             Composite comp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                             int x, int y, int w, int h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                             byte mask[], int offset, int scan)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
            BufferedImage dstBI =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
            SurfaceData tmpData = BufImgSurfaceData.createData(dstBI);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
            // REMIND: This is not pretty.  It would be nicer if we
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
            // passed a "FillData" object to the Pixel loops, instead
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
            // of a SunGraphics2D parameter...
17888
e92f93856c8f 8015606: Text is not rendered correctly if destination buffer is custom
bae
parents: 9035
diff changeset
   198
            Region clip = sg2d.clipRegion;
e92f93856c8f 8015606: Text is not rendered correctly if destination buffer is custom
bae
parents: 9035
diff changeset
   199
            sg2d.clipRegion = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            int pixel = sg2d.pixel;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
            sg2d.pixel = tmpData.pixelFor(sg2d.getColor());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            fillop.FillRect(sg2d, tmpData, 0, 0, w, h);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
            sg2d.pixel = pixel;
17888
e92f93856c8f 8015606: Text is not rendered correctly if destination buffer is custom
bae
parents: 9035
diff changeset
   204
            sg2d.clipRegion = clip;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
            maskop.MaskBlit(tmpData, sData, comp, null,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                            0, 0, x, y, w, h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                            mask, offset, scan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    public GraphicsPrimitive traceWrap() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        return new TraceMaskFill(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    private static class TraceMaskFill extends MaskFill {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        MaskFill target;
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   218
        MaskFill fillPgramTarget;
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   219
        MaskFill drawPgramTarget;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        public TraceMaskFill(MaskFill target) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
            super(target.getSourceType(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                  target.getCompositeType(),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                  target.getDestType());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
            this.target = target;
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   226
            this.fillPgramTarget = new MaskFill(fillPgramSignature,
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());
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   230
            this.drawPgramTarget = new MaskFill(drawPgramSignature,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   231
                                                target.getSourceType(),
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   232
                                                target.getCompositeType(),
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   233
                                                target.getDestType());
2
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 GraphicsPrimitive traceWrap() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
            return this;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        public void MaskFill(SunGraphics2D sg2d, SurfaceData sData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                             Composite comp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                             int x, int y, int w, int h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
                             byte[] mask, int maskoff, int maskscan)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            tracePrimitive(target);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            target.MaskFill(sg2d, sData, comp, x, y, w, h,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                            mask, maskoff, maskscan);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        }
7745
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   249
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   250
        public void FillAAPgram(SunGraphics2D sg2d, SurfaceData sData,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   251
                                Composite comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   252
                                double x, double y,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   253
                                double dx1, double dy1,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   254
                                double dx2, double 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
            tracePrimitive(fillPgramTarget);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   257
            target.FillAAPgram(sg2d, sData, comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   258
                               x, y, dx1, dy1, dx2, dy2);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   259
        }
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   260
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   261
        public void DrawAAPgram(SunGraphics2D sg2d, SurfaceData sData,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   262
                                Composite comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   263
                                double x, double y,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   264
                                double dx1, double dy1,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   265
                                double dx2, double dy2,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   266
                                double lw1, double 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
            tracePrimitive(drawPgramTarget);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   269
            target.DrawAAPgram(sg2d, sData, comp,
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   270
                               x, y, dx1, dy1, dx2, dy2, lw1, lw2);
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   271
        }
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   272
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   273
        public boolean canDoParallelograms() {
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   274
            return target.canDoParallelograms();
ebd6382e93fd 6766342: Improve performance of Ductus rasterizer
flar
parents: 5506
diff changeset
   275
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
}