Index: fp_Run.cpp =================================================================== --- fp_Run.cpp (revision 26800) +++ fp_Run.cpp (working copy) @@ -1344,15 +1344,15 @@ if(r_type == PP_REVISION_ADDITION || r_type == PP_REVISION_ADDITION_AND_FMT) { - painter.fillRect(s_fgColor,pDA->xoff, pDA->yoff + i2Du, iWidth, getGraphics()->tlu(1)); - painter.fillRect(s_fgColor,pDA->xoff, pDA->yoff + i2Du + getGraphics()->tlu(2), - iWidth, getGraphics()->tlu(1)); + painter.fillRect(s_fgColor,pDA->xoff, pDA->yoff + i2Du, iWidth, pG->tlu(1)); + painter.fillRect(s_fgColor,pDA->xoff, pDA->yoff + i2Du + pG->tlu(2), + iWidth, pG->tlu(1)); } else if(r_type == PP_REVISION_FMT_CHANGE) { // draw a thick line underneath - painter.fillRect(s_fgColor,pDA->xoff, pDA->yoff + i2Du, iWidth, getGraphics()->tlu(2)); + painter.fillRect(s_fgColor,pDA->xoff, pDA->yoff + i2Du, iWidth, pG->tlu(2)); } else { @@ -1965,7 +1965,7 @@ // look for fonts in this DocLayout's font cache FL_DocLayout * pLayout = getBlock()->getDocLayout(); - const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,getGraphics()); + const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,pG); if (pFont != _getFont()) { @@ -2435,10 +2435,10 @@ // look for fonts in this DocLayout's font cache FL_DocLayout * pLayout = getBlock()->getDocLayout(); - const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,getGraphics()); - getGraphics()->setFont(pFont); + const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,pG); + pG->setFont(pFont); } - _setWidth(getGraphics()->measureString(pEOP, 0, iTextLen, NULL)); + _setWidth(pG->measureString(pEOP, 0, iTextLen, NULL)); xxx_UT_DEBUGMSG(("fp_EndOfParagraphRun::lookupProperties: width %d\n", getWidth())); } else @@ -2544,8 +2544,12 @@ return; } - GR_Painter painter(getGraphics()); + GR_Graphics* pG = pDA->pG; + if (pG == NULL) + pG = getGraphics(); + GR_Painter painter(pG); + UT_uint32 iRunBase = getBlock()->getPosition() + getBlockOffset(); UT_uint32 iSelAnchor = pView->getSelectionAnchor(); @@ -2572,7 +2576,7 @@ if (pPropRun && (FPRUN_TEXT == pPropRun->getType())) { fp_TextRun* pTextRun = static_cast(pPropRun); - getGraphics()->setFont(pTextRun->getFont()); + pG->setFont(pTextRun->getFont()); iAscent = pTextRun->getAscent(); } else @@ -2587,9 +2591,9 @@ // look for fonts in this DocLayout's font cache FL_DocLayout * pLayout = getBlock()->getDocLayout(); - const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,getGraphics()); - getGraphics()->setFont(pFont); - iAscent = getGraphics()->getFontAscent(); + const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,pG); + pG->setFont(pFont); + iAscent = pG->getFontAscent(); } // if we currently have a 0 width, i.e., we draw in response to the @@ -2599,7 +2603,7 @@ // if(!getWidth()) // bWidthChange = true; - _setWidth(getGraphics()->measureString(pEOP, 0, iTextLen, NULL)); + _setWidth(pG->measureString(pEOP, 0, iTextLen, NULL)); // if(bWidthChange) // { // getLine()->layout(); @@ -2607,7 +2611,7 @@ // return; // } - _setHeight(getGraphics()->getFontHeight()); + _setHeight(pG->getFontHeight()); iXoffText = pDA->xoff; if(getBlock()->getDominantDirection() == UT_BIDI_RTL) @@ -2624,12 +2628,12 @@ } else { - Fill(getGraphics(),iXoffText, iYoffText, getWidth(), getLine()->getHeight()); + Fill(pG,iXoffText, iYoffText, getWidth(), getLine()->getHeight()); } if (pView->getShowPara()) { // Draw pilcrow - getGraphics()->setColor(clrShowPara); + pG->setColor(clrShowPara); painter.drawChars(pEOP, 0, iTextLen, iXoffText, iYoffText); } } @@ -3172,7 +3176,7 @@ // look for fonts in this DocLayout's font cache FL_DocLayout * pLayout = getBlock()->getDocLayout(); - const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,getGraphics()); + const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,pG); pG->setFont(pFont); } m_iDrawWidth = pG->measureString(pEOP, 0, iTextLen, NULL); @@ -3314,6 +3318,12 @@ return; } + GR_Graphics* pG = pDA->pG; + if (pG == NULL) + { + pG = getGraphics(); + } + UT_uint32 iRunBase = getBlock()->getPosition() + getBlockOffset(); UT_uint32 iSelAnchor = pView->getSelectionAnchor(); @@ -3329,7 +3339,7 @@ ((iSel1 <= iRunBase) && (iSel2 > iRunBase))) bIsSelected = true; - GR_Painter painter(getGraphics()); + GR_Painter painter(pG); UT_UCSChar pEOP[] = { UCS_PILCROW, 0 }; UT_uint32 iTextLen = UT_UCS4_strlen(pEOP); @@ -3339,7 +3349,7 @@ if (pPropRun && (FPRUN_TEXT == pPropRun->getType())) { fp_TextRun* pTextRun = static_cast(pPropRun); - getGraphics()->setFont(pTextRun->getFont()); + pG->setFont(pTextRun->getFont()); iAscent = pTextRun->getAscent(); } else @@ -3354,8 +3364,8 @@ // look for fonts in this DocLayout's font cache FL_DocLayout * pLayout = getBlock()->getDocLayout(); - const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,getGraphics()); - getGraphics()->setFont(pFont); + const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,pG); + pG->setFont(pFont); iAscent = getGraphics()->getFontAscent(); } @@ -3366,7 +3376,7 @@ // if(!m_iDrawWidth) // bWidthChange = true; - m_iDrawWidth = getGraphics()->measureString(pEOP, 0, iTextLen, NULL); + m_iDrawWidth = pG->measureString(pEOP, 0, iTextLen, NULL); // if(bWidthChange) // { // getLine()->layout(); @@ -3374,7 +3384,7 @@ // return; // } - _setHeight(getGraphics()->getFontHeight()); + _setHeight(pG->getFontHeight()); m_iXoffText = pDA->xoff; if(getBlock()->getDominantDirection() == UT_BIDI_RTL) @@ -3391,14 +3401,14 @@ } else { - Fill(getGraphics(),m_iXoffText, m_iYoffText, m_iDrawWidth, getLine()->getHeight()); + Fill(pG,m_iXoffText, m_iYoffText, m_iDrawWidth, getLine()->getHeight()); } - if (getGraphics()->queryProperties(GR_Graphics::DGP_SCREEN) && pView->getShowPara()) + if (pG->queryProperties(GR_Graphics::DGP_SCREEN) && pView->getShowPara()) { // Draw pilcrow // use the hard-coded colour only if not revised if(!getRevisions() || !pView->isShowRevisions()) - getGraphics()->setColor(pView->getColorShowPara()); + pG->setColor(pView->getColorShowPara()); painter.drawChars(pEOP, 0, iTextLen, m_iXoffText, m_iYoffText); } } @@ -3570,13 +3580,13 @@ getBlockAP(pBlockAP); FL_DocLayout * pLayout = getBlock()->getDocLayout(); - const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,getGraphics()); + const GR_Font * pFont = pLayout->findFont(pSpanAP,pBlockAP,pSectionAP,pG); if (pFont != _getFont()) { _setFont(pFont); } - m_iPointHeight = pG->getFontAscent(pFont) + getGraphics()->getFontDescent(pFont); + m_iPointHeight = pG->getFontAscent(pFont) + pG->getFontDescent(pFont); } bool fp_ImageRun::canBreakAfter(void) const @@ -4316,6 +4326,8 @@ void fp_FieldRun::_defaultDraw(dg_DrawArgs* pDA) { GR_Graphics * pG = pDA->pG; + if (pG == NULL) + pG = getGraphics(); // TODO is this really needed // should not be, since lookupProperties is called on @@ -4373,7 +4385,7 @@ } else { - Fill(getGraphics(),pDA->xoff, iFillTop, getWidth(), iFillHeight); + Fill(pG,pDA->xoff, iFillTop, getWidth(), iFillHeight); pG->setColor(_getColorFG()); } }