Performance improvements

This commit is contained in:
cnjinhao
2015-01-09 08:12:20 +08:00
parent 750c3dffd5
commit 9a71f23ddd
16 changed files with 46 additions and 56 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -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());