From 32aa6f116acc6e3e20a1ec76cef45b29f7005ad7 Mon Sep 17 00:00:00 2001 From: Yuqian Yang Date: Fri, 17 Oct 2025 12:06:14 +0800 Subject: Remove String stage 1. --- src/platform/graphics/direct2d/ImageFactory.cpp | 2 +- src/platform/graphics/direct2d/Painter.cpp | 24 ++++++++++++------------ src/platform/graphics/direct2d/TextLayout.cpp | 4 ++-- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/platform/graphics/direct2d') diff --git a/src/platform/graphics/direct2d/ImageFactory.cpp b/src/platform/graphics/direct2d/ImageFactory.cpp index b9e9221a..aff411c4 100644 --- a/src/platform/graphics/direct2d/ImageFactory.cpp +++ b/src/platform/graphics/direct2d/ImageFactory.cpp @@ -74,7 +74,7 @@ GUID ConvertImageFormatToGUID(ImageFormat format) { void WinImageFactory::EncodeToStream(IImage* image, io::Stream* stream, ImageFormat format, float quality) { - auto direct_image = CheckPlatform(image, GetPlatformIdUtf8()); + auto direct_image = CheckPlatform(image, GetPlatformId()); Microsoft::WRL::ComPtr com_stream( platform::win::ConvertStreamToComStream(stream)); diff --git a/src/platform/graphics/direct2d/Painter.cpp b/src/platform/graphics/direct2d/Painter.cpp index 29ddcabb..fabcdafd 100644 --- a/src/platform/graphics/direct2d/Painter.cpp +++ b/src/platform/graphics/direct2d/Painter.cpp @@ -55,7 +55,7 @@ void D2DDeviceContextPainter::Clear(const Color& color) { void D2DDeviceContextPainter::DrawLine(const Point& start, const Point& end, IBrush* brush, float width) { CheckValidation(); - const auto b = CheckPlatform(brush, GetPlatformIdUtf8()); + const auto b = CheckPlatform(brush, GetPlatformId()); device_context_->DrawLine(Convert(start), Convert(end), b->GetD2DBrushInterface(), width); } @@ -63,7 +63,7 @@ void D2DDeviceContextPainter::DrawLine(const Point& start, const Point& end, void D2DDeviceContextPainter::StrokeRectangle(const Rect& rectangle, IBrush* brush, float width) { CheckValidation(); - const auto b = CheckPlatform(brush, GetPlatformIdUtf8()); + const auto b = CheckPlatform(brush, GetPlatformId()); device_context_->DrawRectangle(Convert(rectangle), b->GetD2DBrushInterface(), width); } @@ -71,14 +71,14 @@ void D2DDeviceContextPainter::StrokeRectangle(const Rect& rectangle, void D2DDeviceContextPainter::FillRectangle(const Rect& rectangle, IBrush* brush) { CheckValidation(); - const auto b = CheckPlatform(brush, GetPlatformIdUtf8()); + const auto b = CheckPlatform(brush, GetPlatformId()); device_context_->FillRectangle(Convert(rectangle), b->GetD2DBrushInterface()); } void D2DDeviceContextPainter::StrokeEllipse(const Rect& outline_rect, IBrush* brush, float width) { CheckValidation(); - const auto b = CheckPlatform(brush, GetPlatformIdUtf8()); + const auto b = CheckPlatform(brush, GetPlatformId()); device_context_->DrawEllipse( D2D1::Ellipse(Convert(outline_rect.GetCenter()), outline_rect.width / 2.0f, outline_rect.height / 2.0f), @@ -87,7 +87,7 @@ void D2DDeviceContextPainter::StrokeEllipse(const Rect& outline_rect, void D2DDeviceContextPainter::FillEllipse(const Rect& outline_rect, IBrush* brush) { CheckValidation(); - const auto b = CheckPlatform(brush, GetPlatformIdUtf8()); + const auto b = CheckPlatform(brush, GetPlatformId()); device_context_->FillEllipse( D2D1::Ellipse(Convert(outline_rect.GetCenter()), outline_rect.width / 2.0f, outline_rect.height / 2.0f), @@ -97,16 +97,16 @@ void D2DDeviceContextPainter::FillEllipse(const Rect& outline_rect, void D2DDeviceContextPainter::StrokeGeometry(IGeometry* geometry, IBrush* brush, float width) { CheckValidation(); - const auto g = CheckPlatform(geometry, GetPlatformIdUtf8()); - const auto b = CheckPlatform(brush, GetPlatformIdUtf8()); + const auto g = CheckPlatform(geometry, GetPlatformId()); + const auto b = CheckPlatform(brush, GetPlatformId()); device_context_->DrawGeometry(g->GetComInterface(), b->GetD2DBrushInterface(), width); } void D2DDeviceContextPainter::FillGeometry(IGeometry* geometry, IBrush* brush) { CheckValidation(); - const auto g = CheckPlatform(geometry, GetPlatformIdUtf8()); - const auto b = CheckPlatform(brush, GetPlatformIdUtf8()); + const auto g = CheckPlatform(geometry, GetPlatformId()); + const auto b = CheckPlatform(brush, GetPlatformId()); device_context_->FillGeometry(g->GetComInterface(), b->GetD2DBrushInterface()); } @@ -115,15 +115,15 @@ void D2DDeviceContextPainter::DrawText(const Point& offset, ITextLayout* text_layout, IBrush* brush) { CheckValidation(); - const auto t = CheckPlatform(text_layout, GetPlatformIdUtf8()); - const auto b = CheckPlatform(brush, GetPlatformIdUtf8()); + const auto t = CheckPlatform(text_layout, GetPlatformId()); + const auto b = CheckPlatform(brush, GetPlatformId()); device_context_->DrawTextLayout(Convert(offset), t->GetComInterface(), b->GetD2DBrushInterface()); } void D2DDeviceContextPainter::DrawImage(const Point& offset, IImage* image) { CheckValidation(); - const auto i = CheckPlatform(image, GetPlatformIdUtf8()); + const auto i = CheckPlatform(image, GetPlatformId()); Microsoft::WRL::ComPtr device_context; diff --git a/src/platform/graphics/direct2d/TextLayout.cpp b/src/platform/graphics/direct2d/TextLayout.cpp index 7a2074ec..06bbcaa6 100644 --- a/src/platform/graphics/direct2d/TextLayout.cpp +++ b/src/platform/graphics/direct2d/TextLayout.cpp @@ -14,7 +14,7 @@ DWriteTextLayout::DWriteTextLayout(DirectGraphicsFactory* factory, std::shared_ptr font, String text) : DirectGraphicsResource(factory), text_(std::move(text)) { Expects(font); - font_ = CheckPlatform(font, GetPlatformIdUtf8()); + font_ = CheckPlatform(font, GetPlatformId()); ThrowIfFailed(factory->GetDWriteFactory()->CreateTextLayout( reinterpret_cast(text_.c_str()), @@ -39,7 +39,7 @@ std::shared_ptr DWriteTextLayout::GetFont() { } void DWriteTextLayout::SetFont(std::shared_ptr font) { - font_ = CheckPlatform(font, GetPlatformIdUtf8()); + font_ = CheckPlatform(font, GetPlatformId()); ThrowIfFailed(GetDirectFactory()->GetDWriteFactory()->CreateTextLayout( reinterpret_cast(text_.c_str()), static_cast(text_.size()), font_->GetComInterface(), max_width_, -- cgit v1.2.3