From 9b7a3da5d8ea154e3f4aa6ac43eba2f6967d8858 Mon Sep 17 00:00:00 2001 From: James Gray Date: Thu, 23 Jul 2015 18:52:57 -0500 Subject: [PATCH] console: wip texture decode API --- lime/graphics/Image.hx | 7 ++++++- lime/graphics/console/TextureData.hx | 6 +++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lime/graphics/Image.hx b/lime/graphics/Image.hx index ae3955993..da14b33eb 100644 --- a/lime/graphics/Image.hx +++ b/lime/graphics/Image.hx @@ -1029,7 +1029,11 @@ class Image { #if 1 - cpp.NativeArray.setSize (data, w*h*4); + var size = w * h * 4; + cpp.NativeArray.setSize (data, size); + + td.decode (cpp.Pointer.arrayElem (data, 0), size); +/* { var dest:cpp.Pointer = cast cpp.Pointer.arrayElem (data, 0); var src:cpp.Pointer = cast td.pointer; @@ -1038,6 +1042,7 @@ class Image { dest[i] = src[i]; } } +*/ td.release (); #else diff --git a/lime/graphics/console/TextureData.hx b/lime/graphics/console/TextureData.hx index f088e813f..86247f5f5 100644 --- a/lime/graphics/console/TextureData.hx +++ b/lime/graphics/console/TextureData.hx @@ -19,13 +19,14 @@ extern class TextureData { public var width (get, never):Int; public var height (get, never):Int; - public var pointer (get, never):Pointer; - // fromFile loads texture data from the named file. @:native("lime::ConsoleTextureData::fromFile") public static function fromFile (name:String):TextureData; + // decode does any decompression or whatever is necessary to output lime's + // standard RGBA. + public function decode (dest:Pointer, destSize:Int):Void; // release releases the texture data. public function release ():Void; @@ -34,7 +35,6 @@ extern class TextureData { private function get_valid ():Bool; private function get_width ():Int; private function get_height ():Int; - private function get_pointer ():Pointer; }