0N/A/*
2362N/A * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A#ifndef IntArgbPre_h_Included
0N/A#define IntArgbPre_h_Included
0N/A
0N/A#include "IntDcm.h"
0N/A
0N/A/*
0N/A * This file contains macro and type definitions used by the macros in
0N/A * LoopMacros.h to manipulate a surface of type "IntArgbPre".
0N/A */
0N/A
0N/Atypedef jint IntArgbPrePixelType;
0N/Atypedef jint IntArgbPreDataType;
0N/A
300N/A#define IntArgbPreIsOpaque 0
300N/A
0N/A#define IntArgbPrePixelStride 4
0N/A
0N/A#define DeclareIntArgbPreLoadVars(PREFIX)
0N/A#define DeclareIntArgbPreStoreVars(PREFIX)
0N/A#define InitIntArgbPreLoadVars(PREFIX, pRasInfo)
0N/A#define SetIntArgbPreStoreVarsYPos(PREFIX, pRasInfo, y)
0N/A#define SetIntArgbPreStoreVarsXPos(PREFIX, pRasInfo, x)
0N/A#define InitIntArgbPreStoreVarsY(PREFIX, pRasInfo)
0N/A#define InitIntArgbPreStoreVarsX(PREFIX, pRasInfo)
0N/A#define NextIntArgbPreStoreVarsX(PREFIX)
0N/A#define NextIntArgbPreStoreVarsY(PREFIX)
0N/A
0N/A
0N/A#define IntArgbPrePixelFromArgb(pixel, rgb, pRasInfo) \
0N/A do { \
0N/A if ((((rgb) >> 24) + 1) == 0) { \
0N/A (pixel) = (rgb); \
0N/A } else { \
0N/A jint a, r, g, b; \
0N/A ExtractIntDcmComponents1234(rgb, a, r, g, b); \
0N/A r = MUL8(a, r); \
0N/A g = MUL8(a, g); \
0N/A b = MUL8(a, b); \
0N/A (pixel) = ComposeIntDcmComponents1234(a, r, g, b); \
0N/A } \
0N/A } while (0)
0N/A
0N/A#define StoreIntArgbPrePixel(pRas, x, pixel) \
0N/A (pRas)[x] = (pixel)
0N/A
0N/A#define DeclareIntArgbPrePixelData(PREFIX)
0N/A
0N/A#define ExtractIntArgbPrePixelData(PIXEL, PREFIX)
0N/A
0N/A#define StoreIntArgbPrePixelData(pPix, x, pixel, PREFIX) \
0N/A (pPix)[x] = (pixel)
0N/A
0N/A
0N/A/*
0N/A * REMIND: we delegate to the ...To1IntArgb macro here, although it does
0N/A * slightly more work (may pack the alpha value into the RGB result)
0N/A */
0N/A#define LoadIntArgbPreTo1IntRgb(pRas, PREFIX, x, rgb) \
0N/A LoadIntArgbPreTo1IntArgb(pRas, PREFIX, x, rgb)
0N/A
0N/A#define LoadIntArgbPreTo1IntArgb(pRas, PREFIX, x, argb) \
0N/A do { \
0N/A jint pixel = (pRas)[x]; \
0N/A jint a = ((juint) pixel) >> 24; \
0N/A if ((a == 0xff) || (a == 0)) { \
0N/A (argb) = pixel; \
0N/A } else { \
0N/A jint r, g, b; \
0N/A ExtractIntDcmComponentsX123(pixel, r, g, b); \
0N/A r = DIV8(r, a); \
0N/A g = DIV8(g, a); \
0N/A b = DIV8(b, a); \
0N/A (argb) = ComposeIntDcmComponents1234(a, r, g, b); \
0N/A } \
0N/A } while (0)
0N/A
0N/A#define LoadIntArgbPreTo3ByteRgb(pRas, PREFIX, x, r, g, b) \
0N/A do { \
0N/A jint a; \
0N/A LoadIntArgbPreTo4ByteArgb(pRas, PREFIX, x, a, r, g, b); \
0N/A } while (0)
0N/A
0N/A#define LoadIntArgbPreTo4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
0N/A do { \
0N/A jint pixel = (pRas)[x]; \
0N/A ExtractIntDcmComponents1234(pixel, a, r, g, b); \
0N/A if (((a) != 0xff) && ((a) != 0)) { \
0N/A (r) = DIV8(r, a); \
0N/A (g) = DIV8(g, a); \
0N/A (b) = DIV8(b, a); \
0N/A } \
0N/A } while (0)
0N/A
0N/A#define StoreIntArgbPreFrom1IntRgb(pRas, PREFIX, x, rgb) \
0N/A (pRas)[x] = 0xff000000 | (rgb)
0N/A
0N/A#define StoreIntArgbPreFrom1IntArgb(pRas, PREFIX, x, argb) \
0N/A do { \
0N/A if ((((argb) >> 24) + 1) == 0) { \
0N/A (pRas)[x] = (argb); \
0N/A } else { \
0N/A jint a, r, g, b; \
0N/A ExtractIntDcmComponents1234(argb, a, r, g, b); \
0N/A r = MUL8(a, r); \
0N/A g = MUL8(a, g); \
0N/A b = MUL8(a, b); \
0N/A (pRas)[x] = ComposeIntDcmComponents1234(a, r, g, b); \
0N/A } \
0N/A } while (0)
0N/A
0N/A#define StoreIntArgbPreFrom3ByteRgb(pRas, PREFIX, x, r, g, b) \
0N/A (pRas)[x] = ComposeIntDcmComponents1234(0xff, r, g, b)
0N/A
0N/A#define StoreIntArgbPreFrom4ByteArgb(pRas, PREFIX, x, a, r, g, b) \
0N/A do { \
0N/A if ((a) != 0xff) { \
0N/A (r) = MUL8(a, r); \
0N/A (g) = MUL8(a, g); \
0N/A (b) = MUL8(a, b); \
0N/A } \
0N/A (pRas)[x] = ComposeIntDcmComponents1234(a, r, g, b); \
0N/A } while (0)
0N/A
0N/A#define CopyIntArgbPreToIntArgbPre(pRGB, i, PREFIX, pRow, x) \
0N/A (pRGB)[i] = (pRow)[x]
0N/A
0N/A
0N/A#define DeclareIntArgbPreAlphaLoadData(PREFIX) \
0N/A jint PREFIX;
0N/A
0N/A#define InitIntArgbPreAlphaLoadData(PREFIX, pRasInfo)
0N/A
0N/A#define LoadAlphaFromIntArgbPreFor4ByteArgb(pRas, PREFIX, COMP_PREFIX) \
0N/A do { \
0N/A PREFIX = (pRas)[0]; \
0N/A COMP_PREFIX ## A = ((juint) PREFIX) >> 24; \
0N/A } while (0)
0N/A
0N/A#define LoadAlphaFromIntArgbPreFor1ByteGray(pRas, PREFIX, COMP_PREFIX) \
0N/A LoadAlphaFromIntArgbPreFor4ByteArgb(pRas, PREFIX, COMP_PREFIX)
0N/A
0N/A#define LoadAlphaFromIntArgbPreFor1ShortGray(pRas, PREFIX, COMP_PREFIX) \
0N/A do { \
0N/A LoadAlphaFromIntArgbFor4ByteArgb(pRas, PREFIX, COMP_PREFIX); \
0N/A COMP_PREFIX ## A = (COMP_PREFIX ## A << 8) + COMP_PREFIX ## A; \
0N/A } while (0)
0N/A
0N/A#define Postload4ByteArgbFromIntArgbPre(pRas, PREFIX, COMP_PREFIX) \
0N/A do { \
0N/A ExtractIntDcmComponentsX123(PREFIX, COMP_PREFIX ## R, \
0N/A COMP_PREFIX ## G, COMP_PREFIX ## B); \
0N/A } while (0)
0N/A
0N/A#define Postload1ByteGrayFromIntArgbPre(pRas, PREFIX, COMP_PREFIX) \
0N/A do { \
0N/A int r, g, b; \
0N/A ExtractIntDcmComponentsX123(PREFIX, r, g, b); \
0N/A COMP_PREFIX ## G = ComposeByteGrayFrom3ByteRgb(r, g, b); \
0N/A } while (0)
0N/A
0N/A#define Postload1ShortGrayFromIntArgbPre(pRas, PREFIX, COMP_PREFIX) \
0N/A do { \
0N/A int r, g, b; \
0N/A ExtractIntDcmComponentsX123(PREFIX, r, g, b); \
0N/A COMP_PREFIX ## G = ComposeUshortGrayFrom3ByteRgb(r, g, b); \
0N/A } while (0)
0N/A
0N/A
0N/A#define IntArgbPreIsPremultiplied 1
0N/A
0N/A#define DeclareIntArgbPreBlendFillVars(PREFIX)
0N/A
0N/A#define ClearIntArgbPreBlendFillVars(PREFIX, argb) \
0N/A argb = 0
0N/A
0N/A#define InitIntArgbPreBlendFillVarsNonPre(PREFIX, argb, COMP_PREFIX)
0N/A
0N/A#define InitIntArgbPreBlendFillVarsPre(PREFIX, argb, COMP_PREFIX) \
0N/A argb = ComposeIntDcmComponents1234(COMP_PREFIX ## A, \
0N/A COMP_PREFIX ## R, \
0N/A COMP_PREFIX ## G, \
0N/A COMP_PREFIX ## B)
0N/A
0N/A#define StoreIntArgbPreBlendFill(pRas, PREFIX, x, argb, COMP_PREFIX) \
0N/A (pRas)[x] = (argb)
0N/A
0N/A#define StoreIntArgbPreFrom4ByteArgbComps(pRas, PREFIX, x, COMP_PREFIX) \
0N/A (pRas)[x] = ComposeIntDcmComponents1234(COMP_PREFIX ## A, \
0N/A COMP_PREFIX ## R, \
0N/A COMP_PREFIX ## G, \
0N/A COMP_PREFIX ## B)
0N/A
0N/A#endif /* IntArgbPre_h_Included */