1 | /* |
2 | * Copyright (c) 2000, 2001, 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 | #include "GraphicsPrimitiveMgr.h" |
27 | #include "LoopMacros.h" |
28 | |
29 | /* |
30 | * This file contains macro and type definitions used by the macros in |
31 | * LoopMacros.h to manipulate a surface of type "Any4Byte". |
32 | */ |
33 | |
34 | typedef jubyte Any4ByteDataType; |
35 | |
36 | #define Any4BytePixelStride 4 |
37 | |
38 | #define DeclareAny4ByteLoadVars(PREFIX) |
39 | #define DeclareAny4ByteStoreVars(PREFIX) |
40 | #define InitAny4ByteLoadVars(PREFIX, pRasInfo) |
41 | #define InitAny4ByteStoreVarsY(PREFIX, pRasInfo) |
42 | #define InitAny4ByteStoreVarsX(PREFIX, pRasInfo) |
43 | #define NextAny4ByteStoreVarsX(PREFIX) |
44 | #define NextAny4ByteStoreVarsY(PREFIX) |
45 | |
46 | #define DeclareAny4BytePixelData(PREFIX) \ |
47 | jubyte PREFIX ## 0, PREFIX ## 1, PREFIX ## 2, PREFIX ## 3; |
48 | |
49 | #define (PIXEL, PREFIX) \ |
50 | do { \ |
51 | PREFIX ## 0 = (jubyte) (PIXEL); \ |
52 | PREFIX ## 1 = (jubyte) (PIXEL >> 8); \ |
53 | PREFIX ## 2 = (jubyte) (PIXEL >> 16); \ |
54 | PREFIX ## 3 = (jubyte) (PIXEL >> 24); \ |
55 | } while (0) |
56 | |
57 | #define StoreAny4BytePixelData(pPix, x, pixel, PREFIX) \ |
58 | do { \ |
59 | (pPix)[4*x+0] = PREFIX ## 0; \ |
60 | (pPix)[4*x+1] = PREFIX ## 1; \ |
61 | (pPix)[4*x+2] = PREFIX ## 2; \ |
62 | (pPix)[4*x+3] = PREFIX ## 3; \ |
63 | } while (0) |
64 | |
65 | #define CopyAny4BytePixelData(pSrc, sx, pDst, dx) \ |
66 | do { \ |
67 | (pDst)[4*dx+0] = (pSrc)[4*sx+0]; \ |
68 | (pDst)[4*dx+1] = (pSrc)[4*sx+1]; \ |
69 | (pDst)[4*dx+2] = (pSrc)[4*sx+2]; \ |
70 | (pDst)[4*dx+3] = (pSrc)[4*sx+3]; \ |
71 | } while (0) |
72 | |
73 | #define XorCopyAny4BytePixelData(pSrc, pDst, x, xorpixel, XORPREFIX) \ |
74 | do { \ |
75 | (pDst)[4*x+0] ^= (pSrc)[4*x+0] ^ XORPREFIX ## 0; \ |
76 | (pDst)[4*x+1] ^= (pSrc)[4*x+1] ^ XORPREFIX ## 1; \ |
77 | (pDst)[4*x+2] ^= (pSrc)[4*x+2] ^ XORPREFIX ## 2; \ |
78 | (pDst)[4*x+3] ^= (pSrc)[4*x+3] ^ XORPREFIX ## 3; \ |
79 | } while (0) |
80 | |
81 | #define XorAny4BytePixelData(srcpixel, SRCPREFIX, pDst, x, \ |
82 | xorpixel, XORPREFIX, mask, MASKPREFIX) \ |
83 | do { \ |
84 | (pDst)[4*x+0] ^= ((SRCPREFIX ## 0 ^ XORPREFIX ## 0) & \ |
85 | ~MASKPREFIX ## 0); \ |
86 | (pDst)[4*x+1] ^= ((SRCPREFIX ## 1 ^ XORPREFIX ## 1) & \ |
87 | ~MASKPREFIX ## 1); \ |
88 | (pDst)[4*x+2] ^= ((SRCPREFIX ## 2 ^ XORPREFIX ## 2) & \ |
89 | ~MASKPREFIX ## 2); \ |
90 | (pDst)[4*x+3] ^= ((SRCPREFIX ## 3 ^ XORPREFIX ## 3) & \ |
91 | ~MASKPREFIX ## 3); \ |
92 | } while (0) |
93 | |
94 | DECLARE_ISOCOPY_BLIT(Any4Byte); |
95 | DECLARE_ISOSCALE_BLIT(Any4Byte); |
96 | DECLARE_ISOXOR_BLIT(Any4Byte); |
97 | |
98 | #define REGISTER_ANY4BYTE_ISOCOPY_BLIT(FOURBYTETYPE) \ |
99 | REGISTER_ISOCOPY_BLIT(FOURBYTETYPE, Any4Byte) |
100 | |
101 | #define REGISTER_ANY4BYTE_ISOSCALE_BLIT(FOURBYTETYPE) \ |
102 | REGISTER_ISOSCALE_BLIT(FOURBYTETYPE, Any4Byte) |
103 | |
104 | #define REGISTER_ANY4BYTE_ISOXOR_BLIT(FOURBYTETYPE) \ |
105 | REGISTER_ISOXOR_BLIT(FOURBYTETYPE, Any4Byte) |
106 | |