Use GraphicsContext (if available) for drawing in SurfaceImpl::AlphaRectangle. Fixes #10542.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@63115 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
#ifdef wxHAVE_RAW_BITMAP
|
||||
#include "wx/rawbmp.h"
|
||||
#endif
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
#include "wx/dcgraph.h"
|
||||
#endif
|
||||
|
||||
#include "Platform.h"
|
||||
#include "PlatWX.h"
|
||||
@@ -46,6 +49,14 @@ wxColour wxColourFromCA(const ColourAllocated& ca) {
|
||||
(unsigned char)cd.GetBlue());
|
||||
}
|
||||
|
||||
wxColour wxColourFromCAandAlpha(const ColourAllocated& ca, int alpha) {
|
||||
ColourDesired cd(ca.AsLong());
|
||||
return wxColour((unsigned char)cd.GetRed(),
|
||||
(unsigned char)cd.GetGreen(),
|
||||
(unsigned char)cd.GetBlue(),
|
||||
(unsigned char)alpha);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
Palette::Palette() {
|
||||
@@ -348,6 +359,16 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
|
||||
ColourAllocated fill, int alphaFill,
|
||||
ColourAllocated outline, int alphaOutline,
|
||||
int /*flags*/) {
|
||||
#if wxUSE_GRAPHICS_CONTEXT
|
||||
wxGCDC dc(*(wxMemoryDC*)hdc);
|
||||
wxColour penColour(wxColourFromCAandAlpha(outline, alphaOutline));
|
||||
wxColour brushColour(wxColourFromCAandAlpha(fill, alphaFill));
|
||||
dc.SetPen(wxPen(penColour));
|
||||
dc.SetBrush(wxBrush(brushColour));
|
||||
dc.DrawRoundedRectangle(wxRectFromPRectangle(rc), cornerSize);
|
||||
return;
|
||||
#else
|
||||
|
||||
#ifdef wxHAVE_RAW_BITMAP
|
||||
|
||||
// TODO: do something with cornerSize
|
||||
@@ -417,6 +438,7 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
|
||||
wxUnusedVar(alphaOutline);
|
||||
RectangleDraw(rc, outline, fill);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
|
||||
|
Reference in New Issue
Block a user