< prev index next >
src/java.desktop/share/classes/java/awt/RadialGradientPaintContext.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 168,178 ****
* operation.
*
* @param x,y,w,h the area in device space for which colors are
* generated.
*/
! protected void fillRaster(int pixels[], int off, int adjust,
int x, int y, int w, int h)
{
if (isSimpleFocus && isNonCyclic && isSimpleLookup) {
simpleNonCyclicFillRaster(pixels, off, adjust, x, y, w, h);
} else {
--- 168,178 ----
* operation.
*
* @param x,y,w,h the area in device space for which colors are
* generated.
*/
! protected void fillRaster(int[] pixels, int off, int adjust,
int x, int y, int w, int h)
{
if (isSimpleFocus && isNonCyclic && isSimpleLookup) {
simpleNonCyclicFillRaster(pixels, off, adjust, x, y, w, h);
} else {
*** 183,193 ****
/**
* This code works in the simplest of cases, where the focus == center
* point, the gradient is noncyclic, and the gradient lookup method is
* fast (single array index, no conversion necessary).
*/
! private void simpleNonCyclicFillRaster(int pixels[], int off, int adjust,
int x, int y, int w, int h)
{
/* We calculate sqrt(X^2 + Y^2) relative to the radius
* size to get the fraction for the color to use.
*
--- 183,193 ----
/**
* This code works in the simplest of cases, where the focus == center
* point, the gradient is noncyclic, and the gradient lookup method is
* fast (single array index, no conversion necessary).
*/
! private void simpleNonCyclicFillRaster(int[] pixels, int off, int adjust,
int x, int y, int w, int h)
{
/* We calculate sqrt(X^2 + Y^2) relative to the radius
* size to get the fraction for the color to use.
*
*** 299,309 ****
}
}
// SQRT_LUT_SIZE must be a power of 2 for the test above to work.
private static final int SQRT_LUT_SIZE = (1 << 11);
! private static float sqrtLut[] = new float[SQRT_LUT_SIZE+1];
static {
for (int i = 0; i < sqrtLut.length; i++) {
sqrtLut[i] = (float) Math.sqrt(i / ((float) SQRT_LUT_SIZE));
}
}
--- 299,309 ----
}
}
// SQRT_LUT_SIZE must be a power of 2 for the test above to work.
private static final int SQRT_LUT_SIZE = (1 << 11);
! private static float[] sqrtLut = new float[SQRT_LUT_SIZE+1];
static {
for (int i = 0; i < sqrtLut.length; i++) {
sqrtLut[i] = (float) Math.sqrt(i / ((float) SQRT_LUT_SIZE));
}
}
*** 325,335 ****
* y = mx + b
* Replacing y in the circle equation and solving using the quadratic
* formula produces the following set of equations. Constant factors have
* been extracted out of the inner loop.
*/
! private void cyclicCircularGradientFillRaster(int pixels[], int off,
int adjust,
int x, int y,
int w, int h)
{
// constant part of the C factor of the quadratic equation
--- 325,335 ----
* y = mx + b
* Replacing y in the circle equation and solving using the quadratic
* formula produces the following set of equations. Constant factors have
* been extracted out of the inner loop.
*/
! private void cyclicCircularGradientFillRaster(int[] pixels, int off,
int adjust,
int x, int y,
int w, int h)
{
// constant part of the C factor of the quadratic equation
< prev index next >