shithub: h264bsd

Download patch

ref: 3e6e13f8f0a30b18eda44a507946b2608cdeebf6
parent: 3679d082c528461bb2511aa2a404cb03a9f19b7c
author: Matthew Stephure <matt.stephure@calgaryscientific.com>
date: Wed Apr 2 10:40:54 EDT 2014

- Properly respect the cropping info, and transform. In Flex the cropping rect is applied to the target, not the source (contrary to the docs, and all other params)

--- a/flex/src/h264bsd/Decoder.as
+++ b/flex/src/h264bsd/Decoder.as
@@ -182,7 +182,7 @@
             
             var width:int = cinfo.uncroppedWidth;
             var height:int = cinfo.uncroppedHeight;
-                        
+            
             var outputPicture:BitmapData = new BitmapData(width, height);
             outputPicture.setPixels(new Rectangle(0,0, width, height), outputPictureBytes);
             
@@ -193,11 +193,19 @@
                 0, 0, 0, 1, 0
             ]);
             
-            outputPicture.applyFilter(outputPicture, outputPicture.rect, new Point(0,0), bt601Filter);
             
+            var tempData:BitmapData = new BitmapData(cinfo.width, cinfo.height);
+            tempData.lock();
             target.lock();
-            target.draw(outputPicture, transform, null, null, new Rectangle(0,0, cinfo.width, cinfo.height), true);
-            target.unlock();
+            
+            // Cropped and color converted
+            tempData.applyFilter( outputPicture, new Rectangle(0, 0, cinfo.width, cinfo.height), new Point(0, 0), bt601Filter);
+            
+            // Translated and scaled
+            target.draw(tempData, transform, null, null, null, true);
+            
+            tempData.unlock();
+            target.unlock();   
         }
 
         private function get outputByteLength():int {