< prev index next >

src/java.desktop/share/native/libawt/java2d/loops/AlphaMath.h

Print this page


   1 /*
   2  * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #ifndef AlphaMath_h_Included
  27 #define AlphaMath_h_Included
  28 
  29 extern unsigned char mul8table[256][256];
  30 extern unsigned char div8table[256][256];


  31 extern void initAlphaTables();
  32 
  33 
  34 /*
  35  * Multiply and Divide macros for single byte (8-bit) quantities representing
  36  * the values 0.0 to 1.0 as 0x00 to 0xff.
  37  * MUL8 multiplies its operands together
  38  * DIV8 divides the first operand by the second, clipping to 0xff
  39  *    (Note that since the divisor for DIV8 is likely to be
  40  *     the alpha quantity which is likely to be the same for
  41  *     multiple adjacent invocations, the table is designed
  42  *     with the first index being the divisor to hopefully
  43  *     improve memory cache hits...)
  44  */
  45 #define MUL8(a,b) mul8table[a][b]
  46 #define DIV8(a,b) div8table[b][a]
  47 
  48 /*
  49  * Multiply and Divide macros for operations involving a single short (16-bit)
  50  * quantity and a single byte (8-bit) quantity.  Typically, promoting the


   1 /*
   2  * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 #ifndef AlphaMath_h_Included
  27 #define AlphaMath_h_Included
  28 
  29 #include "jni.h"
  30 
  31 JNIEXPORT extern unsigned char mul8table[256][256];
  32 JNIEXPORT extern unsigned char div8table[256][256];
  33 extern void initAlphaTables();
  34 
  35 
  36 /*
  37  * Multiply and Divide macros for single byte (8-bit) quantities representing
  38  * the values 0.0 to 1.0 as 0x00 to 0xff.
  39  * MUL8 multiplies its operands together
  40  * DIV8 divides the first operand by the second, clipping to 0xff
  41  *    (Note that since the divisor for DIV8 is likely to be
  42  *     the alpha quantity which is likely to be the same for
  43  *     multiple adjacent invocations, the table is designed
  44  *     with the first index being the divisor to hopefully
  45  *     improve memory cache hits...)
  46  */
  47 #define MUL8(a,b) mul8table[a][b]
  48 #define DIV8(a,b) div8table[b][a]
  49 
  50 /*
  51  * Multiply and Divide macros for operations involving a single short (16-bit)
  52  * quantity and a single byte (8-bit) quantity.  Typically, promoting the


< prev index next >