mirror of
https://github.com/vczh-libraries/Release.git
synced 2026-05-27 18:25:27 +08:00
Update release
This commit is contained in:
+197
-156
File diff suppressed because it is too large
Load Diff
+18
-4
@@ -813,6 +813,13 @@ Basic Construction
|
||||
virtual IGuiGraphicsRenderer* Create()=0;
|
||||
};
|
||||
|
||||
enum RenderTargetFailure
|
||||
{
|
||||
None,
|
||||
ResizeWhileRendering,
|
||||
LostDevice,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// This is the interface for graphics renderer targets.
|
||||
/// </summary>
|
||||
@@ -827,7 +834,7 @@ Basic Construction
|
||||
/// Notify the target to stop rendering.
|
||||
/// </summary>
|
||||
/// <returns>Returns false to recreate render target.</returns>
|
||||
virtual bool StopRendering()=0;
|
||||
virtual RenderTargetFailure StopRendering()=0;
|
||||
/// <summary>
|
||||
/// Apply a clipper to 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>
|
||||
virtual void RecreateRenderTarget(INativeWindow* window) = 0;
|
||||
/// <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.
|
||||
/// </summary>
|
||||
/// <returns>Returns the layout provider.</returns>
|
||||
@@ -6888,7 +6900,6 @@ Table Compositions
|
||||
collections::Array<vint> rowSizes;
|
||||
collections::Array<vint> columnSizes;
|
||||
|
||||
Rect previousBounds;
|
||||
Size previousContentMinSize;
|
||||
Size tableContentMinSize;
|
||||
|
||||
@@ -8019,6 +8030,7 @@ Host
|
||||
vint FilterTitles();
|
||||
void ClearAltHost();
|
||||
void CloseAltHost();
|
||||
void RefreshRelatedHostRecord(INativeWindow* nativeWindow);
|
||||
|
||||
void DisconnectCompositionInternal(GuiGraphicsComposition* composition);
|
||||
void MouseCapture(const NativeWindowMouseInfo& info);
|
||||
@@ -10806,13 +10818,15 @@ List Control
|
||||
|
||||
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:
|
||||
GuiListControl* listControl;
|
||||
IItemProvider* itemProvider;
|
||||
StyleList cachedStyles;
|
||||
StyleList installedStyles;
|
||||
InstalledStyleMap installedStyles;
|
||||
|
||||
void OnStyleBoundsChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments);
|
||||
public:
|
||||
ItemCallback(GuiListControl* _listControl);
|
||||
~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."));
|
||||
}
|
||||
}
|
||||
else if (element->name.value == L"ref.Members")
|
||||
{
|
||||
if (element->subNodes.Count() == 1)
|
||||
{
|
||||
if (auto cdata = element->subNodes[0].Cast<XmlCData>())
|
||||
{
|
||||
context->memberScript = cdata->content.value;
|
||||
context->memberPosition = { {resource},cdata->codeRange.start };
|
||||
context->memberPosition.column += 9; // <![CDATA[
|
||||
goto MEMBERSCRIPT_SUCCESS;
|
||||
}
|
||||
}
|
||||
errors.Add(GuiResourceError({ {resource},element->codeRange.start }, L"Script should be contained in a CDATA section."));
|
||||
MEMBERSCRIPT_SUCCESS:;
|
||||
}
|
||||
|
||||
#define COLLECT_SCRIPT(NAME, SCRIPT, POSITION)\
|
||||
(element->name.value == L"ref." #NAME)\
|
||||
{\
|
||||
if (element->subNodes.Count() == 1)\
|
||||
{\
|
||||
if (auto cdata = element->subNodes[0].Cast<XmlCData>())\
|
||||
{\
|
||||
context->SCRIPT = cdata->content.value;\
|
||||
context->POSITION = { {resource},cdata->codeRange.start };\
|
||||
context->POSITION.column += 9; /* <
|
||||
{
|
||||
WString wrappedCode = L"module parse_members; class Class {\r\n" + code + L"\r\n}";
|
||||
@@ -7340,6 +7367,10 @@ Workflow_GenerateInstanceClass
|
||||
return block;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// ref.Members
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
if (context->memberScript != L"")
|
||||
{
|
||||
List<Ptr<WfDeclaration>> memberDecls;
|
||||
@@ -7360,6 +7391,10 @@ Workflow_GenerateInstanceClass
|
||||
CopyFrom(instanceClass->declarations, memberDecls, true);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Constructor Declaration
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
auto ctor = MakePtr<WfConstructorDeclaration>();
|
||||
ctor->constructorType = WfConstructorType::RawPtr;
|
||||
auto ctorBlock = (beforePrecompile ? notImplemented() : MakePtr<WfBlockStatement>());
|
||||
@@ -7393,6 +7428,10 @@ Workflow_GenerateInstanceClass
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// ref.Parameter (Variable, Getter, CtorArgument)
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
FOREACH(Ptr<GuiInstanceParameter>, param, context->parameters)
|
||||
{
|
||||
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)
|
||||
{
|
||||
WorkflowEventNamesVisitor visitor(precompileContext, resolvingResult, instanceClass, errors);
|
||||
context->instance->Accept(&visitor);
|
||||
}
|
||||
|
||||
addDecl(ctor);
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Calling Constructor Class
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
if (!beforePrecompile)
|
||||
{
|
||||
{
|
||||
@@ -7574,13 +7622,97 @@ Workflow_GenerateInstanceClass
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// ref.Ctor
|
||||
///////////////////////////////////////////////////////////////
|
||||
|
||||
if (context->ctorScript != L"")
|
||||
{
|
||||
auto dtor = MakePtr<WfDestructorDeclaration>();
|
||||
addDecl(dtor);
|
||||
if (auto stat = Workflow_ParseStatement(precompileContext, { resolvingResult.resource }, context->ctorScript, context->ctorPosition, errors))
|
||||
{
|
||||
if (!beforePrecompile)
|
||||
{
|
||||
if (!stat.Cast<WfBlockStatement>())
|
||||
{
|
||||
auto block = MakePtr<WfBlockStatement>();
|
||||
block->statements.Add(stat);
|
||||
stat = block;
|
||||
}
|
||||
|
||||
auto block = MakePtr<WfBlockStatement>();
|
||||
dtor->statement = 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>();
|
||||
ref->name.value = L"ClearSubscriptions";
|
||||
|
||||
@@ -7589,9 +7721,11 @@ Workflow_GenerateInstanceClass
|
||||
|
||||
auto stat = MakePtr<WfExpressionStatement>();
|
||||
stat->expression = call;
|
||||
block->statements.Add(stat);
|
||||
dtorBlock->statements.Add(stat);
|
||||
}
|
||||
|
||||
addDecl(dtor);
|
||||
|
||||
return module;
|
||||
}
|
||||
|
||||
|
||||
@@ -362,11 +362,15 @@ Instance Context
|
||||
|
||||
ParameterList parameters;
|
||||
WString memberScript;
|
||||
WString ctorScript;
|
||||
WString dtorScript;
|
||||
|
||||
GuiResourceTextPos tagPosition;
|
||||
GuiResourceTextPos classPosition;
|
||||
GuiResourceTextPos stylePosition;
|
||||
GuiResourceTextPos memberPosition;
|
||||
GuiResourceTextPos ctorPosition;
|
||||
GuiResourceTextPos dtorPosition;
|
||||
|
||||
bool appliedStyles = false;
|
||||
StyleContextList styles;
|
||||
|
||||
+132
-63
@@ -1627,6 +1627,13 @@ Windows Platform Native Controller
|
||||
|
||||
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 *tSetPolicy)(DWORD dwFlags);
|
||||
const DWORD EXCEPTION_SWALLOWING = 0x1;
|
||||
@@ -1660,6 +1667,8 @@ namespace vl
|
||||
{
|
||||
namespace presentation
|
||||
{
|
||||
using namespace elements;
|
||||
|
||||
namespace windows
|
||||
{
|
||||
using namespace vl::collections;
|
||||
@@ -1673,6 +1682,8 @@ WindowListener
|
||||
protected:
|
||||
ID2D1Factory* d2dFactory;
|
||||
INativeWindow* window;
|
||||
bool rendering = false;
|
||||
bool movedWhileRendering = false;
|
||||
|
||||
virtual void RebuildCanvas(Size size) = 0;
|
||||
public:
|
||||
@@ -1683,10 +1694,39 @@ WindowListener
|
||||
}
|
||||
|
||||
void Moved()
|
||||
{
|
||||
if (rendering)
|
||||
{
|
||||
movedWhileRendering = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ResizeRenderTarget();
|
||||
}
|
||||
}
|
||||
|
||||
void ResizeRenderTarget()
|
||||
{
|
||||
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 void RecreateRenderTarget() = 0;
|
||||
virtual bool PresentRenderTarget() = 0;
|
||||
@@ -2067,40 +2107,6 @@ ControllerListener
|
||||
|
||||
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()
|
||||
{
|
||||
return direct2DListener->d2dFactory.Obj();
|
||||
@@ -2125,48 +2131,107 @@ OS Supporting
|
||||
|
||||
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:
|
||||
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();
|
||||
}
|
||||
|
||||
IDWriteFactory* GetDirectWriteFactory()
|
||||
IDWriteFactory* GetDirectWriteFactory()override
|
||||
{
|
||||
return vl::presentation::windows::GetDirectWriteFactory();
|
||||
}
|
||||
|
||||
IWindowsDirect2DRenderTarget* GetBindedRenderTarget(INativeWindow* window)
|
||||
IWindowsDirect2DRenderTarget* GetBindedRenderTarget(INativeWindow* window)override
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
IWICImagingFactory* GetWICImagingFactory()
|
||||
IWICImagingFactory* GetWICImagingFactory()override
|
||||
{
|
||||
return vl::presentation::windows::GetWICImagingFactory();
|
||||
}
|
||||
|
||||
IWICBitmap* GetWICBitmap(INativeImageFrame* frame)
|
||||
IWICBitmap* GetWICBitmap(INativeImageFrame* frame)override
|
||||
{
|
||||
return vl::presentation::windows::GetWICBitmap(frame);
|
||||
}
|
||||
@@ -9778,10 +9843,10 @@ WindowsGDIRenderTarget
|
||||
dc=GetWindowsGDIObjectProvider()->GetNativeWindowDC(window);
|
||||
}
|
||||
|
||||
bool StopRendering()override
|
||||
RenderTargetFailure StopRendering()override
|
||||
{
|
||||
dc = 0;
|
||||
return true;
|
||||
return RenderTargetFailure::None;
|
||||
}
|
||||
|
||||
void PushClipper(Rect clipper)override
|
||||
@@ -10053,6 +10118,10 @@ WindowsGDIResourceManager
|
||||
{
|
||||
}
|
||||
|
||||
void ResizeRenderTarget(INativeWindow* window)override
|
||||
{
|
||||
}
|
||||
|
||||
IGuiGraphicsLayoutProvider* GetLayoutProvider()override
|
||||
{
|
||||
return layoutProvider.Obj();
|
||||
@@ -13051,9 +13120,9 @@ WindowsDirect2DRenderTarget
|
||||
typedef SortedList<Ptr<WindowsDirect2DImageFrameCache>> ImageCacheList;
|
||||
protected:
|
||||
INativeWindow* window;
|
||||
ID2D1RenderTarget* d2dRenderTarget;
|
||||
ID2D1RenderTarget* d2dRenderTarget = nullptr;
|
||||
List<Rect> clippers;
|
||||
vint clipperCoverWholeTargetCounter;
|
||||
vint clipperCoverWholeTargetCounter = 0;
|
||||
|
||||
CachedSolidBrushAllocator solidBrushes;
|
||||
CachedLinearBrushAllocator linearBrushes;
|
||||
@@ -13089,8 +13158,6 @@ WindowsDirect2DRenderTarget
|
||||
public:
|
||||
WindowsDirect2DRenderTarget(INativeWindow* _window)
|
||||
:window(_window)
|
||||
,d2dRenderTarget(0)
|
||||
,clipperCoverWholeTargetCounter(0)
|
||||
{
|
||||
solidBrushes.SetRenderTarget(this);
|
||||
linearBrushes.SetRenderTarget(this);
|
||||
@@ -13173,20 +13240,17 @@ WindowsDirect2DRenderTarget
|
||||
void StartRendering()override
|
||||
{
|
||||
d2dRenderTarget = GetWindowsDirect2DObjectProvider()->GetNativeWindowDirect2DRenderTarget(window);
|
||||
d2dRenderTarget->BeginDraw();
|
||||
d2dRenderTarget->Clear(D2D1::ColorF(D2D1::ColorF::Black));
|
||||
CHECK_ERROR(d2dRenderTarget, L"vl::presentation::elements_windows_d2d::WindowsDirect2DRenderTarget::StartRendering()#Invalid render target.");
|
||||
|
||||
GetWindowsDirect2DObjectProvider()->StartRendering(window);
|
||||
}
|
||||
|
||||
bool StopRendering()override
|
||||
RenderTargetFailure StopRendering()override
|
||||
{
|
||||
auto result = d2dRenderTarget->EndDraw();
|
||||
bool deviceAvailable = false;
|
||||
if (result == S_OK)
|
||||
{
|
||||
deviceAvailable = GetWindowsDirect2DObjectProvider()->PresentRenderTarget(window);
|
||||
}
|
||||
d2dRenderTarget = 0;
|
||||
return deviceAvailable;
|
||||
CHECK_ERROR(d2dRenderTarget, L"vl::presentation::elements_windows_d2d::WindowsDirect2DRenderTarget::StartRendering()#Invalid render target.");
|
||||
auto result = GetWindowsDirect2DObjectProvider()->StopRenderingAndPresent(window);
|
||||
d2dRenderTarget = nullptr;
|
||||
return result;
|
||||
}
|
||||
|
||||
void PushClipper(Rect clipper)override
|
||||
@@ -13301,6 +13365,11 @@ WindowsGDIResourceManager
|
||||
NativeWindowCreated(window);
|
||||
}
|
||||
|
||||
void ResizeRenderTarget(INativeWindow* window)
|
||||
{
|
||||
GetWindowsDirect2DObjectProvider()->ResizeRenderTarget(window);
|
||||
}
|
||||
|
||||
IGuiGraphicsLayoutProvider* GetLayoutProvider()override
|
||||
{
|
||||
return layoutProvider.Obj();
|
||||
|
||||
+12
-12
@@ -650,9 +650,6 @@ namespace vl
|
||||
{
|
||||
namespace windows
|
||||
{
|
||||
extern ID2D1RenderTarget* GetNativeWindowDirect2DRenderTarget(INativeWindow* window);
|
||||
extern void RecreateNativeWindowDirect2DRenderTarget(INativeWindow* window);
|
||||
extern bool PresentNativeWindowDirect2DRenderTarget(INativeWindow* window);
|
||||
extern ID2D1Factory* GetDirect2DFactory();
|
||||
extern IDWriteFactory* GetDirectWriteFactory();
|
||||
extern ID3D11Device* GetD3D11Device();
|
||||
@@ -1935,15 +1932,18 @@ OS Supporting
|
||||
class IWindowsDirect2DObjectProvider : public Interface
|
||||
{
|
||||
public:
|
||||
virtual void RecreateRenderTarget(INativeWindow* window)=0;
|
||||
virtual bool PresentRenderTarget(INativeWindow* window)=0;
|
||||
virtual ID2D1RenderTarget* GetNativeWindowDirect2DRenderTarget(INativeWindow* window)=0;
|
||||
virtual ID2D1Factory* GetDirect2DFactory()=0;
|
||||
virtual IDWriteFactory* GetDirectWriteFactory()=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;
|
||||
virtual void RecreateRenderTarget(INativeWindow* window) = 0;
|
||||
virtual void ResizeRenderTarget(INativeWindow* window) = 0;
|
||||
virtual ID2D1RenderTarget* GetNativeWindowDirect2DRenderTarget(INativeWindow* window) = 0;
|
||||
virtual void StartRendering(INativeWindow* window) = 0;
|
||||
virtual elements::RenderTargetFailure StopRenderingAndPresent(INativeWindow* window) = 0;
|
||||
|
||||
virtual ID2D1Factory* GetDirect2DFactory() = 0;
|
||||
virtual IDWriteFactory* GetDirectWriteFactory() = 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();
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user