jdk/src/share/native/sun/java2d/loops/Ushort555Rgbx.h
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 549 4273b1234967
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2002 Sun Microsystems, Inc.  All Rights Reserved.
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
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
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
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#ifndef Ushort555Rgbx_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define Ushort555Rgbx_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * This file contains macro and type definitions used by the macros in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * LoopMacros.h to manipulate a surface of type "Ushort555Rgbx".
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
typedef jushort Ushort555RgbxPixelType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
typedef jushort Ushort555RgbxDataType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#define Ushort555RgbxPixelStride        2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#define DeclareUshort555RgbxLoadVars(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#define DeclareUshort555RgbxStoreVars(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#define SetUshort555RgbxStoreVarsYPos(PREFIX, pRasInfo, y)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#define SetUshort555RgbxStoreVarsXPos(PREFIX, pRasInfo, x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define InitUshort555RgbxLoadVars(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#define InitUshort555RgbxStoreVarsY(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#define InitUshort555RgbxStoreVarsX(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#define NextUshort555RgbxStoreVarsX(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#define NextUshort555RgbxStoreVarsY(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#define DeclareUshort555RgbxPixelData(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#define ExtractUshort555RgbxPixelData(PIXEL, PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#define Ushort555RgbxXparLutEntry               -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
#define Ushort555RgbxIsXparLutEntry(pix)        (pix < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#define StoreUshort555RgbxNonXparFromArgb       StoreUshort555RgbxFrom1IntArgb
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#define IntArgbToUshort555Rgbx(rgb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    (Ushort555RgbxPixelType)((((rgb) >> (16 + 3 - 11)) & 0xf800) | \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                             (((rgb) >> ( 8 + 3 -  6)) & 0x07c0) | \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                             (((rgb) >> ( 0 + 3 -  1)) & 0x003e))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
#define Ushort555RgbxPixelFromArgb(pixel, rgb, pRasInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    (pixel) = IntArgbToUshort555Rgbx(rgb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
#define StoreUshort555RgbxPixel(pRas, x, pixel) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    ((pRas)[x] = (jushort) (pixel))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
#define StoreUshort555RgbxPixelData(pPix, x, pixel, PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    StoreUshort555RgbxPixel(pPix, x, pixel)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
#define LoadUshort555RgbxTo3ByteRgb(pRas, PREFIX, x, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        jushort pixel = (pRas)[x]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        (r) = ((pixel) >> 11) & 0x1f; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        (r) = ((r) << 3) | ((r) >> 2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        (g) = ((pixel) >>  6) & 0x1f; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        (g) = ((g) << 3) | ((g) >> 2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        (b) = ((pixel) >>  1) & 0x1f; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        (b) = ((b) << 3) | ((b) >> 2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
#define LoadUshort555RgbxTo4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        LoadUshort555RgbxTo3ByteRgb(pRas, PREFIX, x, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        (a) = 0xff; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
#define StoreUshort555RgbxFrom1IntArgb(pRas, PREFIX, x, rgb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    (pRas)[x] = IntArgbToUshort555Rgbx(rgb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
#define StoreUshort555RgbxFrom1IntRgb(pRas, PREFIX, x, rgb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    StoreUshort555RgbxFrom1IntArgb(pRas, PREFIX, x, rgb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
#define StoreUshort555RgbxFrom3ByteRgb(pRas, PREFIX, x, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    (pRas)[x] = (jushort) ((((r) >> 3) << 11) | \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                           (((g) >> 3) <<  6) | \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                           (((b) >> 3) <<  1))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
#define StoreUshort555RgbxFrom4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    StoreUshort555RgbxFrom3ByteRgb(pRas, PREFIX, x, r, g, b)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
#endif /* Ushort555Rgbx_h_Included */