8364214: Enhance polygon data support

Reviewed-by: rhalade, psadhukhan, mschoene, prr
This commit is contained in:
Jayathirth D V 2025-08-18 10:25:12 +00:00 committed by bchristi
parent f8fb780426
commit 9f3f960b36
2 changed files with 9 additions and 5 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2025, 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
@ -1901,9 +1901,9 @@ public final class SunGraphics2D
if (usrClip == null) {
clipState = CLIP_DEVICE;
clipRegion = devClip;
} else if (usrClip instanceof Rectangle2D) {
} else if (usrClip instanceof Rectangle2D clip) {
clipState = CLIP_RECTANGULAR;
clipRegion = devClip.getIntersection((Rectangle2D) usrClip);
clipRegion = devClip.getIntersection(clip);
} else {
PathIterator cpi = usrClip.getPathIterator(null);
int[] box = new int[4];

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2025, 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
@ -27,6 +27,8 @@ package sun.java2d.pipe;
import java.awt.Rectangle;
import java.awt.Shape;
import sun.java2d.InvalidPipeException;
import sun.java2d.SunGraphics2D;
/**
@ -67,7 +69,9 @@ public class SpanClipRenderer implements CompositePipe
public Object startSequence(SunGraphics2D sg, Shape s, Rectangle devR,
int[] abox) {
RegionIterator ri = sg.clipRegion.getIterator();
if (ri.region.isRectangular()) {
throw new InvalidPipeException("Invalid clip data");
}
return new SCRcontext(ri, outpipe.startSequence(sg, s, devR, abox));
}