< prev index next >

src/java.desktop/unix/classes/sun/java2d/xr/RectTileManager.java

Print this page
rev 48925 : Xrender: Rename MaskTil(eManager) to RectTile(Manager) to avoid confusion later
rev 48927 : Xrender: make aa tile mask handling a responsibility of the backend implementation
rev 48932 : XRender: Update+introduce copyright statements + comments + unused import removal

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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

@@ -29,36 +29,36 @@
 import java.util.*;
 
 /**
  * We render non-antialiased geometry (consisting of rectangles) into a mask,
  * which is later used in a composition step.
- * To avoid mask-allocations of large size, MaskTileManager splits
+ * To avoid mask-allocations of large size, RectTileManager splits
  * geometry larger than MASK_SIZE into several tiles,
- * and stores the geometry in instances of MaskTile.
+ * and stores the geometry in instances of RectTile.
  *
  * @author Clemens Eisserer
  */
 
-public class MaskTileManager {
+public class RectTileManager {
 
     public static final int MASK_SIZE = 256;
 
-    MaskTile mainTile = new MaskTile();
+    RectTile mainTile = new RectTile();
 
-    ArrayList<MaskTile> tileList;
+    ArrayList<RectTile> tileList;
     int allocatedTiles = 0;
     int xTiles, yTiles;
 
     XRCompositeManager xrMgr;
     XRBackend con;
 
     int maskPixmap;
     int maskPicture;
     long maskGC;
 
-    public MaskTileManager(XRCompositeManager xrMgr, int parentXid) {
-        tileList = new ArrayList<MaskTile>();
+    public RectTileManager(XRCompositeManager xrMgr, int parentXid) {
+        tileList = new ArrayList<RectTile>();
         this.xrMgr = xrMgr;
         this.con = xrMgr.getBackend();
 
         maskPixmap = con.createPixmap(parentXid, 8, MASK_SIZE, MASK_SIZE);
         maskPicture = con.createPicture(maskPixmap, XRUtils.PictStandardA8);

@@ -95,11 +95,11 @@
                 allocTiles(dirtyArea);
                 tileRects();
 
                 for (int i = 0; i < yTiles; i++) {
                     for (int m = 0; m < xTiles; m++) {
-                        MaskTile tile = tileList.get(i * xTiles + m);
+                        RectTile tile = tileList.get(i * xTiles + m);
 
                         int tileStartX = m * MASK_SIZE;
                         int tileStartY = i * MASK_SIZE;
                         compositeSingleTile(dst, tile, dirtyArea, maskRequired,
                                             tileStartX, tileStartY, maskColor);

@@ -120,44 +120,14 @@
 
         mainTile.reset();
     }
 
     /**
-     * Uploads aa geometry generated for maskblit/fill into the mask pixmap.
-     */
-    public int uploadMask(int w, int h, int maskscan, int maskoff, byte[] mask) {
-        int maskPic = XRUtils.None;
-
-        if (mask != null) {
-            float maskAlpha =
-                 xrMgr.isTexturePaintActive() ? xrMgr.getExtraAlpha() : 1.0f;
-            con.putMaskImage(maskPixmap, maskGC, mask, 0, 0, 0, 0,
-                             w, h, maskoff, maskscan, maskAlpha);
-            maskPic = maskPicture;
-        } else if (xrMgr.isTexturePaintActive()) {
-            maskPic = xrMgr.getExtraAlphaMask();
-         }
-
-        return maskPic;
-    }
-
-    /**
-     * Clears the area of the mask-pixmap used for uploading aa coverage values.
-     */
-    public void clearUploadMask(int mask, int w, int h) {
-        if (mask == maskPicture) {
-            con.renderRectangle(maskPicture, XRUtils.PictOpClear,
-                                XRColor.NO_ALPHA, 0, 0, w, h);
-        }
-    }
-
-
-    /**
      * Renders the rectangles provided to the mask, and does a composition
      * operation with the properties set inXRCompositeManager.
      */
-    protected void compositeSingleTile(XRSurfaceData dst, MaskTile tile,
+    protected void compositeSingleTile(XRSurfaceData dst, RectTile tile,
                                        DirtyRegion dirtyArea,
                                        boolean maskRequired,
                                        int tileStartX, int tileStartY,
                                        XRColor maskColor) {
         if (tile.rects.getSize() > 0) {

@@ -210,11 +180,11 @@
         }
     }
 
 
     /**
-     * Allocates enough MaskTile instances, to cover the whole
+     * Allocates enough RectTile instances, to cover the whole
      * mask area, or resets existing ones.
      */
     protected void allocTiles(DirtyRegion maskArea) {
         xTiles = (maskArea.getWidth() / MASK_SIZE) + 1;
         yTiles = (maskArea.getHeight() / MASK_SIZE) + 1;

@@ -223,11 +193,11 @@
         if (tileCnt > allocatedTiles) {
             for (int i = 0; i < tileCnt; i++) {
                 if (i < allocatedTiles) {
                     tileList.get(i).reset();
                 } else {
-                    tileList.add(new MaskTile());
+                    tileList.add(new RectTile());
                 }
             }
 
             allocatedTiles = tileCnt;
         }

@@ -252,11 +222,11 @@
             for (int n = 0; n < tileYLength; n++) {
                 for (int m = 0; m < tileXLength; m++) {
 
                     int tileIndex =
                          xTiles * (tileYStartIndex + n) + tileXStartIndex + m;
-                    MaskTile tile = tileList.get(tileIndex);
+                    RectTile tile = tileList.get(tileIndex);
 
                     GrowableRectArray rectTileList = tile.getRects();
                     int tileArrayIndex = rectTileList.getNextIndex();
 
                     int tileStartPosX = (tileXStartIndex + m) * MASK_SIZE;

@@ -303,9 +273,9 @@
     }
 
     /**
      * @return MainTile to which rectangles are added before composition.
      */
-    public MaskTile getMainTile() {
+    public RectTile getMainTile() {
         return mainTile;
      }
 }
< prev index next >