Adobe-Runtime-Support icon indicating copy to clipboard operation
Adobe-Runtime-Support copied to clipboard

Big image (BitmapData) in small Bitmap incorrect render

Open itlancer opened this issue 4 years ago • 4 comments

Problem Description

Loaded big image (2300x1500 pixels, for example) into small bitmap object (90x60 pixels, for example) cause incorrect render (it starts to work like mask/scrollRect) when it x coordinate more than about 1255 pixels (different from image to image). This is very old bug.

Tested with many different AIR and Flash Player versions even with latests AIR 32.0.0.144 beta and AIR 33.0.2.330 with different Windows, macOS, Android and iOS devices, its architectures, build target and OSes versions.

Tracker link: https://tracker.adobe.com/#/view/AIR-4153130 Related issue: http://forum.starling-framework.org/topic/all-platforms-big-image-in-small-bitmap-object-render-problem

Same problem with all cases with any "big image". Changing renderMode in application manifest doesn't help. Changing Stage::quality doesn't help. Changing Bitmap::smoothing doesn't help. Changing requestedDisplayResolution in application manifest doesn't help. Parent (DisplayObjectContainer) that contains Bitmap object doesn't matter.

Steps to Reproduce

Launch code below and move mouse (or touch) somewhere to the right side of stage (application screen). "Problem coordinates" seems depends on screen resolution, application window size, image resolution and some other factors. Application example with sources and example of image attached. big_image_bug.zip

package {
	import flash.display.Bitmap;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class BigImageBug extends Sprite {
		
		[Embed(source = "big_image.jpg")]
		private const EmbeddedImage:Class;//Embed image just for simplicity
		
		private var bitmap:Bitmap;
		
		public function BigImageBug() {
			//Just to use whole avaiable stage space
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			bitmap = new EmbeddedImage();//Type of loading or embedding image doesn't matter
			bitmap.width = 90;//Set image width/height relatively small
			bitmap.height = 60;
			//bitmap.cacheAsBitmap = true;//Uncomment this line for workaround
			addChild(bitmap);
			
			addEventListener(Event.ENTER_FRAME, enterFrameMove);
		}
		
		//Move image (bitmap) at mouse coordinates
		private function enterFrameMove(e:Event):void {
			bitmap.x = stage.mouseX;
			bitmap.y = stage.mouseY;
		}
	}
}

Actual Result: Image incorrect render. It start to work something like scrollRect and show only strange part of image. actual

Expected Result: Correct image render. expected

Known Workarounds

  • use Bitmap::cacheAsBitmap=true but it cause memory and performance issues
  • may be redraw to smaller one BitmapData but it also cause memory and performance issues

itlancer avatar Dec 03 '19 20:12 itlancer