shithub: h264bsd

Download patch

ref: bc0a8f5e82e1adcd6c2eb6309eaa917b1c3a121d
parent: 470fbfbf74b20014460021673ce75794eb3ddaee
parent: 3e6e13f8f0a30b18eda44a507946b2608cdeebf6
author: Sam Leitch <sam@nugger.net>
date: Wed Apr 2 10:46:27 EDT 2014

Merge pull request #1 from oneam/flex-proper-cropping

Properly respect the cropping info, and transform.

--- 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 {