Image.replaceWith

14 views
Skip to first unread message

Matt Mastracci

unread,
Jan 9, 2012, 10:37:31 PM1/9/12
to PlayN
Anyone object to removing Image.replaceWith? I see four problems with keeping it around:

1) Inconstancy: It fails when you try to replace the guts of a CanvasImage with another image in Flash mode, but not in other modes. This could be tricky to make consistent on every platform, as XCanvas is not always a subclass of XImage, and we can't guarantee that passing the guts of a CanvasImage back and forth with non-canvas Images is safe.
2) It's buggy: it doesn't notify the associated image layers that its guts have been replaced, which means that it doesn't currently work in DOM mode. I suspect that it's not currently re-creating textures in WebGL either, but I haven't tested it.
3) It's nearly a duplicate of the functionality of ImageLayer.setImage()
4) It makes images not-quite-immutable, which makes it somewhat more difficult to reason about them.


Matt Mastracci
Twitter@mmastrac
Bloggrack.com

Michael Bayne

unread,
Jan 9, 2012, 11:31:20 PM1/9/12
to pl...@googlegroups.com
On Mon, Jan 9, 2012 at 7:37 PM, Matt Mastracci <mat...@mastracci.com> wrote:
Anyone object to removing Image.replaceWith?

No objections here. I like immutable images.

-- m...@samskivert.com

Philip Rogers

unread,
Jan 10, 2012, 8:51:00 AM1/10/12
to pl...@googlegroups.com
+1

Joel Webber

unread,
Jan 11, 2012, 9:42:39 AM1/11/12
to pl...@googlegroups.com
Nuke it. It is an old hack that hasn't been used in ages.

Michael Bayne

unread,
Jan 11, 2012, 12:30:39 PM1/11/12
to pl...@googlegroups.com
On Wed, Jan 11, 2012 at 6:42 AM, Joel Webber <j...@google.com> wrote:
Nuke it. It is an old hack that hasn't been used in ages.

I'll remove it now as part of the graphics rewrite I'm working on.

-- m...@samskivert.com
Reply all
Reply to author
Forward
0 new messages