MCPcopy Create free account
hub / github.com/MyGUI/mygui / doRender

Method doRender

MyGUIEngine/src/MyGUI_EditText.cpp:485–598  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483 }
484
485 void EditText::doRender()
486 {
487 if (nullptr == mFont || !mVisible || mEmptyView)
488 return;
489
490 if (mRenderItem->getCurrentUpdate() || mTextOutDate)
491 updateRawData();
492
493 Vertex* vertex = mRenderItem->getCurrentVertexBuffer();
494
495 const RenderTargetInfo& renderTargetInfo = mRenderItem->getRenderTarget()->getInfo();
496
497 // колличество отрисованных вершин
498 size_t vertexCount = 0;
499
500 // текущие цвета
501 uint32 colour = mCurrentColourNative;
502 uint32 inverseColour = mInverseColourNative;
503 uint32 selectedColour = mInvertSelect ? inverseColour : colour | 0x00FFFFFF;
504
505 const VectorLineInfo& textViewData = mTextView.getData();
506
507 float top = (float)(-mViewOffset.top + mCoord.top);
508
509 FloatRect vertexRect;
510
511 const FloatRect& selectedUVRect =
512 mFont->getGlyphInfo(mBackgroundNormal ? FontCodeType::Selected : FontCodeType::SelectedBack)->uvRect;
513
514 size_t index = 0;
515
516 for (const auto& line : textViewData)
517 {
518 float left = (float)(line.offset - mViewOffset.left + mCoord.left);
519
520 for (const auto& sym : line.symbols)
521 {
522 if (sym.isColour())
523 {
524 colour = sym.getColour() | (colour & 0xFF000000);
525 inverseColour = colour ^ 0x00FFFFFF;
526 selectedColour = mInvertSelect ? inverseColour : colour | 0x00FFFFFF;
527 continue;
528 }
529
530 // смещение текстуры для фона
531 bool select = index >= mStartSelect && index < mEndSelect;
532
533 float fullAdvance = sym.getBearingX() + sym.getAdvance();
534
535 // Render the selection, if any, first.
536 if (select)
537 {
538 vertexRect.set(left, top, left + fullAdvance, top + (float)mFontHeight);
539
540 drawGlyph(renderTargetInfo, vertex, vertexCount, vertexRect, selectedUVRect, selectedColour);
541 }
542

Callers

nothing calls this directly

Calls 15

getCurrentUpdateMethod · 0.80
getInfoMethod · 0.80
isColourMethod · 0.80
getBearingXMethod · 0.80
getAdvanceMethod · 0.80
getBearingYMethod · 0.80
getCursorPointMethod · 0.80
setLastVertexCountMethod · 0.80
getRenderTargetMethod · 0.45
getDataMethod · 0.45
getGlyphInfoMethod · 0.45

Tested by

no test coverage detected