本文整理汇总了C++中Glyph::Setup方法的典型用法代码示例。如果您正苦于以下问题:C++ Glyph::Setup方法的具体用法?C++ Glyph::Setup怎么用?C++ Glyph::Setup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Glyph
的用法示例。
在下文中一共展示了Glyph::Setup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PB_Display
// Note: .pg based render only
void* May12th::PB_Display(int sub_pg_num){
bool newPage = false;
HDocState docState = NULL;
Char::ftMgr.PreBuildWidTab();
if (sub_pg_num > ctx->pgMgr.GetToWorkPageNum()){
// Forward Display
int i = ctx->pgMgr.GetToWorkPageNum();
PB_Display(i);
if(i++ >= ctx->pgMgr.GetMaxPageNum())
return NULL;
while(i < sub_pg_num){
PB_Display(ctx->pgMgr.NextPage());
if(i++ >= ctx->pgMgr.GetMaxPageNum())
return NULL;
}
return PB_Display(i);
}
else if (sub_pg_num == ctx->pgMgr.GetToWorkPageNum()){
char buf[100];
sprintf(buf, "Render a new page: %d-%d", pb_cur_page, sub_pg_num);
LOG_EVENT(buf);
docState = ctx->pgMgr.StartPage(pb_cur_page);
newPage = true;
}
else if (sub_pg_num < ctx->pgMgr.GetToWorkPageNum()){
char buf[100];
sprintf(buf,"Render the rendered page: %d-%d", pb_cur_page, sub_pg_num);
LOG_EVENT(buf);
ctx->layout.Reset();
ctx->pgMgr.RestorePage(pb_cur_page, sub_pg_num);
newPage = false;
}
ctx->render.Clear();
Glyph* glyph;
DocParser::DP_RET_T dp_ret = DocParser::DP_OK;
bool finished = false;
void* img = NULL;
while(!finished){
dp_ret = ctx->docParse.GetNextGlyph(&glyph, &ctx->layout);
Glyph::GY_ST_RET gy_ret = Glyph::GY_OK;
Table* tab = NULL;
switch(dp_ret){
case DocParser::DP_OK:
gy_ret = glyph->Setup(ctx->layout);
switch(gy_ret){
case Glyph::GY_OK:
// Table render is trigered here
// if (tab){ tab->Draw(ctx->render); }
break;
case Glyph::GY_NEW_PAGE:
// Table render is trigered here
tab = dynamic_cast<Table *>(glyph);
if (tab){ tab->Draw(ctx->render); }
if(true == newPage){
ctx->docParse << glyph->UngetSet();
}
if (bgMode || (!bgMode && !convert))
img = ctx->render.Flush(&ctx->bufMgr);
else
img = ctx->render.Flush(NULL);
ctx->pgMgr.EndPage(docState, &ctx->render, sub_pg_num, pb_cur_page);
// Char::ClearCache();
ctx->layout.DeleteGlyph();
finished = true;
break;
case Glyph::GY_EOF:
ctx->pgMgr.SetMaxPageNum(sub_pg_num);
ctx->layout.curLine->DrawFlush(&ctx->render);
if (bgMode || (!bgMode && !convert))
img = ctx->render.Flush(&ctx->bufMgr);
else
img = ctx->render.Flush(NULL);
ctx->pgMgr.EndPage(docState, &ctx->render, sub_pg_num, pb_cur_page);
// Char::ClearCache();
ctx->layout.DeleteGlyph();
finished = true;
break;
case Glyph::GY_ERROR:
LOG_ERROR("Internal error.");
// finished = true;
break;
default:
LOG_ERROR("Unsupported setting up return value of glyph.");
finished = true;
break;
}
case DocParser::DP_EOF:
break;
case DocParser::DP_INVALID:
LOG_ERROR("DocParser return invalid stream!");
break;
case DocParser::DP_ERROR:
LOG_ERROR("DocParser return parse error!");
break;
//.........这里部分代码省略.........
示例2: while
void* May12th::SerializedDisplay(int page_num){
ctx->layout.Reset();
ctx->pgMgr.RestorePage(page_num);
Char::ftMgr.PreBuildWidTab();
ctx->render.Clear();
Glyph* glyph;
DocParser::DP_RET_T dp_ret = DocParser::DP_OK;
bool finished = false;
void* img = NULL;
while(!finished){
dp_ret = ctx->docParse.GetNextGlyph(&glyph, &ctx->layout);
Glyph::GY_ST_RET gy_ret = Glyph::GY_OK;
Table* tab = NULL;
switch(dp_ret){
case DocParser::DP_OK:
gy_ret = glyph->Setup(ctx->layout);
switch(gy_ret){
case Glyph::GY_OK:
// Table render is trigered here
// if (tab){ tab->Draw(ctx->render); }
break;
case Glyph::GY_NEW_PAGE:
// Table render is trigered here
tab = dynamic_cast<Table *>(glyph);
if (tab){ tab->Draw(ctx->render); }
img = ctx->render.Flush(&ctx->bufMgr);
// ctx->pgMgr.EndPage(page_num, &ctx->render);
// Char::ClearCache();
ctx->layout.DeleteGlyph();
finished = true;
break;
case Glyph::GY_EOF:
// ctx->pgMgr.SetMaxPageNum(page_num);
ctx->layout.curLine->DrawFlush(&ctx->render);
img = ctx->render.Flush(&ctx->bufMgr);
// ctx->pgMgr.EndPage(page_num, &ctx->render);
// Char::ClearCache();
ctx->layout.DeleteGlyph();
finished = true;
break;
case Glyph::GY_ERROR:
LOG_ERROR("Internal error.");
// finished = true;
break;
default:
LOG_ERROR("Unsupported setting up return value of glyph.");
finished = true;
break;
}
case DocParser::DP_EOF:
// finished = true;
break;
case DocParser::DP_INVALID:
LOG_ERROR("DocParser return invalid stream!");
// finished = true;
break;
case DocParser::DP_ERROR:
LOG_ERROR("DocParser return parse error!");
// finished = true;
break;
default:
LOG_ERROR("Unsupported DocParser return type!");
// finished = true;
break;
}
}
return img;
}