jdk/src/share/native/sun/java2d/loops/Ushort4444Argb.h
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 549 4273b1234967
child 5506 202f599c92aa
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 549
diff changeset
     2
 * Copyright 2002-2008 Sun Microsystems, Inc.  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
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 Ushort4444Argb_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define Ushort4444Argb_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 "Ushort4444Argb".
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 Ushort4444ArgbPixelType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
typedef jushort Ushort4444ArgbDataType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
549
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
    37
#define Ushort4444ArgbIsOpaque 0
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
    38
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#define Ushort4444ArgbPixelStride               2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#define DeclareUshort4444ArgbLoadVars(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#define DeclareUshort4444ArgbStoreVars(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define SetUshort4444ArgbStoreVarsYPos(PREFIX, pRasInfo, y)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#define SetUshort4444ArgbStoreVarsXPos(PREFIX, pRasInfo, x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#define InitUshort4444ArgbLoadVars(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#define InitUshort4444ArgbStoreVarsY(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#define InitUshort4444ArgbStoreVarsX(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#define NextUshort4444ArgbStoreVarsX(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#define NextUshort4444ArgbStoreVarsY(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
#define DeclareUshort4444ArgbPixelData(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#define ExtractUshort4444ArgbPixelData(PIXEL, PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#define Ushort4444ArgbXparLutEntry              -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
#define Ushort4444ArgbIsXparLutEntry(pix)               (pix < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
#define StoreUshort4444ArgbNonXparFromArgb      StoreUshort4444ArgbFrom1IntArgb
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
#define ComposeUshort4444ArgbFrom3ByteRgb(r, g, b)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
#define IntArgbToUshort4444Argb(rgb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    (Ushort4444ArgbPixelType)((((rgb) << 8) & 0xf000) | \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                              (((rgb) << 4) & 0x0f00) | \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                              (((rgb) << 0) & 0x00f0) | \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                              (((rgb) >> 4) & 0x000f))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
#define Ushort4444ArgbPixelFromArgb(pixel, rgb, pRasInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    (pixel) = IntArgbToUshort4444Argb(rgb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
#define StoreUshort4444ArgbPixel(pRas, x, pixel) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    ((pRas)[x] = (jushort) (pixel))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#define StoreUshort4444ArgbPixelData(pPix, x, pixel, PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
#define LoadUshort4444ArgbTo3ByteRgb(pRas, PREFIX, x, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        jushort pixel = (pRas)[x]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        (r) = ((pixel) >> 8) & 0xf; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        (r) = ((r) << 4) | (r); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        (g) = ((pixel) >>  4) & 0xf; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        (g) = ((g) << 4) | (g); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        (b) = ((pixel) >>  0) & 0xf; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
        (b) = ((b) << 4) | (b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
#define LoadUshort4444ArgbTo4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
        jushort pixel = (pRas)[x]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        LoadUshort4444ArgbTo3ByteRgb(pRas, PREFIX, x, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        (a) = ((pixel) >>  12) & 0xf; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        (a) = ((a) << 4) | (a); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
#define LoadUshort4444ArgbTo1IntArgb(pRas, PREFIX, x, argb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        jint a, r, g, b; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        LoadUshort4444ArgbTo4ByteArgb(pRas, PREFIX, x, a, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
        (argb) = (a << 24) | (r << 16) | (g << 8) | (b << 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
#define LoadUshort4444ArgbTo1IntRgb(pRas, PREFIX, x, rgb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        jint r, g, b; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        LoadUshort4444ArgbTo3ByteRgb(pRas, PREFIX, x, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
        (rgb) = 0xff000000 | (r << 16) | (g << 8) | (b << 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
#define StoreUshort4444ArgbFrom1IntArgb(pRas, PREFIX, x, rgb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
#define StoreUshort4444ArgbFrom1IntRgb(pRas, PREFIX, x, rgb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
#define StoreUshort4444ArgbFrom3ByteRgb(pRas, PREFIX, x, r, g, b)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
#define StoreUshort4444ArgbFrom4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        (pRas)[x] = (jushort)((((a) <<  8) & 0xf000) | \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                              (((r) <<  4) & 0x0f00) | \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                              (((g) <<  0) & 0x00f0) | \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                              (((b) >>  4) & 0x000f)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
#define DeclareUshort4444ArgbAlphaLoadData(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    jint PREFIX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
#define InitUshort4444ArgbAlphaLoadData(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
#define LoadAlphaFromUshort4444ArgbFor4ByteArgb(pRas, PREFIX, COMP_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        PREFIX = (pRas)[0]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        COMP_PREFIX ## A = (((jushort) PREFIX) >> 12) & 0xf; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        COMP_PREFIX ## A = ((COMP_PREFIX ## A) << 4) | (COMP_PREFIX ## A); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
#define Postload4ByteArgbFromUshort4444Argb(pRas, PREFIX, COMP_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    LoadUshort4444ArgbTo4ByteArgb(pRas, PREFIX, 0, COMP_PREFIX ## A, COMP_PREFIX ## R, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
                                  COMP_PREFIX ## G, COMP_PREFIX ## B)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
#define Ushort4444ArgbIsPremultiplied   0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
#define StoreUshort4444ArgbFrom4ByteArgbComps(pRas, PREFIX, x, COMP_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    StoreUshort4444ArgbFrom4ByteArgb(pRas, PREFIX, x, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                                     COMP_PREFIX ## A, COMP_PREFIX ## R, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                                     COMP_PREFIX ## G, COMP_PREFIX ## B)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
#endif /* Ushort4444Argb_h_Included */