1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-03 01:19:24 +02:00

Draw link tiles stationary relative to the DC

This commit is contained in:
businessmanprogrammersteve 2010-02-18 19:46:37 +00:00
parent 5a6b7a4ec9
commit 449bee981f

View File

@ -2642,23 +2642,40 @@ void TrackArtist::SetSpectrumLogMaxFreq(int freq)
mLogMaxFreq = freq; mLogMaxFreq = freq;
} }
// Draws the link bitmap, tiled; always draws stationary relative to the DC
void TrackArtist::DrawLinkTiles(wxDC *dc, wxRect r) void TrackArtist::DrawLinkTiles(wxDC *dc, wxRect r)
{ {
wxBitmap sync(theTheme.Image(bmpLinkSelect)); wxBitmap sync(theTheme.Image(bmpLinkSelect));
// Draw in full-width copies int xOffset = r.x % sync.GetWidth();
int x; int width;
for (x = 0; x + sync.GetWidth() < r.width; x += sync.GetWidth()) { for (int x = 0; x < r.width; x += width) {
for (int y = 0; y < r.height; y += sync.GetHeight()) { width = sync.GetWidth() - xOffset;
dc->DrawBitmap(sync, r.x + x, r.y + y, true); if (x + width > r.width)
} width = r.width - x;
}
// Draw in partial column at end of selection int yOffset = r.y % sync.GetHeight();
if (r.width - x > 0) { int height;
sync = sync.GetSubBitmap(wxRect(0, 0, r.width - x, sync.GetHeight())); for (int y = 0; y < r.height; y += height) {
for (int y = 0; y < r.height; y += sync.GetHeight()) { height = sync.GetHeight() - yOffset;
dc->DrawBitmap(sync, r.x + x, r.y + y, true); if (y + height > r.height)
height = r.height - y;
// Do we need to get a sub-bitmap?
if (width != sync.GetWidth() || height != sync.GetHeight()) {
wxBitmap subSync = sync.GetSubBitmap(wxRect(
xOffset, yOffset, width, height));
dc->DrawBitmap(subSync, r.x + x, r.y + y, true);
}
else {
dc->DrawBitmap(sync, r.x + x, r.y + y, true);
}
// Only offset first row
yOffset = 0;
} }
// Only offset first column
xOffset = 0;
} }
} }