@@ -257,6 +257,7 @@ public class ScratchCostume {
257
257
258
258
private static var shapeDict: Object = {};
259
259
public function getShape ():Shape {
260
+ if (! baseLayerMD5) prepareToSave();
260
261
var id : String = baseLayerMD5;
261
262
if (id && textLayerMD5) id += textLayerMD5;
262
263
else if (textLayerMD5) id = textLayerMD5;
@@ -372,6 +373,7 @@ public class ScratchCostume {
372
373
H [ i++] = R [ j]; //right part;
373
374
374
375
R . length = L . length = 0 ;
376
+ image. dispose ();
375
377
376
378
//trace('found bounds: '+new Rectangle(minX, minY, maxX - minX, maxY - minY));
377
379
return H ;
@@ -392,16 +394,16 @@ public class ScratchCostume {
392
394
dup. rotationCenterY = rotationCenterY;
393
395
394
396
dup. baseLayerBitmap = baseLayerBitmap;
395
- dup. baseLayerMD5 = baseLayerMD5;
396
397
dup. baseLayerData = baseLayerData;
398
+ dup. baseLayerMD5 = baseLayerMD5;
397
399
398
400
dup. svgRoot = svgRoot;
399
401
dup. svgWidth = svgWidth;
400
402
dup. svgHeight = svgHeight;
401
403
402
404
dup. textLayerBitmap = textLayerBitmap;
403
- dup. textLayerMD5 = textLayerMD5;
404
405
dup. textLayerData = textLayerData;
406
+ dup. textLayerMD5 = textLayerMD5;
405
407
406
408
dup. text = text ;
407
409
dup. textRect = textRect;
@@ -481,9 +483,10 @@ public class ScratchCostume {
481
483
var centerX: Number = r. x + (r. width / 2 );
482
484
var centerY: Number = r. y + (r. height / 2 );
483
485
var bm: BitmapData = new BitmapData (w, h, true , 0x00FFFFFF ); // transparent fill color
484
- var scale : Number = Math . min (1 , w / r. width , h / r. height );
486
+ var scale : Number = Math . min (w / r. width , h / r. height );
487
+ if (bitmap) scale = Math . min (1 , scale );
485
488
var m: Matrix = new Matrix ();
486
- if (scale < 1 ) m. scale (scale , scale ); // scale down a large image
489
+ if (scale < 1 || ! bitmap ) m. scale (scale , scale ); // don't scale up bitmaps
487
490
m. translate ((w / 2 ) - (scale * centerX), (h / 2 ) - (scale * centerY));
488
491
bm. draw (dispObj, m);
489
492
return bm;
0 commit comments