jdk/src/share/native/sun/java2d/loops/Any4Byte.h
author flar
Mon, 06 Dec 2010 21:45:48 -0800
changeset 7487 9b031d062ede
parent 5506 202f599c92aa
permissions -rw-r--r--
6775317: Improve performance of non-AA transformed rectangles and single wide lines in software pipelines Reviewed-by: jgodinez, prr
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: 2
diff changeset
     2
 * Copyright (c) 2000, 2001, 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: 2
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: 2
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: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
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
#include "GraphicsPrimitiveMgr.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include "LoopMacros.h"
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 "Any4Byte".
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 jubyte  Any4ByteDataType;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#define Any4BytePixelStride     4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#define DeclareAny4ByteLoadVars(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#define DeclareAny4ByteStoreVars(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#define InitAny4ByteLoadVars(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#define InitAny4ByteStoreVarsY(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#define InitAny4ByteStoreVarsX(PREFIX, pRasInfo)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define NextAny4ByteStoreVarsX(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#define NextAny4ByteStoreVarsY(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#define DeclareAny4BytePixelData(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
    jubyte PREFIX ## 0, PREFIX ## 1, PREFIX ## 2, PREFIX ## 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#define ExtractAny4BytePixelData(PIXEL, PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
        PREFIX ## 0 = (jubyte) (PIXEL); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
        PREFIX ## 1 = (jubyte) (PIXEL >> 8); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
        PREFIX ## 2 = (jubyte) (PIXEL >> 16); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
        PREFIX ## 3 = (jubyte) (PIXEL >> 24); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
#define StoreAny4BytePixelData(pPix, x, pixel, PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
        (pPix)[4*x+0] = PREFIX ## 0; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
        (pPix)[4*x+1] = PREFIX ## 1; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        (pPix)[4*x+2] = PREFIX ## 2; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        (pPix)[4*x+3] = PREFIX ## 3; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
#define CopyAny4BytePixelData(pSrc, sx, pDst, dx) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        (pDst)[4*dx+0] = (pSrc)[4*sx+0]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
        (pDst)[4*dx+1] = (pSrc)[4*sx+1]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
        (pDst)[4*dx+2] = (pSrc)[4*sx+2]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
        (pDst)[4*dx+3] = (pSrc)[4*sx+3]; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#define XorCopyAny4BytePixelData(pSrc, pDst, x, xorpixel, XORPREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        (pDst)[4*x+0] ^= (pSrc)[4*x+0] ^ XORPREFIX ## 0; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
        (pDst)[4*x+1] ^= (pSrc)[4*x+1] ^ XORPREFIX ## 1; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
        (pDst)[4*x+2] ^= (pSrc)[4*x+2] ^ XORPREFIX ## 2; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
        (pDst)[4*x+3] ^= (pSrc)[4*x+3] ^ XORPREFIX ## 3; \
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 XorAny4BytePixelData(srcpixel, SRCPREFIX, pDst, x, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                             xorpixel, XORPREFIX, mask, MASKPREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
        (pDst)[4*x+0] ^= ((SRCPREFIX ## 0 ^ XORPREFIX ## 0) & \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                          ~MASKPREFIX ## 0); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        (pDst)[4*x+1] ^= ((SRCPREFIX ## 1 ^ XORPREFIX ## 1) & \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                          ~MASKPREFIX ## 1); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        (pDst)[4*x+2] ^= ((SRCPREFIX ## 2 ^ XORPREFIX ## 2) & \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
                          ~MASKPREFIX ## 2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        (pDst)[4*x+3] ^= ((SRCPREFIX ## 3 ^ XORPREFIX ## 3) & \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                          ~MASKPREFIX ## 3); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
DECLARE_ISOCOPY_BLIT(Any4Byte);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
DECLARE_ISOSCALE_BLIT(Any4Byte);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
DECLARE_ISOXOR_BLIT(Any4Byte);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
#define REGISTER_ANY4BYTE_ISOCOPY_BLIT(FOURBYTETYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    REGISTER_ISOCOPY_BLIT(FOURBYTETYPE, Any4Byte)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
#define REGISTER_ANY4BYTE_ISOSCALE_BLIT(FOURBYTETYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    REGISTER_ISOSCALE_BLIT(FOURBYTETYPE, Any4Byte)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
#define REGISTER_ANY4BYTE_ISOXOR_BLIT(FOURBYTETYPE) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    REGISTER_ISOXOR_BLIT(FOURBYTETYPE, Any4Byte)