The OpenGL drawing function. This UI will draw a 3x3 grid, with on/off states according to plugin parameters. */
| 104 | This UI will draw a 3x3 grid, with on/off states according to plugin parameters. |
| 105 | */ |
| 106 | void onDisplay() override |
| 107 | { |
| 108 | const GraphicsContext& context(getGraphicsContext()); |
| 109 | |
| 110 | const uint width = getWidth(); |
| 111 | const uint height = getHeight(); |
| 112 | const uint minwh = std::min(width, height); |
| 113 | const uint bgColor = getBackgroundColor(); |
| 114 | |
| 115 | Rectangle<double> r; |
| 116 | |
| 117 | // if host doesn't respect aspect-ratio but supports ui background, draw out-of-bounds color from it |
| 118 | if (width != height && bgColor != 0) |
| 119 | { |
| 120 | const int red = (bgColor >> 24) & 0xff; |
| 121 | const int green = (bgColor >> 16) & 0xff; |
| 122 | const int blue = (bgColor >> 8) & 0xff; |
| 123 | Color(red, green, blue).setFor(context); |
| 124 | |
| 125 | if (width > height) |
| 126 | { |
| 127 | r.setPos(height, 0); |
| 128 | r.setSize(width-height, height); |
| 129 | } |
| 130 | else |
| 131 | { |
| 132 | r.setPos(0, width); |
| 133 | r.setSize(width, height-width); |
| 134 | } |
| 135 | |
| 136 | r.draw(context); |
| 137 | } |
| 138 | |
| 139 | r.setWidth(minwh/3 - 6); |
| 140 | r.setHeight(minwh/3 - 6); |
| 141 | |
| 142 | // draw left, center and right columns |
| 143 | for (int i=0; i<3; ++i) |
| 144 | { |
| 145 | r.setX(3 + i*minwh/3); |
| 146 | |
| 147 | // top |
| 148 | r.setY(3); |
| 149 | |
| 150 | if (fParamGrid[0+i]) |
| 151 | Color(0.8f, 0.5f, 0.3f).setFor(context); |
| 152 | else |
| 153 | Color(0.3f, 0.5f, 0.8f).setFor(context); |
| 154 | |
| 155 | r.draw(context); |
| 156 | |
| 157 | // middle |
| 158 | r.setY(3 + minwh/3); |
| 159 | |
| 160 | if (fParamGrid[3+i]) |
| 161 | Color(0.8f, 0.5f, 0.3f).setFor(context); |
| 162 | else |
| 163 | Color(0.3f, 0.5f, 0.8f).setFor(context); |
nothing calls this directly
no test coverage detected