mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-05-28 17:16:29 +03:00
Some rendering optimizations.
This commit is contained in:
@@ -1336,7 +1336,7 @@ Int32 Text::findCharacterFromPos( const Vector2i& pos, bool returnNearest, Font*
|
||||
};
|
||||
|
||||
if ( fpos.y >= charTop && fpos.y <= charBottom ) {
|
||||
auto findNextInsertionIndex = [&layout, sg, i, sgs, tSize, sp]() -> Int32 {
|
||||
auto findNextInsertionIndex = [&]() -> Int32 {
|
||||
if ( layout->isRTL() ) {
|
||||
if ( i > 0 ) {
|
||||
for ( auto j = i - 1; j >= 0; j-- ) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace EE::Graphics {
|
||||
|
||||
using LRULayoutCache = LRUCache<2048, Uint64, TextLayout::Cache>;
|
||||
using LRULayoutCache = LRUCache<8192, Uint64, TextLayout::Cache>;
|
||||
|
||||
#ifdef EE_TEXT_SHAPER_ENABLED
|
||||
|
||||
|
||||
@@ -4212,6 +4212,7 @@ void UICodeEditor::drawLineText( const Int64& line, Vector2f position, const Flo
|
||||
}
|
||||
}
|
||||
} else {
|
||||
bool getChunkHints = !Text::canSkipShaping( drawHints ) && tokens.size() > 8192;
|
||||
for ( const auto& token : tokens ) {
|
||||
String::View text = strLine.view();
|
||||
if ( pos < strLine.size() && !( pos == 0 && text.size() == token.len ) ) {
|
||||
@@ -4281,28 +4282,35 @@ void UICodeEditor::drawLineText( const Int64& line, Vector2f position, const Flo
|
||||
Int64 totalChars = curCharsWidth - start;
|
||||
Int64 end = eemin( totalChars, minimumCharsToCoverScreen );
|
||||
if ( curCharsWidth >= charsToVisible ) {
|
||||
String::View subText( text.substr( start, end ) );
|
||||
size = Text::draw(
|
||||
text.substr( start, end ),
|
||||
subText,
|
||||
{ position.x + start * getGlyphWidth(), position.y + lineOffset },
|
||||
fontStyle, mTabWidth, drawHints, mTextDirection,
|
||||
whitespaceDisplayConfig );
|
||||
fontStyle, mTabWidth,
|
||||
getChunkHints ? String::getTextHints( subText ) : drawHints,
|
||||
mTextDirection, whitespaceDisplayConfig );
|
||||
if ( minimumCharsToCoverScreen == end )
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
size = Text::draw( text.substr( 0, eemin( curCharsWidth, maxWidth ) ),
|
||||
{ position.x, position.y + lineOffset }, fontStyle,
|
||||
mTabWidth, drawHints, mTextDirection,
|
||||
whitespaceDisplayConfig );
|
||||
String::View subText( text.substr( 0, eemin( curCharsWidth, maxWidth ) ) );
|
||||
size = Text::draw(
|
||||
subText, { position.x, position.y + lineOffset }, fontStyle, mTabWidth,
|
||||
getChunkHints ? String::getTextHints( subText ) : drawHints,
|
||||
mTextDirection, whitespaceDisplayConfig );
|
||||
}
|
||||
} else {
|
||||
size =
|
||||
Text::draw( text, { position.x, position.y + lineOffset }, fontStyle,
|
||||
mTabWidth, drawHints, mTextDirection, whitespaceDisplayConfig );
|
||||
size = Text::draw( text, { position.x, position.y + lineOffset }, fontStyle,
|
||||
mTabWidth,
|
||||
getChunkHints ? String::getTextHints( text ) : drawHints,
|
||||
mTextDirection, whitespaceDisplayConfig );
|
||||
}
|
||||
|
||||
if ( !isMonospace )
|
||||
textWidth = size.getWidth();
|
||||
|
||||
if ( position.x > mScreenPos.x + mSize.getWidth() )
|
||||
break;
|
||||
} else if ( position.x > mScreenPos.x + mSize.getWidth() ) {
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include <eepp/window/backend/SDL3/joystickmanagersdl3.hpp>
|
||||
#include <eepp/window/backend/SDL3/windowsdl3.hpp>
|
||||
#include <eepp/window/engine.hpp>
|
||||
#include <limits>
|
||||
|
||||
#ifdef EE_BACKEND_SDL3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user