modules/graphics/src/main/java/com/sun/javafx/sg/prism/NGCanvas.java

Print this page




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.javafx.sg.prism;
  27 
  28 import com.sun.glass.ui.Screen;
  29 import javafx.geometry.VPos;
  30 import javafx.scene.text.Font;
  31 import java.nio.IntBuffer;
  32 import java.util.concurrent.ExecutionException;
  33 import java.util.concurrent.FutureTask;
  34 import java.util.LinkedList;
  35 import com.sun.javafx.font.PGFont;
  36 import com.sun.javafx.geom.Arc2D;
  37 import com.sun.javafx.geom.BaseBounds;
  38 import com.sun.javafx.geom.DirtyRegionContainer;
  39 import com.sun.javafx.geom.DirtyRegionPool;
  40 import com.sun.javafx.geom.Path2D;
  41 import com.sun.javafx.geom.PathIterator;
  42 import com.sun.javafx.geom.RectBounds;
  43 import com.sun.javafx.geom.Rectangle;
  44 import com.sun.javafx.geom.RoundRectangle2D;
  45 import com.sun.javafx.geom.Shape;
  46 import com.sun.javafx.geom.transform.Affine2D;
  47 import com.sun.javafx.geom.transform.BaseTransform;
  48 import com.sun.javafx.geom.transform.NoninvertibleTransformException;


 338     private int baseline;
 339     private Affine2D transform;
 340     private Affine2D inverseTransform;
 341     private boolean inversedirty;
 342     private LinkedList<Path2D> clipStack;
 343     private int clipsRendered;
 344     private boolean clipIsRect;
 345     private Rectangle clipRect;
 346     private Effect effect;
 347     private int arctype;
 348 
 349     static float TEMP_COORDS[] = new float[6];
 350     private static Arc2D TEMP_ARC = new Arc2D();
 351     private static RectBounds TEMP_RECTBOUNDS = new RectBounds();
 352 
 353     public NGCanvas() {
 354         Toolkit tk = Toolkit.getToolkit();
 355         ScreenConfigurationAccessor screenAccessor = tk.getScreenConfigurationAccessor();
 356         float hPS = 1.0f;
 357         for (Object screen : tk.getScreens()) {
 358             hPS = Math.max(screenAccessor.getRenderScale(screen), hPS);

 359         }
 360         highestPixelScale = hPS;
 361 
 362         cv = new RenderBuf(InitType.PRESERVE_UPPER_LEFT);
 363         temp = new RenderBuf(InitType.CLEAR);
 364         clip = new RenderBuf(InitType.FILL_WHITE);
 365 
 366         path = new Path2D();
 367         ngtext = new NGText();
 368         textLayout = new PrismTextLayout();
 369         transform = new Affine2D();
 370         clipStack = new LinkedList<Path2D>();
 371         initAttributes();
 372     }
 373 
 374     private void initAttributes() {
 375         globalAlpha = 1.0f;
 376         blendmode = Mode.SRC_OVER;
 377         fillPaint = Color.BLACK;
 378         strokePaint = Color.BLACK;
 379         linewidth = 1.0f;
 380         linecap = BasicStroke.CAP_SQUARE;




   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.sun.javafx.sg.prism;
  27 

  28 import javafx.geometry.VPos;
  29 import javafx.scene.text.Font;
  30 import java.nio.IntBuffer;
  31 import java.util.concurrent.ExecutionException;
  32 import java.util.concurrent.FutureTask;
  33 import java.util.LinkedList;
  34 import com.sun.javafx.font.PGFont;
  35 import com.sun.javafx.geom.Arc2D;
  36 import com.sun.javafx.geom.BaseBounds;
  37 import com.sun.javafx.geom.DirtyRegionContainer;
  38 import com.sun.javafx.geom.DirtyRegionPool;
  39 import com.sun.javafx.geom.Path2D;
  40 import com.sun.javafx.geom.PathIterator;
  41 import com.sun.javafx.geom.RectBounds;
  42 import com.sun.javafx.geom.Rectangle;
  43 import com.sun.javafx.geom.RoundRectangle2D;
  44 import com.sun.javafx.geom.Shape;
  45 import com.sun.javafx.geom.transform.Affine2D;
  46 import com.sun.javafx.geom.transform.BaseTransform;
  47 import com.sun.javafx.geom.transform.NoninvertibleTransformException;


 337     private int baseline;
 338     private Affine2D transform;
 339     private Affine2D inverseTransform;
 340     private boolean inversedirty;
 341     private LinkedList<Path2D> clipStack;
 342     private int clipsRendered;
 343     private boolean clipIsRect;
 344     private Rectangle clipRect;
 345     private Effect effect;
 346     private int arctype;
 347 
 348     static float TEMP_COORDS[] = new float[6];
 349     private static Arc2D TEMP_ARC = new Arc2D();
 350     private static RectBounds TEMP_RECTBOUNDS = new RectBounds();
 351 
 352     public NGCanvas() {
 353         Toolkit tk = Toolkit.getToolkit();
 354         ScreenConfigurationAccessor screenAccessor = tk.getScreenConfigurationAccessor();
 355         float hPS = 1.0f;
 356         for (Object screen : tk.getScreens()) {
 357             hPS = Math.max(screenAccessor.getRecommendedOutputScaleX(screen), hPS);
 358             hPS = Math.max(screenAccessor.getRecommendedOutputScaleY(screen), hPS);
 359         }
 360         highestPixelScale = (float) Math.ceil(hPS);
 361 
 362         cv = new RenderBuf(InitType.PRESERVE_UPPER_LEFT);
 363         temp = new RenderBuf(InitType.CLEAR);
 364         clip = new RenderBuf(InitType.FILL_WHITE);
 365 
 366         path = new Path2D();
 367         ngtext = new NGText();
 368         textLayout = new PrismTextLayout();
 369         transform = new Affine2D();
 370         clipStack = new LinkedList<Path2D>();
 371         initAttributes();
 372     }
 373 
 374     private void initAttributes() {
 375         globalAlpha = 1.0f;
 376         blendmode = Mode.SRC_OVER;
 377         fillPaint = Color.BLACK;
 378         strokePaint = Color.BLACK;
 379         linewidth = 1.0f;
 380         linecap = BasicStroke.CAP_SQUARE;