1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-02 08:39:46 +02:00

Revert "Remove wx/dc.h from ImageRoll.h ..."

This reverts commit 8078aa854751f0c7fc4f1d68a08b10b3eb4104e5.
This commit is contained in:
Paul Licameli 2019-04-04 10:52:31 -04:00
parent 8078aa8547
commit 5f218a4ab4
2 changed files with 12 additions and 21 deletions

View File

@ -297,27 +297,20 @@ bool ImageRoll::Ok() const
}
void ImageRoll::DrawBitmap(wxDC &dc, wxBitmap &bitmap,
int x, int y, int logicalFunc)
int x, int y, wxRasterOperationMode logicalFunc)
{
auto func = static_cast< wxRasterOperationMode >( logicalFunc );
if (func == wxCOPY)
if (logicalFunc == wxCOPY)
dc.DrawBitmap(bitmap, x, y);
else {
wxMemoryDC memDC;
memDC.SelectObject(bitmap);
dc.Blit(x, y, bitmap.GetWidth(), bitmap.GetHeight(),
&memDC, 0, 0, func);
&memDC, 0, 0, logicalFunc);
}
}
void ImageRoll::Draw(wxDC &dc, wxRect rect)
void ImageRoll::Draw(wxDC &dc, wxRect rect, wxRasterOperationMode WXUNUSED(logicalFunc))
{
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();
@ -342,7 +335,7 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, int WXUNUSED(logicalFunc))
// fixed
if (mPieces[i].Ok())
DrawBitmap(dc, mPieces[i], rect.x + x, rect.y, func);
DrawBitmap(dc, mPieces[i], rect.x + x, rect.y);
x += w;
}
else {
@ -355,7 +348,7 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, int WXUNUSED(logicalFunc))
j = 0;
while(j < space) {
if (mPieces[i].Ok())
DrawBitmap(dc, mPieces[i], rect.x + x + j, rect.y, func);
DrawBitmap(dc, mPieces[i], rect.x + x + j, rect.y);
j += w;
}
@ -382,7 +375,7 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, int WXUNUSED(logicalFunc))
// fixed
if (mPieces[i].Ok())
DrawBitmap(dc, mPieces[i], rect.x, rect.y + y, func);
DrawBitmap(dc, mPieces[i], rect.x, rect.y + y);
y += h;
}
else {
@ -395,7 +388,7 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, int WXUNUSED(logicalFunc))
j = 0;
while(j < space) {
if (mPieces[i].Ok())
DrawBitmap(dc, mPieces[i], rect.x, rect.y + y + j, func);
DrawBitmap(dc, mPieces[i], rect.x, rect.y + y + j);
j += h;
}
@ -405,7 +398,7 @@ void ImageRoll::Draw(wxDC &dc, wxRect rect, int WXUNUSED(logicalFunc))
} break; // case VerticalRoll
case FixedImage:
DrawBitmap(dc, mPieces[0], rect.x, rect.y, func);
DrawBitmap(dc, mPieces[0], rect.x, rect.y);
break;
/* the other possible cases don't really make sense, but not having them
* listed gives a GCC warning */

View File

@ -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,8 +45,7 @@ class ImageRoll
wxSize GetMaxSize() const { return mMaxSize; }
void Draw(wxDC &dc, wxRect rect,
int /* wxRasterOperationMode */ logicalFunc);
void Draw(wxDC &dc, wxRect rect); // default logicalFunc to wxCOPY
wxRasterOperationMode logicalFunc = wxCOPY);
static ImageArray SplitH(const wxImage &src, wxColour magicColor);
static ImageArray SplitV(const wxImage &src, wxColour magicColor);
@ -54,8 +53,7 @@ class ImageRoll
protected:
void DrawBitmap(wxDC &dc, wxBitmap &bitmap,
int x, int y,
int /* wxRasterOperationMode */ logicalFunc);
int x, int y, wxRasterOperationMode logicalFunc = wxCOPY);
void Init(RollType type, const wxImage &src, wxColour magicColor);