Closed Bug 264708 Opened 20 years ago Closed 20 years ago

Single-bit transparency not supported on Win98

Categories

(Core :: XUL, defect)

x86
Windows 98
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.8alpha6

People

(Reporter: nrm, Assigned: jonitis)

References

()

Details

Attachments

(3 files, 3 obsolete files)

Even though Windows 98 doesn't support alpha transparencies,
non-rectangular windows should still be possible using (eg)
transparent GIFs. This allows non-rectangular windows across
all Windows ports except (the officially not supported) win95.

It also reduces the dependancy on OS APIs if XUL apps are built
without any transparency.

See attachments for examples of ancient windows apps that
support this under win98 and provide a heightened visual
experience.

- N.
Attached image Banshee Screamer
Built using a 3rd party theme engine. freeware. No longer maintained. No
source.
Attached image HotBurn CD Burner
HotBurn CD burner. ancient version. commercial.
Attached patch diff -d -u -8 (obsolete) — Splinter Review
This patch adds support for non-rectangular windows for anything older than
Windows 2000 (Win95, Win NT 3.51). It uses complex shaped window regions to set
window transparency map. Every non-zero AlphaMask value maps to opaque window pixel.

Works pretty well with static images. For animated octopus sample it takes up to
80% CPU time on 1.6 GHz P4 and around 30% on Athlon64 3200+. Window region for
average octopus frame consists from approx. 300 rectangles. 


Attachment #165560 - Flags: superreview?(roc)
Attachment #165560 - Flags: review?(emaijala)
David,
Can you check if this compiles with MinGW?
It doesn't compile under Win32/MinGW/cygwin....

I get :-

In file included from e:/mozilla/source/mozilla/widget/src/windows/nsNativeDragT
arget.cpp:47:
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.h:529: error: ISO C++ proh
ibits anonymous structs
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.h:534: error: ISO C++ proh
ibits anonymous structs
e:/mozilla/source/mozilla/widget/src/windows/nsNativeDragTarget.h: In constructo
r `nsNativeDragTarget::nsNativeDragTarget(nsIWidget*)':
e:/mozilla/source/mozilla/widget/src/windows/nsNativeDragTarget.h:107: warning:
`nsNativeDragTarget::mWindow' will be initialized after
e:/mozilla/source/mozilla/widget/src/windows/nsNativeDragTarget.h:104: warning:
  `PRBool nsNativeDragTarget::mCanMove'
e:/mozilla/source/mozilla/widget/src/windows/nsNativeDragTarget.cpp:78: warning:
   when initialized here
make[5]: *** [nsNativeDragTarget.o] Error 1
make[5]: Leaving directory `/cygdrive/e/mozilla/source/mozilla/widget/src/window
s'
make[4]: *** [libs] Error 2
make[4]: Leaving directory `/cygdrive/e/mozilla/source/mozilla/widget/src'
make[3]: *** [libs] Error 2
make[3]: Leaving directory `/cygdrive/e/mozilla/source/mozilla/widget'
make[2]: *** [libs] Error 2
make[2]: Leaving directory `/cygdrive/e/mozilla/source/mozilla'
make[1]: *** [alldep] Error 2
make[1]: Leaving directory `/cygdrive/e/mozilla/source/mozilla'
make: *** [alldep] Error 2
Attached patch diff -d -u -8 (obsolete) — Splinter Review
Make it compile on MinGW. Instead of anonymous structures use named ones w2k
and w9x inside the anonymous union.
Assignee: nobody → Dainis_Jonitis
Attachment #165560 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #165560 - Flags: superreview?(roc)
Attachment #165560 - Flags: review?(emaijala)
Attachment #165664 - Flags: superreview?(roc)
Attachment #165664 - Flags: review?(emaijala)
Ummm, still got some MinGW problems....

e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `v
irtual nsresult nsWindow::StandardWindowCreate(nsIWidget*, const nsRect&, nsEven
tStatus (*)(nsGUIEvent*), nsIDeviceContext*, nsIAppShell*, nsIToolkit*, nsWidget
InitData*, void*)':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:1531: warning: passing
 NULL used for non-pointer converting 5 of `HWND__* CreateDialogIndirectParamA(H
INSTANCE__*, const DLGTEMPLATE*, HWND__*, BOOL (*)(HWND__*, UINT, WPARAM, LPARAM
), LPARAM)'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `v
irtual nsresult nsWindow::SetCursor(nsCursor)':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:2545: warning: unused
variable 'oldCursor'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In function `void Pri
ntEvent(UINT, PRBool, PRBool)':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:3628: warning: int for
mat, long int arg (arg 2)
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In function `nsresult
 HeapDump(const char*, const char*)':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:3668: warning: unused
variable 'written'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `v
oid nsWindow::DispatchPendingEvents()':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:3755: warning: passing
 NULL used for non-pointer converting 3 of `BOOL EnumChildWindows(HWND__*, BOOL
(*)(HWND__*, LPARAM), LPARAM)'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `v
irtual PRBool nsWindow::ProcessMessage(UINT, WPARAM, LPARAM, LRESULT*)':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:4078: warning: compari
son between signed and unsigned integer expressions
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:4188: warning: unused
variable 'result'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:4390: warning: unused
variable 'hOldPal'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:4393: warning: unused
variable 'i'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:4480: warning: unused
variable 'rv'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:3761: warning: unused
variable 'vkKeyCached'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `v
irtual const WCHAR* nsWindow::WindowClassW()':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:4741: warning: cast fr
om pointer to integer of different size
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `v
irtual const WCHAR* nsWindow::WindowPopupClassW()':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:4793: warning: cast fr
om pointer to integer of different size
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `B
OOL nsWindow::OnIMEComposition(LPARAM)':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6131: warning: convert
ing to non-pointer type `HIMC' from NULL
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6132: warning: NULL us
ed in arithmetic
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `B
OOL nsWindow::OnIMEEndComposition()':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6330: warning: convert
ing to non-pointer type `HIMC' from NULL
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6331: warning: NULL us
ed in arithmetic
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `B
OOL nsWindow::OnIMEStartComposition()':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6566: warning: convert
ing to non-pointer type `HIMC' from NULL
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6567: warning: NULL us
ed in arithmetic
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `v
irtual nsresult nsWindow::ResetInputState()':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6582: warning: convert
ing to non-pointer type `HIMC' from NULL
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6585: warning: passing
 NULL used for non-pointer converting 4 of `virtual HRESULT IActiveIMMApp::Notif
yIME(HIMC, DWORD, DWORD, DWORD)'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6585: warning: passing
 NULL used for non-pointer converting 4 of `LONG nsIMM::NotifyIME(HIMC, DWORD, D
WORD, DWORD)'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6586: warning: passing
 NULL used for non-pointer converting 4 of `virtual HRESULT IActiveIMMApp::Notif
yIME(HIMC, DWORD, DWORD, DWORD)'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6586: warning: passing
 NULL used for non-pointer converting 4 of `LONG nsIMM::NotifyIME(HIMC, DWORD, D
WORD, DWORD)'
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `v
irtual nsresult nsWindow::SetIMEOpenState(PRBool)':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6600: warning: convert
ing to non-pointer type `HIMC' from NULL
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `v
irtual nsresult nsWindow::GetIMEOpenState(PRBool*)':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6612: warning: convert
ing to non-pointer type `HIMC' from NULL
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `P
RBool nsWindow::HandleMouseActionOfIME(int, POINT*)':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6659: warning: convert
ing to non-pointer type `HIMC' from NULL
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:6660: warning: convert
ing to non-pointer type `HIMC' from NULL
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp: In member function `v
oid nsWindow::SetWindowRegionToAlphaMask()':
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:7601: error: name look
up of `sx' changed for new ISO `for' scoping
e:/mozilla/source/mozilla/widget/src/windows/nsWindow.cpp:7579: error:   using o
bsolete binding at `sx'
make[5]: *** [nsWindow.o] Error 1
make[5]: Leaving directory `/cygdrive/e/mozilla/source/mozilla/widget/src/window
s'
make[4]: *** [libs] Error 2
make[4]: Leaving directory `/cygdrive/e/mozilla/source/mozilla/widget/src'
make[3]: *** [libs] Error 2
make[3]: Leaving directory `/cygdrive/e/mozilla/source/mozilla/widget'
make[2]: *** [libs] Error 2
make[2]: Leaving directory `/cygdrive/e/mozilla/source/mozilla'
make[1]: *** [alldep] Error 2
make[1]: Leaving directory `/cygdrive/e/mozilla/source/mozilla'
make: *** [alldep] Error 2
Attached patch diff -d -u -8 Fix MinGW (obsolete) — Splinter Review
This compiles with Visual C++ 6.0 and .Net 2003. Hopefully should compile with
MinGW, too.
Attachment #165664 - Attachment is obsolete: true
Attachment #165686 - Flags: superreview?(roc)
Attachment #165686 - Flags: review?(emaijala)
Attachment #165664 - Flags: superreview?(roc)
Attachment #165664 - Flags: review?(emaijala)
I can't test this at the moment as the fix for Bug #267767 has broken my build.
Works fine with Win32/MinGW/cygwin. Good work.

(In reply to comment #9)
> Created an attachment (id=165686)
> diff -d -u -8  Fix MinGW
> 
> This compiles with Visual C++ 6.0 and .Net 2003. Hopefully should compile with
> MinGW, too.

Comment on attachment 165686 [details] [diff] [review]
diff -d -u -8  Fix MinGW

>+        for (PRInt32 x = 0; x < aRect.width ; x++)
>+        {
>+          if (!*pDest != !*pSrc)
>+          {
>+            TransparencyMaskChanged = PR_TRUE;
>+            SkipMaskChangeCheck = PR_TRUE;
>+          }
>+
>+          *pDest++ = *pSrc++;
>+        }

Couldn't you just compare the lines with memcmp to be more efficient?
Attachment #165686 - Flags: superreview?(roc)
Attachment #165686 - Flags: review?(emaijala)
Attachment #165686 - Flags: review-
> Couldn't you just compare the lines with memcmp to be more efficient?

No. Please note that translucency values are first converted to boolean value
(with !) and only then comparison is made.
There are four different states what should be checked:
0 -> 0
0 -> 1..255 (mask changes)
1..255 -> 0 (mask changes)
1..255 -> 1..255


1. I can't just cast to PRBool, because it is just PRIntn
2. I can cast to bool, bet then Visual C++ generates warning that cast to bool
   limits the performance
3. I can use (!!*pDest != !!*pSrc)
4. I can write the check as:

if ((*pDest == 0 && *pSrc != 0) || (*pDest != 0 && *pSrc == 0))
Comment on attachment 165686 [details] [diff] [review]
diff -d -u -8  Fix MinGW

Right, I missed that. r=ere provided it compiles with MingW and actually works
for Win98 (I couldn't test these).
Attachment #165686 - Flags: superreview?(roc)
Attachment #165686 - Flags: review-
Attachment #165686 - Flags: review+
I checked and it works on Win98SE. Should work on Win95 and NT 4.

Just noticed that for:
       for (PRInt32 x = 0; x < aRect.width ; x++)
       {
         if (!*pDest != !*pSrc)

does not have space between 0 and ;. To be pretty one could add it before
checking in.
Or rather remove the space between aRect.width and ;. That's the normal (and
pretty, of course :) ) style.
Comment on attachment 165686 [details] [diff] [review]
diff -d -u -8  Fix MinGW

please make the local variables all start with lowercase
Attachment #165686 - Flags: superreview?(roc) → superreview+
Same as one that got reviews, but uses lowercase for local variables and
removes space between function name and opening parenthesis to be more
consistent with surrounding code.

Ere, please check this is when you have time. Thanks!
Attachment #165686 - Attachment is obsolete: true
Attachment #166312 - Flags: review?(emaijala)
Comment on attachment 166312 [details] [diff] [review]
lowercase local variables

You can carry the + from the previous patch if you don't make other than the
suggested changes.
Attachment #166312 - Flags: review?(emaijala) → review+
Comment on attachment 166312 [details] [diff] [review]
lowercase local variables

Carrying over sr+ from previous patch.
Attachment #166312 - Flags: superreview+
Fix checked in to trunk.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Confirmed. See also bug 274150.

- N.
Depends on: 313927
Target Milestone: --- → mozilla1.8alpha6
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: xptoolkit.widgets
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: