| 242 | #define DRAW_TABLE_BORDERS 0 |
| 243 | |
| 244 | void CHTML::OnDraw(float alpha) |
| 245 | { |
| 246 | const int w = GLOB_ENGINE->Width2D(); |
| 247 | const int h = GLOB_ENGINE->Height2D(); |
| 248 | |
| 249 | float xx = toInt(_x * w) + 0.5; |
| 250 | float yy = toInt(_y * h) + 0.5; |
| 251 | float ww = toInt(_w * w); |
| 252 | float hh = toInt(_h * h); |
| 253 | |
| 254 | PackedColor pictureColor = PackedColor(Color(1, 1, 1, 0.6 * alpha)); |
| 255 | PackedColor pictureColorSelected = PackedColor(Color(1, 1, 1, alpha)); |
| 256 | PackedColor bgColor = ModAlpha(_bgColor, alpha); |
| 257 | |
| 258 | MipInfo mip = GLOB_ENGINE->TextBank()->UseMipmap(nullptr, 0, 0); |
| 259 | GLOB_ENGINE->Draw2D(mip, bgColor, Rect2DPixel(xx, yy, ww, hh)); |
| 260 | |
| 261 | if (_sections.Size() <= 0) |
| 262 | { |
| 263 | return; |
| 264 | } |
| 265 | HTMLSection& section = _sections[_currentSection]; |
| 266 | |
| 267 | float top = _y; |
| 268 | bool bottom = false; |
| 269 | |
| 270 | for (int r = 0; r < section.rows.Size(); r++) |
| 271 | { |
| 272 | HTMLRow& row = section.rows[r]; |
| 273 | if (!bottom && row.bottom) |
| 274 | { |
| 275 | bottom = true; |
| 276 | top = _y + _h; |
| 277 | for (int rr = r; rr < section.rows.Size(); rr++) |
| 278 | { |
| 279 | top -= _scale * section.rows[rr].height; |
| 280 | } |
| 281 | } |
| 282 | float left; |
| 283 | switch (row.align) |
| 284 | { |
| 285 | case HARight: |
| 286 | left = _x + _w - _scale * (row.width + textBorder); |
| 287 | break; |
| 288 | case HACenter: |
| 289 | left = _x + 0.5 * (_w - _scale * row.width); |
| 290 | break; |
| 291 | default: |
| 292 | PoseidonAssert(row.align == HALeft); |
| 293 | left = _x + _scale * textBorder; |
| 294 | break; |
| 295 | } |
| 296 | for (int f = row.firstField; f <= row.lastField; f++) |
| 297 | { |
| 298 | if (f >= section.fields.Size()) |
| 299 | { |
| 300 | continue; |
| 301 | } |
nothing calls this directly
no test coverage detected