From ff31994909a7556f126d3ca0a85037c418ce28b1 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Fri, 9 Jan 2009 02:24:11 +0000 Subject: [PATCH] Some rearrangement. Fucking A. It seems to default back to the size of the last snapshot taken even if that snapshot was affected by the bug. When you quit and then come back in, it is "stuck" to the last size. There's no way to know what this size is. Right now: logging everything, doing no adjustment. Let's see if other people have problems, or what. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@751 ed5b42cb-e716-0410-a449-f6a68f950b19 --- .../com/threerings/flash/CameraSnapshotter.as | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/as/com/threerings/flash/CameraSnapshotter.as b/src/as/com/threerings/flash/CameraSnapshotter.as index 69ccb7e5..851b67ae 100644 --- a/src/as/com/threerings/flash/CameraSnapshotter.as +++ b/src/as/com/threerings/flash/CameraSnapshotter.as @@ -16,6 +16,7 @@ import flash.media.Video; import flash.text.TextField; +import com.threerings.util.Log; import com.threerings.util.MethodQueue; // TODO: use PreferredCamera? @@ -84,7 +85,7 @@ public class CameraSnapshotter extends Sprite removeChild(_video); } _bitmap = null; - _video = null; + detachVideo(); } _camera = camera; @@ -108,8 +109,9 @@ public class CameraSnapshotter extends Sprite { clearSnapshot(); removeChild(_video); - _camera.setMode(width, height, fps, favorArea); + detachVideo(); + _camera.setMode(width, height, fps, favorArea); attachVideo(); } @@ -125,13 +127,13 @@ public class CameraSnapshotter extends Sprite // than leaving everything alone, which mostly didn't work. But then again, // this code is specifically saying: "fuck up the scale", so if Adobe fixes their // bug in the future, this will cause broken behavior. - _bitmap.bitmapData.draw(_video, - new Matrix(_camera.width / 160, 0, 0, _camera.height / 120)); -// com.threerings.util.Log.testing("Camera stuff", -// "camera.width", _camera.width, "camera.height", _camera.height, -// "video.width", _video.width, "video.height", _video.height, -// "videoWidth", _video.videoWidth, "videoHeight", _video.videoHeight, -// "bitmap.width", _bitmap.width, "bitmap.height", _bitmap.height); + _bitmap.bitmapData.draw(_video); + //new Matrix(_camera.width / 160, 0, 0, _camera.height / 120)); + Log.getLog(this).debug("Camera snapshotted", + "camera.width", _camera.width, "camera.height", _camera.height, + "video.width", _video.width, "video.height", _video.height, + "videoWidth", _video.videoWidth, "videoHeight", _video.videoHeight, + "bitmap.width", _bitmap.width, "bitmap.height", _bitmap.height); if (_video.parent != null) { removeChild(_video); @@ -162,10 +164,8 @@ public class CameraSnapshotter extends Sprite protected function attachVideo () :void { - if (_video != null) { - // shut down the old video - _video.attachCamera(null); - } + // detach any old first + detachVideo(); _video = new Video(_camera.width, _camera.height); // the constructor args don't seem to do dick, so we set the values again... @@ -176,6 +176,14 @@ public class CameraSnapshotter extends Sprite _bitmap = new Bitmap(new BitmapData(_camera.width, _camera.height, false)); } + protected function detachVideo () :void + { + if (_video != null) { + _video.attachCamera(null); + _video = null; + } + } + protected var _camera :Camera; protected var _video :Video;