< prev index next >
src/java.desktop/share/classes/sun/java2d/pipe/Region.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 1998, 2016, 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) 1998, 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
*** 265,275 ****
((RectangularShape)s).isEmpty())
{
return EMPTY_REGION;
}
! int box[] = new int[4];
ShapeSpanIterator sr = new ShapeSpanIterator(normalize);
try {
sr.setOutputArea(devBounds);
sr.appendPath(s.getPathIterator(at));
sr.getPathBox(box);
--- 265,275 ----
((RectangularShape)s).isEmpty())
{
return EMPTY_REGION;
}
! int[] box = new int[4];
ShapeSpanIterator sr = new ShapeSpanIterator(normalize);
try {
sr.setOutputArea(devBounds);
sr.appendPath(s.getPathIterator(at));
sr.getPathBox(box);
*** 344,354 ****
* by the indicated span array.
* <p>
* This method can also be used to create a simple rectangular
* region.
*/
! public static Region getInstance(int box[]) {
return new Region(box[0], box[1], box[2], box[3]);
}
/**
* Returns a Region object with a rectangle of interest specified
--- 344,354 ----
* by the indicated span array.
* <p>
* This method can also be used to create a simple rectangular
* region.
*/
! public static Region getInstance(int[] box) {
return new Region(box[0], box[1], box[2], box[3]);
}
/**
* Returns a Region object with a rectangle of interest specified
*** 368,378 ****
* Appends the list of spans returned from the indicated SpanIterator. Each
* span must be at a higher starting Y coordinate than the previous data or
* it must have a Y range equal to the highest Y band in the region and a
* higher X coordinate than any of the spans in that band.
*/
! public static Region getInstance(int box[], SpanIterator si) {
Region ret = new Region(box[0], box[1], box[2], box[3]);
ret.appendSpans(si);
return ret;
}
--- 368,378 ----
* Appends the list of spans returned from the indicated SpanIterator. Each
* span must be at a higher starting Y coordinate than the previous data or
* it must have a Y range equal to the highest Y band in the region and a
* higher X coordinate than any of the spans in that band.
*/
! public static Region getInstance(int[] box, SpanIterator si) {
Region ret = new Region(box[0], box[1], box[2], box[3]);
ret.appendSpans(si);
return ret;
}
*** 409,422 ****
int tlox = clipScale(lox, sx);
int tloy = clipScale(loy, sy);
int thix = clipScale(hix, sx);
int thiy = clipScale(hiy, sy);
Region ret = new Region(tlox, tloy, thix, thiy);
! int bands[] = this.bands;
if (bands != null) {
int end = endIndex;
! int newbands[] = new int[end];
int i = 0; // index for source bands
int j = 0; // index for translated newbands
int ncol;
while (i < end) {
int y1, y2;
--- 409,422 ----
int tlox = clipScale(lox, sx);
int tloy = clipScale(loy, sy);
int thix = clipScale(hix, sx);
int thiy = clipScale(hiy, sy);
Region ret = new Region(tlox, tloy, thix, thiy);
! int[] bands = this.bands;
if (bands != null) {
int end = endIndex;
! int[] newbands = new int[end];
int i = 0; // index for source bands
int j = 0; // index for translated newbands
int ncol;
while (i < end) {
int y1, y2;
*** 486,500 ****
(thiy > hiy) != (dy > 0))
{
return getSafeTranslatedRegion(dx, dy);
}
Region ret = new Region(tlox, tloy, thix, thiy);
! int bands[] = this.bands;
if (bands != null) {
int end = endIndex;
ret.endIndex = end;
! int newbands[] = new int[end];
ret.bands = newbands;
int i = 0;
int ncol;
while (i < end) {
newbands[i] = bands[i] + dy; i++;
--- 486,500 ----
(thiy > hiy) != (dy > 0))
{
return getSafeTranslatedRegion(dx, dy);
}
Region ret = new Region(tlox, tloy, thix, thiy);
! int[] bands = this.bands;
if (bands != null) {
int end = endIndex;
ret.endIndex = end;
! int[] newbands = new int[end];
ret.bands = newbands;
int i = 0;
int ncol;
while (i < end) {
newbands[i] = bands[i] + dy; i++;
*** 513,526 ****
int tlox = clipAdd(lox, dx);
int tloy = clipAdd(loy, dy);
int thix = clipAdd(hix, dx);
int thiy = clipAdd(hiy, dy);
Region ret = new Region(tlox, tloy, thix, thiy);
! int bands[] = this.bands;
if (bands != null) {
int end = endIndex;
! int newbands[] = new int[end];
int i = 0; // index for source bands
int j = 0; // index for translated newbands
int ncol;
while (i < end) {
int y1, y2;
--- 513,526 ----
int tlox = clipAdd(lox, dx);
int tloy = clipAdd(loy, dy);
int thix = clipAdd(hix, dx);
int thiy = clipAdd(hiy, dy);
Region ret = new Region(tlox, tloy, thix, thiy);
! int[] bands = this.bands;
if (bands != null) {
int end = endIndex;
! int[] newbands = new int[end];
int i = 0; // index for source bands
int j = 0; // index for translated newbands
int ncol;
while (i < end) {
int y1, y2;
*** 744,762 ****
private static final int INCLUDE_A = 1;
private static final int INCLUDE_B = 2;
private static final int INCLUDE_COMMON = 4;
private void filterSpans(Region ra, Region rb, int flags) {
! int abands[] = ra.bands;
! int bbands[] = rb.bands;
if (abands == null) {
abands = new int[] {ra.loy, ra.hiy, 1, ra.lox, ra.hix};
}
if (bbands == null) {
bbands = new int[] {rb.loy, rb.hiy, 1, rb.lox, rb.hix};
}
! int box[] = new int[6];
int acolstart = 0;
int ay1 = abands[acolstart++];
int ay2 = abands[acolstart++];
int acolend = abands[acolstart++];
acolend = acolstart + 2 * acolend;
--- 744,762 ----
private static final int INCLUDE_A = 1;
private static final int INCLUDE_B = 2;
private static final int INCLUDE_COMMON = 4;
private void filterSpans(Region ra, Region rb, int flags) {
! int[] abands = ra.bands;
! int[] bbands = rb.bands;
if (abands == null) {
abands = new int[] {ra.loy, ra.hiy, 1, ra.lox, ra.hix};
}
if (bbands == null) {
bbands = new int[] {rb.loy, rb.hiy, 1, rb.lox, rb.hix};
}
! int[] box = new int[6];
int acolstart = 0;
int ay1 = abands[acolstart++];
int ay2 = abands[acolstart++];
int acolend = abands[acolstart++];
acolend = acolstart + 2 * acolend;
*** 963,973 ****
* This span must be at a higher starting Y coordinate than
* the previous data or it must have a Y range equal to the
* highest Y band in the region and a higher X coordinate
* than any of the spans in that band.
*/
! private void appendSpan(int box[]) {
int spanlox, spanloy, spanhix, spanhiy;
if ((spanlox = box[0]) < lox) spanlox = lox;
if ((spanloy = box[1]) < loy) spanloy = loy;
if ((spanhix = box[2]) > hix) spanhix = hix;
if ((spanhiy = box[3]) > hiy) spanhiy = hiy;
--- 963,973 ----
* This span must be at a higher starting Y coordinate than
* the previous data or it must have a Y range equal to the
* highest Y band in the region and a higher X coordinate
* than any of the spans in that band.
*/
! private void appendSpan(int[] box) {
int spanlox, spanloy, spanhix, spanhiy;
if ((spanlox = box[0]) < lox) spanlox = lox;
if ((spanloy = box[1]) < loy) spanloy = loy;
if ((spanhix = box[2]) > hix) spanhix = hix;
if ((spanhiy = box[3]) > hiy) spanhiy = hiy;
*** 1009,1019 ****
System.arraycopy(bands, 0, newbands, 0, endIndex);
bands = newbands;
}
}
! private void endRow(int box[]) {
int cur = box[4];
int prev = box[5];
if (cur > prev) {
int[] bands = this.bands;
if (bands[prev + 1] == bands[cur] &&
--- 1009,1019 ----
System.arraycopy(bands, 0, newbands, 0, endIndex);
bands = newbands;
}
}
! private void endRow(int[] box) {
int cur = box[4];
int prev = box[5];
if (cur > prev) {
int[] bands = this.bands;
if (bands[prev + 1] == bands[cur] &&
*** 1271,1291 ****
}
/**
* Gets the bbox of the available spans, clipped to the OutputArea.
*/
! public void getBounds(int pathbox[]) {
pathbox[0] = lox;
pathbox[1] = loy;
pathbox[2] = hix;
pathbox[3] = hiy;
}
/**
* Clips the indicated bbox array to the bounds of this Region.
*/
! public void clipBoxToBounds(int bbox[]) {
if (bbox[0] < lox) bbox[0] = lox;
if (bbox[1] < loy) bbox[1] = loy;
if (bbox[2] > hix) bbox[2] = hix;
if (bbox[3] > hiy) bbox[3] = hiy;
}
--- 1271,1291 ----
}
/**
* Gets the bbox of the available spans, clipped to the OutputArea.
*/
! public void getBounds(int[] pathbox) {
pathbox[0] = lox;
pathbox[1] = loy;
pathbox[2] = hix;
pathbox[3] = hiy;
}
/**
* Clips the indicated bbox array to the bounds of this Region.
*/
! public void clipBoxToBounds(int[] bbox) {
if (bbox[0] < lox) bbox[0] = lox;
if (bbox[1] < loy) bbox[1] = loy;
if (bbox[2] > hix) bbox[2] = hix;
if (bbox[3] > hiy) bbox[3] = hiy;
}
*** 1306,1316 ****
/**
* Gets a span iterator object that iterates over the spans in this region
* but clipped to the bounds given in the argument (xlo, ylo, xhi, yhi).
*/
! public SpanIterator getSpanIterator(int bbox[]) {
SpanIterator result = getSpanIterator();
result.intersectClipBox(bbox[0], bbox[1], bbox[2], bbox[3]);
return result;
}
--- 1306,1316 ----
/**
* Gets a span iterator object that iterates over the spans in this region
* but clipped to the bounds given in the argument (xlo, ylo, xhi, yhi).
*/
! public SpanIterator getSpanIterator(int[] bbox) {
SpanIterator result = getSpanIterator();
result.intersectClipBox(bbox[0], bbox[1], bbox[2], bbox[3]);
return result;
}
*** 1393,1404 ****
return false;
}
if (this.endIndex != r.endIndex) {
return false;
}
! int abands[] = this.bands;
! int bbands[] = r.bands;
for (int i = 0; i < endIndex; i++) {
if (abands[i] != bbands[i]) {
return false;
}
}
--- 1393,1404 ----
return false;
}
if (this.endIndex != r.endIndex) {
return false;
}
! int[] abands = this.bands;
! int[] bbands = r.bands;
for (int i = 0; i < endIndex; i++) {
if (abands[i] != bbands[i]) {
return false;
}
}
< prev index next >