Fix bug 65583

This commit is contained in:
Oleg Korshul
2024-02-18 22:10:54 +03:00
parent 0ff68fcd8d
commit 7d6a95d521
10 changed files with 199 additions and 48 deletions

View File

@ -564,3 +564,14 @@ JSSmart<CJSValue> CGraphicsEmbed::GetTransform()
e->set("ty", res.ty);
return e->toValue();
}
JSSmart<CJSValue> CGraphicsEmbed::CreateLayer(JSSmart<CJSValue> opacity)
{
m_pInternal->CreateLayer(opacity->toDouble());
return NULL;
}
JSSmart<CJSValue> CGraphicsEmbed::BlendLayer()
{
m_pInternal->BlendLayer();
return NULL;
}

View File

@ -82,11 +82,11 @@ public:
JSSmart<CJSValue> drawHorLine (JSSmart<CJSValue> align, JSSmart<CJSValue> y, JSSmart<CJSValue> x, JSSmart<CJSValue> r, JSSmart<CJSValue> penW);
JSSmart<CJSValue> drawHorLine2(JSSmart<CJSValue> align, JSSmart<CJSValue> y, JSSmart<CJSValue> x, JSSmart<CJSValue> r, JSSmart<CJSValue> penW);
JSSmart<CJSValue> drawVerLine (JSSmart<CJSValue> align, JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> b, JSSmart<CJSValue> penW);
// мега крутые функции для таблиц
JSSmart<CJSValue> drawHorLineExt(JSSmart<CJSValue> align, JSSmart<CJSValue> y, JSSmart<CJSValue> x, JSSmart<CJSValue> r, JSSmart<CJSValue> penW, JSSmart<CJSValue> leftMW, JSSmart<CJSValue> rightMW);
JSSmart<CJSValue> rect (JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
JSSmart<CJSValue> TableRect(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
// функции клиппирования
JSSmart<CJSValue> AddClipRect(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
JSSmart<CJSValue> RemoveClipRect();
JSSmart<CJSValue> SetClip(JSSmart<CJSValue> x, JSSmart<CJSValue> y, JSSmart<CJSValue> w, JSSmart<CJSValue> h);
@ -132,6 +132,10 @@ public:
JSSmart<CJSValue> CoordTransformOffset(JSSmart<CJSValue> tx, JSSmart<CJSValue> ty);
JSSmart<CJSValue> GetTransform();
// layer
JSSmart<CJSValue> CreateLayer(JSSmart<CJSValue> opacity);
JSSmart<CJSValue> BlendLayer();
DECLARE_EMBED_METHODS
};

View File

@ -176,7 +176,7 @@ JSSmart<CJSValue> CZipEmbed::encodeImageData(JSSmart<CJSValue> typedArray, JSSma
if (oFrame.Encode(pBuffer, nEncodedSize, format->toInt32()))
{
BYTE* pData = NSAllocator::Alloc((size_t)nEncodedSize);
memcpy(pData, oFrame.get_Data(), (size_t)nEncodedSize);
memcpy(pData, pBuffer, (size_t)nEncodedSize);
oFrame.FreeEncodedMemory(pBuffer);
oFrame.put_Data(NULL);
@ -230,7 +230,7 @@ JSSmart<CJSValue> CZipEmbed::encodeImage(JSSmart<CJSValue> typedArray, JSSmart<C
if (oFrame.Encode(pBuffer, nEncodedSize, format->toInt32()))
{
BYTE* pData = NSAllocator::Alloc((size_t)nEncodedSize);
memcpy(pData, oFrame.get_Data(), (size_t)nEncodedSize);
memcpy(pData, pBuffer, (size_t)nEncodedSize);
oFrame.FreeEncodedMemory(pBuffer);
oFrame.put_Data(NULL);

View File

@ -108,6 +108,8 @@
-(JSValue*) DrawPath : (JSValue*)path;
-(JSValue*) CoordTransformOffset : (JSValue*)tx : (JSValue*)ty;
-(JSValue*) GetTransform;
-(JSValue*) CreateLayer : (JSValue*)opacity;
-(JSValue*) BlendLayer;
@end
@interface CJSCGraphicsEmbed : NSObject<IJSCGraphicsEmbed, JSEmbedObjectProtocol>
@ -223,6 +225,8 @@ FUNCTION_WRAPPER_JS_0(GetlineWidth, GetlineWidth)
FUNCTION_WRAPPER_JS_1(DrawPath, DrawPath)
FUNCTION_WRAPPER_JS_2(CoordTransformOffset, CoordTransformOffset)
FUNCTION_WRAPPER_JS_0(GetTransform, GetTransform)
FUNCTION_WRAPPER_JS_1(CreateLayer, CreateLayer)
FUNCTION_WRAPPER_JS_0(BlendLayer, BlendLayer)
@end
class CGraphicsEmbedAdapter : public CJSEmbedObjectAdapterJSC

View File

@ -111,6 +111,8 @@ namespace NSGraphicsEmbed
FUNCTION_WRAPPER_V8_1(_DrawPath, DrawPath)
FUNCTION_WRAPPER_V8_2(_CoordTransformOffset, CoordTransformOffset)
FUNCTION_WRAPPER_V8_0(_GetTransform, GetTransform)
FUNCTION_WRAPPER_V8_1(_CreateLayer, CreateLayer)
FUNCTION_WRAPPER_V8_0(_BlendLayer, BlendLayer)
v8::Handle<v8::ObjectTemplate> CreateTemplate(v8::Isolate* isolate)
{
@ -221,6 +223,8 @@ namespace NSGraphicsEmbed
NSV8Objects::Template_Set(result, "DrawPath", _DrawPath);
NSV8Objects::Template_Set(result, "CoordTransformOffset", _CoordTransformOffset);
NSV8Objects::Template_Set(result, "GetTransform", _GetTransform);
NSV8Objects::Template_Set(result, "CreateLayer", _CreateLayer);
NSV8Objects::Template_Set(result, "BlendLayer", _BlendLayer);
return handle_scope.Escape(result);
}