2362N/A * Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 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 * 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 * 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. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * Multiply and Divide macros for single byte (8-bit) quantities representing 0N/A * the values 0.0 to 1.0 as 0x00 to 0xff. 0N/A * MUL8 multiplies its operands together 0N/A * DIV8 divides the first operand by the second, clipping to 0xff 0N/A * (Note that since the divisor for DIV8 is likely to be 0N/A * the alpha quantity which is likely to be the same for 0N/A * multiple adjacent invocations, the table is designed 0N/A * with the first index being the divisor to hopefully 0N/A * improve memory cache hits...) 0N/A * Multiply and Divide macros for operations involving a single short (16-bit) 0N/A * quantity and a single byte (8-bit) quantity. Typically, promoting the 0N/A * 8-bit value to 16 bits would lead to overflow when the operation occurs. 0N/A * These macros have been modified somewhat so that overflow will not occur. 0N/A * MUL8_16 multiplies an 8-bit value by a 16-bit value (the order of operands 0N/A * is unimportant since multiplication is a commutative operation) 0N/A * DIV16_8 divides the first (16-bit) operand by the second (8-bit) value 0N/A * Multiply and Divide macros for single short (16-bit) quantities 0N/A * representing the values 0.0 to 1.0 as 0x0000 to 0xffff. 0N/A * MUL16 multiplies its operands using the standard multiplication operator 0N/A * and normalizes the result to the appropriate range 0N/A * DIV16 divides the first operand by the second and normalizes the result 0N/A * Macro for the sum of two normalized (16-bit) products. Refer to the 0N/A * following equation and note that the right side reduces the number of 0N/A * divide operations in the left side and increases the precision of the 0N/A * a*f1 + b*f2 a*f1 + b*f2 0N/A * ---- ---- = ----------- (where n in this case will be 65535) 0N/A ((((a) * (
f1)) + ((b) * (
f2))) /
65535)
0N/A * The following macros help to generalize the MaskBlit and MaskFill loops 0N/A * strategy of the given loop. The strategy types take the form: 0N/A * <number of components per pixel><component data type><colorspace> 0N/A * For example, these are the current strategy types: 0N/A * 3ByteRgb (currently only used as a glyph list blending strategy where 0N/A * the alpha value itself is neither blended nor stored) 0N/A * 4ByteArgb (eg. IntArgb, ThreeByteBgr, Ushort555Rgb, ByteIndexed, etc.) 0N/A * 4ShortArgb (not used currently; could be used when surface types using 0N/A * 16 bits per component are implemented) 0N/A * 1ByteGray (eg. ByteGray) 0N/A * 1ShortGray (eg. UshortGray) 0N/A * Note that the macros which operate on alpha values have the word "Alpha" 0N/A * somewhere in their name. Those macros that only operate on the color/gray 0N/A * components of a given strategy will have the word "Components" or "Comps" 0N/A * MaxValFor ## STRATEGY 0N/A * AlphaType ## STRATEGY 0N/A * ComponentType ## STRATEGY 0N/A * DeclareAlphaVarFor ## STRATEGY(VAR) 0N/A * DeclareAndInitAlphaVarFor ## STRATEGY(VAR, initval) 0N/A * DeclareAndClearAlphaVarFor ## STRATEGY(VAR) 0N/A * DeclareAndSetOpaqueAlphaVarFor ## STRATEGY(VAR) 0N/A * DeclareAndInvertAlphaVarFor ## STRATEGY(VAR, invalpha) 0N/A * jint a = 0xff - resA; 0N/A * DeclareCompVarsFor ## STRATEGY(PREFIX) 0N/A * DeclareAndInitExtraAlphaFor ## STRATEGY(VAR) 0N/A * jint extraA = (int)(pCompInfo->details.extraAlpha * 255.0 + 0.5); 0N/A * PromoteByteAlphaFor ## STRATEGY(a) 0N/A (a) = (((a) <<
8) + (a))
0N/A * DeclareAndInitPathAlphaFor ## STRATEGY(VAR) 0N/A * jint pathA = *pMask++; 0N/A * MultiplyAlphaFor ## STRATEGY(a, b) 0N/A * MultiplyAndStore ## STRATEGY ## Comps(PROD_PREFIX, M1, M2_PREFIX) 0N/A * DivideAndStore ## STRATEGY ## Comps(QUOT_PREFIX, D1_PREFIX, D2) 0N/A * MultiplyAddAndStore ## STRATEGY ## Comps(RES_PREFIX, M1, \ 0N/A * M2_PREFIX, A_PREFIX) 0N/A * c = (m1 * m2) + a; 0N/A * MultMultAddAndStore ## STRATEGY ## Comps(RES_PREFIX, M1, M2_PREFIX, \ 0N/A * c = (m1 * m2) + (m3 * m4); 0N/A * Store ## STRATEGY ## CompsUsingOp(L_PREFIX, OP, R_PREFIX) 0N/A * l op r; // where op can be something like = or += 0N/A * Set ## STRATEGY ## CompsToZero(PREFIX) 0N/A#
endif /* AlphaMath_h_Included */