查看单个帖子
旧 2009-05-04, 08:04 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】double buffer does not work after change active layou

double buffer does not work after change active layout.
double buffer does not work after change active layout.
hi all!
i have a problem with double buffering when change active layout. at the first time, double buffer work fine. after change active layout, it seem that double buffer does not work any more. my steps is below:
- change active layout: pdb->setcurrentlayout((odstring)szspace);
- release all device
- create device again (enablegsmodel(true))
- call onviewzoomextents: if the layout is paper space, set active view is overall view (to make model space and paper space zooming at the same time)
after change active layout, it redraw slowly, it have no double buffer anymore. the problem occurs with odamfcapp sample too. you can test with attached file.
code:
code:
void cdwgviewer:nviewzoomextents()
{
oddbcommandcontextptr pdbcmdctx(getdocument()->cmdctx());
oddbdatabaseptr pdb = pdbcmdctx->database();
oddblayoutptr playout = pdb->currentlayoutid().safeopenobject(oddb::kforwrite);
odstring layout = playout->getlayoutname();
if (layout != l"model")
{ // paper space

execmd( dd_t("zoom e ") );
oddbobjectid overallvpid = playout->overallvportid();
oddbviewportptr pactivevp = overallvpid.safeopenobject(oddb::kforwrite);
odrxobjectptr playoutview = pactivevp;
odgsviewptr poverallview = overallview(m_pdevice);
odgsviewptr pactiveview = m_pdevice->activeview();
m_pdevice->makeviewactive(poverallview.detach());
}
else execmd( dd_t("zoom e ") );do anybody know this problem? what can i do to have double buffer again?
please help...
attached files
please answer me!
do any body know how to fix this problem, please answer me. odamfcapp sample have this problem, but i know that many people know how to fix this. please help me soon...!!!
thank you!
trang

hi,
use:
code:
m_pdevice->makeviewactive(poverallview.get());, instead of:
code:
m_pdevice->makeviewactive(poverallview.detach());you corrupt smart pointer to overall view. problem with geometry cache goes from here.
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)