|
I may have extreme confusion isolating where the mistake is. I've gotten to page 5 of spit and polish and noticed this error in my zooming.
I don't know whether revision control notions I heard 20 years ago have ever been refined, but I sure know my revisions were out of control, as you will see.
Mike Beam's image app from both working with bitmaps 1 and 2 did zoom right. In particular, Mike's image doesn't distort on my drag of lower right corner window reshaper, mine does.
Michele suggested more code for dragging in working with bitmaps article 1. For some reason, I put this in a folder for working with bitmaps article 2. Since I chose to put it in #2, I am not sure whether I added Michele's code to article 2's code or article 1's. I did working wth bitmaps article 3 on top of that revision wherein I first observed that zooming broke.
Here's what happens :
(at first glance impressions)
At 100% my image is "right". I zoom down to 50% and I see (at least) two jumps of 50% but things settle down to about three jumps netting about an 8 times rescaling. I had the impression there might have been both horizontal and vertical rescalings in time sequence.
I don't know how to slow down the graphics of os x so my brain can follow how many jumps there are in this "first glance set of impressions". Steve Jobs did genie with slow motion; I can't.
Isolation choice : Since Michele's drag code is older than the stuff I build on top of it, it will have less to search amongst than code build on top of it. I can use debugger and step through slow graphics changes.
scaleimageto's [[self window] zoom:nil] line called windowwillusestandardframe though, somehow, I couldn't step into windowwillusestandardframe. Passing through gave no overkill zoom on 50% from 100%. It, however, returned standard frame to something else that resized the window. But, recall, I observed that dragging the lower right corner to resize the "containing" window also resized the image. That could have compounded the zooming, you see.
Candidate methodology : How do I find that something else called?
I don't know how, other than flagging all methods in debugger to see "finer resolution" (of calls) on that scaleimageto's [[self window] zoom:nil] line. This methodology is bad on two counts. It is both highly inefficient, forcing slow stepping through of everything irrelevant, and might miss things called other than in my code, eg. in the frameworks.
|
You cannot use my code with Mike's code, it brings conflicts.
Otherwise, I tell you again (I think I've already done it) how you can see some outputs from your code.
Use NSLog.
The code for NSLog must be put after all variables' declarations, otherwise you'll get errors at compile time.
So, when you want to see what happens during willUsesStandardFrame, put inside the code something like this, assuming that myWindow is the window you want info from:
NSLog(@"Info about myWindow: %g, %g", [myWindow frame].size.width, [myWindow frame].size.height);
It gives you the width and size of the window at the time the runtime system calls this line of code.
You can put NSLog about what you want throughout your code. Very useful when you cannot access to info through the debugger, what happens with the window willuseStandardFrame because it is called repeatedly or when you invoke something like windowWillBecomeKey, because that debugger's window that becomes key.
For other types of methods, put breaks into your code with an NSLog like this:
NSLog(@"Enter myMethod");
so you can trace the code and run your app with debugger and then you will understand why mixing both codes (Mike's and mine) makes no sense.
Hope this helps.
Michèle