Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed opaqueBackground and BitmapData texture fillRect #2637

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

andresa88
Copy link
Contributor

Fixed opaqueBackground. Also fixed BitmapData's fillRect when backed by a Texture. In both cases, the Context3D clear() clears the entire framebuffer and ignores any scissor setting. We need a new __clear() method that takes into account the supplied scissor rectangle.

Here's an example that shows both glitches.

package;

import openfl.display.Bitmap;
import openfl.geom.Rectangle;
import openfl.display3D.Context3DTextureFormat;
import openfl.display.BitmapData;
import openfl.display.Shape;
import openfl.display.Sprite;

class Main extends Sprite
{
	public function new ()
	{
		super ();

		stage.color = 0;

		test_opaqueBackground();

		#if !flash
		test_texture_fillRect();
		#end
	}

	// Should render a red circle with a green opaque background
	function test_opaqueBackground()
	{
		var shape = new Shape();
		shape.opaqueBackground = 0x00FF00;
		shape.graphics.beginFill(0xFF0000);
		shape.graphics.drawCircle(100, 100, 100);
		shape.graphics.endFill();
		shape.x = 100;
		shape.y = 100;
		addChild(shape);
	}

	// It should render a blue square with a red square in the center
	function test_texture_fillRect()
	{
		var texture = stage.context3D.createRectangleTexture(200, 200, Context3DTextureFormat.BGRA, true);
		var bitmapData = BitmapData.fromTexture(texture);
		bitmapData.fillRect(bitmapData.rect, 0xFF0000FF);
		bitmapData.fillRect(new Rectangle(50, 50, 100, 100), 0xFFFF0000);

		var bitmap = new Bitmap(bitmapData);
		bitmap.x = 400;
		bitmap.y = 100;
		addChild(bitmap);
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant