jdk/src/java.desktop/share/native/libawt/java2d/loops/IntBgr.h
author ntv
Fri, 06 May 2016 11:23:49 +0000
changeset 37800 518e44c93fbb
parent 26751 70bac69b37c9
permissions -rw-r--r--
8015070: Antialiased text on translucent backgrounds gets bright artifacts Reviewed-by: flar, prr, jdv Contributed-by: prahalad.kumar.narayanan@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
     2
 * Copyright (c) 2000, 2008, Oracle and/or its affiliates. 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
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
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
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 715
diff changeset
    23
 * questions.
2
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 IntBgr_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define IntBgr_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "IntDcm.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include "ByteGray.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include "UshortGray.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * This file contains macro and type definitions used by the macros in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * LoopMacros.h to manipulate a surface of type "IntBgr".
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
typedef jint    IntBgrPixelType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
typedef jint    IntBgrDataType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
549
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
    41
#define IntBgrIsOpaque 1
4273b1234967 6679308: Poor text rendering on translucent image.
prr
parents: 2
diff changeset
    42
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define IntBgrPixelStride       4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#define DeclareIntBgrLoadVars(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#define DeclareIntBgrStoreVars(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#define InitIntBgrLoadVars(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#define SetIntBgrStoreVarsYPos(PREFIX, pRasInfo, y)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#define SetIntBgrStoreVarsXPos(PREFIX, pRasInfo, x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
#define InitIntBgrStoreVarsY(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#define InitIntBgrStoreVarsX(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
#define NextIntBgrStoreVarsX(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#define NextIntBgrStoreVarsY(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
#define IntBgrXparLutEntry              -1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#define IntBgrIsXparLutEntry(pix)       (pix < 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
#define StoreIntBgrNonXparFromArgb(pRas, PREFIX, x, argb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    (pRas)[x] = SwapIntDcmComponentsX123ToC321(argb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
#define IntBgrPixelFromArgb(pixel, rgb, pRasInfo) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    (pixel) = SwapIntDcmComponentsX123ToX321(rgb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
#define StoreIntBgrPixel(pRas, x, pixel) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    (pRas)[x] = (pixel)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
#define DeclareIntBgrPixelData(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
#define ExtractIntBgrPixelData(PIXEL, PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
#define StoreIntBgrPixelData(pPix, x, pixel, PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    StoreIntBgrPixel(pPix, x, pixel)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
#define LoadIntBgrTo1IntRgb(pRas, PREFIX, x, rgb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        jint pixel = (pRas)[x]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        (rgb) = SwapIntDcmComponentsX123ToX321(pixel); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
#define LoadIntBgrTo1IntArgb(pRas, PREFIX, x, argb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        jint pixel = (pRas)[x]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        (argb) = SwapIntDcmComponentsX123ToS321(pixel); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
#define LoadIntBgrTo3ByteRgb(pRas, PREFIX, x, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        jint pixel = (pRas)[x]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        ExtractIntDcmComponentsX123(pixel, b, g, r); \
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 LoadIntBgrTo4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
        LoadIntBgrTo3ByteRgb(pRas, PREFIX, x, r, g, b); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
        (a) = 0xff; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
#define StoreIntBgrFrom1IntRgb(pRas, PREFIX, x, rgb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    (pRas)[x] = SwapIntDcmComponentsX123ToX321(rgb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
#define StoreIntBgrFrom1IntArgb(pRas, PREFIX, x, argb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    StoreIntBgrFrom1IntRgb(pRas, PREFIX, x, argb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
#define StoreIntBgrFrom3ByteRgb(pRas, PREFIX, x, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    (pRas)[x] = ComposeIntDcmComponentsX123(b, g, r)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
#define StoreIntBgrFrom4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    StoreIntBgrFrom3ByteRgb(pRas, PREFIX, x, r, g, b)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
#define CopyIntBgrToIntArgbPre(pRGB, i, PREFIX, pRow, x) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    LoadIntBgrTo1IntArgb(pRow, PREFIX, x, (pRGB)[i])
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
#define DeclareIntBgrAlphaLoadData(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
#define InitIntBgrAlphaLoadData(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
#define LoadAlphaFromIntBgrFor4ByteArgb(pRas, PREFIX, COMP_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    COMP_PREFIX ## A = 0xff
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
#define Postload4ByteArgbFromIntBgr(pRas, PREFIX, COMP_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    LoadIntBgrTo3ByteRgb(pRas, PREFIX, 0, COMP_PREFIX ## R, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
                         COMP_PREFIX ## G, COMP_PREFIX ## B)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
#define IntBgrIsPremultiplied   0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
#define DeclareIntBgrBlendFillVars(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    jint PREFIX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
#define ClearIntBgrBlendFillVars(PREFIX, argb) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    PREFIX = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
#define InitIntBgrBlendFillVarsNonPre(PREFIX, argb, COMP_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    PREFIX = ComposeIntDcmComponentsX123(COMP_PREFIX ## B, COMP_PREFIX ## G, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
                                         COMP_PREFIX ## R)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
#define InitIntBgrBlendFillVarsPre(PREFIX, argb, COMP_PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
#define StoreIntBgrBlendFill(pRas, PREFIX, x, argb, COMP_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    (pRas)[x] = PREFIX
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
#define StoreIntBgrFrom4ByteArgbComps(pRas, PREFIX, x, COMP_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    StoreIntBgrFrom4ByteArgb(pRas, PREFIX, x, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
                             COMP_PREFIX ## A, COMP_PREFIX ## R, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
                             COMP_PREFIX ## G, COMP_PREFIX ## B)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
#endif /* IntBgr_h_Included */