Closed
Bug 285054
Opened 21 years ago
Closed 21 years ago
ConvertDDBtoDIB violates windows APIs
Categories
(Core Graveyard :: GFX: Win32, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: Biesinger, Unassigned)
References
()
Details
Attachments
(1 file)
|
1.28 KB,
patch
|
Biesinger
:
review+
tor
:
superreview+
|
Details | Diff | Splinter Review |
quoting
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_7gms.asp
"hbmp
[in] Handle to the bitmap. This must be a compatible bitmap (DDB)."
"The bitmap identified by the hbmp parameter must not be selected into a device
context when the application calls this function."
This function does select the bitmap into a DC:
1661 oldbits = (HBITMAP)::SelectObject(memPrDC,mHBitmap);
Also, in many cases mHBitmap seems to be a DIB, as created by CreateDIBSection:
http://lxr.mozilla.org/seamonkey/source/gfx/src/windows/nsImageWin.cpp#1498
Comment 1•21 years ago
|
||
With regards to mHBitmap being a DIBSection, we really don't need to call
ConvertDDBtoDIB at all, if we didn't null out mImageBits and mImageSize. I
think that should be another bug though.
As for the bug in question, the SelectObject has been in the code since May,
1999. But you're right, it's incorrect according to the spec. Looks like the
two SelectObject calls and the oldbits variable can be removed.
| Reporter | ||
Comment 2•21 years ago
|
||
if we didn't delete and null out mImageBits, we'd take up twice the memory for
the images, wouldn't we?
Comment 3•21 years ago
|
||
When the DIB is created, we copy mImageBits into the "bits" pointer that the OS
gave us, and then clear mImageBits. What I meant to say in Comment 1 was that
we can "delete [] mImageBits; mImageBits = bits;", leaving only 1 copy.
Comment 4•21 years ago
|
||
Attachment #178215 -
Flags: review?(cbiesinger)
| Reporter | ||
Comment 5•21 years ago
|
||
Comment on attachment 178215 [details] [diff] [review]
Don't select bitmap into HDC
this still passes a DIB to GetDIBits sometimes, but ok...
Attachment #178215 -
Flags: review?(cbiesinger) → review+
Comment 6•21 years ago
|
||
(In reply to comment #5)
> (From update of attachment 178215 [details] [diff] [review] [edit])
> this still passes a DIB to GetDIBits sometimes, but ok...
one bug at a time :)
Updated•21 years ago
|
Attachment #178215 -
Flags: superreview?(tor)
Attachment #178215 -
Flags: superreview?(tor) → superreview+
Comment 7•21 years ago
|
||
Checking in gfx/src/windows/nsImageWin.cpp;
/cvsroot/mozilla/gfx/src/windows/nsImageWin.cpp,v <-- nsImageWin.cpp
new revision: 3.144; previous revision: 3.143
done
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Updated•21 years ago
|
Attachment #178215 -
Flags: approval1.8b2?
Comment 8•21 years ago
|
||
Has this not actually landed? Why is it marked Fixed?
Comment 9•21 years ago
|
||
Comment on attachment 178215 [details] [diff] [review]
Don't select bitmap into HDC
sorry, I flagged approval1.8b2 request on the wrong bug.
Attachment #178215 -
Flags: approval1.8b2?
Updated•17 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•