src/java.desktop/share/classes/sun/java2d/pipe/SpanShapeRenderer.java
changeset 52248 2e330da7cbf4
parent 47216 71c04702a3d5
equal deleted inserted replaced
52247:f775f83d6b60 52248:2e330da7cbf4
     1 /*
     1 /*
     2  * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   125     public abstract void renderBox(Object ctx, int x, int y, int w, int h);
   125     public abstract void renderBox(Object ctx, int x, int y, int w, int h);
   126 
   126 
   127     public abstract void endSequence(Object ctx);
   127     public abstract void endSequence(Object ctx);
   128 
   128 
   129     public void renderRect(SunGraphics2D sg, Rectangle2D r) {
   129     public void renderRect(SunGraphics2D sg, Rectangle2D r) {
   130         double corners[] = {
   130         double[] corners = {
   131             r.getX(), r.getY(), r.getWidth(), r.getHeight(),
   131             r.getX(), r.getY(), r.getWidth(), r.getHeight(),
   132         };
   132         };
   133         corners[2] += corners[0];
   133         corners[2] += corners[0];
   134         corners[3] += corners[1];
   134         corners[3] += corners[1];
   135         if (corners[2] <= corners[0] || corners[3] <= corners[1]) {
   135         if (corners[2] <= corners[0] || corners[3] <= corners[1]) {
   144         if (corners[3] < corners[1]) {
   144         if (corners[3] < corners[1]) {
   145             double t = corners[3];
   145             double t = corners[3];
   146             corners[3] = corners[1];
   146             corners[3] = corners[1];
   147             corners[1] = t;
   147             corners[1] = t;
   148         }
   148         }
   149         int abox[] = {
   149         int[] abox = {
   150             (int) corners[0],
   150             (int) corners[0],
   151             (int) corners[1],
   151             (int) corners[1],
   152             (int) corners[2],
   152             (int) corners[2],
   153             (int) corners[3],
   153             (int) corners[3],
   154         };
   154         };
   178 
   178 
   179     public void renderSpans(SunGraphics2D sg, Region clipRegion, Shape s,
   179     public void renderSpans(SunGraphics2D sg, Region clipRegion, Shape s,
   180                             ShapeSpanIterator sr)
   180                             ShapeSpanIterator sr)
   181     {
   181     {
   182         Object context = null;
   182         Object context = null;
   183         int abox[] = new int[4];
   183         int[] abox = new int[4];
   184         try {
   184         try {
   185             sr.getPathBox(abox);
   185             sr.getPathBox(abox);
   186             Rectangle devR = new Rectangle(abox[0], abox[1],
   186             Rectangle devR = new Rectangle(abox[0], abox[1],
   187                                            abox[2] - abox[0],
   187                                            abox[2] - abox[0],
   188                                            abox[3] - abox[1]);
   188                                            abox[3] - abox[1]);