Fix image.scroll

This commit is contained in:
Joshua Granick
2016-11-23 17:42:51 -08:00
parent 2b12cb3e91
commit bba4765a02
2 changed files with 11 additions and 7 deletions

View File

@@ -317,6 +317,14 @@ class Image {
destPoint.y = 0; //clamp destination point to 0
}
// TODO: Optimize
if (sourceImage == this) {
sourceImage = clone ();
}
switch (type) {
case CANVAS:
@@ -801,12 +809,6 @@ class Image {
case DATA:
//#if (js && html5)
//ImageCanvasUtil.convertToData (this);
//#end
//ImageDataUtil.scroll (this, x, y);
copyPixels (this, rect, new Vector2 (x, y));
case FLASH:

View File

@@ -369,10 +369,12 @@ class ImageCanvasUtil {
if ((x % image.width == 0) && (y % image.height == 0)) return;
var copy = image.clone ();
convertToCanvas (image, true);
image.buffer.__srcContext.clearRect (x, y, image.width, image.height);
image.buffer.__srcContext.drawImage (image.buffer.__srcCanvas, x, y);
image.buffer.__srcContext.drawImage (copy.src, x, y);
image.dirty = true;
image.version++;