Disable ImageDataUtil changes for now

This commit is contained in:
Joshua Granick
2015-04-11 20:32:18 -07:00
parent 5aa9d6b581
commit 66c1840952

View File

@@ -173,6 +173,15 @@ class ImageDataUtil {
if (!mergeAlpha || !sourceImage.transparent) {
//#if (!js && !flash)
//if (sourceRect.width == image.width && sourceRect.height == image.height && image.width == sourceImage.width && image.height == sourceImage.height && sourceRect.x == 0 && sourceRect.y == 0 && destPoint.x == 0 && destPoint.y == 0) {
//
//image.buffer.data.buffer.blit (0, sourceImage.buffer.data.buffer, 0, Std.int (sourceRect.width * sourceRect.height) * 4);
//return;
//
//}
//#end
for (row in Std.int (sourceRect.top + sourceImage.offsetY)...Std.int (sourceRect.bottom + sourceImage.offsetY)) {
for (column in Std.int (sourceRect.left + sourceImage.offsetX)...Std.int (sourceRect.right + sourceImage.offsetX)) {
@@ -395,12 +404,24 @@ class ImageDataUtil {
public static function getPixels (image:Image, rect:Rectangle):ByteArray {
var length = Std.int (rect.width * rect.height);
#if flash
var byteArray = new ByteArray ();
#else
var byteArray = new ByteArray (Std.int (rect.width * rect.height * 4));
var byteArray = new ByteArray (length * 4);
byteArray.position = 0;
#end
//#if (!js && !flash)
//if (rect.width == image.width && rect.height == image.height && rect.x == 0 && rect.y == 0) {
//
//byteArray.blit (0, image.buffer.data.buffer, 0, length * 4);
//return byteArray;
//
//}
//#end
// TODO: optimize if the rect is the same as the full buffer size
var srcData = image.buffer.data;
@@ -409,7 +430,6 @@ class ImageDataUtil {
var srcRowOffset = srcStride - Std.int (4 * rect.width);
var srcRowEnd = Std.int (4 * (rect.x + rect.width));
var length = Std.int (rect.width * rect.height);
#if js
byteArray.length = length * 4;
#end
@@ -641,6 +661,15 @@ class ImageDataUtil {
var len = Math.round (rect.width * rect.height);
//#if (!js && !flash)
//if (rect.width == image.width && rect.height == image.height && rect.x == 0 && rect.y == 0) {
//
//image.buffer.data.buffer.blit (0, byteArray, 0, len * 4);
//return;
//
//}
//#end
// TODO: optimize when rect is the same as the buffer size
var data = image.buffer.data;