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 "Any3Byte".
32  */
33 
34 typedef jubyte  Any3ByteDataType;
35 
36 #define Any3BytePixelStride     3
37 
38 #define DeclareAny3ByteLoadVars(PREFIX)
39 #define DeclareAny3ByteStoreVars(PREFIX)
40 #define InitAny3ByteLoadVars(PREFIX, pRasInfo)
41 #define InitAny3ByteStoreVarsY(PREFIX, pRasInfo)
42 #define InitAny3ByteStoreVarsX(PREFIX, pRasInfo)
43 #define NextAny3ByteStoreVarsX(PREFIX)
44 #define NextAny3ByteStoreVarsY(PREFIX)
45 
46 #define DeclareAny3BytePixelData(PREFIX) \
47     jubyte PREFIX ## 0, PREFIX ## 1, PREFIX ## 2;
48 
49 #define ExtractAny3BytePixelData(PIXEL, PREFIX) \
50     do { \
51         PREFIX ## 0 = (jubyte) (PIXEL); \
52         PREFIX ## 1 = (jubyte) (PIXEL >> 8); \
53         PREFIX ## 2 = (jubyte) (PIXEL >> 16); \
54     } while (0)
55 
56 #define StoreAny3BytePixelData(pPix, x, pixel, PREFIX) \
57     do { \
58         (pPix)[3*x+0] = PREFIX ## 0; \
59         (pPix)[3*x+1] = PREFIX ## 1; \
60         (pPix)[3*x+2] = PREFIX ## 2; \
61     } while (0)
62 
63 #define CopyAny3BytePixelData(pSrc, sx, pDst, dx) \
64     do { \
65         (pDst)[3*dx+0] = (pSrc)[3*sx+0]; \
66         (pDst)[3*dx+1] = (pSrc)[3*sx+1]; \
67         (pDst)[3*dx+2] = (pSrc)[3*sx+2]; \
68     } while (0)
69 
70 #define XorCopyAny3BytePixelData(pSrc, pDst, x, xorpixel, XORPREFIX) \
71     do { \
72         (pDst)[3*x+0] ^= (pSrc)[3*x+0] ^ XORPREFIX ## 0; \
73         (pDst)[3*x+1] ^= (pSrc)[3*x+1] ^ XORPREFIX ## 1; \
74         (pDst)[3*x+2] ^= (pSrc)[3*x+2] ^ XORPREFIX ## 2; \
75     } while (0)
76 
77 #define XorAny3BytePixelData(srcpixel, SRCPREFIX, pDst, x, \
78                              xorpixel, XORPREFIX, mask, MASKPREFIX) \
79     do { \
80         (pDst)[3*x+0] ^= ((SRCPREFIX ## 0 ^ XORPREFIX ## 0) & \
81                           ~MASKPREFIX ## 0); \
82         (pDst)[3*x+1] ^= ((SRCPREFIX ## 1 ^ XORPREFIX ## 1) & \
83                           ~MASKPREFIX ## 1); \
84         (pDst)[3*x+2] ^= ((SRCPREFIX ## 2 ^ XORPREFIX ## 2) & \
85                           ~MASKPREFIX ## 2); \
86     } while (0)
87 
88 DECLARE_ISOCOPY_BLIT(Any3Byte);
89 DECLARE_ISOSCALE_BLIT(Any3Byte);
90 DECLARE_ISOXOR_BLIT(Any3Byte);
91 
92 #define REGISTER_ANY3BYTE_ISOCOPY_BLIT(THREEBYTETYPE) \
93     REGISTER_ISOCOPY_BLIT(THREEBYTETYPE, Any3Byte)
94 
95 #define REGISTER_ANY3BYTE_ISOSCALE_BLIT(THREEBYTETYPE) \
96     REGISTER_ISOSCALE_BLIT(THREEBYTETYPE, Any3Byte)
97 
98 #define REGISTER_ANY3BYTE_ISOXOR_BLIT(THREEBYTETYPE) \
99     REGISTER_ISOXOR_BLIT(THREEBYTETYPE, Any3Byte)
100