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

Print this page




1268         // hijack it right here to start with. Note that any of the calls
1269         // in computeDirtyRegion might end up changing the region instance
1270         // from dirtyRegionTemp (which is a RectBounds) to a BoxBounds if any
1271         // of the other bounds / transforms involve a perspective transformation.
1272         BaseBounds region = dirtyRegionTemp;
1273         if (!dirtyBounds.isEmpty()) {
1274             region = region.deriveWithNewBounds(dirtyBounds);
1275         } else {
1276             // If dirtyBounds is empty, then we will simply set the bounds to
1277             // be the same as the transformedBounds (since that means the bounds
1278             // haven't changed and right now we don't support dirty sub regions
1279             // for generic nodes). This can happen if, for example, this is
1280             // a group with a clip and the dirty area of child nodes within
1281             // the group exceeds the bounds of the clip on the group. Just trust me.
1282             region = region.deriveWithNewBounds(transformedBounds);
1283         }
1284 
1285         // We shouldn't do anything with empty region, as we may accidentally make
1286         // it non empty or turn it into some nonsense (like (-1,-1,0,0) )
1287         if (!region.isEmpty()) {









1288             // Now that we have the dirty region, we will simply apply the tx
1289             // to it (after slightly padding it for good luck) to get the scene
1290             // coordinates for this.
1291             region = computePadding(region);
1292             region = tx.transform(region, region);
1293             region = pvTx.transform(region, region);
1294         }
1295         return region;
1296     }
1297 
1298     /**
1299      * LCD Text creates some painful situations where, due to the LCD text
1300      * algorithm, we end up with some pixels touched that are normally outside
1301      * the bounds. To compensate, we need a hook for NGText to add padding.
1302      */
1303     protected BaseBounds computePadding(BaseBounds region) {
1304         return region;
1305     }
1306 
1307     /**




1268         // hijack it right here to start with. Note that any of the calls
1269         // in computeDirtyRegion might end up changing the region instance
1270         // from dirtyRegionTemp (which is a RectBounds) to a BoxBounds if any
1271         // of the other bounds / transforms involve a perspective transformation.
1272         BaseBounds region = dirtyRegionTemp;
1273         if (!dirtyBounds.isEmpty()) {
1274             region = region.deriveWithNewBounds(dirtyBounds);
1275         } else {
1276             // If dirtyBounds is empty, then we will simply set the bounds to
1277             // be the same as the transformedBounds (since that means the bounds
1278             // haven't changed and right now we don't support dirty sub regions
1279             // for generic nodes). This can happen if, for example, this is
1280             // a group with a clip and the dirty area of child nodes within
1281             // the group exceeds the bounds of the clip on the group. Just trust me.
1282             region = region.deriveWithNewBounds(transformedBounds);
1283         }
1284         
1285         // We shouldn't do anything with empty region, as we may accidentally make
1286         // it non empty or turn it into some nonsense (like (-1,-1,0,0) )
1287         if (!region.isEmpty()) {
1288             // In case we have a valid cache, there might be sub-pixel differences between the computed
1289             // transformedBounds (and consequently also dirtyBounds) and the bounds of the cache.
1290             // At this point, we still don't know for sure if the cache fill be used (or if it will be recomputed).
1291             // For finding that out and then for computing the new cache bounds, we'd need to analyze the current tx
1292             // (using "unmatrix" of CacheFilter). Since the gain of tight bounds would be probably very low and so not
1293             // worth an extra computation, we just round out the region right here.
1294             if (cacheFilter != null && !tx.isTranslateOrIdentity()) {
1295                 region.roundOut();
1296             }
1297             // Now that we have the dirty region, we will simply apply the tx
1298             // to it (after slightly padding it for good luck) to get the scene
1299             // coordinates for this.
1300             region = computePadding(region);
1301             region = tx.transform(region, region);
1302             region = pvTx.transform(region, region);
1303         }
1304         return region;
1305     }
1306 
1307     /**
1308      * LCD Text creates some painful situations where, due to the LCD text
1309      * algorithm, we end up with some pixels touched that are normally outside
1310      * the bounds. To compensate, we need a hook for NGText to add padding.
1311      */
1312     protected BaseBounds computePadding(BaseBounds region) {
1313         return region;
1314     }
1315 
1316     /**