Prev Previous Post   Next Post Next
Old 04-26-2016, 12:23 AM   #1
ijijn
Human being with feelings
 
ijijn's Avatar
 
Join Date: Apr 2012
Location: Christchurch, New Zealand
Posts: 482
Default JSFX: unusual behaviour using gfx_setimgdim

Hello!

I've noticed some exceedingly strange behaviour (possibly) related to gfx_setimgdim.

Here's some code I use to resize an image, based on various properties, along with the positive/negative results I'm getting:

Code:
// the following code works completely fine...

source = this.getImageSource();
width = this.getWidth();
height = this.getHeight();
gfx_setimgdim(source, width, height);

// as does this...

function setImageDimensions(source, width, height) (
  gfx_setimgdim(source, width, height);
);

setImageDimensions(this.getImageSource(), this.getWidth(), this.getHeight());

// but this one (sometimes) doesn't...

gfx_setimgdim(this.getImageSource(), this.getWidth(), this.getHeight());
As you can see, the input values are being calculated correctly but sometimes they don't make it through the function call. In particular, I've noticed these two bizarre behaviours at various times:
  1. the result of the first "this"-based calculation is also piped into all other this.xxx values: e.g. a non-"this" source followed by a "this" width also sets the height to this width, with little regard for their actual values, or
  2. all such values are sent as 0
I haven't been able to replicate this behaviour consistently in isolated tests, so maybe it's something to do with concurrency issues during the long evaluation time of arguments, something silly that I'm doing (always a danger) and/or maybe some stack wobbliness? These getter functions involve a few layers of nesting and some fairly hefty string manipulation.

I'm using the wrapped function technique to solve the problem but this does seem weird, right?

Any ideas?
ijijn is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:43 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.