// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
+
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "../../include/pdfwindow/PDFWindow.h"
{
CFX_ByteTextBuf sAppStream;
- CFX_ByteString sAlias = this->GetImageAlias();
+ CFX_ByteString sAlias = GetImageAlias();
CPDF_Rect rcPlate = GetClientRect();
CPDF_Matrix mt;
mt.SetReverse(GetImageMatrix());
CPDF_Stream * CPWL_Image::GetPDFStream()
{
- return this->m_pPDFStream;
+ return m_pPDFStream;
}
void CPWL_Image::GetImageSize(FX_FLOAT & fWidth,FX_FLOAT & fHeight)
{
if (m_pPDFStream)
{
- if (CPDF_Dictionary * pDict = m_pPDFStream->GetDict())
+ if (CPDF_Dictionary * pDict = m_pPDFStream->GetDict())
{
return pDict->GetString("Name");
}
return CFX_ByteString();
}
-void CPWL_Image::SetImageAlias(FX_LPCSTR sImageAlias)
+void CPWL_Image::SetImageAlias(const FX_CHAR* sImageAlias)
{
m_sImageAlias = sImageAlias;
}
{
}
-FX_INT32 CPWL_Icon::GetScaleMethod()
+int32_t CPWL_Icon::GetScaleMethod()
{
if (m_pIconFit)
return m_pIconFit->GetScaleMethod();
//m_pIconFit->GetIconPosition(fLeft,fBottom);
fLeft = 0.0f;
fBottom = 0.0f;
- CPDF_Array* pA = m_pIconFit->m_pDict->GetArray("A");
+ CPDF_Array* pA = m_pIconFit->m_pDict ? m_pIconFit->m_pDict->GetArray("A") : NULL;
if (pA != NULL)
{
FX_DWORD dwCount = pA->GetCount();
{
fHScale = 1.0f;
fVScale = 1.0f;
-
+
if (m_pPDFStream)
{
FX_FLOAT fImageWidth,fImageHeight;
FX_FLOAT fPlateWidth,fPlateHeight;
- CPDF_Rect rcPlate = this->GetClientRect();
+ CPDF_Rect rcPlate = GetClientRect();
fPlateWidth = rcPlate.right - rcPlate.left;
fPlateHeight = rcPlate.top - rcPlate.bottom;
GetImageSize(fImageWidth,fImageHeight);
- FX_INT32 nScaleMethod = this->GetScaleMethod();
-
- /*
- enum ScaleMethod
- {
- Always = 0, //A, Always scale
- Bigger, //B, Scale only when the icon is bigger than the annotation rectangle
- Smaller, //S, Scale only when the icon is smaller then the annotation rectangle
- Never //N, Never scale
- };
- */
+ int32_t nScaleMethod = GetScaleMethod();
switch (nScaleMethod)
{
{
FX_FLOAT fLeft,fBottom;
- this->GetIconPosition(fLeft,fBottom);
+ GetIconPosition(fLeft, fBottom);
x = 0.0f;
y = 0.0f;
FX_FLOAT fImageFactHeight = fImageHeight * fVScale;
FX_FLOAT fPlateWidth,fPlateHeight;
- CPDF_Rect rcPlate = this->GetClientRect();
+ CPDF_Rect rcPlate = GetClientRect();
fPlateWidth = rcPlate.right - rcPlate.left;
fPlateHeight = rcPlate.top - rcPlate.bottom;