mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-06-01 06:14:11 +08:00
Update release
This commit is contained in:
+192
-151
File diff suppressed because it is too large
Load Diff
+17
-3
@@ -813,6 +813,13 @@ Basic Construction
|
|||||||
virtual IGuiGraphicsRenderer* Create()=0;
|
virtual IGuiGraphicsRenderer* Create()=0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum RenderTargetFailure
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
ResizeWhileRendering,
|
||||||
|
LostDevice,
|
||||||
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is the interface for graphics renderer targets.
|
/// This is the interface for graphics renderer targets.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -827,7 +834,7 @@ Basic Construction
|
|||||||
/// Notify the target to stop rendering.
|
/// Notify the target to stop rendering.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Returns false to recreate render target.</returns>
|
/// <returns>Returns false to recreate render target.</returns>
|
||||||
virtual bool StopRendering()=0;
|
virtual RenderTargetFailure StopRendering()=0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Apply a clipper to the render target.
|
/// Apply a clipper to the render target.
|
||||||
/// The result clipper is combined by all clippers in the clipper stack maintained by the render target.
|
/// The result clipper is combined by all clippers in the clipper stack maintained by the render target.
|
||||||
@@ -2981,6 +2988,11 @@ Resource Manager
|
|||||||
/// <param name="window">The specified window.</param>
|
/// <param name="window">The specified window.</param>
|
||||||
virtual void RecreateRenderTarget(INativeWindow* window) = 0;
|
virtual void RecreateRenderTarget(INativeWindow* window) = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Resize the render target to fit the current window size.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="window">The specified window.</param>
|
||||||
|
virtual void ResizeRenderTarget(INativeWindow* window) = 0;
|
||||||
|
/// <summary>
|
||||||
/// Get the renderer awared rich text document layout engine provider object.
|
/// Get the renderer awared rich text document layout engine provider object.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>Returns the layout provider.</returns>
|
/// <returns>Returns the layout provider.</returns>
|
||||||
@@ -6888,7 +6900,6 @@ Table Compositions
|
|||||||
collections::Array<vint> rowSizes;
|
collections::Array<vint> rowSizes;
|
||||||
collections::Array<vint> columnSizes;
|
collections::Array<vint> columnSizes;
|
||||||
|
|
||||||
Rect previousBounds;
|
|
||||||
Size previousContentMinSize;
|
Size previousContentMinSize;
|
||||||
Size tableContentMinSize;
|
Size tableContentMinSize;
|
||||||
|
|
||||||
@@ -8019,6 +8030,7 @@ Host
|
|||||||
vint FilterTitles();
|
vint FilterTitles();
|
||||||
void ClearAltHost();
|
void ClearAltHost();
|
||||||
void CloseAltHost();
|
void CloseAltHost();
|
||||||
|
void RefreshRelatedHostRecord(INativeWindow* nativeWindow);
|
||||||
|
|
||||||
void DisconnectCompositionInternal(GuiGraphicsComposition* composition);
|
void DisconnectCompositionInternal(GuiGraphicsComposition* composition);
|
||||||
void MouseCapture(const NativeWindowMouseInfo& info);
|
void MouseCapture(const NativeWindowMouseInfo& info);
|
||||||
@@ -10807,12 +10819,14 @@ List Control
|
|||||||
class ItemCallback : public IItemProviderCallback, public IItemArrangerCallback
|
class ItemCallback : public IItemProviderCallback, public IItemArrangerCallback
|
||||||
{
|
{
|
||||||
typedef collections::List<IItemStyleController*> StyleList;
|
typedef collections::List<IItemStyleController*> StyleList;
|
||||||
|
typedef collections::Dictionary<IItemStyleController*, Ptr<compositions::IGuiGraphicsEventHandler>> InstalledStyleMap;
|
||||||
protected:
|
protected:
|
||||||
GuiListControl* listControl;
|
GuiListControl* listControl;
|
||||||
IItemProvider* itemProvider;
|
IItemProvider* itemProvider;
|
||||||
StyleList cachedStyles;
|
StyleList cachedStyles;
|
||||||
StyleList installedStyles;
|
InstalledStyleMap installedStyles;
|
||||||
|
|
||||||
|
void OnStyleBoundsChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments);
|
||||||
public:
|
public:
|
||||||
ItemCallback(GuiListControl* _listControl);
|
ItemCallback(GuiListControl* _listControl);
|
||||||
~ItemCallback();
|
~ItemCallback();
|
||||||
|
|||||||
+163
-29
@@ -2915,21 +2915,29 @@ GuiInstanceContext
|
|||||||
errors.Add(GuiResourceError({ {resource},element->codeRange.start }, L"ref.Parameter requires the following attributes existing at the same time: Name, Class."));
|
errors.Add(GuiResourceError({ {resource},element->codeRange.start }, L"ref.Parameter requires the following attributes existing at the same time: Name, Class."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (element->name.value == L"ref.Members")
|
|
||||||
{
|
#define COLLECT_SCRIPT(NAME, SCRIPT, POSITION)\
|
||||||
if (element->subNodes.Count() == 1)
|
(element->name.value == L"ref." #NAME)\
|
||||||
{
|
{\
|
||||||
if (auto cdata = element->subNodes[0].Cast<XmlCData>())
|
if (element->subNodes.Count() == 1)\
|
||||||
{
|
{\
|
||||||
context->memberScript = cdata->content.value;
|
if (auto cdata = element->subNodes[0].Cast<XmlCData>())\
|
||||||
context->memberPosition = { {resource},cdata->codeRange.start };
|
{\
|
||||||
context->memberPosition.column += 9; // <
|
auto parseClassMembers = [&](const WString& code, const WString& name, List<Ptr<WfDeclaration>>& memberDecls, GuiResourceTextPos position)
|
||||||
{
|
{
|
||||||
WString wrappedCode = L"module parse_members; class Class {\r\n" + code + L"\r\n}";
|
WString wrappedCode = L"module parse_members; class Class {\r\n" + code + L"\r\n}";
|
||||||
@@ -7340,6 +7367,10 @@ Workflow_GenerateInstanceClass
|
|||||||
return block;
|
return block;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// ref.Members
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
if (context->memberScript != L"")
|
if (context->memberScript != L"")
|
||||||
{
|
{
|
||||||
List<Ptr<WfDeclaration>> memberDecls;
|
List<Ptr<WfDeclaration>> memberDecls;
|
||||||
@@ -7360,6 +7391,10 @@ Workflow_GenerateInstanceClass
|
|||||||
CopyFrom(instanceClass->declarations, memberDecls, true);
|
CopyFrom(instanceClass->declarations, memberDecls, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// Constructor Declaration
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
auto ctor = MakePtr<WfConstructorDeclaration>();
|
auto ctor = MakePtr<WfConstructorDeclaration>();
|
||||||
ctor->constructorType = WfConstructorType::RawPtr;
|
ctor->constructorType = WfConstructorType::RawPtr;
|
||||||
auto ctorBlock = (beforePrecompile ? notImplemented() : MakePtr<WfBlockStatement>());
|
auto ctorBlock = (beforePrecompile ? notImplemented() : MakePtr<WfBlockStatement>());
|
||||||
@@ -7393,6 +7428,10 @@ Workflow_GenerateInstanceClass
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// ref.Parameter (Variable, Getter, CtorArgument)
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
FOREACH(Ptr<GuiInstanceParameter>, param, context->parameters)
|
FOREACH(Ptr<GuiInstanceParameter>, param, context->parameters)
|
||||||
{
|
{
|
||||||
if (auto type = Workflow_ParseType(precompileContext, { resolvingResult.resource }, param->className.ToString() + L"^", param->classPosition, errors))
|
if (auto type = Workflow_ParseType(precompileContext, { resolvingResult.resource }, param->className.ToString() + L"^", param->classPosition, errors))
|
||||||
@@ -7476,13 +7515,22 @@ Workflow_GenerateInstanceClass
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// Event Handlers
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
if (needEventHandler)
|
if (needEventHandler)
|
||||||
{
|
{
|
||||||
WorkflowEventNamesVisitor visitor(precompileContext, resolvingResult, instanceClass, errors);
|
WorkflowEventNamesVisitor visitor(precompileContext, resolvingResult, instanceClass, errors);
|
||||||
context->instance->Accept(&visitor);
|
context->instance->Accept(&visitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
addDecl(ctor);
|
addDecl(ctor);
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// Calling Constructor Class
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
if (!beforePrecompile)
|
if (!beforePrecompile)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -7574,13 +7622,97 @@ Workflow_GenerateInstanceClass
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// ref.Ctor
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if (context->ctorScript != L"")
|
||||||
|
{
|
||||||
|
if (auto stat = Workflow_ParseStatement(precompileContext, { resolvingResult.resource }, context->ctorScript, context->ctorPosition, errors))
|
||||||
|
{
|
||||||
|
if (!beforePrecompile)
|
||||||
|
{
|
||||||
|
if (!stat.Cast<WfBlockStatement>())
|
||||||
{
|
{
|
||||||
auto dtor = MakePtr<WfDestructorDeclaration>();
|
|
||||||
addDecl(dtor);
|
|
||||||
|
|
||||||
auto block = MakePtr<WfBlockStatement>();
|
auto block = MakePtr<WfBlockStatement>();
|
||||||
dtor->statement = block;
|
block->statements.Add(stat);
|
||||||
|
stat = block;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto decl = MakePtr<WfFunctionDeclaration>();
|
||||||
|
decl->anonymity = WfFunctionAnonymity::Named;
|
||||||
|
decl->name.value = L"<instance-ctor>";
|
||||||
|
decl->returnType = GetTypeFromTypeInfo(TypeInfoRetriver<void>::CreateTypeInfo().Obj());
|
||||||
|
decl->statement = stat;
|
||||||
|
addDecl(decl);
|
||||||
|
|
||||||
|
{
|
||||||
|
auto refCtor = MakePtr<WfReferenceExpression>();
|
||||||
|
refCtor->name.value = L"<instance-ctor>";
|
||||||
|
|
||||||
|
auto callExpr = MakePtr<WfCallExpression>();
|
||||||
|
callExpr->function = refCtor;
|
||||||
|
|
||||||
|
auto exprStat = MakePtr<WfExpressionStatement>();
|
||||||
|
exprStat->expression = callExpr;
|
||||||
|
ctorBlock->statements.Add(exprStat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// Destructor
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
auto dtor = MakePtr<WfDestructorDeclaration>();
|
||||||
|
auto dtorBlock = MakePtr<WfBlockStatement>();
|
||||||
|
dtor->statement = dtorBlock;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// ref.Dtor
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
if (context->dtorScript != L"")
|
||||||
|
{
|
||||||
|
if (auto stat = Workflow_ParseStatement(precompileContext, { resolvingResult.resource }, context->dtorScript, context->dtorPosition, errors))
|
||||||
|
{
|
||||||
|
if (!beforePrecompile)
|
||||||
|
{
|
||||||
|
if (!stat.Cast<WfBlockStatement>())
|
||||||
|
{
|
||||||
|
auto block = MakePtr<WfBlockStatement>();
|
||||||
|
block->statements.Add(stat);
|
||||||
|
stat = block;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto decl = MakePtr<WfFunctionDeclaration>();
|
||||||
|
decl->anonymity = WfFunctionAnonymity::Named;
|
||||||
|
decl->name.value = L"<instance-dtor>";
|
||||||
|
decl->returnType = GetTypeFromTypeInfo(TypeInfoRetriver<void>::CreateTypeInfo().Obj());
|
||||||
|
decl->statement = stat;
|
||||||
|
addDecl(decl);
|
||||||
|
|
||||||
|
{
|
||||||
|
auto refDtor = MakePtr<WfReferenceExpression>();
|
||||||
|
refDtor->name.value = L"<instance-dtor>";
|
||||||
|
|
||||||
|
auto callExpr = MakePtr<WfCallExpression>();
|
||||||
|
callExpr->function = refDtor;
|
||||||
|
|
||||||
|
auto exprStat = MakePtr<WfExpressionStatement>();
|
||||||
|
exprStat->expression = callExpr;
|
||||||
|
dtorBlock->statements.Add(exprStat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
// Clear Binding Subscriptions
|
||||||
|
///////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
{
|
||||||
auto ref = MakePtr<WfReferenceExpression>();
|
auto ref = MakePtr<WfReferenceExpression>();
|
||||||
ref->name.value = L"ClearSubscriptions";
|
ref->name.value = L"ClearSubscriptions";
|
||||||
|
|
||||||
@@ -7589,9 +7721,11 @@ Workflow_GenerateInstanceClass
|
|||||||
|
|
||||||
auto stat = MakePtr<WfExpressionStatement>();
|
auto stat = MakePtr<WfExpressionStatement>();
|
||||||
stat->expression = call;
|
stat->expression = call;
|
||||||
block->statements.Add(stat);
|
dtorBlock->statements.Add(stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addDecl(dtor);
|
||||||
|
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -362,11 +362,15 @@ Instance Context
|
|||||||
|
|
||||||
ParameterList parameters;
|
ParameterList parameters;
|
||||||
WString memberScript;
|
WString memberScript;
|
||||||
|
WString ctorScript;
|
||||||
|
WString dtorScript;
|
||||||
|
|
||||||
GuiResourceTextPos tagPosition;
|
GuiResourceTextPos tagPosition;
|
||||||
GuiResourceTextPos classPosition;
|
GuiResourceTextPos classPosition;
|
||||||
GuiResourceTextPos stylePosition;
|
GuiResourceTextPos stylePosition;
|
||||||
GuiResourceTextPos memberPosition;
|
GuiResourceTextPos memberPosition;
|
||||||
|
GuiResourceTextPos ctorPosition;
|
||||||
|
GuiResourceTextPos dtorPosition;
|
||||||
|
|
||||||
bool appliedStyles = false;
|
bool appliedStyles = false;
|
||||||
StyleContextList styles;
|
StyleContextList styles;
|
||||||
|
|||||||
+132
-63
@@ -1627,6 +1627,13 @@ Windows Platform Native Controller
|
|||||||
|
|
||||||
void EnableCrossKernelCrashing()
|
void EnableCrossKernelCrashing()
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options"
|
||||||
|
DWORD DisableUserModeCallbackFilter = 1
|
||||||
|
|
||||||
|
"HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\TestCppCodegen.exe"
|
||||||
|
DWORD DisableUserModeCallbackFilter = 1
|
||||||
|
*/
|
||||||
typedef BOOL (WINAPI *tGetPolicy)(LPDWORD lpFlags);
|
typedef BOOL (WINAPI *tGetPolicy)(LPDWORD lpFlags);
|
||||||
typedef BOOL (WINAPI *tSetPolicy)(DWORD dwFlags);
|
typedef BOOL (WINAPI *tSetPolicy)(DWORD dwFlags);
|
||||||
const DWORD EXCEPTION_SWALLOWING = 0x1;
|
const DWORD EXCEPTION_SWALLOWING = 0x1;
|
||||||
@@ -1660,6 +1667,8 @@ namespace vl
|
|||||||
{
|
{
|
||||||
namespace presentation
|
namespace presentation
|
||||||
{
|
{
|
||||||
|
using namespace elements;
|
||||||
|
|
||||||
namespace windows
|
namespace windows
|
||||||
{
|
{
|
||||||
using namespace vl::collections;
|
using namespace vl::collections;
|
||||||
@@ -1673,6 +1682,8 @@ WindowListener
|
|||||||
protected:
|
protected:
|
||||||
ID2D1Factory* d2dFactory;
|
ID2D1Factory* d2dFactory;
|
||||||
INativeWindow* window;
|
INativeWindow* window;
|
||||||
|
bool rendering = false;
|
||||||
|
bool movedWhileRendering = false;
|
||||||
|
|
||||||
virtual void RebuildCanvas(Size size) = 0;
|
virtual void RebuildCanvas(Size size) = 0;
|
||||||
public:
|
public:
|
||||||
@@ -1683,10 +1694,39 @@ WindowListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Moved()
|
void Moved()
|
||||||
|
{
|
||||||
|
if (rendering)
|
||||||
|
{
|
||||||
|
movedWhileRendering = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ResizeRenderTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResizeRenderTarget()
|
||||||
{
|
{
|
||||||
RebuildCanvas(window->GetClientSize());
|
RebuildCanvas(window->GetClientSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void StartRendering()
|
||||||
|
{
|
||||||
|
rendering = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StopRendering()
|
||||||
|
{
|
||||||
|
rendering = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RetrieveAndResetMovedWhileRendering()
|
||||||
|
{
|
||||||
|
bool result = movedWhileRendering;
|
||||||
|
movedWhileRendering = false;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
virtual ID2D1RenderTarget* GetDirect2DRenderTarget() = 0;
|
virtual ID2D1RenderTarget* GetDirect2DRenderTarget() = 0;
|
||||||
virtual void RecreateRenderTarget() = 0;
|
virtual void RecreateRenderTarget() = 0;
|
||||||
virtual bool PresentRenderTarget() = 0;
|
virtual bool PresentRenderTarget() = 0;
|
||||||
@@ -2067,40 +2107,6 @@ ControllerListener
|
|||||||
|
|
||||||
Direct2DWindowsNativeControllerListener* direct2DListener=0;
|
Direct2DWindowsNativeControllerListener* direct2DListener=0;
|
||||||
|
|
||||||
Direct2DWindowsNativeWindowListener* GetNativeWindowListener(INativeWindow* window)
|
|
||||||
{
|
|
||||||
vint index = direct2DListener->nativeWindowListeners.Keys().IndexOf(window);
|
|
||||||
return index == -1
|
|
||||||
? 0
|
|
||||||
: direct2DListener->nativeWindowListeners.Values().Get(index).Obj();
|
|
||||||
}
|
|
||||||
|
|
||||||
ID2D1RenderTarget* GetNativeWindowDirect2DRenderTarget(INativeWindow* window)
|
|
||||||
{
|
|
||||||
if (auto listener = GetNativeWindowListener(window))
|
|
||||||
{
|
|
||||||
return listener->GetDirect2DRenderTarget();
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RecreateNativeWindowDirect2DRenderTarget(INativeWindow* window)
|
|
||||||
{
|
|
||||||
if (auto listener = GetNativeWindowListener(window))
|
|
||||||
{
|
|
||||||
return listener->RecreateRenderTarget();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool PresentNativeWindowDirect2DRenderTarget(INativeWindow* window)
|
|
||||||
{
|
|
||||||
if (auto listener = GetNativeWindowListener(window))
|
|
||||||
{
|
|
||||||
return listener->PresentRenderTarget();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
ID2D1Factory* GetDirect2DFactory()
|
ID2D1Factory* GetDirect2DFactory()
|
||||||
{
|
{
|
||||||
return direct2DListener->d2dFactory.Obj();
|
return direct2DListener->d2dFactory.Obj();
|
||||||
@@ -2125,48 +2131,107 @@ OS Supporting
|
|||||||
|
|
||||||
class WinDirect2DApplicationDirect2DObjectProvider : public IWindowsDirect2DObjectProvider
|
class WinDirect2DApplicationDirect2DObjectProvider : public IWindowsDirect2DObjectProvider
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
windows::Direct2DWindowsNativeWindowListener* GetNativeWindowListener(INativeWindow* window)
|
||||||
|
{
|
||||||
|
vint index = windows::direct2DListener->nativeWindowListeners.Keys().IndexOf(window);
|
||||||
|
return index == -1
|
||||||
|
? nullptr
|
||||||
|
: windows::direct2DListener->nativeWindowListeners.Values().Get(index).Obj();
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void RecreateRenderTarget(INativeWindow* window)
|
void RecreateRenderTarget(INativeWindow* window)override
|
||||||
{
|
{
|
||||||
vl::presentation::windows::RecreateNativeWindowDirect2DRenderTarget(window);
|
if (auto listener = GetNativeWindowListener(window))
|
||||||
|
{
|
||||||
|
return listener->RecreateRenderTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PresentRenderTarget(INativeWindow* window)
|
void ResizeRenderTarget(INativeWindow* window)override
|
||||||
{
|
{
|
||||||
return vl::presentation::windows::PresentNativeWindowDirect2DRenderTarget(window);
|
if (auto listener = GetNativeWindowListener(window))
|
||||||
|
{
|
||||||
|
return listener->ResizeRenderTarget();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ID2D1RenderTarget* GetNativeWindowDirect2DRenderTarget(INativeWindow* window)
|
ID2D1RenderTarget* GetNativeWindowDirect2DRenderTarget(INativeWindow* window)override
|
||||||
{
|
{
|
||||||
return vl::presentation::windows::GetNativeWindowDirect2DRenderTarget(window);
|
if (auto listener = GetNativeWindowListener(window))
|
||||||
|
{
|
||||||
|
return listener->GetDirect2DRenderTarget();
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ID2D1Factory* GetDirect2DFactory()
|
void StartRendering(INativeWindow* window)override
|
||||||
|
{
|
||||||
|
if (auto listener = GetNativeWindowListener(window))
|
||||||
|
{
|
||||||
|
listener->StartRendering();
|
||||||
|
if (auto renderTarget = listener->GetDirect2DRenderTarget())
|
||||||
|
{
|
||||||
|
renderTarget->BeginDraw();
|
||||||
|
renderTarget->Clear(D2D1::ColorF(D2D1::ColorF::Black));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RenderTargetFailure StopRenderingAndPresent(INativeWindow* window)override
|
||||||
|
{
|
||||||
|
if (auto listener = GetNativeWindowListener(window))
|
||||||
|
{
|
||||||
|
listener->StopRendering();
|
||||||
|
bool moved = listener->RetrieveAndResetMovedWhileRendering();
|
||||||
|
|
||||||
|
if (auto renderTarget = listener->GetDirect2DRenderTarget())
|
||||||
|
{
|
||||||
|
HRESULT hr = renderTarget->EndDraw();
|
||||||
|
if (hr == S_OK)
|
||||||
|
{
|
||||||
|
if (moved)
|
||||||
|
{
|
||||||
|
return RenderTargetFailure::ResizeWhileRendering;
|
||||||
|
}
|
||||||
|
else if (listener->PresentRenderTarget())
|
||||||
|
{
|
||||||
|
return RenderTargetFailure::None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return RenderTargetFailure::LostDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
ID2D1Factory* GetDirect2DFactory()override
|
||||||
{
|
{
|
||||||
return vl::presentation::windows::GetDirect2DFactory();
|
return vl::presentation::windows::GetDirect2DFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
IDWriteFactory* GetDirectWriteFactory()
|
IDWriteFactory* GetDirectWriteFactory()override
|
||||||
{
|
{
|
||||||
return vl::presentation::windows::GetDirectWriteFactory();
|
return vl::presentation::windows::GetDirectWriteFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
IWindowsDirect2DRenderTarget* GetBindedRenderTarget(INativeWindow* window)
|
IWindowsDirect2DRenderTarget* GetBindedRenderTarget(INativeWindow* window)override
|
||||||
{
|
{
|
||||||
return dynamic_cast<IWindowsDirect2DRenderTarget*>(vl::presentation::windows::GetWindowsForm(window)->GetGraphicsHandler());
|
return dynamic_cast<IWindowsDirect2DRenderTarget*>(vl::presentation::windows::GetWindowsForm(window)->GetGraphicsHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetBindedRenderTarget(INativeWindow* window, IWindowsDirect2DRenderTarget* renderTarget)
|
void SetBindedRenderTarget(INativeWindow* window, IWindowsDirect2DRenderTarget* renderTarget)override
|
||||||
{
|
{
|
||||||
vl::presentation::windows::GetWindowsForm(window)->SetGraphicsHandler(renderTarget);
|
vl::presentation::windows::GetWindowsForm(window)->SetGraphicsHandler(renderTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
IWICImagingFactory* GetWICImagingFactory()
|
IWICImagingFactory* GetWICImagingFactory()override
|
||||||
{
|
{
|
||||||
return vl::presentation::windows::GetWICImagingFactory();
|
return vl::presentation::windows::GetWICImagingFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
IWICBitmap* GetWICBitmap(INativeImageFrame* frame)
|
IWICBitmap* GetWICBitmap(INativeImageFrame* frame)override
|
||||||
{
|
{
|
||||||
return vl::presentation::windows::GetWICBitmap(frame);
|
return vl::presentation::windows::GetWICBitmap(frame);
|
||||||
}
|
}
|
||||||
@@ -9778,10 +9843,10 @@ WindowsGDIRenderTarget
|
|||||||
dc=GetWindowsGDIObjectProvider()->GetNativeWindowDC(window);
|
dc=GetWindowsGDIObjectProvider()->GetNativeWindowDC(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StopRendering()override
|
RenderTargetFailure StopRendering()override
|
||||||
{
|
{
|
||||||
dc = 0;
|
dc = 0;
|
||||||
return true;
|
return RenderTargetFailure::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PushClipper(Rect clipper)override
|
void PushClipper(Rect clipper)override
|
||||||
@@ -10053,6 +10118,10 @@ WindowsGDIResourceManager
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResizeRenderTarget(INativeWindow* window)override
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
IGuiGraphicsLayoutProvider* GetLayoutProvider()override
|
IGuiGraphicsLayoutProvider* GetLayoutProvider()override
|
||||||
{
|
{
|
||||||
return layoutProvider.Obj();
|
return layoutProvider.Obj();
|
||||||
@@ -13051,9 +13120,9 @@ WindowsDirect2DRenderTarget
|
|||||||
typedef SortedList<Ptr<WindowsDirect2DImageFrameCache>> ImageCacheList;
|
typedef SortedList<Ptr<WindowsDirect2DImageFrameCache>> ImageCacheList;
|
||||||
protected:
|
protected:
|
||||||
INativeWindow* window;
|
INativeWindow* window;
|
||||||
ID2D1RenderTarget* d2dRenderTarget;
|
ID2D1RenderTarget* d2dRenderTarget = nullptr;
|
||||||
List<Rect> clippers;
|
List<Rect> clippers;
|
||||||
vint clipperCoverWholeTargetCounter;
|
vint clipperCoverWholeTargetCounter = 0;
|
||||||
|
|
||||||
CachedSolidBrushAllocator solidBrushes;
|
CachedSolidBrushAllocator solidBrushes;
|
||||||
CachedLinearBrushAllocator linearBrushes;
|
CachedLinearBrushAllocator linearBrushes;
|
||||||
@@ -13089,8 +13158,6 @@ WindowsDirect2DRenderTarget
|
|||||||
public:
|
public:
|
||||||
WindowsDirect2DRenderTarget(INativeWindow* _window)
|
WindowsDirect2DRenderTarget(INativeWindow* _window)
|
||||||
:window(_window)
|
:window(_window)
|
||||||
,d2dRenderTarget(0)
|
|
||||||
,clipperCoverWholeTargetCounter(0)
|
|
||||||
{
|
{
|
||||||
solidBrushes.SetRenderTarget(this);
|
solidBrushes.SetRenderTarget(this);
|
||||||
linearBrushes.SetRenderTarget(this);
|
linearBrushes.SetRenderTarget(this);
|
||||||
@@ -13173,20 +13240,17 @@ WindowsDirect2DRenderTarget
|
|||||||
void StartRendering()override
|
void StartRendering()override
|
||||||
{
|
{
|
||||||
d2dRenderTarget = GetWindowsDirect2DObjectProvider()->GetNativeWindowDirect2DRenderTarget(window);
|
d2dRenderTarget = GetWindowsDirect2DObjectProvider()->GetNativeWindowDirect2DRenderTarget(window);
|
||||||
d2dRenderTarget->BeginDraw();
|
CHECK_ERROR(d2dRenderTarget, L"vl::presentation::elements_windows_d2d::WindowsDirect2DRenderTarget::StartRendering()#Invalid render target.");
|
||||||
d2dRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::Black));
|
|
||||||
|
GetWindowsDirect2DObjectProvider()->StartRendering(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StopRendering()override
|
RenderTargetFailure StopRendering()override
|
||||||
{
|
{
|
||||||
auto result = d2dRenderTarget->EndDraw();
|
CHECK_ERROR(d2dRenderTarget, L"vl::presentation::elements_windows_d2d::WindowsDirect2DRenderTarget::StartRendering()#Invalid render target.");
|
||||||
bool deviceAvailable = false;
|
auto result = GetWindowsDirect2DObjectProvider()->StopRenderingAndPresent(window);
|
||||||
if (result == S_OK)
|
d2dRenderTarget = nullptr;
|
||||||
{
|
return result;
|
||||||
deviceAvailable = GetWindowsDirect2DObjectProvider()->PresentRenderTarget(window);
|
|
||||||
}
|
|
||||||
d2dRenderTarget = 0;
|
|
||||||
return deviceAvailable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PushClipper(Rect clipper)override
|
void PushClipper(Rect clipper)override
|
||||||
@@ -13301,6 +13365,11 @@ WindowsGDIResourceManager
|
|||||||
NativeWindowCreated(window);
|
NativeWindowCreated(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResizeRenderTarget(INativeWindow* window)
|
||||||
|
{
|
||||||
|
GetWindowsDirect2DObjectProvider()->ResizeRenderTarget(window);
|
||||||
|
}
|
||||||
|
|
||||||
IGuiGraphicsLayoutProvider* GetLayoutProvider()override
|
IGuiGraphicsLayoutProvider* GetLayoutProvider()override
|
||||||
{
|
{
|
||||||
return layoutProvider.Obj();
|
return layoutProvider.Obj();
|
||||||
|
|||||||
+12
-12
@@ -650,9 +650,6 @@ namespace vl
|
|||||||
{
|
{
|
||||||
namespace windows
|
namespace windows
|
||||||
{
|
{
|
||||||
extern ID2D1RenderTarget* GetNativeWindowDirect2DRenderTarget(INativeWindow* window);
|
|
||||||
extern void RecreateNativeWindowDirect2DRenderTarget(INativeWindow* window);
|
|
||||||
extern bool PresentNativeWindowDirect2DRenderTarget(INativeWindow* window);
|
|
||||||
extern ID2D1Factory* GetDirect2DFactory();
|
extern ID2D1Factory* GetDirect2DFactory();
|
||||||
extern IDWriteFactory* GetDirectWriteFactory();
|
extern IDWriteFactory* GetDirectWriteFactory();
|
||||||
extern ID3D11Device* GetD3D11Device();
|
extern ID3D11Device* GetD3D11Device();
|
||||||
@@ -1935,15 +1932,18 @@ OS Supporting
|
|||||||
class IWindowsDirect2DObjectProvider : public Interface
|
class IWindowsDirect2DObjectProvider : public Interface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void RecreateRenderTarget(INativeWindow* window)=0;
|
virtual void RecreateRenderTarget(INativeWindow* window) = 0;
|
||||||
virtual bool PresentRenderTarget(INativeWindow* window)=0;
|
virtual void ResizeRenderTarget(INativeWindow* window) = 0;
|
||||||
virtual ID2D1RenderTarget* GetNativeWindowDirect2DRenderTarget(INativeWindow* window)=0;
|
virtual ID2D1RenderTarget* GetNativeWindowDirect2DRenderTarget(INativeWindow* window) = 0;
|
||||||
virtual ID2D1Factory* GetDirect2DFactory()=0;
|
virtual void StartRendering(INativeWindow* window) = 0;
|
||||||
virtual IDWriteFactory* GetDirectWriteFactory()=0;
|
virtual elements::RenderTargetFailure StopRenderingAndPresent(INativeWindow* window) = 0;
|
||||||
virtual IWindowsDirect2DRenderTarget* GetBindedRenderTarget(INativeWindow* window)=0;
|
|
||||||
virtual void SetBindedRenderTarget(INativeWindow* window, IWindowsDirect2DRenderTarget* renderTarget)=0;
|
virtual ID2D1Factory* GetDirect2DFactory() = 0;
|
||||||
virtual IWICImagingFactory* GetWICImagingFactory()=0;
|
virtual IDWriteFactory* GetDirectWriteFactory() = 0;
|
||||||
virtual IWICBitmap* GetWICBitmap(INativeImageFrame* frame)=0;
|
virtual IWindowsDirect2DRenderTarget* GetBindedRenderTarget(INativeWindow* window) = 0;
|
||||||
|
virtual void SetBindedRenderTarget(INativeWindow* window, IWindowsDirect2DRenderTarget* renderTarget) = 0;
|
||||||
|
virtual IWICImagingFactory* GetWICImagingFactory() = 0;
|
||||||
|
virtual IWICBitmap* GetWICBitmap(INativeImageFrame* frame) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern IWindowsDirect2DObjectProvider* GetWindowsDirect2DObjectProvider();
|
extern IWindowsDirect2DObjectProvider* GetWindowsDirect2DObjectProvider();
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user