-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid a crash if GdiPlus is not initialized #309
Open
WeberAndre
wants to merge
8
commits into
RRUZ:master
Choose a base branch
from
WeberAndre:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If GdiPlus is not initialized in GetIcon a GDI Plus exception is raised. If this happends inside a detour function this leads to a serious crash.
DrawStyleParentBackgroundEx used the coordinates of the parentwindow (LPoint) to copy from LBuffer device context, thats wrong to copy from the bitmap dc the source position must be 0, 0. For the WM_ERASEBKGND you must change the Origin of the bitmap devicecontext so that the right part of the background is painted into to bitmap. (DrawStyleParentBackground may be removed later, because its complete wrong and doesn't paint anything to DC !)
…ialog For Menus with OwnerDraw we don't get a ItemText, this is also the case for the history drop down of the FileOpen / FileSave dialog. This patch tries to delegate ownerdraw back to the owner windows of the menu - in case of the file dialogs it works.
…r align popup Detour_UxTheme_GetThemeColor: Reorganized code instead that every TMT_TEXTCOLOR is answered with clWindowText. First give a try to each case if this doesn't set the pColor to something different as clNone - stay at clWindowText. For VSCLASS_MENU we get ask for the TMT_TEXTCOLOR and for the TMT_FILLCOLOR of the same state. Replaced calls to DrawStyleParentBackground with DrawStyleParentBackgroundEx after fixing it. -> this also fixes drawing issues with TButton in Designmode. UxTheme_Button: Reverted the drawing on a temporary bitmap with a simple transparent color - because the fill and transparentcolor clBtnFace is also the color used of some style to draw the button surface .. which becomes in that case transparent and not visible. If the button itself has rounded corners - these are drawn with semitransparency in the StyleService - so if a temporary bitmap is used it must be set to pf32bit with AlphaFormat instead of a transparent color. After replacing not working DrawStyleParentBackGround with my modifed DrawStyleParentBackgroundEx it seems to work.
…ylesBrush Resolving a problem using a GetSysColorBrush as hbrBackground in RegisterClass. The detour created HBRUSH will be destroyed by windows in UnregisterClass and leave a invalid HBRUSH in VCLStylesBrush dictionary. So the next call to GetSysColorBrush will return a invalid HBRUSH. (problem occured useing TWAIN driver written with QT Library)
…in VCLStylesBrush" This reverts commit 9a75a2e.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If GdiPlus is not initialized in GetIcon a GDI Plus exception is raised. If this happends inside a detour function this leads to a serious crash of the whole application.
Fix DrawStyleParentBackgroundEx wrong portion of background used
DrawStyleParentBackgroundEx used the coordinates of the parentwindow (LPoint) to copy from LBuffer device context, thats wrong to copy from the bitmap dc the source position must be 0, 0. For the WM_ERASEBKGND you must change the Origin of the bitmap devicecontext so that the right part of the background is painted into to bitmap.
(DrawStyleParentBackground may be removed later, because its complete wrong and doesn't paint anything to DC !)
For Menus with OwnerDraw we don't get a ItemText, this is also the case for the history drop down of the FileOpen / FileSave dialog. This patch tries to delegate ownerdraw back to the owner windows of the menu - in case of the file dialogs it works.
Detour_UxTheme_GetThemeColor: Reorganized code instead that every TMT_TEXTCOLOR is answered with clWindowText. First give a try to each case if this doesn't set the pColor to something different as clNone - stay at clWindowText. For VSCLASS_MENU we get ask for the TMT_TEXTCOLOR and for the TMT_FILLCOLOR of the same state.
Replaced calls to DrawStyleParentBackground with DrawStyleParentBackgroundEx after fixing it. -> this also fixes drawing issues with TButton in Designmode.
UxTheme_Button: Reverted the drawing on a temporary bitmap with a simple transparent color - because the fill and transparentcolor clBtnFace is also the color used of some style to draw the button surface .. which becomes in that case transparent and not visible.
If the button itself has rounded corners - these are drawn with semitransparency in the StyleService - so if a temporary bitmap is used it must be set to pf32bit with AlphaFormat instead of a transparent color.
After replacing not working DrawStyleParentBackGround with my modifed DrawStyleParentBackgroundEx it seems to work.