Closed
Bug 57327
Opened 25 years ago
Closed 25 years ago
nsImageMac should use PixMaps, not GWorlds, to reduce memory use
Categories
(Core :: Layout, defect, P3)
Tracking
()
VERIFIED
FIXED
mozilla0.9
People
(Reporter: sfraser_bugs, Assigned: sfraser_bugs)
References
Details
Attachments
(2 files)
20.71 KB,
patch
|
Details | Diff | Splinter Review | |
21.00 KB,
patch
|
Details | Diff | Splinter Review |
Spinning off from bug 20743...
We're currently using GWorlds for all image bits, which involves significant
overhead (4-6K per GWorld), and lots (29) of small handles that go into the
application heap, even when allocating image bits in temp mem.
I think we need to go back to hand-rolling our own PixMaps here, as the code used
to do (back up to an older version to get the code back).
Assignee | ||
Comment 1•25 years ago
|
||
Target for mozilla 0.9
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9
Assignee | ||
Comment 2•25 years ago
|
||
Assignee | ||
Comment 3•25 years ago
|
||
cc some strong mac hackers
Assignee | ||
Comment 4•25 years ago
|
||
Removing donttest keyword. Actually, this does need testing. Things to test:
1. Loading of large images
2. Stress-test image loading under low memory conditions.
3. Printing of images (including transparent GIFs and scaled images).
Keywords: donttest
Assignee | ||
Comment 5•25 years ago
|
||
Assignee | ||
Comment 6•25 years ago
|
||
The new patch fixes the following:
1. dtor now correctly disposes the two handles
2. Mask off the top 2 bits of the rowBytes instead of just the first
3. when printing, use the correct destination pixmap.
Comment 7•25 years ago
|
||
Is it better to pass the address of a PixMapHandle or a dereferenced PixMap?
The old code passed a pointer to a PixMap, rather than the address of a
PixMapHandle. Clearly, for compatibility with pre-color Quickdraw, one could
always safely treat a CGrafPort as a GrafPort, and you could pass
&port->portBits, which would end up being the address of a PixMapHandle.
Anyway, you are using:
::CopyBits((BitMap*)&mImagePixmap, (BitMap*)*destPixels, &srcRect, &dstRect,
srcCopy, nsnull);
I would rather see all of the (BitMap*) parameters be dereferenced PixMapHandles,
which of course should probably be locked. Other than this nit, sr=beard.
Assignee | ||
Comment 8•25 years ago
|
||
CopyBits determines what is being passed in by examining the top two bits of the
rowBytes field (as described in <http://developer.apple.com/technotes/qd/
qd_15.html>). The top bit is used to distinguish between a bitmap and a pixmap,
and we always set this in CreatePixMap(). The next bit is used by CopyBits to
tell if the pixMap is part of a CGrafPtr or not. This bit is set for the pixMap
of a CGrafPtr, in which case CopyBits knows that it's being passed a
PixMapHandle, and will dereference it. We are *not* setting this bit. So, since
we only set the top bit, it is safe to pass the address of a PixMap structure to
CopyBits.
Assignee | ||
Comment 9•25 years ago
|
||
Fix checked in. To verify this bug, please test the following:
1. Image rendering with various screen depths.
2. Drawing and printing of transparent GIFs
3. Drawing and printing of PNGs with alpha
4. Stress-test image display under low memory conditions
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Comment 10•25 years ago
|
||
Tested in 16 bit and 32 bit depths (1152 X 870 / 1280 X 1024). Opened multiple
JPG's ,PNG's and GIF's at various different sizes. Printed out several
transparent GIF's and alpha channel PNG files. Verified fixed in the Mac
2001010408 build.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•