Performance improvements
This commit is contained in:
@@ -378,11 +378,9 @@ namespace nana
|
||||
dw->draw(graphics);
|
||||
}
|
||||
|
||||
//If the drawer_trigger didn't declear a lazy refresh, then use the refresh().
|
||||
void drawer::_m_use_refresh()
|
||||
bool drawer::_m_lazy_decleared() const
|
||||
{
|
||||
if (basic_window::update_state::refresh != core_window_->other.upd_state)
|
||||
refresh();
|
||||
return (basic_window::update_state::refresh != core_window_->other.upd_state);
|
||||
}
|
||||
}//end namespace detail
|
||||
}//end namespace nana
|
||||
|
||||
@@ -183,7 +183,7 @@ namespace nana
|
||||
|
||||
//Enable the effect.
|
||||
data_sect.effects_bground_windows.push_back(wd);
|
||||
wd->other.glass_buffer.make(wd->dimension.width, wd->dimension.height);
|
||||
wd->other.glass_buffer.make(wd->dimension);
|
||||
make_bground(wd);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -546,8 +546,8 @@ namespace detail
|
||||
{
|
||||
wd->dimension.width = r.width;
|
||||
wd->dimension.height = r.height;
|
||||
wd->drawer.graphics.make(r.width, r.height);
|
||||
wd->root_graph->make(r.width, r.height);
|
||||
wd->drawer.graphics.make(wd->dimension);
|
||||
wd->root_graph->make(wd->dimension);
|
||||
native_interface::move_window(wd->root, r);
|
||||
|
||||
arg_resized arg;
|
||||
@@ -612,7 +612,7 @@ namespace detail
|
||||
if(category::lite_widget_tag::value != wd->other.category)
|
||||
{
|
||||
bool graph_state = wd->drawer.graphics.empty();
|
||||
wd->drawer.graphics.make(sz.width, sz.height);
|
||||
wd->drawer.graphics.make(sz);
|
||||
|
||||
//It shall make a typeface_changed() call when the graphics state is changing.
|
||||
//Because when a widget is created with zero-size, it may get some wrong result in typeface_changed() call
|
||||
@@ -622,7 +622,7 @@ namespace detail
|
||||
|
||||
if(category::root_tag::value == wd->other.category)
|
||||
{
|
||||
wd->root_graph->make(sz.width, sz.height);
|
||||
wd->root_graph->make(sz);
|
||||
if(false == passive)
|
||||
native_interface::window_size(wd->root, sz + nana::size(wd->extra_width, wd->extra_height));
|
||||
}
|
||||
@@ -637,7 +637,7 @@ namespace detail
|
||||
//update the bground buffer of glass window.
|
||||
if(wd->effect.bground && wd->parent)
|
||||
{
|
||||
wd->other.glass_buffer.make(sz.width, sz.height);
|
||||
wd->other.glass_buffer.make(sz);
|
||||
wndlayout_type::make_bground(wd);
|
||||
}
|
||||
}
|
||||
@@ -767,7 +767,7 @@ namespace detail
|
||||
if (!impl_->wd_register.available(wd))
|
||||
return false;
|
||||
|
||||
result.make(wd->drawer.graphics.width(), wd->drawer.graphics.height());
|
||||
result.make(wd->drawer.graphics.size());
|
||||
result.bitblt(0, 0, wd->drawer.graphics);
|
||||
wndlayout_type::paste_children_to_graphics(wd, result);
|
||||
return true;
|
||||
|
||||
@@ -547,7 +547,7 @@ namespace nana
|
||||
draw_method * clone() const override
|
||||
{
|
||||
auto p = new draw_graph;
|
||||
p->graph.make(graph.width(), graph.height());
|
||||
p->graph.make(graph.size());
|
||||
graph.paste(p->graph, 0, 0);
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace API
|
||||
internal_scope_guard isg;
|
||||
if(restrict::window_manager.available(iwd))
|
||||
{
|
||||
iwd->drawer.graphics.make(iwd->dimension.width, iwd->dimension.height);
|
||||
iwd->drawer.graphics.make(iwd->dimension);
|
||||
iwd->drawer.graphics.rectangle(true, iwd->expr_colors->background.get_color());
|
||||
iwd->drawer.attached(wd, dr);
|
||||
iwd->drawer.refresh(); //Always redrawe no matter it is visible or invisible. This can make the graphics data correctly.
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace nana
|
||||
{
|
||||
nana::point refpos(1, static_cast<int>(topbar_height) + 1);
|
||||
|
||||
nana::paint::graphics gbuf(width, graph.height() - 2 - topbar_height);
|
||||
nana::paint::graphics gbuf({ width, graph.height() - 2 - topbar_height });
|
||||
gbuf.rectangle(true, {0xf0, 0xf0, 0xf0});
|
||||
|
||||
switch(page_)
|
||||
@@ -599,12 +599,12 @@ namespace nana
|
||||
nana::point refpos(1, static_cast<int>(topbar_height) + 1);
|
||||
nana::rectangle r(0, 0, graph.width() - 2, graph.height() - 2 - topbar_height);
|
||||
|
||||
nana::paint::graphics dirtybuf(r.width, r.height);
|
||||
nana::paint::graphics dirtybuf({ r.width, r.height });
|
||||
dirtybuf.bitblt(r, graph, refpos);
|
||||
|
||||
_m_draw(graph);
|
||||
|
||||
nana::paint::graphics gbuf(r.width, r.height);
|
||||
nana::paint::graphics gbuf({ r.width, r.height });
|
||||
gbuf.bitblt(r, graph, refpos);
|
||||
|
||||
_m_perf_transform(tfid, graph, dirtybuf, gbuf, refpos);
|
||||
|
||||
@@ -831,7 +831,7 @@ namespace nana
|
||||
if(graph_ptr->empty())
|
||||
{
|
||||
graph_ptr = &substitute;
|
||||
graph_ptr->make(10, 10);
|
||||
graph_ptr->make({ 10, 10 });
|
||||
}
|
||||
|
||||
return impl->renderer.measure(*graph_ptr, limited, impl->text_align, impl->text_align_v);
|
||||
|
||||
@@ -2317,7 +2317,7 @@ namespace nana
|
||||
{
|
||||
const auto & item = essence_->header.column(essence_->pointer_where.second);
|
||||
|
||||
nana::paint::graphics ext_graph(item.pixels, essence_->header_size);
|
||||
nana::paint::graphics ext_graph({ item.pixels, essence_->header_size });
|
||||
ext_graph.typeface(essence_->graph->typeface());
|
||||
|
||||
int txtop = (essence_->header_size - essence_->text_height) / 2;
|
||||
|
||||
@@ -1473,7 +1473,7 @@ namespace nana{ namespace widgets
|
||||
|
||||
text_area_.area = r;
|
||||
if(attributes_.enable_counterpart)
|
||||
attributes_.counterpart.make(r.width, r.height);
|
||||
attributes_.counterpart.make({ r.width, r.height });
|
||||
|
||||
behavior_->pre_calc_lines(width_pixels());
|
||||
_m_scrollbar();
|
||||
@@ -1529,7 +1529,7 @@ namespace nana{ namespace widgets
|
||||
{
|
||||
attributes_.enable_counterpart = enb;
|
||||
if(enb)
|
||||
attributes_.counterpart.make(text_area_.area.width, text_area_.area.height);
|
||||
attributes_.counterpart.make({ text_area_.area.width, text_area_.area.height });
|
||||
else
|
||||
attributes_.counterpart.release();
|
||||
}
|
||||
@@ -2716,7 +2716,7 @@ namespace nana{ namespace widgets
|
||||
auto px_w = std::accumulate(glyphs, glyphs + len, unsigned{});
|
||||
|
||||
::nana::paint::graphics canvas;
|
||||
canvas.make(px_w, px_h);
|
||||
canvas.make({ px_w, px_h });
|
||||
canvas.typeface(graph_.typeface());
|
||||
::nana::point canvas_text_pos;
|
||||
|
||||
@@ -2832,7 +2832,7 @@ namespace nana{ namespace widgets
|
||||
this->_m_draw_parse_string(parser, true, strpos, clr, str, len);
|
||||
|
||||
//Draw selected part
|
||||
paint::graphics graph(glyph_selected, line_h_pixels);
|
||||
paint::graphics graph({ glyph_selected, line_h_pixels });
|
||||
graph.typeface(this->graph_.typeface());
|
||||
graph.rectangle(true, scheme_->selection.get_color());
|
||||
|
||||
@@ -2920,8 +2920,6 @@ namespace nana{ namespace widgets
|
||||
graph_.set_text_color(scheme_->selection_text.get_color());
|
||||
graph_.string(text_pos, ent.begin, endpos - pos);
|
||||
|
||||
//graph_.set_text_color(clr); //deprecated
|
||||
//graph_.string(text_pos + ::nana::point(static_cast<int>(sel_w), 0), ent.begin + (endpos - pos), str_end - endpos);
|
||||
_m_draw_parse_string(parser, false, text_pos + ::nana::point(static_cast<int>(sel_w), 0), clr, ent.begin + (endpos - pos), str_end - endpos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace nana
|
||||
item.image.paste(size, graph, pos);
|
||||
if(item.enable == false)
|
||||
{
|
||||
nana::paint::graphics gh(size.width, size.height);
|
||||
nana::paint::graphics gh(size);
|
||||
gh.bitblt(size, graph, pos);
|
||||
gh.rgb_to_wb();
|
||||
gh.paste(graph, pos.x, pos.y);
|
||||
|
||||
@@ -1391,7 +1391,7 @@ namespace nana
|
||||
comp_attribute_t attr;
|
||||
if(comp_attribute(component::text, attr))
|
||||
{
|
||||
nana::paint::graphics item_graph(item_r_.width, item_r_.height);
|
||||
nana::paint::graphics item_graph({ item_r_.width, item_r_.height });
|
||||
item_graph.typeface(graph_->typeface());
|
||||
|
||||
renderer_->set_color(widget_->bgcolor(), widget_->fgcolor());
|
||||
|
||||
Reference in New Issue
Block a user