/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#include "GraphicsPrimitiveMgr.h"
#include "LineUtils.h"
#include "sun_java2d_loops_DrawLine.h"
static void
{
} else {
}
max++;
/* integer overflow */
max--;
}
} else {
}
max++;
/* integer overflow */
max--;
}
}
/*
* "Small" math here will be done if the coordinates are less
* than 15 bits in range (-16384 => 16383). This could be
* expanded to 16 bits if we rearrange some of the math in
* the normal version of SetupBresenham.
* "Big" math here will be done with coordinates with 30 bits
* of total range - 2 bits less than a jint holds.
* Intermediate calculations for "Big" coordinates will be
* done using jlong variables.
*/
do { \
\
\
\
return JNI_FALSE; \
} \
if (outcode1 != 0) { \
if (outcode1 & OUTCODE_TOP) { \
} else { \
} \
if (ysteps < 0) { \
} \
if (xmajor) { \
} \
if (dx < 0) { \
} \
if (outcode1 & OUTCODE_LEFT) { \
} else { \
} \
if (xsteps < 0) { \
} \
if (!xmajor) { \
} \
if (dy < 0) { \
} \
} \
} else { \
if (outcode2 & OUTCODE_TOP) { \
} else { \
} \
if (ysteps < 0) { \
} \
if (xmajor) { \
} else { \
xsteps -= 1; \
} \
if (dx > 0) { \
} \
if (outcode2 & OUTCODE_LEFT) { \
} else { \
} \
if (xsteps < 0) { \
} \
if (xmajor) { \
ysteps -= 1; \
} else { \
} \
if (dy > 0) { \
} \
} \
} \
} \
\
if (xmajor) { \
SHORTEN = 0; \
} \
} else { \
SHORTEN = 0; \
} \
} \
return JNI_FALSE; \
} \
if (ysteps < 0) { \
} \
} \
if (xsteps < 0) { \
} \
} \
\
} while (0)
static jboolean
{
/*
* Part of calculating the Bresenham parameters for line stepping
* involves being able to store numbers that are twice the magnitude
* of the biggest absolute difference in coordinates. Since we
* want the stepping parameters to be stored in jints, we then need
* to avoid any absolute differences more than 30 bits. Thus, we
* need to preprocess the coordinates to reduce their range to 30
* bits regardless of clipping. We need to cut their range back
* before we do the clipping because the Bresenham stepping values
* need to be calculated based on the "unclipped" coordinates.
*
* Thus, first we perform a "pre-clipping" stage to bring the
* coordinates within the 30-bit range and then we proceed to the
* regular clipping procedure, pretending that these were the
* original coordinates all along. Since this operation occurs
* based on a constant "pre-clip" rectangle of +/- 30 bits without
* any consideration for the final clip, the rounding errors that
* occur here will depend only on the line coordinates and be
* rectangles in effect at the time. Thus, rendering a given
* large-range line will be consistent under a variety of
* clipping conditions.
*/
{
/*
* Use doubles to get us into range for "Big" arithmetic.
*
* The math of adjusting an endpoint for clipping can involve
* an intermediate result with twice the number of bits as the
* original coordinate range. Since we want to maintain as
* much as 30 bits of precision in the resulting coordinates,
* we will get roundoff here even using IEEE double-precision
* arithmetic which cannot carry 60 bits of mantissa. Since
* the rounding errors will be consistent for a given set
* of input coordinates the potential roundoff error should
* not affect the consistency of our rendering.
*/
}
/* Use Y1d instead of _y1 for testing now as we may have modified it */
}
}
/* Use Y2d instead of _y2 for testing now as we may have modified it */
}
}
return JNI_TRUE;
}
{
{
}
return JNI_TRUE;
}
/*
* Class: sun_java2d_loops_DrawLine
* Method: DrawLine
* Signature: (Lsun/java2d/SunGraphics2D;Lsun/java2d/SurfaceData;IIII)V
*/
{
return;
}
}
if (sdOps == 0) {
return;
}
return;
}
{
}
}
}