本文整理汇总了C++中FramePtr::set_refresh_offsets方法的典型用法代码示例。如果您正苦于以下问题:C++ FramePtr::set_refresh_offsets方法的具体用法?C++ FramePtr::set_refresh_offsets怎么用?C++ FramePtr::set_refresh_offsets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FramePtr
的用法示例。
在下文中一共展示了FramePtr::set_refresh_offsets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: position_lines
//.........这里部分代码省略.........
y_offset = 0;
baseline = 0;
SHORT line_count = frame->number_of_lines();
if (line_count == 0)
{
refresh_offsets.x0 = 0;
refresh_offsets.x1 = 0;
}
else
{
PCOORD xmin, xmax;
xmin = 0x7fffffff;
xmax = -xmin;
for (lp = frame->get_line(0), l_index = 0; l_index < line_count; lp++, l_index++)
{
xmin = __min(xmin, lp->refresh_xmin);
xmax = __max(xmax, lp->refresh_xmax);
if (l_index == 0)
{
baseline = y_offset + lp->ascend;
}
else
{
baseline = y_offset + lp->line_spacing - lp->descend;
}
y_offset = baseline + lp->descend;
}
refresh_offsets.x0 = xmin;
refresh_offsets.x1 = xmax;
}
/*
// Compute the offset value from the height of the text and the frame height.
*/
if ((y_offset = bound.y1 - bound.y0 - y_offset) > 0)
{
switch (align_type)
{
case ALIGN_top:
{
y_offset = 0;
break;
}
case ALIGN_middle:
{
y_offset /= 2;
break;
}
case ALIGN_bottom:
default:
{
break;
}
}
}
else
{
/* Text too big for frame. Top align it. */
y_offset = 0;
}
refresh_offsets.y0 = y_offset;
/*
// We have the amount to offset. Do the offset now.
*/
for (lp = frame->get_line(0), l_index = 0; l_index < line_count; lp++, l_index++)
{
if (l_index == 0)
{
y_offset += lp->ascend;
}
else
{
y_offset += lp->line_spacing - lp->descend;
}
if (y_offset != lp->baseline)
{
if (lp->baseline != -1)
{
add_line_refresh_extent(frame, lp);
}
lp->baseline = y_offset;
add_line_refresh_extent(frame, lp);
}
y_offset += lp->descend;
}
refresh_offsets.y1 = __min(y_offset, bound.y1 - bound.y0);
frame->set_refresh_offsets(refresh_offsets);
}