Fixed: #1156 Rendering - 9 slice scaling (DefineScalingGrid) clipping

This commit is contained in:
Jindra Petřík
2021-03-06 17:54:34 +01:00
parent 5ecb5f8a87
commit b85d22d9c5
3 changed files with 29 additions and 26 deletions

View File

@@ -12,7 +12,8 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library.
* License along with this library.
*/
package com.jpexs.decompiler.flash.tags;
import com.jpexs.decompiler.flash.SWF;
@@ -200,29 +201,12 @@ public class DefineScalingGridTag extends Tag implements CharacterIdTag {
}
for (int i = 0; i < targetRect.length; i++) {
for (int i = 0; i < targetRect.length; i++) {
/* sourceRect[i].xMax = roundPixels20(sourceRect[i].xMax);
sourceRect[i].yMax = roundPixels20(sourceRect[i].yMax);
sourceRect[i].xMin = roundPixels20(sourceRect[i].xMin);
sourceRect[i].yMin = roundPixels20(sourceRect[i].yMin);
*/
//System.out.println("source[" + i + "]=" + sourceRect[i]);
//System.out.println("target[" + i + "]=" + targetRect[i]);
/*targetRect[i].xMax = roundPixels20(targetRect[i].xMax);
targetRect[i].yMax = roundPixels20(targetRect[i].yMax);
targetRect[i].xMin = roundPixels20(targetRect[i].xMin);
targetRect[i].yMin = roundPixels20(targetRect[i].yMin);
transforms[i] = rectToRectMatrix(sourceRect[i], targetRect[i]);
targetRect[i].xMax = Math.rint(targetRect[i].xMax / SWF.unitDivisor);
targetRect[i].yMax = Math.rint(targetRect[i].yMax / SWF.unitDivisor);
targetRect[i].xMin = Math.rint(targetRect[i].xMin / SWF.unitDivisor);
targetRect[i].yMin = Math.rint(targetRect[i].yMin / SWF.unitDivisor);
targetRect[i].yMin = Math.rint(targetRect[i].yMin / SWF.unitDivisor);
//targetRect[i].xMax += maxStroke;
}
}
}

View File

@@ -916,15 +916,32 @@ public class Timeline {
DefineScalingGridTag.getSlices(targetBoundsRect, boundsRect, new ExportRectangle(scalingRect), sourceRect, targetRect, transforms);
Shape c = g.getClip();
AffineTransform origTransform = g.getTransform();
for (int s = 0; s < 9; s++) {
g.setTransform(new AffineTransform());
ExportRectangle p1 = transformation.transform(targetRect[s]);
g.setClip(c);
int s = 0;
for (int sy = 0; sy < 3; sy++) {
for (int sx = 0; sx < 3; sx++) {
g.setTransform(new AffineTransform());
ExportRectangle p1 = transformation.transform(targetRect[s]);
g.setClip(c);
Rectangle2D r = new Rectangle2D.Double(p1.xMin, p1.yMin, p1.getWidth(), p1.getHeight());
g.setClip(r);
drawDrawable(strokeTransformation.preConcatenate(layerMatrix), layer, transforms[s], g, colorTransform, layer.blendMode, clips, transformation, isClip, layer.clipDepth, absMat, time, layer.ratio, renderContext, image, (DrawableTag) character, layer.filters, unzoom, clrTrans);
if (sx == 0) {
p1.xMin = 0;
}
if (sy == 0) {
p1.yMin = 0;
}
if (sx == 2) {
p1.xMax = Integer.MAX_VALUE;
}
if (sy == 2) {
p1.yMax = Integer.MAX_VALUE;
}
Rectangle2D r = new Rectangle2D.Double(p1.xMin, p1.yMin, p1.getWidth(), p1.getHeight());
g.setClip(r);
drawDrawable(strokeTransformation.preConcatenate(layerMatrix), layer, transforms[s], g, colorTransform, layer.blendMode, clips, transformation, isClip, layer.clipDepth, absMat, time, layer.ratio, renderContext, image, (DrawableTag) character, layer.filters, unzoom, clrTrans);
s++;
}
}
g.setClip(c);
@@ -964,7 +981,8 @@ public class Timeline {
}
}
g.setTransform(new AffineTransform());
g.setTransform(
new AffineTransform());
g.setClip(prevClip);
}