jdk/src/java.desktop/windows/classes/sun/java2d/d3d/D3DBlitLoops.java
author psadhukhan
Thu, 03 Mar 2016 12:20:11 +0530
changeset 36467 836382b377d9
parent 27500 d291fa015bf9
permissions -rw-r--r--
8044788: [D3D] clip is ignored during surface->sw blit Reviewed-by: serb, prr Contributed-by: prasanta.sadhukhan@oracle.com, prahalad.kumar.narayanan@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
27500
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
     2
 * Copyright (c) 2007, 2014, 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: 1723
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: 1723
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: 1723
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1723
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1723
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.d3d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.Composite;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.Transparency;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.geom.AffineTransform;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.image.AffineTransformOp;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    32
import java.awt.image.BufferedImage;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    33
import java.awt.image.BufferedImageOp;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    34
import java.lang.ref.WeakReference;
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
    35
import java.lang.annotation.Native;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    36
import sun.java2d.ScreenUpdateManager;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    37
import sun.java2d.SurfaceData;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    38
import sun.java2d.loops.Blit;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    39
import sun.java2d.loops.CompositeType;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import sun.java2d.loops.GraphicsPrimitive;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import sun.java2d.loops.GraphicsPrimitiveMgr;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    42
import sun.java2d.loops.ScaledBlit;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import sun.java2d.loops.SurfaceType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import sun.java2d.loops.TransformBlit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
import sun.java2d.pipe.Region;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    46
import sun.java2d.pipe.RenderBuffer;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    47
import sun.java2d.pipe.RenderQueue;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    48
import static sun.java2d.pipe.BufferedOpCodes.*;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    49
import sun.java2d.windows.GDIWindowSurfaceData;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
27500
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
    51
final class D3DBlitLoops {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    53
    static void register() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    54
        Blit blitIntArgbPreToSurface =
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    55
            new D3DSwToSurfaceBlit(SurfaceType.IntArgbPre,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    56
                                   D3DSurfaceData.ST_INT_ARGB_PRE);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    57
        Blit blitIntArgbPreToTexture =
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    58
            new D3DSwToTextureBlit(SurfaceType.IntArgbPre,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    59
                                   D3DSurfaceData.ST_INT_ARGB_PRE);
27500
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
    60
        TransformBlit transformBlitIntArgbPreToSurface =
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
    61
            new D3DSwToSurfaceTransform(SurfaceType.IntArgbPre,
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
    62
                                        D3DSurfaceData.ST_INT_ARGB_PRE);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        GraphicsPrimitive[] primitives = {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    64
            // prevent D3DSurface -> Screen blits
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    65
            new D3DSurfaceToGDIWindowSurfaceBlit(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    66
            new D3DSurfaceToGDIWindowSurfaceScale(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    67
            new D3DSurfaceToGDIWindowSurfaceTransform(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    68
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    69
            // surface->surface ops
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    70
            new D3DSurfaceToSurfaceBlit(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    71
            new D3DSurfaceToSurfaceScale(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    72
            new D3DSurfaceToSurfaceTransform(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    73
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    74
            // render-to-texture surface->surface ops
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    75
            new D3DRTTSurfaceToSurfaceBlit(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    76
            new D3DRTTSurfaceToSurfaceScale(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    77
            new D3DRTTSurfaceToSurfaceTransform(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    78
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    79
            // surface->sw ops
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    80
            new D3DSurfaceToSwBlit(SurfaceType.IntArgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    81
                                   D3DSurfaceData.ST_INT_ARGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    82
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    83
            // sw->surface ops
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    84
            blitIntArgbPreToSurface,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    85
            new D3DSwToSurfaceBlit(SurfaceType.IntArgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    86
                                   D3DSurfaceData.ST_INT_ARGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    87
            new D3DSwToSurfaceBlit(SurfaceType.IntRgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    88
                                   D3DSurfaceData.ST_INT_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    89
            new D3DSwToSurfaceBlit(SurfaceType.IntBgr,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    90
                                   D3DSurfaceData.ST_INT_BGR),
1723
4a616c1eac0b 6739267: D3D/OGL: add missing ThreeByteBgr to texture upload blit loop
tdv
parents: 887
diff changeset
    91
            new D3DSwToSurfaceBlit(SurfaceType.ThreeByteBgr,
4a616c1eac0b 6739267: D3D/OGL: add missing ThreeByteBgr to texture upload blit loop
tdv
parents: 887
diff changeset
    92
                                   D3DSurfaceData.ST_3BYTE_BGR),
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    93
            new D3DSwToSurfaceBlit(SurfaceType.Ushort565Rgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    94
                                   D3DSurfaceData.ST_USHORT_565_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    95
            new D3DSwToSurfaceBlit(SurfaceType.Ushort555Rgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    96
                                   D3DSurfaceData.ST_USHORT_555_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    97
            new D3DSwToSurfaceBlit(SurfaceType.ByteIndexed,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    98
                                   D3DSurfaceData.ST_BYTE_INDEXED),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
    99
            // REMIND: we don't have a native sw loop to back this loop up
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   100
//            new D3DSwToSurfaceBlit(SurfaceType.ByteIndexedBm,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   101
//                                   D3DSurfaceData.ST_BYTE_INDEXED_BM),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   102
            new D3DGeneralBlit(D3DSurfaceData.D3DSurface,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   103
                               CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   104
                               blitIntArgbPreToSurface),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   106
            new D3DSwToSurfaceScale(SurfaceType.IntArgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   107
                                    D3DSurfaceData.ST_INT_ARGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   108
            new D3DSwToSurfaceScale(SurfaceType.IntArgbPre,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   109
                                    D3DSurfaceData.ST_INT_ARGB_PRE),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   110
            new D3DSwToSurfaceScale(SurfaceType.IntRgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   111
                                    D3DSurfaceData.ST_INT_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   112
            new D3DSwToSurfaceScale(SurfaceType.IntBgr,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   113
                                    D3DSurfaceData.ST_INT_BGR),
1723
4a616c1eac0b 6739267: D3D/OGL: add missing ThreeByteBgr to texture upload blit loop
tdv
parents: 887
diff changeset
   114
            new D3DSwToSurfaceScale(SurfaceType.ThreeByteBgr,
4a616c1eac0b 6739267: D3D/OGL: add missing ThreeByteBgr to texture upload blit loop
tdv
parents: 887
diff changeset
   115
                                    D3DSurfaceData.ST_3BYTE_BGR),
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   116
            new D3DSwToSurfaceScale(SurfaceType.Ushort565Rgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   117
                                    D3DSurfaceData.ST_USHORT_565_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   118
            new D3DSwToSurfaceScale(SurfaceType.Ushort555Rgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   119
                                    D3DSurfaceData.ST_USHORT_555_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   120
            new D3DSwToSurfaceScale(SurfaceType.ByteIndexed,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   121
                                    D3DSurfaceData.ST_BYTE_INDEXED),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   122
            // REMIND: we don't have a native sw loop to back this loop up
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   123
//            new D3DSwToSurfaceScale(SurfaceType.ByteIndexedBm,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   124
//                                    D3DSurfaceData.ST_BYTE_INDEXED_BM),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   126
            new D3DSwToSurfaceTransform(SurfaceType.IntArgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   127
                                        D3DSurfaceData.ST_INT_ARGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   128
            new D3DSwToSurfaceTransform(SurfaceType.IntRgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   129
                                        D3DSurfaceData.ST_INT_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   130
            new D3DSwToSurfaceTransform(SurfaceType.IntBgr,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   131
                                        D3DSurfaceData.ST_INT_BGR),
1723
4a616c1eac0b 6739267: D3D/OGL: add missing ThreeByteBgr to texture upload blit loop
tdv
parents: 887
diff changeset
   132
            new D3DSwToSurfaceTransform(SurfaceType.ThreeByteBgr,
4a616c1eac0b 6739267: D3D/OGL: add missing ThreeByteBgr to texture upload blit loop
tdv
parents: 887
diff changeset
   133
                                        D3DSurfaceData.ST_3BYTE_BGR),
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   134
            new D3DSwToSurfaceTransform(SurfaceType.Ushort565Rgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   135
                                        D3DSurfaceData.ST_USHORT_565_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   136
            new D3DSwToSurfaceTransform(SurfaceType.Ushort555Rgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   137
                                        D3DSurfaceData.ST_USHORT_555_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   138
            new D3DSwToSurfaceTransform(SurfaceType.ByteIndexed,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   139
                                        D3DSurfaceData.ST_BYTE_INDEXED),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   140
            // REMIND: we don't have a native sw loop to back this loop up
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   141
//            new D3DSwToSurfaceTransform(SurfaceType.ByteIndexedBm,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   142
//                                        D3DSurfaceData.ST_BYTE_INDEXED_BM),
27500
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   143
            transformBlitIntArgbPreToSurface,
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   144
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   145
            new D3DGeneralTransformedBlit(transformBlitIntArgbPreToSurface),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   147
            // texture->surface ops
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   148
            new D3DTextureToSurfaceBlit(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   149
            new D3DTextureToSurfaceScale(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   150
            new D3DTextureToSurfaceTransform(),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   152
            // sw->texture ops
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   153
            blitIntArgbPreToTexture,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   154
            new D3DSwToTextureBlit(SurfaceType.IntRgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   155
                                   D3DSurfaceData.ST_INT_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   156
            new D3DSwToTextureBlit(SurfaceType.IntArgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   157
                                   D3DSurfaceData.ST_INT_ARGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   158
            new D3DSwToTextureBlit(SurfaceType.IntBgr,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   159
                                   D3DSurfaceData.ST_INT_BGR),
1723
4a616c1eac0b 6739267: D3D/OGL: add missing ThreeByteBgr to texture upload blit loop
tdv
parents: 887
diff changeset
   160
            new D3DSwToTextureBlit(SurfaceType.ThreeByteBgr,
4a616c1eac0b 6739267: D3D/OGL: add missing ThreeByteBgr to texture upload blit loop
tdv
parents: 887
diff changeset
   161
                                   D3DSurfaceData.ST_3BYTE_BGR),
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   162
            new D3DSwToTextureBlit(SurfaceType.Ushort565Rgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   163
                                   D3DSurfaceData.ST_USHORT_565_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   164
            new D3DSwToTextureBlit(SurfaceType.Ushort555Rgb,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   165
                                   D3DSurfaceData.ST_USHORT_555_RGB),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   166
            new D3DSwToTextureBlit(SurfaceType.ByteIndexed,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   167
                                   D3DSurfaceData.ST_BYTE_INDEXED),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   168
            // REMIND: we don't have a native sw loop to back this loop up
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   169
//            new D3DSwToTextureBlit(SurfaceType.ByteIndexedBm,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   170
//                                   D3DSurfaceData.ST_BYTE_INDEXED_BM),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   171
            new D3DGeneralBlit(D3DSurfaceData.D3DTexture,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   172
                               CompositeType.SrcNoEa,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   173
                               blitIntArgbPreToTexture),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
        GraphicsPrimitiveMgr.register(primitives);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    }
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   177
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   178
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   179
     * The following offsets are used to pack the parameters in
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   180
     * createPackedParams().  (They are also used at the native level when
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   181
     * unpacking the params.)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   182
     */
16734
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   183
    @Native private static final int OFFSET_SRCTYPE = 16;
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   184
    @Native private static final int OFFSET_HINT    =  8;
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   185
    @Native private static final int OFFSET_TEXTURE =  3;
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   186
    @Native private static final int OFFSET_RTT     =  2;
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   187
    @Native private static final int OFFSET_XFORM   =  1;
da1901d79073 8000406: change files using @GenerateNativeHeader to use @Native
dxu
parents: 12813
diff changeset
   188
    @Native private static final int OFFSET_ISOBLIT =  0;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   189
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   190
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   191
     * Packs the given parameters into a single int value in order to save
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   192
     * space on the rendering queue.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   193
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   194
    private static int createPackedParams(boolean isoblit, boolean texture,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   195
                                          boolean rtt, boolean xform,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   196
                                          int hint, int srctype)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   197
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   198
        return
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   199
            ((srctype           << OFFSET_SRCTYPE) |
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   200
             (hint              << OFFSET_HINT   ) |
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   201
             ((texture ? 1 : 0) << OFFSET_TEXTURE) |
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   202
             ((rtt     ? 1 : 0) << OFFSET_RTT    ) |
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   203
             ((xform   ? 1 : 0) << OFFSET_XFORM  ) |
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   204
             ((isoblit ? 1 : 0) << OFFSET_ISOBLIT));
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   205
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   207
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   208
     * Enqueues a BLIT operation with the given parameters.  Note that the
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   209
     * RenderQueue lock must be held before calling this method.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   210
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   211
    private static void enqueueBlit(RenderQueue rq,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   212
                                    SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   213
                                    int packedParams,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   214
                                    int sx1, int sy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   215
                                    int sx2, int sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   216
                                    double dx1, double dy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   217
                                    double dx2, double dy2)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   219
        // assert rq.lock.isHeldByCurrentThread();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   220
        RenderBuffer buf = rq.getBuffer();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   221
        rq.ensureCapacityAndAlignment(72, 24);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   222
        buf.putInt(BLIT);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   223
        buf.putInt(packedParams);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   224
        buf.putInt(sx1).putInt(sy1);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   225
        buf.putInt(sx2).putInt(sy2);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   226
        buf.putDouble(dx1).putDouble(dy1);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   227
        buf.putDouble(dx2).putDouble(dy2);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   228
        buf.putLong(src.getNativeOps());
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   229
        buf.putLong(dst.getNativeOps());
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   230
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   231
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   232
    static void Blit(SurfaceData srcData, SurfaceData dstData,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   233
                     Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   234
                     AffineTransform xform, int hint,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   235
                     int sx1, int sy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   236
                     int sx2, int sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   237
                     double dx1, double dy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   238
                     double dx2, double dy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   239
                     int srctype, boolean texture)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   240
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   241
        int ctxflags = 0;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   242
        if (srcData.getTransparency() == Transparency.OPAQUE) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   243
            ctxflags |= D3DContext.SRC_IS_OPAQUE;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   246
        D3DSurfaceData d3dDst = (D3DSurfaceData)dstData;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   247
        D3DRenderQueue rq = D3DRenderQueue.getInstance();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   248
        rq.lock();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   249
        try {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   250
            // make sure the RenderQueue keeps a hard reference to the
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   251
            // source (sysmem) SurfaceData to prevent it from being
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   252
            // disposed while the operation is processed on the QFT
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   253
            rq.addReference(srcData);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   254
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   255
            if (texture) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   256
                // make sure we have a current context before uploading
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   257
                // the sysmem data to the texture object
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   258
                D3DContext.setScratchSurface(d3dDst.getContext());
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   259
            } else {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   260
                D3DContext.validateContext(d3dDst, d3dDst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   261
                                           clip, comp, xform, null, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   262
                                           ctxflags);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   263
            }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   264
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   265
            int packedParams = createPackedParams(false, texture,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   266
                                                  false, xform != null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   267
                                                  hint, srctype);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   268
            enqueueBlit(rq, srcData, dstData,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   269
                        packedParams,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   270
                        sx1, sy1, sx2, sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   271
                        dx1, dy1, dx2, dy2);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   272
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   273
            // always flush immediately, since we (currently) have no means
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   274
            // of tracking changes to the system memory surface
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   275
            rq.flushNow();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   276
        } finally {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   277
            rq.unlock();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   278
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   279
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   280
        if (d3dDst.getType() == D3DSurfaceData.WINDOW) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   281
            // flush immediately when copying to the screen to improve
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   282
            // responsiveness of applications using VI or BI backbuffers
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   283
            D3DScreenUpdateManager mgr =
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   284
                (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   285
            mgr.runUpdateNow();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   286
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   287
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   288
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   289
    /**
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   290
     * Note: The srcImg and biop parameters are only used when invoked
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   291
     * from the D3DBufImgOps.renderImageWithOp() method; in all other cases,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   292
     * this method can be called with null values for those two parameters,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   293
     * and they will be effectively ignored.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   294
     */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   295
    static void IsoBlit(SurfaceData srcData, SurfaceData dstData,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   296
                        BufferedImage srcImg, BufferedImageOp biop,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   297
                        Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   298
                        AffineTransform xform, int hint,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   299
                        int sx1, int sy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   300
                        int sx2, int sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   301
                        double dx1, double dy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   302
                        double dx2, double dy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   303
                        boolean texture)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   304
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   305
        int ctxflags = 0;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   306
        if (srcData.getTransparency() == Transparency.OPAQUE) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   307
            ctxflags |= D3DContext.SRC_IS_OPAQUE;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   308
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   309
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   310
        D3DSurfaceData d3dDst = (D3DSurfaceData)dstData;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   311
        D3DRenderQueue rq = D3DRenderQueue.getInstance();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   312
        boolean rtt = false;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   313
        rq.lock();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   314
        try {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   315
            D3DSurfaceData d3dSrc = (D3DSurfaceData)srcData;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   316
            int srctype = d3dSrc.getType();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   317
            D3DSurfaceData srcCtxData = d3dSrc;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   318
            if (srctype == D3DSurfaceData.TEXTURE) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   319
                rtt = false;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   320
            } else {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   321
                // the source is a backbuffer, or render-to-texture
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   322
                // surface; we set rtt to true to differentiate this kind
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   323
                // of surface from a regular texture object
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   324
                rtt = true;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   325
            }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   326
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   327
            D3DContext.validateContext(srcCtxData, d3dDst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   328
                                       clip, comp, xform, null, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   329
                                       ctxflags);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   330
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   331
            if (biop != null) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   332
                D3DBufImgOps.enableBufImgOp(rq, d3dSrc, srcImg, biop);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   333
            }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   334
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   335
            int packedParams = createPackedParams(true, texture,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   336
                                                  rtt, xform != null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   337
                                                  hint, 0 /*unused*/);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   338
            enqueueBlit(rq, srcData, dstData,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   339
                        packedParams,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   340
                        sx1, sy1, sx2, sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   341
                        dx1, dy1, dx2, dy2);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   342
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   343
            if (biop != null) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   344
                D3DBufImgOps.disableBufImgOp(rq, biop);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   345
            }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   346
        } finally {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   347
            rq.unlock();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   348
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   349
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   350
        if (rtt && (d3dDst.getType() == D3DSurfaceData.WINDOW)) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   351
            // we only have to flush immediately when copying from a
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   352
            // (non-texture) surface to the screen; otherwise Swing apps
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   353
            // might appear unresponsive until the auto-flush completes
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   354
            D3DScreenUpdateManager mgr =
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   355
                (D3DScreenUpdateManager)ScreenUpdateManager.getInstance();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   356
            mgr.runUpdateNow();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   357
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   361
class D3DSurfaceToSurfaceBlit extends Blit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   362
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   363
    D3DSurfaceToSurfaceBlit() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   364
        super(D3DSurfaceData.D3DSurface,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   365
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   366
              D3DSurfaceData.D3DSurface);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    public void Blit(SurfaceData src, SurfaceData dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                     Composite comp, Region clip,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                     int sx, int sy, int dx, int dy, int w, int h)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   373
        D3DBlitLoops.IsoBlit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   374
                             null, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   375
                             comp, clip, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   376
                             AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   377
                             sx, sy, sx+w, sy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   378
                             dx, dy, dx+w, dy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   379
                             false);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   383
class D3DSurfaceToSurfaceScale extends ScaledBlit {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   385
    D3DSurfaceToSurfaceScale() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   386
        super(D3DSurfaceData.D3DSurface,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   387
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   388
              D3DSurfaceData.D3DSurface);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   391
    public void Scale(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   392
                      Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   393
                      int sx1, int sy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   394
                      int sx2, int sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   395
                      double dx1, double dy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   396
                      double dx2, double dy2)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   397
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   398
        D3DBlitLoops.IsoBlit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   399
                             null, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   400
                             comp, clip, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   401
                             AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   402
                             sx1, sy1, sx2, sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   403
                             dx1, dy1, dx2, dy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   404
                             false);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   405
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   406
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   407
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   408
class D3DSurfaceToSurfaceTransform extends TransformBlit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   409
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   410
    D3DSurfaceToSurfaceTransform() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   411
        super(D3DSurfaceData.D3DSurface,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   412
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   413
              D3DSurfaceData.D3DSurface);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   414
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   415
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    public void Transform(SurfaceData src, SurfaceData dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                          Composite comp, Region clip,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
                          AffineTransform at, int hint,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                          int sx, int sy, int dx, int dy,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
                          int w, int h)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   422
        D3DBlitLoops.IsoBlit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   423
                             null, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   424
                             comp, clip, at, hint,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   425
                             sx, sy, sx+w, sy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   426
                             dx, dy, dx+w, dy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   427
                             false);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   428
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   429
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   430
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   431
class D3DRTTSurfaceToSurfaceBlit extends Blit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   432
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   433
    D3DRTTSurfaceToSurfaceBlit() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   434
        super(D3DSurfaceData.D3DSurfaceRTT,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   435
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   436
              D3DSurfaceData.D3DSurface);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   437
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   438
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   439
    public void Blit(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   440
                     Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   441
                     int sx, int sy, int dx, int dy, int w, int h)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   442
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   443
        D3DBlitLoops.IsoBlit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   444
                             null, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   445
                             comp, clip, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   446
                             AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   447
                             sx, sy, sx+w, sy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   448
                             dx, dy, dx+w, dy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   449
                             true);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   450
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   451
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   452
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   453
class D3DRTTSurfaceToSurfaceScale extends ScaledBlit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   454
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   455
    D3DRTTSurfaceToSurfaceScale() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   456
        super(D3DSurfaceData.D3DSurfaceRTT,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   457
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   458
              D3DSurfaceData.D3DSurface);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   459
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   460
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   461
    public void Scale(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   462
                      Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   463
                      int sx1, int sy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   464
                      int sx2, int sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   465
                      double dx1, double dy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   466
                      double dx2, double dy2)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   467
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   468
        D3DBlitLoops.IsoBlit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   469
                             null, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   470
                             comp, clip, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   471
                             AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   472
                             sx1, sy1, sx2, sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   473
                             dx1, dy1, dx2, dy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   474
                             true);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   475
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   476
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   477
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   478
class D3DRTTSurfaceToSurfaceTransform extends TransformBlit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   479
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   480
    D3DRTTSurfaceToSurfaceTransform() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   481
        super(D3DSurfaceData.D3DSurfaceRTT,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   482
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   483
              D3DSurfaceData.D3DSurface);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   484
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   485
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   486
    public void Transform(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   487
                          Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   488
                          AffineTransform at, int hint,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   489
                          int sx, int sy, int dx, int dy, int w, int h)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   490
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   491
        D3DBlitLoops.IsoBlit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   492
                             null, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   493
                             comp, clip, at, hint,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   494
                             sx, sy, sx+w, sy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   495
                             dx, dy, dx+w, dy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   496
                             true);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   497
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   498
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   499
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   500
class D3DSurfaceToSwBlit extends Blit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   501
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   502
    private int typeval;
36467
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   503
    private WeakReference<SurfaceData> srcTmp;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   504
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   505
    // REMIND: destination will actually be opaque/premultiplied...
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   506
    D3DSurfaceToSwBlit(SurfaceType dstType, int typeval) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   507
        super(D3DSurfaceData.D3DSurface,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   508
              CompositeType.SrcNoEa,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   509
              dstType);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   510
        this.typeval = typeval;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   511
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   512
36467
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   513
    /*
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   514
     * Clip value is ignored in D3D SurfaceToSw blit.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   515
     * Root Cause: The native interfaces to D3D use StretchRect API followed
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   516
     * by custom copy of pixels from Surface to Sysmem. As a result, clipping
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   517
     * in D3DSurfaceToSw works 'only' for Rect clips, provided, proper srcX,
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   518
     * srcY, dstX, dstY, width and height are passed to native interfaces.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   519
     * Non rect clips (For example: Shape clips) are ignored completely.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   520
     *
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   521
     * Solution: There are three solutions possible to fix this issue.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   522
     * 1. Convert the entire Surface to Sysmem and perform regular Blit.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   523
     *    An optimized version of this is to take up the conversion only
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   524
     *    when Shape clips are needed. Existing native interface will suffice
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   525
     *    for supporting Rect clips.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   526
     * 2. With help of existing classes we could perform SwToSurface,
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   527
     *    SurfaceToSurface (implements clip) and SurfaceToSw (complete copy)
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   528
     *    in order.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   529
     * 3. Modify the native D3D interface to accept clip and perform same logic
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   530
     *    as the second approach but at native side.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   531
     *
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   532
     * Upon multiple experiments, the first approach has been found to be
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   533
     * faster than the others as it deploys 1-draw/copy operation for rect clip
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   534
     * and 2-draw/copy operations for shape clip compared to 3-draws/copy
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   535
     * operations deployed by the remaining approaches.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   536
     *
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   537
     * complexClipBlit method helps to convert or copy the contents from
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   538
     * D3DSurface onto Sysmem and perform a regular Blit with the clip
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   539
     * information as required. This method is used when non-rectangular
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   540
     * clip is needed.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   541
     */
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   542
    private synchronized void complexClipBlit(SurfaceData src, SurfaceData dst,
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   543
                                              Composite comp, Region clip,
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   544
                                              int sx, int sy, int dx, int dy,
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   545
                                              int w, int h) {
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   546
        SurfaceData cachedSrc = null;
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   547
        if (srcTmp != null) {
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   548
            // use cached intermediate surface, if available
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   549
            cachedSrc = srcTmp.get();
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   550
        }
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   551
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   552
        // Type- indicates the pixel format of Sysmem based BufferedImage.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   553
        // Native d3d interfaces support on the fly conversion of pixels from
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   554
        // d3d surface to destination sysmem memory of type IntARGB only.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   555
        final int type = BufferedImage.TYPE_INT_ARGB;
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   556
        src = convertFrom(this, src, sx, sy, w, h, cachedSrc, type);
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   557
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   558
        // copy intermediate SW to destination SW using complex clip
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   559
        final Blit performop = Blit.getFromCache(src.getSurfaceType(),
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   560
                                                 CompositeType.SrcNoEa,
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   561
                                                 dst.getSurfaceType());
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   562
        performop.Blit(src, dst, comp, clip, 0, 0, dx, dy, w, h);
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   563
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   564
        if (src != cachedSrc) {
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   565
            // cache the intermediate surface
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   566
            srcTmp = new WeakReference<>(src);
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   567
        }
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   568
    }
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   569
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   570
    public void Blit(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   571
                     Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   572
                     int sx, int sy, int dx, int dy,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   573
                     int w, int h)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   574
    {
36467
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   575
        if (clip != null) {
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   576
            clip = clip.getIntersectionXYWH(dx, dy, w, h);
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   577
            // At the end this method will flush the RenderQueue, we should exit
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   578
            // from it as soon as possible.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   579
            if (clip.isEmpty()) {
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   580
                return;
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   581
            }
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   582
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   583
            // Adjust final dst(x,y) and src(x,y) based on the clip. The
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   584
            // logic is that, when clip limits drawing on the destination,
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   585
            // corresponding pixels from the src should be skipped.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   586
            sx += clip.getLoX() - dx;
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   587
            sy += clip.getLoY() - dy;
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   588
            dx = clip.getLoX();
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   589
            dy = clip.getLoY();
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   590
            w = clip.getWidth();
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   591
            h = clip.getHeight();
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   592
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   593
            // Check if the clip is Rectangular. For non-rectangular clips
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   594
            // complexClipBlit will convert Surface To Sysmem and perform
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   595
            // regular Blit.
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   596
            if (!clip.isRectangular()) {
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   597
                complexClipBlit(src, dst, comp, clip,
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   598
                                sx, sy, dx, dy,
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   599
                                w, h);
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   600
                return;
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   601
            }
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   602
        }
836382b377d9 8044788: [D3D] clip is ignored during surface->sw blit
psadhukhan
parents: 27500
diff changeset
   603
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   604
        D3DRenderQueue rq = D3DRenderQueue.getInstance();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   605
        rq.lock();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   606
        try {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   607
            // make sure the RenderQueue keeps a hard reference to the
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   608
            // destination (sysmem) SurfaceData to prevent it from being
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   609
            // disposed while the operation is processed on the QFT
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   610
            rq.addReference(dst);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   611
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   612
            RenderBuffer buf = rq.getBuffer();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   613
            D3DContext.setScratchSurface(((D3DSurfaceData)src).getContext());
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   614
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   615
            rq.ensureCapacityAndAlignment(48, 32);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   616
            buf.putInt(SURFACE_TO_SW_BLIT);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   617
            buf.putInt(sx).putInt(sy);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   618
            buf.putInt(dx).putInt(dy);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   619
            buf.putInt(w).putInt(h);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   620
            buf.putInt(typeval);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   621
            buf.putLong(src.getNativeOps());
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   622
            buf.putLong(dst.getNativeOps());
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   623
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   624
            // always flush immediately
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   625
            rq.flushNow();
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   626
        } finally {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   627
            rq.unlock();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   632
class D3DSwToSurfaceBlit extends Blit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   633
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   634
    private int typeval;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   635
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   636
    D3DSwToSurfaceBlit(SurfaceType srcType, int typeval) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   637
        super(srcType,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   638
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   639
              D3DSurfaceData.D3DSurface);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   640
        this.typeval = typeval;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   641
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   642
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   643
    public void Blit(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   644
                     Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   645
                     int sx, int sy, int dx, int dy, int w, int h)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   646
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   647
        D3DBlitLoops.Blit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   648
                          comp, clip, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   649
                          AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   650
                          sx, sy, sx+w, sy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   651
                          dx, dy, dx+w, dy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   652
                          typeval, false);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   653
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   654
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   655
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   656
class D3DSwToSurfaceScale extends ScaledBlit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   657
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   658
    private int typeval;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   659
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   660
    D3DSwToSurfaceScale(SurfaceType srcType, int typeval) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   661
        super(srcType,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   662
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   663
              D3DSurfaceData.D3DSurface);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   664
        this.typeval = typeval;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   665
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   666
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   667
    public void Scale(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   668
                      Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   669
                      int sx1, int sy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   670
                      int sx2, int sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   671
                      double dx1, double dy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   672
                      double dx2, double dy2)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   673
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   674
        D3DBlitLoops.Blit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   675
                          comp, clip, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   676
                          AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   677
                          sx1, sy1, sx2, sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   678
                          dx1, dy1, dx2, dy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   679
                          typeval, false);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   680
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   681
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   682
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   683
class D3DSwToSurfaceTransform extends TransformBlit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   684
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   685
    private int typeval;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   686
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   687
    D3DSwToSurfaceTransform(SurfaceType srcType, int typeval) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   688
        super(srcType,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   689
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   690
              D3DSurfaceData.D3DSurface);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   691
        this.typeval = typeval;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   692
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   693
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   694
    public void Transform(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   695
                          Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   696
                          AffineTransform at, int hint,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   697
                          int sx, int sy, int dx, int dy, int w, int h)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   698
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   699
        D3DBlitLoops.Blit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   700
                          comp, clip, at, hint,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   701
                          sx, sy, sx+w, sy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   702
                          dx, dy, dx+w, dy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   703
                          typeval, false);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   704
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   705
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   706
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   707
class D3DSwToTextureBlit extends Blit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   708
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   709
    private int typeval;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   710
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   711
    D3DSwToTextureBlit(SurfaceType srcType, int typeval) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   712
        super(srcType,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   713
              CompositeType.SrcNoEa,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   714
              D3DSurfaceData.D3DTexture);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   715
        this.typeval = typeval;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   716
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   717
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   718
    public void Blit(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   719
                     Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   720
                     int sx, int sy, int dx, int dy, int w, int h)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   721
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   722
        D3DBlitLoops.Blit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   723
                          comp, clip, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   724
                          AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   725
                          sx, sy, sx+w, sy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   726
                          dx, dy, dx+w, dy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   727
                          typeval, true);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   728
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   729
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   730
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   731
class D3DTextureToSurfaceBlit extends Blit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   732
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   733
    D3DTextureToSurfaceBlit() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   734
        super(D3DSurfaceData.D3DTexture,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   735
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   736
              D3DSurfaceData.D3DSurface);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   737
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   738
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   739
    public void Blit(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   740
                     Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   741
                     int sx, int sy, int dx, int dy, int w, int h)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   742
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   743
        D3DBlitLoops.IsoBlit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   744
                             null, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   745
                             comp, clip, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   746
                             AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   747
                             sx, sy, sx+w, sy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   748
                             dx, dy, dx+w, dy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   749
                             true);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   750
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   751
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   752
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
class D3DTextureToSurfaceScale extends ScaledBlit {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   755
    D3DTextureToSurfaceScale() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   756
        super(D3DSurfaceData.D3DTexture,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   757
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   758
              D3DSurfaceData.D3DSurface);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   759
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   760
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   761
    public void Scale(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   762
                      Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   763
                      int sx1, int sy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   764
                      int sx2, int sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   765
                      double dx1, double dy1,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   766
                      double dx2, double dy2)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   767
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   768
        D3DBlitLoops.IsoBlit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   769
                             null, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   770
                             comp, clip, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   771
                             AffineTransformOp.TYPE_NEAREST_NEIGHBOR,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   772
                             sx1, sy1, sx2, sy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   773
                             dx1, dy1, dx2, dy2,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   774
                             true);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   775
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   776
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   777
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   778
class D3DTextureToSurfaceTransform extends TransformBlit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   779
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   780
    D3DTextureToSurfaceTransform() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   781
        super(D3DSurfaceData.D3DTexture,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   782
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   783
              D3DSurfaceData.D3DSurface);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   784
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   785
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   786
    public void Transform(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   787
                          Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   788
                          AffineTransform at, int hint,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   789
                          int sx, int sy, int dx, int dy,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   790
                          int w, int h)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   791
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   792
        D3DBlitLoops.IsoBlit(src, dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   793
                             null, null,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   794
                             comp, clip, at, hint,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   795
                             sx, sy, sx+w, sy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   796
                             dx, dy, dx+w, dy+h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   797
                             true);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   798
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   799
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   800
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   801
/**
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 16734
diff changeset
   802
 * This general Blit implementation converts any source surface to an
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   803
 * intermediate IntArgbPre surface, and then uses the more specific
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   804
 * IntArgbPre->D3DSurface/Texture loop to get the intermediate
27500
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   805
 * (premultiplied) surface down to D3D using simple blit.
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   806
 */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   807
class D3DGeneralBlit extends Blit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   808
27500
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   809
    private final Blit performop;
25192
4e2dc0f8702d 8044551: Fix raw and unchecked lint warnings in platform-specific sun.awt files
henryjen
parents: 21278
diff changeset
   810
    private WeakReference<SurfaceData> srcTmp;
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   811
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   812
    D3DGeneralBlit(SurfaceType dstType,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   813
                   CompositeType compType,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   814
                   Blit performop)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   815
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   816
        super(SurfaceType.Any, compType, dstType);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   817
        this.performop = performop;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   820
    public synchronized void Blit(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   821
                                  Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   822
                                  int sx, int sy, int dx, int dy,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   823
                                  int w, int h)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   824
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   825
        Blit convertsrc = Blit.getFromCache(src.getSurfaceType(),
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   826
                                            CompositeType.SrcNoEa,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   827
                                            SurfaceType.IntArgbPre);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   828
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   829
        SurfaceData cachedSrc = null;
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   830
        if (srcTmp != null) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   831
            // use cached intermediate surface, if available
25192
4e2dc0f8702d 8044551: Fix raw and unchecked lint warnings in platform-specific sun.awt files
henryjen
parents: 21278
diff changeset
   832
            cachedSrc = srcTmp.get();
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   833
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   834
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   835
        // convert source to IntArgbPre
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   836
        src = convertFrom(convertsrc, src, sx, sy, w, h,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   837
                          cachedSrc, BufferedImage.TYPE_INT_ARGB_PRE);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   838
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   839
        // copy IntArgbPre intermediate surface to D3D surface
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   840
        performop.Blit(src, dst, comp, clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   841
                       0, 0, dx, dy, w, h);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   842
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   843
        if (src != cachedSrc) {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   844
            // cache the intermediate surface
25192
4e2dc0f8702d 8044551: Fix raw and unchecked lint warnings in platform-specific sun.awt files
henryjen
parents: 21278
diff changeset
   845
            srcTmp = new WeakReference<>(src);
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   846
        }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   847
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   848
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   849
27500
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   850
/**
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   851
 * This general TransformedBlit implementation converts any source surface to an
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   852
 * intermediate IntArgbPre surface, and then uses the more specific
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   853
 * IntArgbPre->D3DSurface/Texture loop to get the intermediate
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   854
 * (premultiplied) surface down to D3D using simple transformBlit.
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   855
 */
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   856
final class D3DGeneralTransformedBlit extends TransformBlit {
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   857
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   858
    private final TransformBlit performop;
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   859
    private WeakReference<SurfaceData> srcTmp;
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   860
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   861
    D3DGeneralTransformedBlit(final TransformBlit performop) {
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   862
        super(SurfaceType.Any, CompositeType.AnyAlpha,
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   863
                D3DSurfaceData.D3DSurface);
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   864
        this.performop = performop;
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   865
    }
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   866
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   867
    @Override
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   868
    public synchronized void Transform(SurfaceData src, SurfaceData dst,
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   869
                                       Composite comp, Region clip,
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   870
                                       AffineTransform at, int hint, int srcx,
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   871
                                       int srcy, int dstx, int dsty, int width,
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   872
                                       int height){
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   873
        Blit convertsrc = Blit.getFromCache(src.getSurfaceType(),
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   874
                                            CompositeType.SrcNoEa,
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   875
                                            SurfaceType.IntArgbPre);
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   876
        // use cached intermediate surface, if available
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   877
        final SurfaceData cachedSrc = srcTmp != null ? srcTmp.get() : null;
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   878
        // convert source to IntArgbPre
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   879
        src = convertFrom(convertsrc, src, srcx, srcy, width, height, cachedSrc,
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   880
                          BufferedImage.TYPE_INT_ARGB_PRE);
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   881
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   882
        // transform IntArgbPre intermediate surface to D3D surface
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   883
        performop.Transform(src, dst, comp, clip, at, hint, 0, 0, dstx, dsty,
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   884
                            width, height);
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   885
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   886
        if (src != cachedSrc) {
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   887
            // cache the intermediate surface
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   888
            srcTmp = new WeakReference<>(src);
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   889
        }
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   890
    }
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   891
}
d291fa015bf9 8059941: [D3D] The fix for JDK-8029253 should be ported to d3d pipeline
serb
parents: 25859
diff changeset
   892
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   893
/*
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   894
 * The following classes prohibit copying D3DSurfaces to the screen
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   895
 * (the D3D->sysmem->GDI path is known to be very very slow).
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   896
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   897
 * Note: we used to disable hw acceleration for the surafce manager associated
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   898
 * with the source surface in these loops but it proved to be too cautious.
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   899
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   900
 * In most cases d3d->screen copy happens only during some transitional
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   901
 * period where the accelerated destination surface is being recreated or
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   902
 * restored (for example, when Swing's backbuffer VI is copied to the screen
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   903
 * but the D3DScreenSurfaceManager couldn't restore its surface).
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   904
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   905
 * An exception is if for some reason we could not enable accelerated on-screen
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   906
 * rendering for this window for some permanent reason (like window being too
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   907
 * small, or a present BufferStrategy).
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   908
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   909
 * This meant that we'd disable hw acceleration after the first failure
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   910
 * completely (at least until the src image is recreated which in case of
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   911
 * Swing back-buffer happens only after resize).
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   912
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   913
 * Now we delegate to the VISM to figure out if the acceleration needs to
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   914
 * be disabled or if we can wait for a while until the onscreen accelerated
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   915
 * can resume (by marking the source surface lost and making sure the
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   916
 * VISM has a chance to use the backup surface).
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   917
 *
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   918
 */
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   919
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   920
class D3DSurfaceToGDIWindowSurfaceBlit extends Blit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   921
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   922
    D3DSurfaceToGDIWindowSurfaceBlit() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   923
        super(D3DSurfaceData.D3DSurface,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   924
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   925
              GDIWindowSurfaceData.AnyGdi);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   926
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   927
    @Override
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   928
    public void Blit(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   929
                     Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   930
                     int sx, int sy, int dx, int dy, int w, int h)
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   931
    {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   932
        // see comment above
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   933
        D3DVolatileSurfaceManager.handleVItoScreenOp(src, dst);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   934
    }
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   935
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   936
}
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   937
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   938
class D3DSurfaceToGDIWindowSurfaceScale extends ScaledBlit {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   939
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   940
    D3DSurfaceToGDIWindowSurfaceScale() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   941
        super(D3DSurfaceData.D3DSurface,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   942
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   943
              GDIWindowSurfaceData.AnyGdi);
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   944
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
    @Override
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
    public void Scale(SurfaceData src, SurfaceData dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
                      Composite comp, Region clip,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
                      int sx1, int sy1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
                      int sx2, int sy2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
                      double dx1, double dy1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
                      double dx2, double dy2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
    {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   953
        // see comment above
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   954
        D3DVolatileSurfaceManager.handleVItoScreenOp(src, dst);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   958
class D3DSurfaceToGDIWindowSurfaceTransform extends TransformBlit {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   960
    D3DSurfaceToGDIWindowSurfaceTransform() {
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   961
        super(D3DSurfaceData.D3DSurface,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   962
              CompositeType.AnyAlpha,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   963
              GDIWindowSurfaceData.AnyGdi);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
    @Override
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   966
    public void Transform(SurfaceData src, SurfaceData dst,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   967
                          Composite comp, Region clip,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   968
                          AffineTransform at, int hint,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   969
                          int sx, int sy, int dx, int dy,
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   970
                          int w, int h)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
    {
887
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   972
        // see comment above
0aab8d3fa11a 6725214: D3D: forward-port the new pipeline from 6u10
tdv
parents: 2
diff changeset
   973
        D3DVolatileSurfaceManager.handleVItoScreenOp(src, dst);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
}