X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=vu_common.cpp;h=171f50d26a244059abcb1cab0cbd056565f6dbcc;hb=ffd68fbfb90242069af957f2a28908f0559f8348;hp=b40502cad91b918276983a3c35a7b2422641de40;hpb=cf7b9ee186d4ef8e5da0531b75854c97b821be44;p=nageru diff --git a/vu_common.cpp b/vu_common.cpp index b40502c..171f50d 100644 --- a/vu_common.cpp +++ b/vu_common.cpp @@ -30,9 +30,9 @@ double lufs_to_pos(float level_lu, int height, float min_level, float max_level) return y; } -void draw_vu_meter(QPainter &painter, int width, int height, int horizontal_margin, double segment_margin, bool is_on, float min_level, float max_level, bool flip) +void draw_vu_meter(QPainter &painter, int width, int height, int horizontal_margin, double segment_margin, bool is_on, float min_level, float max_level, bool flip, int y_offset) { - painter.fillRect(horizontal_margin, 0, width - 2 * horizontal_margin, height, Qt::black); + painter.fillRect(horizontal_margin, y_offset, width - 2 * horizontal_margin, height, Qt::black); for (int y = 0; y < height; ++y) { // Find coverage of “on” rectangles in this pixel row. @@ -68,6 +68,6 @@ void draw_vu_meter(QPainter &painter, int width, int height, int horizontal_marg int g = lrintf(255 * pow(on_g * coverage, 1.0 / 2.2)); int b = lrintf(255 * pow(on_b * coverage, 1.0 / 2.2)); int draw_y = flip ? (height - y - 1) : y; - painter.fillRect(horizontal_margin, draw_y, width - 2 * horizontal_margin, 1, QColor(r, g, b)); + painter.fillRect(horizontal_margin, draw_y + y_offset, width - 2 * horizontal_margin, 1, QColor(r, g, b)); } }