summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-08-15 13:56:43 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-08-15 21:33:32 +0000
commiteb14e04c79c575146fe96c025dbf56b7440870c7 (patch)
tree323ca30b3b5b2df46427e336c3482901ca26db8f /fpdfsdk
parent6e524ad89eac22f0e5d5475652ec78c609b788e8 (diff)
downloadpdfium-chromium/3187.tar.xz
Change a bunch of methods to take a const CFX_Matrix& param.chromium/3187
Simplify some code along the way. Change-Id: I0022c8a82188192c63b9ac0bc87e9b9dbf983040 Reviewed-on: https://pdfium-review.googlesource.com/10852 Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp2
-rw-r--r--fpdfsdk/pwl/cpwl_caret.cpp4
-rw-r--r--fpdfsdk/pwl/cpwl_caret.h2
-rw-r--r--fpdfsdk/pwl/cpwl_combo_box.cpp6
-rw-r--r--fpdfsdk/pwl/cpwl_combo_box.h2
-rw-r--r--fpdfsdk/pwl/cpwl_edit.cpp10
-rw-r--r--fpdfsdk/pwl/cpwl_edit.h2
-rw-r--r--fpdfsdk/pwl/cpwl_edit_impl.cpp189
-rw-r--r--fpdfsdk/pwl/cpwl_edit_impl.h2
-rw-r--r--fpdfsdk/pwl/cpwl_list_box.cpp38
-rw-r--r--fpdfsdk/pwl/cpwl_list_box.h2
-rw-r--r--fpdfsdk/pwl/cpwl_scroll_bar.cpp30
-rw-r--r--fpdfsdk/pwl/cpwl_scroll_bar.h4
-rw-r--r--fpdfsdk/pwl/cpwl_wnd.cpp20
-rw-r--r--fpdfsdk/pwl/cpwl_wnd.h8
15 files changed, 160 insertions, 161 deletions
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index e0af8955ac..e0d02d0f4c 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -88,7 +88,7 @@ void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView,
if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, false)) {
CFX_Matrix mt = GetCurMatrix();
mt.Concat(*pUser2Device);
- pWnd->DrawAppearance(pDevice, &mt);
+ pWnd->DrawAppearance(pDevice, mt);
return;
}
diff --git a/fpdfsdk/pwl/cpwl_caret.cpp b/fpdfsdk/pwl/cpwl_caret.cpp
index 65c0fc56c7..3d05961601 100644
--- a/fpdfsdk/pwl/cpwl_caret.cpp
+++ b/fpdfsdk/pwl/cpwl_caret.cpp
@@ -24,7 +24,7 @@ CFX_ByteString CPWL_Caret::GetClassName() const {
}
void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
+ const CFX_Matrix& mtUser2Device) {
if (!IsVisible() || !m_bFlash)
return;
@@ -49,7 +49,7 @@ void CPWL_Caret::DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_GraphStateData gsd;
gsd.m_LineWidth = m_fWidth;
- pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEncode(255, 0, 0, 0),
+ pDevice->DrawPath(&path, &mtUser2Device, &gsd, 0, ArgbEncode(255, 0, 0, 0),
FXFILL_ALTERNATE);
}
diff --git a/fpdfsdk/pwl/cpwl_caret.h b/fpdfsdk/pwl/cpwl_caret.h
index 5bba6fe9b1..32034708a7 100644
--- a/fpdfsdk/pwl/cpwl_caret.h
+++ b/fpdfsdk/pwl/cpwl_caret.h
@@ -17,7 +17,7 @@ class CPWL_Caret : public CPWL_Wnd {
// CPWL_Wnd
CFX_ByteString GetClassName() const override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) override;
+ const CFX_Matrix& mtUser2Device) override;
void InvalidateRect(CFX_FloatRect* pRect) override;
void SetVisible(bool bVisible) override {}
void TimerProc() override;
diff --git a/fpdfsdk/pwl/cpwl_combo_box.cpp b/fpdfsdk/pwl/cpwl_combo_box.cpp
index 49254b8171..8c5e99ff09 100644
--- a/fpdfsdk/pwl/cpwl_combo_box.cpp
+++ b/fpdfsdk/pwl/cpwl_combo_box.cpp
@@ -94,8 +94,8 @@ bool CPWL_CBListBox::OnCharNotify(uint16_t nChar, uint32_t nFlag) {
}
void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
- CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
+ const CFX_Matrix& mtUser2Device) {
+ CPWL_Wnd::DrawThisAppearance(pDevice, mtUser2Device);
CFX_FloatRect rectWnd = CPWL_Wnd::GetWindowRect();
@@ -118,7 +118,7 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
path.AppendPoint(pt3, FXPT_TYPE::LineTo, false);
path.AppendPoint(pt1, FXPT_TYPE::LineTo, false);
- pDevice->DrawPath(&path, pUser2Device, nullptr,
+ pDevice->DrawPath(&path, &mtUser2Device, nullptr,
PWL_DEFAULT_BLACKCOLOR.ToFXColor(GetTransparency()), 0,
FXFILL_ALTERNATE);
}
diff --git a/fpdfsdk/pwl/cpwl_combo_box.h b/fpdfsdk/pwl/cpwl_combo_box.h
index 81e4256e18..7059faccbc 100644
--- a/fpdfsdk/pwl/cpwl_combo_box.h
+++ b/fpdfsdk/pwl/cpwl_combo_box.h
@@ -37,7 +37,7 @@ class CPWL_CBButton : public CPWL_Wnd {
// CPWL_Wnd
void DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) override;
+ const CFX_Matrix& mtUser2Device) override;
bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override;
bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override;
};
diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp
index d01e3f147d..a6f6f2ac86 100644
--- a/fpdfsdk/pwl/cpwl_edit.cpp
+++ b/fpdfsdk/pwl/cpwl_edit.cpp
@@ -198,8 +198,8 @@ void CPWL_Edit::SetParamByFlag() {
}
void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
- CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
+ const CFX_Matrix& mtUser2Device) {
+ CPWL_Wnd::DrawThisAppearance(pDevice, mtUser2Device);
CFX_FloatRect rcClient = GetClientRect();
@@ -231,7 +231,7 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
FXPT_TYPE::LineTo, false);
}
if (!path.GetPoints().empty()) {
- pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
+ pDevice->DrawPath(&path, &mtUser2Device, &gsd, 0,
GetBorderColor().ToFXColor(255), FXFILL_ALTERNATE);
}
break;
@@ -261,7 +261,7 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
FXPT_TYPE::LineTo, false);
}
if (!path.GetPoints().empty()) {
- pDevice->DrawPath(&path, pUser2Device, &gsd, 0,
+ pDevice->DrawPath(&path, &mtUser2Device, &gsd, 0,
GetBorderColor().ToFXColor(255), FXFILL_ALTERNATE);
}
break;
@@ -280,7 +280,7 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
CFX_SystemHandler* pSysHandler = GetSystemHandler();
- CPWL_EditImpl::DrawEdit(pDevice, pUser2Device, m_pEdit.get(),
+ CPWL_EditImpl::DrawEdit(pDevice, mtUser2Device, m_pEdit.get(),
GetTextColor().ToFXColor(GetTransparency()), rcClip,
CFX_PointF(), pRange, pSysHandler,
m_pFormFiller.Get());
diff --git a/fpdfsdk/pwl/cpwl_edit.h b/fpdfsdk/pwl/cpwl_edit.h
index 1c2d9c03bd..758402394c 100644
--- a/fpdfsdk/pwl/cpwl_edit.h
+++ b/fpdfsdk/pwl/cpwl_edit.h
@@ -49,7 +49,7 @@ class CPWL_Edit : public CPWL_EditCtrl {
void RePosChildWnd() override;
CFX_FloatRect GetClientRect() const override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) override;
+ const CFX_Matrix& mtUser2Device) override;
bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override;
bool OnLButtonDblClk(const CFX_PointF& point, uint32_t nFlag) override;
bool OnRButtonUp(const CFX_PointF& point, uint32_t nFlag) override;
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index 808eddb7cb..f26811e137 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -41,33 +41,27 @@ void DrawTextString(CFX_RenderDevice* pDevice,
const CFX_PointF& pt,
CPDF_Font* pFont,
float fFontSize,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
const CFX_ByteString& str,
FX_ARGB crTextFill,
int32_t nHorzScale) {
- CFX_PointF pos = pUser2Device->Transform(pt);
-
- if (pFont) {
- if (nHorzScale != 100) {
- CFX_Matrix mt(nHorzScale / 100.0f, 0, 0, 1, 0, 0);
- mt.Concat(*pUser2Device);
-
- CPDF_RenderOptions ro;
- ro.m_Flags = RENDER_CLEARTYPE;
- ro.m_ColorMode = CPDF_RenderOptions::kNormal;
-
- CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize,
- &mt, str, crTextFill, nullptr, &ro);
- } else {
- CPDF_RenderOptions ro;
- ro.m_Flags = RENDER_CLEARTYPE;
- ro.m_ColorMode = CPDF_RenderOptions::kNormal;
+ if (!pFont)
+ return;
- CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize,
- pUser2Device, str, crTextFill, nullptr,
- &ro);
- }
+ CFX_PointF pos = mtUser2Device.Transform(pt);
+ CFX_Matrix mt;
+ if (nHorzScale == 100) {
+ mt = mtUser2Device;
+ } else {
+ mt = CFX_Matrix(nHorzScale / 100.0f, 0, 0, 1, 0, 0);
+ mt.Concat(mtUser2Device);
}
+
+ CPDF_RenderOptions ro;
+ ro.m_Flags = RENDER_CLEARTYPE;
+ ro.m_ColorMode = CPDF_RenderOptions::kNormal;
+ CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize,
+ &mt, str, crTextFill, nullptr, &ro);
}
} // namespace
@@ -448,7 +442,7 @@ void CFXEU_InsertText::Undo() {
// static
void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
CPWL_EditImpl* pEdit,
FX_COLORREF crTextFill,
const CFX_FloatRect& rcClip,
@@ -467,8 +461,8 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice,
FX_COLORREF crOldFill = crCurFill;
bool bSelect = false;
- const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255);
- const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113);
+ static const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255);
+ static const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113);
std::ostringstream sTextBuf;
int32_t nFontIndex = -1;
@@ -476,91 +470,92 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice,
CFX_RenderDevice::StateRestorer restorer(pDevice);
if (!rcClip.IsEmpty()) {
CFX_FloatRect rcTemp = rcClip;
- pUser2Device->TransformRect(rcTemp);
+ mtUser2Device.TransformRect(rcTemp);
pDevice->SetClip_Rect(rcTemp.ToFxRect());
}
CPWL_EditImpl_Iterator* pIterator = pEdit->GetIterator();
- if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) {
- if (pRange)
- pIterator->SetAt(pRange->BeginPos);
- else
- pIterator->SetAt(0);
+ IPVT_FontMap* pFontMap = pEdit->GetFontMap();
+ if (!pFontMap)
+ return;
- CPVT_WordPlace oldplace;
- while (pIterator->NextWord()) {
- CPVT_WordPlace place = pIterator->GetAt();
- if (pRange && place > pRange->EndPos)
- break;
+ if (pRange)
+ pIterator->SetAt(pRange->BeginPos);
+ else
+ pIterator->SetAt(0);
- if (!wrSelect.IsEmpty()) {
- bSelect = place > wrSelect.BeginPos && place <= wrSelect.EndPos;
- crCurFill = bSelect ? crWhite : crTextFill;
- }
- if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) {
- crCurFill = crTextFill;
- crOldFill = crCurFill;
- }
- CPVT_Word word;
- if (pIterator->GetWord(word)) {
- if (bSelect) {
- CPVT_Line line;
- pIterator->GetLine(line);
-
- if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) {
- CFX_FloatRect rc(word.ptWord.x, line.ptLine.y + line.fLineDescent,
- word.ptWord.x + word.fWidth,
- line.ptLine.y + line.fLineAscent);
- rc.Intersect(rcClip);
- pSystemHandler->OutputSelectedRect(pFFLData, rc);
- } else {
- CFX_PathData pathSelBK;
- pathSelBK.AppendRect(
- word.ptWord.x, line.ptLine.y + line.fLineDescent,
- word.ptWord.x + word.fWidth, line.ptLine.y + line.fLineAscent);
-
- pDevice->DrawPath(&pathSelBK, pUser2Device, nullptr, crSelBK, 0,
- FXFILL_WINDING);
- }
+ CPVT_WordPlace oldplace;
+ while (pIterator->NextWord()) {
+ CPVT_WordPlace place = pIterator->GetAt();
+ if (pRange && place > pRange->EndPos)
+ break;
+
+ if (!wrSelect.IsEmpty()) {
+ bSelect = place > wrSelect.BeginPos && place <= wrSelect.EndPos;
+ crCurFill = bSelect ? crWhite : crTextFill;
+ }
+ if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) {
+ crCurFill = crTextFill;
+ crOldFill = crCurFill;
+ }
+ CPVT_Word word;
+ if (pIterator->GetWord(word)) {
+ if (bSelect) {
+ CPVT_Line line;
+ pIterator->GetLine(line);
+
+ if (pSystemHandler && pSystemHandler->IsSelectionImplemented()) {
+ CFX_FloatRect rc(word.ptWord.x, line.ptLine.y + line.fLineDescent,
+ word.ptWord.x + word.fWidth,
+ line.ptLine.y + line.fLineAscent);
+ rc.Intersect(rcClip);
+ pSystemHandler->OutputSelectedRect(pFFLData, rc);
+ } else {
+ CFX_PathData pathSelBK;
+ pathSelBK.AppendRect(word.ptWord.x, line.ptLine.y + line.fLineDescent,
+ word.ptWord.x + word.fWidth,
+ line.ptLine.y + line.fLineAscent);
+
+ pDevice->DrawPath(&pathSelBK, &mtUser2Device, nullptr, crSelBK, 0,
+ FXFILL_WINDING);
}
+ }
- if (bContinuous) {
- if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex ||
- crOldFill != crCurFill) {
- if (sTextBuf.tellp() > 0) {
- DrawTextString(
- pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
- pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device,
- CFX_ByteString(sTextBuf), crOldFill, nHorzScale);
-
- sTextBuf.str("");
- }
- nFontIndex = word.nFontIndex;
- ptBT = word.ptWord;
- crOldFill = crCurFill;
- }
+ if (bContinuous) {
+ if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex ||
+ crOldFill != crCurFill) {
+ if (sTextBuf.tellp() > 0) {
+ DrawTextString(
+ pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
+ pFontMap->GetPDFFont(nFontIndex), fFontSize, mtUser2Device,
+ CFX_ByteString(sTextBuf), crOldFill, nHorzScale);
- sTextBuf << pEdit->GetPDFWordString(word.nFontIndex, word.Word,
- SubWord);
- } else {
- DrawTextString(
- pDevice,
- CFX_PointF(word.ptWord.x + ptOffset.x,
- word.ptWord.y + ptOffset.y),
- pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device,
- pEdit->GetPDFWordString(word.nFontIndex, word.Word, SubWord),
- crCurFill, nHorzScale);
+ sTextBuf.str("");
+ }
+ nFontIndex = word.nFontIndex;
+ ptBT = word.ptWord;
+ crOldFill = crCurFill;
}
- oldplace = place;
+
+ sTextBuf << pEdit->GetPDFWordString(word.nFontIndex, word.Word,
+ SubWord);
+ } else {
+ DrawTextString(
+ pDevice,
+ CFX_PointF(word.ptWord.x + ptOffset.x, word.ptWord.y + ptOffset.y),
+ pFontMap->GetPDFFont(word.nFontIndex), fFontSize, mtUser2Device,
+ pEdit->GetPDFWordString(word.nFontIndex, word.Word, SubWord),
+ crCurFill, nHorzScale);
}
+ oldplace = place;
}
+ }
- if (sTextBuf.tellp() > 0) {
- DrawTextString(pDevice,
- CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
- pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device,
- CFX_ByteString(sTextBuf), crOldFill, nHorzScale);
- }
+ if (sTextBuf.tellp() > 0) {
+ DrawTextString(pDevice,
+ CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
+ pFontMap->GetPDFFont(nFontIndex), fFontSize, mtUser2Device,
+ CFX_ByteString(sTextBuf), crOldFill, nHorzScale);
}
}
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.h b/fpdfsdk/pwl/cpwl_edit_impl.h
index 80c68050f5..177a0524f4 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.h
+++ b/fpdfsdk/pwl/cpwl_edit_impl.h
@@ -272,7 +272,7 @@ class CFXEU_InsertText : public IFX_Edit_UndoItem {
class CPWL_EditImpl {
public:
static void DrawEdit(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
+ const CFX_Matrix& mtUser2Device,
CPWL_EditImpl* pEdit,
FX_COLORREF crTextFill,
const CFX_FloatRect& rcClip,
diff --git a/fpdfsdk/pwl/cpwl_list_box.cpp b/fpdfsdk/pwl/cpwl_list_box.cpp
index 060b3f6ee3..a9c553ee5b 100644
--- a/fpdfsdk/pwl/cpwl_list_box.cpp
+++ b/fpdfsdk/pwl/cpwl_list_box.cpp
@@ -38,18 +38,20 @@ void CPWL_List_Notify::IOnSetScrollInfoY(float fPlateMin,
Info.fBigStep = fBigStep;
m_pList->SetScrollInfo(Info);
- if (CPWL_ScrollBar* pScroll = m_pList->GetVScrollBar()) {
- if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) ||
- IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) {
- if (pScroll->IsVisible()) {
- pScroll->SetVisible(false);
- m_pList->RePosChildWnd();
- }
- } else {
- if (!pScroll->IsVisible()) {
- pScroll->SetVisible(true);
- m_pList->RePosChildWnd();
- }
+ CPWL_ScrollBar* pScroll = m_pList->GetVScrollBar();
+ if (!pScroll)
+ return;
+
+ if (IsFloatBigger(Info.fPlateWidth, Info.fContentMax - Info.fContentMin) ||
+ IsFloatEqual(Info.fPlateWidth, Info.fContentMax - Info.fContentMin)) {
+ if (pScroll->IsVisible()) {
+ pScroll->SetVisible(false);
+ m_pList->RePosChildWnd();
+ }
+ } else {
+ if (!pScroll->IsVisible()) {
+ pScroll->SetVisible(true);
+ m_pList->RePosChildWnd();
}
}
}
@@ -94,8 +96,8 @@ void CPWL_ListBox::OnDestroy() {
}
void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
- CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
+ const CFX_Matrix& mtUser2Device) {
+ CPWL_Wnd::DrawThisAppearance(pDevice, mtUser2Device);
CFX_FloatRect rcPlate = m_pList->GetPlateRect();
CFX_FloatRect rcList = GetListRect();
@@ -118,21 +120,21 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
if (m_pList->IsItemSelected(i)) {
CFX_SystemHandler* pSysHandler = GetSystemHandler();
if (pSysHandler && pSysHandler->IsSelectionImplemented()) {
- CPWL_EditImpl::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
+ CPWL_EditImpl::DrawEdit(pDevice, mtUser2Device, m_pList->GetItemEdit(i),
GetTextColor().ToFXColor(255), rcList, ptOffset,
nullptr, pSysHandler, m_pFormFiller.Get());
pSysHandler->OutputSelectedRect(m_pFormFiller.Get(), rcItem);
} else {
- pDevice->DrawFillRect(pUser2Device, rcItem,
+ pDevice->DrawFillRect(&mtUser2Device, rcItem,
ArgbEncode(255, 0, 51, 113));
- CPWL_EditImpl::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
+ CPWL_EditImpl::DrawEdit(pDevice, mtUser2Device, m_pList->GetItemEdit(i),
ArgbEncode(255, 255, 255, 255), rcList,
ptOffset, nullptr, pSysHandler,
m_pFormFiller.Get());
}
} else {
CFX_SystemHandler* pSysHandler = GetSystemHandler();
- CPWL_EditImpl::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
+ CPWL_EditImpl::DrawEdit(pDevice, mtUser2Device, m_pList->GetItemEdit(i),
GetTextColor().ToFXColor(255), rcList, ptOffset,
nullptr, pSysHandler, nullptr);
}
diff --git a/fpdfsdk/pwl/cpwl_list_box.h b/fpdfsdk/pwl/cpwl_list_box.h
index 8938f243d5..f620ec1050 100644
--- a/fpdfsdk/pwl/cpwl_list_box.h
+++ b/fpdfsdk/pwl/cpwl_list_box.h
@@ -48,7 +48,7 @@ class CPWL_ListBox : public CPWL_Wnd {
void OnCreated() override;
void OnDestroy() override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) override;
+ const CFX_Matrix& mtUser2Device) override;
bool OnKeyDown(uint16_t nChar, uint32_t nFlag) override;
bool OnChar(uint16_t nChar, uint32_t nFlag) override;
bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override;
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.cpp b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
index 142988a815..ea38b0f591 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.cpp
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.cpp
@@ -136,7 +136,7 @@ void CPWL_SBButton::OnCreate(PWL_CREATEPARAM& cp) {
}
void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
+ const CFX_Matrix& mtUser2Device) {
if (!IsVisible())
return;
@@ -148,7 +148,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
int32_t nTransparency = GetTransparency();
if (m_eScrollBarType == SBT_HSCROLL) {
- CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device);
+ CPWL_Wnd::DrawThisAppearance(pDevice, mtUser2Device);
CFX_PointF pt1;
CFX_PointF pt2;
@@ -175,7 +175,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
path.AppendPoint(pt3, FXPT_TYPE::LineTo, false);
path.AppendPoint(pt1, FXPT_TYPE::LineTo, false);
- pDevice->DrawPath(&path, pUser2Device, nullptr,
+ pDevice->DrawPath(&path, &mtUser2Device, nullptr,
PWL_DEFAULT_BLACKCOLOR.ToFXColor(nTransparency), 0,
FXFILL_ALTERNATE);
}
@@ -183,19 +183,19 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
// draw border
- pDevice->DrawStrokeRect(pUser2Device, rectWnd,
+ pDevice->DrawStrokeRect(&mtUser2Device, rectWnd,
ArgbEncode(nTransparency, 100, 100, 100), 0.0f);
- pDevice->DrawStrokeRect(pUser2Device, rectWnd.GetDeflated(0.5f, 0.5f),
+ pDevice->DrawStrokeRect(&mtUser2Device, rectWnd.GetDeflated(0.5f, 0.5f),
ArgbEncode(nTransparency, 255, 255, 255), 1.0f);
if (m_eSBButtonType != PSBT_POS) {
// draw background
if (IsEnabled()) {
- pDevice->DrawShadow(pUser2Device, true, false,
+ pDevice->DrawShadow(&mtUser2Device, true, false,
rectWnd.GetDeflated(1.0f, 1.0f), nTransparency, 80,
220);
} else {
- pDevice->DrawFillRect(pUser2Device, rectWnd.GetDeflated(1.0f, 1.0f),
+ pDevice->DrawFillRect(&mtUser2Device, rectWnd.GetDeflated(1.0f, 1.0f),
ArgbEncode(255, 255, 255, 255));
}
@@ -221,7 +221,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
pts.push_back(CFX_PointF(fX + 4.5f, fY + 3.0f));
pts.push_back(CFX_PointF(fX + 2.5f, fY + 5.0f));
}
- pDevice->DrawFillArea(pUser2Device, pts.data(), 7,
+ pDevice->DrawFillArea(&mtUser2Device, pts.data(), 7,
IsEnabled()
? ArgbEncode(nTransparency, 255, 255, 255)
: PWL_DEFAULT_HEAVYGRAYCOLOR.ToFXColor(255));
@@ -248,13 +248,13 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
ArgbEncode(nTransparency, 180, 180, 180),
ArgbEncode(nTransparency, 210, 210, 210)};
for (FX_COLORREF ref : refs) {
- pDevice->DrawStrokeLine(pUser2Device, ptTop, ptBottom, ref, 1.0f);
+ pDevice->DrawStrokeLine(&mtUser2Device, ptTop, ptBottom, ref, 1.0f);
ptTop.x += 1.0f;
ptBottom.x += 1.0f;
}
} else {
- pDevice->DrawFillRect(pUser2Device, rectWnd.GetDeflated(0.5f, 0.5f),
+ pDevice->DrawFillRect(&mtUser2Device, rectWnd.GetDeflated(0.5f, 0.5f),
ArgbEncode(255, 255, 255, 255));
}
@@ -275,7 +275,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice,
ptCenter.y - nFrictionHeight / 2.0f + 0.5f);
for (size_t i = 0; i < 3; ++i) {
- pDevice->DrawStrokeLine(pUser2Device, ptLeft, ptRight, crStroke, 1.0f);
+ pDevice->DrawStrokeLine(&mtUser2Device, ptLeft, ptRight, crStroke, 1.0f);
ptLeft.y += 2.0f;
ptRight.y += 2.0f;
}
@@ -403,20 +403,20 @@ void CPWL_ScrollBar::RePosChildWnd() {
}
void CPWL_ScrollBar::DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
+ const CFX_Matrix& mtUser2Device) {
CFX_FloatRect rectWnd = GetWindowRect();
if (IsVisible() && !rectWnd.IsEmpty()) {
- pDevice->DrawFillRect(pUser2Device, rectWnd, GetBackgroundColor(),
+ pDevice->DrawFillRect(&mtUser2Device, rectWnd, GetBackgroundColor(),
GetTransparency());
pDevice->DrawStrokeLine(
- pUser2Device, CFX_PointF(rectWnd.left + 2.0f, rectWnd.top - 2.0f),
+ &mtUser2Device, CFX_PointF(rectWnd.left + 2.0f, rectWnd.top - 2.0f),
CFX_PointF(rectWnd.left + 2.0f, rectWnd.bottom + 2.0f),
ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f);
pDevice->DrawStrokeLine(
- pUser2Device, CFX_PointF(rectWnd.right - 2.0f, rectWnd.top - 2.0f),
+ &mtUser2Device, CFX_PointF(rectWnd.right - 2.0f, rectWnd.top - 2.0f),
CFX_PointF(rectWnd.right - 2.0f, rectWnd.bottom + 2.0f),
ArgbEncode(GetTransparency(), 100, 100, 100), 1.0f);
}
diff --git a/fpdfsdk/pwl/cpwl_scroll_bar.h b/fpdfsdk/pwl/cpwl_scroll_bar.h
index c78b6e36f8..e35a6a0fc2 100644
--- a/fpdfsdk/pwl/cpwl_scroll_bar.h
+++ b/fpdfsdk/pwl/cpwl_scroll_bar.h
@@ -52,7 +52,7 @@ class CPWL_SBButton : public CPWL_Wnd {
CFX_ByteString GetClassName() const override;
void OnCreate(PWL_CREATEPARAM& cp) override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) override;
+ const CFX_Matrix& mtUser2Device) override;
bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override;
bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override;
bool OnMouseMove(const CFX_PointF& point, uint32_t nFlag) override;
@@ -126,7 +126,7 @@ class CPWL_ScrollBar : public CPWL_Wnd {
void OnDestroy() override;
void RePosChildWnd() override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) override;
+ const CFX_Matrix& mtUser2Device) override;
bool OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) override;
bool OnLButtonUp(const CFX_PointF& point, uint32_t nFlag) override;
void SetScrollInfo(const PWL_SCROLL_INFO& info) override;
diff --git a/fpdfsdk/pwl/cpwl_wnd.cpp b/fpdfsdk/pwl/cpwl_wnd.cpp
index 37d0bc4cf2..96a3720daf 100644
--- a/fpdfsdk/pwl/cpwl_wnd.cpp
+++ b/fpdfsdk/pwl/cpwl_wnd.cpp
@@ -245,27 +245,27 @@ void CPWL_Wnd::InvalidateRectMove(const CFX_FloatRect& rcOld,
}
void CPWL_Wnd::DrawAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
+ const CFX_Matrix& mtUser2Device) {
if (IsValid() && IsVisible()) {
- DrawThisAppearance(pDevice, pUser2Device);
- DrawChildAppearance(pDevice, pUser2Device);
+ DrawThisAppearance(pDevice, mtUser2Device);
+ DrawChildAppearance(pDevice, mtUser2Device);
}
}
void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
+ const CFX_Matrix& mtUser2Device) {
CFX_FloatRect rectWnd = GetWindowRect();
if (rectWnd.IsEmpty())
return;
if (HasFlag(PWS_BACKGROUND)) {
float width = static_cast<float>(GetBorderWidth() + GetInnerBorderWidth());
- pDevice->DrawFillRect(pUser2Device, rectWnd.GetDeflated(width, width),
+ pDevice->DrawFillRect(&mtUser2Device, rectWnd.GetDeflated(width, width),
GetBackgroundColor(), GetTransparency());
}
if (HasFlag(PWS_BORDER)) {
- pDevice->DrawBorder(pUser2Device, rectWnd,
+ pDevice->DrawBorder(&mtUser2Device, rectWnd,
static_cast<float>(GetBorderWidth()), GetBorderColor(),
GetBorderLeftTopColor(GetBorderStyle()),
GetBorderRightBottomColor(GetBorderStyle()),
@@ -274,17 +274,17 @@ void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice,
}
void CPWL_Wnd::DrawChildAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device) {
+ const CFX_Matrix& mtUser2Device) {
for (CPWL_Wnd* pChild : m_Children) {
if (!pChild)
continue;
CFX_Matrix mt = pChild->GetChildMatrix();
if (mt.IsIdentity()) {
- pChild->DrawAppearance(pDevice, pUser2Device);
+ pChild->DrawAppearance(pDevice, mtUser2Device);
} else {
- mt.Concat(*pUser2Device);
- pChild->DrawAppearance(pDevice, &mt);
+ mt.Concat(mtUser2Device);
+ pChild->DrawAppearance(pDevice, mt);
}
}
}
diff --git a/fpdfsdk/pwl/cpwl_wnd.h b/fpdfsdk/pwl/cpwl_wnd.h
index 78edaa26e5..3c6c2824e2 100644
--- a/fpdfsdk/pwl/cpwl_wnd.h
+++ b/fpdfsdk/pwl/cpwl_wnd.h
@@ -215,7 +215,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
void SetCapture();
void ReleaseCapture();
- void DrawAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device);
+ void DrawAppearance(CFX_RenderDevice* pDevice,
+ const CFX_Matrix& mtUser2Device);
CFX_Color GetBackgroundColor() const;
void SetBackgroundColor(const CFX_Color& color);
@@ -278,7 +279,7 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
virtual void RePosChildWnd();
virtual void DrawThisAppearance(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device);
+ const CFX_Matrix& mtUser2Device);
virtual void OnCreate(PWL_CREATEPARAM& cp);
virtual void OnCreated();
@@ -314,7 +315,8 @@ class CPWL_Wnd : public CPWL_TimerHandler, public CFX_Observable<CPWL_Wnd> {
CFX_PointF ParentToChild(const CFX_PointF& point) const;
CFX_FloatRect ParentToChild(const CFX_FloatRect& rect) const;
- void DrawChildAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device);
+ void DrawChildAppearance(CFX_RenderDevice* pDevice,
+ const CFX_Matrix& mtUser2Device);
FX_RECT PWLtoWnd(const CFX_FloatRect& rect) const;