Skip to content

Commit

Permalink
For bug 72964
Browse files Browse the repository at this point in the history
  • Loading branch information
K0R0L committed Feb 8, 2025
1 parent 2f4b744 commit 896427d
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions DesktopEditor/doctrenderer/embed/GraphicsEmbed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,30 @@ void CGraphicsEmbed::SetAppImage(CGraphicsAppImage* appImage)

JSSmart<CJSValue> CGraphicsEmbed::create(JSSmart<CJSValue> Native, JSSmart<CJSValue> width_px, JSSmart<CJSValue> height_px, JSSmart<CJSValue> width_mm, JSSmart<CJSValue> height_mm)
{
NSNativeControl::CNativeControl* pControl = NULL;
if (!Native->isNull())
{
pControl = (NSNativeControl::CNativeControl*)Native->toObject()->getNative()->getObject();
JSSmart<CJSObject> pNativeObject = Native->toObject();
CJSEmbedObject* pNativeEmbedObject = pNativeObject->getNative();

if (m_pInternal->m_pAppImage)
delete m_pInternal->m_pAppImage;
m_pInternal->m_pAppImage = new CGraphicsAppImage();
m_pInternal->m_pAppImage->SetFontsDirectory(pControl->m_strFontsDirectory);
m_pInternal->m_pAppImage->SetImagesDirectory(pControl->m_strImagesDirectory);

if (pNativeEmbedObject)
{
NSNativeControl::CNativeControl* pControl = (NSNativeControl::CNativeControl*)pNativeEmbedObject->getObject();
m_pInternal->m_pAppImage->SetFontsDirectory(pControl->m_strFontsDirectory);
m_pInternal->m_pAppImage->SetImagesDirectory(pControl->m_strImagesDirectory);
}
else
{
JSSmart<CJSValue> checkResources = pNativeObject->get("isResourcesObject");
if (checkResources->isBool() && true == checkResources->toBool())
{
m_pInternal->m_pAppImage->SetFontsDirectory(pNativeObject->get("fontsDirectory")->toStringW());
m_pInternal->m_pAppImage->SetImagesDirectory(pNativeObject->get("imagesDirectory")->toStringW());
}
}
}

m_pInternal->init(width_px->toDouble(), height_px->toDouble(), width_mm->toDouble(), height_mm->toDouble());
Expand Down

0 comments on commit 896427d

Please sign in to comment.