[deploy] Merge pull request #73 from KiwanoEngine/dev

fixes
This commit is contained in:
Haibo 2023-09-25 18:02:10 +08:00 committed by GitHub
commit 410a2be616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

View File

@ -106,25 +106,21 @@ public:
inline pointer_type operator->()
{
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
return ptr_;
}
inline const_pointer_type operator->() const
{
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
return ptr_;
}
inline reference_type operator*()
{
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
return *ptr_;
}
inline const_reference_type operator*() const
{
KGE_ASSERT(ptr_ != nullptr && "Invalid pointer");
return *ptr_;
}

View File

@ -47,6 +47,8 @@ public:
void ResetNative();
bool IsValid() const override;
protected:
Any native_;
};
@ -86,4 +88,9 @@ inline void NativeObject::ResetNative()
native_.Clear();
}
inline bool NativeObject::IsValid() const
{
return native_.HasValue() && ObjectBase::IsValid();
}
} // namespace kiwano

View File

@ -341,7 +341,9 @@ void RendererImpl::CreateTexture(Texture& texture, const PixelSize& size, const
hr = d2d_res_->GetDeviceContext()->CreateBitmap(
DX::ConvertToSizeU(size), data.buffer, UINT(size.x) * pitch,
D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_TARGET, D2D1::PixelFormat(dxgi_format)), &output);
D2D1::BitmapProperties1(D2D1_BITMAP_OPTIONS_TARGET,
D2D1::PixelFormat(dxgi_format, D2D1_ALPHA_MODE_PREMULTIPLIED)),
&output);
if (SUCCEEDED(hr))
{
ComPolicy::Set(texture, output);