X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1d94e268dd7bc0e8edcec0c3d5668d872f2c0349..5dafb071ba85e7329aa4a0ac176f3ec8e13e55dc:/src/stc/PlatWX.cpp diff --git a/src/stc/PlatWX.cpp b/src/stc/PlatWX.cpp index f0d9d17603..f41304a50a 100644 --- a/src/stc/PlatWX.cpp +++ b/src/stc/PlatWX.cpp @@ -14,6 +14,10 @@ #include "wx/imaglist.h" #include "wx/tokenzr.h" +#ifdef wxHAVE_RAW_BITMAP +#include "wx/rawbmp.h" +#endif + #include "Platform.h" #include "PlatWX.h" #include "wx/stc/stc.h" @@ -47,14 +51,21 @@ wxColour wxColourFromCA(const ColourAllocated& ca) { Palette::Palette() { used = 0; allowRealization = false; + size = 100; + entries = new ColourPair[size]; } Palette::~Palette() { Release(); + delete [] entries; + entries = 0; } void Palette::Release() { used = 0; + delete [] entries; + size = 100; + entries = new ColourPair[size]; } // This method either adds a colour to the list of wanted colours (want==true) @@ -67,11 +78,20 @@ void Palette::WantFind(ColourPair &cp, bool want) { return; } - if (used < numEntries) { - entries[used].desired = cp.desired; - entries[used].allocated.Set(cp.desired.AsLong()); - used++; + if (used >= size) { + int sizeNew = size * 2; + ColourPair *entriesNew = new ColourPair[sizeNew]; + for (int j=0; jDrawRoundedRectangle(wxRectFromPRectangle(rc), 4); } +#ifdef __WXMSW__ +#define wxPy_premultiply(p, a) ((p) * (a) / 0xff) +#else +#define wxPy_premultiply(p, a) (p) +#endif + +void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, + ColourAllocated fill, int alphaFill, + ColourAllocated outline, int alphaOutline, + int /*flags*/) { +#ifdef wxHAVE_RAW_BITMAP + + // TODO: do something with cornerSize + wxUnusedVar(cornerSize); + + int x, y; + wxRect r = wxRectFromPRectangle(rc); + wxBitmap bmp(r.width, r.height, 32); + wxAlphaPixelData pixData(bmp); + pixData.UseAlpha(); + + // Set the fill pixels + ColourDesired cdf(fill.AsLong()); + int red = cdf.GetRed(); + int green = cdf.GetGreen(); + int blue = cdf.GetBlue(); + + wxAlphaPixelData::Iterator p(pixData); + for (y=0; yDrawBitmap(bmp, r.x, r.y, true); + +#else + wxUnusedVar(cornerSize); + wxUnusedVar(alphaFill); + wxUnusedVar(alphaOutline); + RectangleDraw(rc, outline, fill); +#endif +} + void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) { PenColour(fore); BrushColour(back); @@ -543,13 +646,11 @@ void Window::Show(bool show) { void Window::InvalidateAll() { GETWIN(id)->Refresh(false); - wxWakeUpIdle(); } void Window::InvalidateRectangle(PRectangle rc) { wxRect r = wxRectFromPRectangle(rc); GETWIN(id)->Refresh(false, &r); - wxWakeUpIdle(); } void Window::SetFont(Font &font) {