mirror of https://github.com/buggins/dlangui.git
fix unnecessary relayouts; remove excessive logging
This commit is contained in:
parent
4df4c0fc04
commit
d35498a82d
|
@ -66,7 +66,7 @@
|
|||
<debuglevel>0</debuglevel>
|
||||
<debugids>DebugFocus</debugids>
|
||||
<versionlevel>0</versionlevel>
|
||||
<versionids>EmbedStandardResources Unicode USE_SDL</versionids>
|
||||
<versionids>EmbedStandardResources Unicode USE_FREETYPE</versionids>
|
||||
<dump_source>0</dump_source>
|
||||
<mapverbosity>0</mapverbosity>
|
||||
<createImplib>1</createImplib>
|
||||
|
@ -89,6 +89,7 @@
|
|||
<resfile />
|
||||
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
|
||||
<useStdLibPath>1</useStdLibPath>
|
||||
<cRuntime>2</cRuntime>
|
||||
<additionalOptions />
|
||||
<preBuildCommand />
|
||||
<postBuildCommand />
|
||||
|
@ -183,6 +184,7 @@
|
|||
<resfile />
|
||||
<exefile>$(OutDir)\$(ProjectName).lib</exefile>
|
||||
<useStdLibPath>1</useStdLibPath>
|
||||
<cRuntime>1</cRuntime>
|
||||
<additionalOptions />
|
||||
<preBuildCommand />
|
||||
<postBuildCommand />
|
||||
|
|
|
@ -480,12 +480,12 @@ struct FontList {
|
|||
return -1;
|
||||
}
|
||||
ref FontRef add(Font item) {
|
||||
Log.d("FontList.add() enter");
|
||||
//Log.d("FontList.add() enter");
|
||||
if (_len >= _list.length) {
|
||||
_list.length = _len < 16 ? 16 : _list.length * 2;
|
||||
}
|
||||
_list[_len++] = item;
|
||||
Log.d("FontList.add() exit");
|
||||
//Log.d("FontList.add() exit");
|
||||
return _list[_len - 1];
|
||||
}
|
||||
// remove unused items - with reference == 1
|
||||
|
|
|
@ -19,6 +19,9 @@ private import std.file;
|
|||
private import std.string;
|
||||
private import std.utf;
|
||||
|
||||
/// define debug=FontResources for logging of font file resources creation/freeing
|
||||
//debug = FontResources;
|
||||
|
||||
private struct FontDef {
|
||||
immutable FontFamily _family;
|
||||
immutable string _face;
|
||||
|
@ -116,12 +119,12 @@ private class FreeTypeFontFile {
|
|||
_matrix.yy = 0x10000;
|
||||
_matrix.xy = 0;
|
||||
_matrix.yx = 0;
|
||||
debug Log.d("Created FreeTypeFontFile, count=", ++_instanceCount);
|
||||
debug(FontResources) Log.d("Created FreeTypeFontFile, count=", ++_instanceCount);
|
||||
}
|
||||
|
||||
~this() {
|
||||
clear();
|
||||
debug Log.d("Destroyed FreeTypeFontFile, count=", --_instanceCount);
|
||||
debug(FontResources) Log.d("Destroyed FreeTypeFontFile, count=", --_instanceCount);
|
||||
}
|
||||
|
||||
private static string familyName(FT_Face face)
|
||||
|
@ -152,7 +155,7 @@ private class FreeTypeFontFile {
|
|||
if (kernFile.length > 0)
|
||||
error = FT_Attach_File(_face, kernFile.toStringz);
|
||||
}
|
||||
Log.d("Font file opened successfully");
|
||||
debug(FontResources) Log.d("Font file opened successfully");
|
||||
_slot = _face.glyph;
|
||||
_faceName = familyName(_face);
|
||||
error = FT_Set_Pixel_Sizes(
|
||||
|
@ -168,7 +171,7 @@ private class FreeTypeFontFile {
|
|||
_baseline = _height + cast(int)(_face.size.metrics.descender >> 6);
|
||||
_weight = _face.style_flags & FT_STYLE_FLAG_BOLD ? FontWeight.Bold : FontWeight.Normal;
|
||||
_italic = _face.style_flags & FT_STYLE_FLAG_ITALIC ? true : false;
|
||||
Log.d("Opened font face=", _faceName, " height=", _height, " size=", size, " weight=", weight, " italic=", italic);
|
||||
debug(FontResources) Log.d("Opened font face=", _faceName, " height=", _height, " size=", size, " weight=", weight, " italic=", italic);
|
||||
return true; // successfully opened
|
||||
}
|
||||
|
||||
|
@ -498,14 +501,14 @@ class FreeTypeFontManager : FontManager {
|
|||
FT_Library_SetLcdFilter(_library, FT_LCD_FILTER_DEFAULT);
|
||||
}
|
||||
~this() {
|
||||
debug Log.d("FreeTypeFontManager ~this()");
|
||||
debug(FontResources) Log.d("FreeTypeFontManager ~this()");
|
||||
//_activeFonts.clear();
|
||||
foreach(ref FontFileItem item; _fontFiles) {
|
||||
destroy(item);
|
||||
item = null;
|
||||
}
|
||||
_fontFiles.length = 0;
|
||||
debug Log.d("Destroyed all fonts. Freeing library.");
|
||||
debug(FontResources) Log.d("Destroyed all fonts. Freeing library.");
|
||||
// uninit library
|
||||
if (_library)
|
||||
FT_Done_FreeType(_library);
|
||||
|
@ -548,7 +551,7 @@ class FreeTypeFontManager : FontManager {
|
|||
face = font.face;
|
||||
italic = font.italic;
|
||||
weight = font.weight;
|
||||
Log.d("Using properties from font file: face=", face, " weight=", weight, " italic=", italic);
|
||||
debug(FontResources)Log.d("Using properties from font file: face=", face, " weight=", weight, " italic=", italic);
|
||||
}
|
||||
destroy(font);
|
||||
|
||||
|
|
|
@ -480,7 +480,7 @@ class AbstractSlider : WidgetGroup {
|
|||
@property AbstractSlider pageSize(int size) {
|
||||
if (_pageSize != size) {
|
||||
_pageSize = size;
|
||||
requestLayout();
|
||||
//requestLayout();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ class AbstractSlider : WidgetGroup {
|
|||
if (_minValue != min || _maxValue != max) {
|
||||
_minValue = min;
|
||||
_maxValue = max;
|
||||
requestLayout();
|
||||
//requestLayout();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -782,8 +782,18 @@ class ScrollBar : AbstractSlider, OnClickHandler {
|
|||
_pageUp.visibility = Visibility.Gone;
|
||||
_pageDown.visibility = Visibility.Gone;
|
||||
}
|
||||
cancelLayout();
|
||||
}
|
||||
|
||||
override void cancelLayout() {
|
||||
_btnBack.cancelLayout();
|
||||
_btnForward.cancelLayout();
|
||||
_indicator.cancelLayout();
|
||||
_pageUp.cancelLayout();
|
||||
_pageDown.cancelLayout();
|
||||
super.cancelLayout();
|
||||
}
|
||||
|
||||
protected void layoutButtons() {
|
||||
Rect irc = _scrollArea;
|
||||
if (_orientation == Orientation.Vertical) {
|
||||
|
@ -802,6 +812,7 @@ class ScrollBar : AbstractSlider, OnClickHandler {
|
|||
layoutButtons(irc);
|
||||
}
|
||||
updateState();
|
||||
cancelLayout();
|
||||
}
|
||||
|
||||
protected void layoutButtons(Rect irc) {
|
||||
|
|
|
@ -276,12 +276,12 @@ class ScrollWidgetBase : WidgetGroup, OnScrollHandler {
|
|||
hsbrc.right = hsbrc.right - (needVscroll ? _vscrollbar.measuredWidth : 0);
|
||||
hsbrc.top = hsbrc.bottom - (needHscroll ? _hscrollbar.measuredHeight : 0);
|
||||
if (_vscrollbar) {
|
||||
_vscrollbar.layout(vsbrc);
|
||||
_vscrollbar.visibility = needVscroll ? Visibility.Visible : Visibility.Gone;
|
||||
_vscrollbar.layout(vsbrc);
|
||||
}
|
||||
if (_hscrollbar) {
|
||||
_hscrollbar.layout(hsbrc);
|
||||
_hscrollbar.visibility = needHscroll ? Visibility.Visible : Visibility.Gone;
|
||||
_hscrollbar.layout(hsbrc);
|
||||
}
|
||||
// client area
|
||||
_clientRect = rc;
|
||||
|
|
Loading…
Reference in New Issue