mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-02 00:29:41 +02:00
Remove wx/dc.h from ImageRoll.h ...
... I wish I could just forward-declare the enumeration wxRasterOperationMode, but it's not defined as a sized enum
This commit is contained in:
parent
c531fde6b8
commit
8078aa8547
@ -297,20 +297,27 @@ bool ImageRoll::Ok() const
|
||||
}
|
||||
|
||||
void ImageRoll::DrawBitmap(wxDC &dc, wxBitmap &bitmap,
|
||||
int x, int y, wxRasterOperationMode logicalFunc)
|
||||
int x, int y, int logicalFunc)
|
||||
{
|
||||
if (logicalFunc == wxCOPY)
|
||||
auto func = static_cast< wxRasterOperationMode >( logicalFunc );
|
||||
if (func == wxCOPY)
|
||||
dc.DrawBitmap(bitmap, x, y);
|
||||
else {
|
||||
wxMemoryDC memDC;
|
||||
memDC.SelectObject(bitmap);
|
||||
dc.Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(),
|
||||
&memDC, 0, 0, logicalFunc);
|
||||
&memDC, 0, 0, func);
|
||||
}
|
||||
}
|
||||
|
||||
void ImageRoll::Draw(wxDC &dc, wxRect rect, wxRasterOperationMode WXUNUSED(logicalFunc))
|
||||
void ImageRoll::Draw(wxDC &dc, wxRect rect)
|
||||
{
|
||||
Draw( dc, rect, wxCOPY );
|
||||
}
|
||||
|
||||
void ImageRoll::Draw(wxDC &dc, wxRect rect, int WXUNUSED(logicalFunc))
|
||||
{
|
||||
auto func = wxCOPY;
|
||||
int width = rect.width;
|
||||
int height = rect.height;
|
||||
int num = (int)mPieces.size();
|
||||
@ -335,7 +342,7 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, wxRasterOperationMode WXUNUSED(logic
|
||||
// fixed
|
||||
|
||||
if (mPieces[i].Ok())
|
||||
DrawBitmap(dc, mPieces[i], rect.x + x, rect.y);
|
||||
DrawBitmap(dc, mPieces[i], rect.x + x, rect.y, func);
|
||||
x += w;
|
||||
}
|
||||
else {
|
||||
@ -348,7 +355,7 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, wxRasterOperationMode WXUNUSED(logic
|
||||
j = 0;
|
||||
while(j < space) {
|
||||
if (mPieces[i].Ok())
|
||||
DrawBitmap(dc, mPieces[i], rect.x + x + j, rect.y);
|
||||
DrawBitmap(dc, mPieces[i], rect.x + x + j, rect.y, func);
|
||||
j += w;
|
||||
}
|
||||
|
||||
@ -375,7 +382,7 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, wxRasterOperationMode WXUNUSED(logic
|
||||
// fixed
|
||||
|
||||
if (mPieces[i].Ok())
|
||||
DrawBitmap(dc, mPieces[i], rect.x, rect.y + y);
|
||||
DrawBitmap(dc, mPieces[i], rect.x, rect.y + y, func);
|
||||
y += h;
|
||||
}
|
||||
else {
|
||||
@ -388,7 +395,7 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, wxRasterOperationMode WXUNUSED(logic
|
||||
j = 0;
|
||||
while(j < space) {
|
||||
if (mPieces[i].Ok())
|
||||
DrawBitmap(dc, mPieces[i], rect.x, rect.y + y + j);
|
||||
DrawBitmap(dc, mPieces[i], rect.x, rect.y + y + j, func);
|
||||
j += h;
|
||||
}
|
||||
|
||||
@ -398,7 +405,7 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, wxRasterOperationMode WXUNUSED(logic
|
||||
} break; // case VerticalRoll
|
||||
|
||||
case FixedImage:
|
||||
DrawBitmap(dc, mPieces[0], rect.x, rect.y);
|
||||
DrawBitmap(dc, mPieces[0], rect.x, rect.y, func);
|
||||
break;
|
||||
/* the other possible cases don't really make sense, but not having them
|
||||
* listed gives a GCC warning */
|
||||
|
@ -13,7 +13,7 @@
|
||||
#define __AUDACITY_IMAGE_ROLL__
|
||||
|
||||
#include <vector>
|
||||
#include <wx/dc.h> // for enum wxRasterOperationMode
|
||||
// #include <wx/dc.h> // for enum wxRasterOperationMode
|
||||
#include <wx/defs.h>
|
||||
#include "wxPanelWrapper.h" // to inherit
|
||||
|
||||
@ -45,7 +45,8 @@ class ImageRoll
|
||||
wxSize GetMaxSize() const { return mMaxSize; }
|
||||
|
||||
void Draw(wxDC &dc, wxRect rect,
|
||||
wxRasterOperationMode logicalFunc = wxCOPY);
|
||||
int /* wxRasterOperationMode */ logicalFunc);
|
||||
void Draw(wxDC &dc, wxRect rect); // default logicalFunc to wxCOPY
|
||||
|
||||
static ImageArray SplitH(const wxImage &src, wxColour magicColor);
|
||||
static ImageArray SplitV(const wxImage &src, wxColour magicColor);
|
||||
@ -53,7 +54,8 @@ class ImageRoll
|
||||
protected:
|
||||
|
||||
void DrawBitmap(wxDC &dc, wxBitmap &bitmap,
|
||||
int x, int y, wxRasterOperationMode logicalFunc = wxCOPY);
|
||||
int x, int y,
|
||||
int /* wxRasterOperationMode */ logicalFunc);
|
||||
|
||||
void Init(RollType type, const wxImage &src, wxColour magicColor);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user