Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/classes/sun/java2d/x11/X11PMBlitBgLoops.java
32288 views
1
/*
2
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package sun.java2d.x11;
27
28
import sun.awt.SunToolkit;
29
import sun.java2d.loops.GraphicsPrimitive;
30
import sun.java2d.loops.GraphicsPrimitiveMgr;
31
import sun.java2d.loops.CompositeType;
32
import sun.java2d.loops.SurfaceType;
33
import sun.java2d.loops.BlitBg;
34
import sun.java2d.SurfaceData;
35
import sun.java2d.pipe.Region;
36
import java.awt.Color;
37
import java.awt.Composite;
38
39
/**
40
* X11PMBlitBgLoops
41
*
42
* This class accelerates Blits between two surfaces of types *PM. Since
43
* the onscreen surface is of that type and some of the offscreen surfaces
44
* may be of that type (if they were created via X11OffScreenImage), then
45
* this type of BlitBg will accelerated double-buffer copies between those
46
* two surfaces.
47
*/
48
public class X11PMBlitBgLoops extends BlitBg {
49
50
public static void register()
51
{
52
GraphicsPrimitive[] primitives = {
53
new X11PMBlitBgLoops(X11SurfaceData.IntBgrX11_BM,
54
X11SurfaceData.IntBgrX11),
55
new X11PMBlitBgLoops(X11SurfaceData.IntRgbX11_BM,
56
X11SurfaceData.IntRgbX11),
57
new X11PMBlitBgLoops(X11SurfaceData.ThreeByteBgrX11_BM,
58
X11SurfaceData.ThreeByteBgrX11),
59
new X11PMBlitBgLoops(X11SurfaceData.ThreeByteRgbX11_BM,
60
X11SurfaceData.ThreeByteRgbX11),
61
new X11PMBlitBgLoops(X11SurfaceData.ByteIndexedX11_BM,
62
X11SurfaceData.ByteIndexedOpaqueX11),
63
new X11PMBlitBgLoops(X11SurfaceData.ByteGrayX11_BM,
64
X11SurfaceData.ByteGrayX11),
65
new X11PMBlitBgLoops(X11SurfaceData.Index8GrayX11_BM,
66
X11SurfaceData.Index8GrayX11),
67
new X11PMBlitBgLoops(X11SurfaceData.UShort555RgbX11_BM,
68
X11SurfaceData.UShort555RgbX11),
69
new X11PMBlitBgLoops(X11SurfaceData.UShort565RgbX11_BM,
70
X11SurfaceData.UShort565RgbX11),
71
new X11PMBlitBgLoops(X11SurfaceData.UShortIndexedX11_BM,
72
X11SurfaceData.UShortIndexedX11),
73
new X11PMBlitBgLoops(X11SurfaceData.IntRgbX11_BM,
74
X11SurfaceData.IntArgbPreX11),
75
new X11PMBlitBgLoops(X11SurfaceData.IntBgrX11_BM,
76
X11SurfaceData.FourByteAbgrPreX11),
77
};
78
GraphicsPrimitiveMgr.register(primitives);
79
}
80
81
public X11PMBlitBgLoops(SurfaceType srcType, SurfaceType dstType)
82
{
83
super(srcType, CompositeType.SrcNoEa, dstType);
84
}
85
86
@Override
87
public void BlitBg(SurfaceData src, SurfaceData dst,
88
Composite comp, Region clip, int bgColor,
89
int sx, int sy,
90
int dx, int dy,
91
int w, int h)
92
{
93
SunToolkit.awtLock();
94
try {
95
int pixel = dst.pixelFor(bgColor);
96
X11SurfaceData x11sd = (X11SurfaceData)dst;
97
// use false for needExposures since we clip to the pixmap
98
long xgc = x11sd.getBlitGC(clip, false);
99
nativeBlitBg(src.getNativeOps(), dst.getNativeOps(),
100
xgc, pixel,
101
sx, sy, dx, dy, w, h);
102
} finally {
103
SunToolkit.awtUnlock();
104
}
105
}
106
107
/**
108
* This native method is where all of the work happens in the
109
* accelerated Blit.
110
*/
111
private native void nativeBlitBg(long srcData, long dstData,
112
long xgc, int pixel,
113
int sx, int sy,
114
int dx, int dy,
115
int w, int h);
116
}
117
118