diff options
| author | Yuqian Yang <crupest@crupest.life> | 2025-10-17 08:37:30 +0800 | 
|---|---|---|
| committer | Yuqian Yang <crupest@crupest.life> | 2025-10-17 08:37:30 +0800 | 
| commit | 3c8d5c8f732239a8b50418be27464e30b9dddeae (patch) | |
| tree | 8ffb46c18e48c8463c1fb16fcacf216f296b8a1f /src/platform/graphics/direct2d | |
| parent | 37943858b3b260589b5dc222bb5184d2846fb6dc (diff) | |
| download | cru-3c8d5c8f732239a8b50418be27464e30b9dddeae.tar.gz cru-3c8d5c8f732239a8b50418be27464e30b9dddeae.tar.bz2 cru-3c8d5c8f732239a8b50418be27464e30b9dddeae.zip | |
Exception remove string.
Diffstat (limited to 'src/platform/graphics/direct2d')
| -rw-r--r-- | src/platform/graphics/direct2d/Geometry.cpp | 2 | ||||
| -rw-r--r-- | src/platform/graphics/direct2d/ImageFactory.cpp | 8 | ||||
| -rw-r--r-- | src/platform/graphics/direct2d/Painter.cpp | 26 | ||||
| -rw-r--r-- | src/platform/graphics/direct2d/TextLayout.cpp | 4 | 
4 files changed, 20 insertions, 20 deletions
| diff --git a/src/platform/graphics/direct2d/Geometry.cpp b/src/platform/graphics/direct2d/Geometry.cpp index a2377400..45971b76 100644 --- a/src/platform/graphics/direct2d/Geometry.cpp +++ b/src/platform/graphics/direct2d/Geometry.cpp @@ -17,7 +17,7 @@ D2DGeometryBuilder::D2DGeometryBuilder(DirectGraphicsFactory* factory)  void D2DGeometryBuilder::CheckValidation() {    if (!IsValid()) -    throw ReuseException(u"The geometry builder is already disposed."); +    throw ReuseException("The geometry builder is already disposed.");  }  Point D2DGeometryBuilder::GetCurrentPosition() { diff --git a/src/platform/graphics/direct2d/ImageFactory.cpp b/src/platform/graphics/direct2d/ImageFactory.cpp index 113f70c8..b9e9221a 100644 --- a/src/platform/graphics/direct2d/ImageFactory.cpp +++ b/src/platform/graphics/direct2d/ImageFactory.cpp @@ -67,14 +67,14 @@ GUID ConvertImageFormatToGUID(ImageFormat format) {        format_guid = GUID_ContainerFormatGif;        break;      default: -      throw Exception(u"Unknown image format"); +      throw Exception("Unknown image format");    }    return format_guid;  }  void WinImageFactory::EncodeToStream(IImage* image, io::Stream* stream,                                       ImageFormat format, float quality) { -  auto direct_image = CheckPlatform<Direct2DImage>(image, GetPlatformId()); +  auto direct_image = CheckPlatform<Direct2DImage>(image, GetPlatformIdUtf8());    Microsoft::WRL::ComPtr<IStream> com_stream(        platform::win::ConvertStreamToComStream(stream)); @@ -139,8 +139,8 @@ void WinImageFactory::EncodeToStream(IImage* image, io::Stream* stream,  }  std::unique_ptr<IImage> WinImageFactory::CreateBitmap(int width, int height) { -  if (width <= 0) throw Exception(u"Bitmap width must be greater than 0."); -  if (height <= 0) throw Exception(u"Bitmap height must be greater than 0."); +  if (width <= 0) throw Exception("Bitmap width must be greater than 0."); +  if (height <= 0) throw Exception("Bitmap height must be greater than 0.");    auto graphics_factory = GetDirectFactory(); diff --git a/src/platform/graphics/direct2d/Painter.cpp b/src/platform/graphics/direct2d/Painter.cpp index a505e46e..29ddcabb 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<ID2DBrush>(brush, GetPlatformId()); +  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformIdUtf8());    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<ID2DBrush>(brush, GetPlatformId()); +  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformIdUtf8());    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<ID2DBrush>(brush, GetPlatformId()); +  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformIdUtf8());    device_context_->FillRectangle(Convert(rectangle), b->GetD2DBrushInterface());  }  void D2DDeviceContextPainter::StrokeEllipse(const Rect& outline_rect,                                              IBrush* brush, float width) {    CheckValidation(); -  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformId()); +  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformIdUtf8());    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<ID2DBrush>(brush, GetPlatformId()); +  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformIdUtf8());    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<D2DGeometry>(geometry, GetPlatformId()); -  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformId()); +  const auto g = CheckPlatform<D2DGeometry>(geometry, GetPlatformIdUtf8()); +  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformIdUtf8());    device_context_->DrawGeometry(g->GetComInterface(), b->GetD2DBrushInterface(),                                  width);  }  void D2DDeviceContextPainter::FillGeometry(IGeometry* geometry, IBrush* brush) {    CheckValidation(); -  const auto g = CheckPlatform<D2DGeometry>(geometry, GetPlatformId()); -  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformId()); +  const auto g = CheckPlatform<D2DGeometry>(geometry, GetPlatformIdUtf8()); +  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformIdUtf8());    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<DWriteTextLayout>(text_layout, GetPlatformId()); -  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformId()); +  const auto t = CheckPlatform<DWriteTextLayout>(text_layout, GetPlatformIdUtf8()); +  const auto b = CheckPlatform<ID2DBrush>(brush, GetPlatformIdUtf8());    device_context_->DrawTextLayout(Convert(offset), t->GetComInterface(),                                    b->GetD2DBrushInterface());  }  void D2DDeviceContextPainter::DrawImage(const Point& offset, IImage* image) {    CheckValidation(); -  const auto i = CheckPlatform<Direct2DImage>(image, GetPlatformId()); +  const auto i = CheckPlatform<Direct2DImage>(image, GetPlatformIdUtf8());    Microsoft::WRL::ComPtr<ID2D1DeviceContext> device_context; @@ -177,7 +177,7 @@ void D2DDeviceContextPainter::EndDraw() {  void D2DDeviceContextPainter::CheckValidation() {    if (!is_drawing_) {      throw cru::platform::ReuseException( -        u"Can't do that on painter after end drawing."); +        "Can't do that on painter after end drawing.");    }  }  }  // namespace cru::platform::graphics::direct2d diff --git a/src/platform/graphics/direct2d/TextLayout.cpp b/src/platform/graphics/direct2d/TextLayout.cpp index 06bbcaa6..7a2074ec 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<IFont> font, String text)      : DirectGraphicsResource(factory), text_(std::move(text)) {    Expects(font); -  font_ = CheckPlatform<DWriteFont>(font, GetPlatformId()); +  font_ = CheckPlatform<DWriteFont>(font, GetPlatformIdUtf8());    ThrowIfFailed(factory->GetDWriteFactory()->CreateTextLayout(        reinterpret_cast<const wchar_t*>(text_.c_str()), @@ -39,7 +39,7 @@ std::shared_ptr<IFont> DWriteTextLayout::GetFont() {  }  void DWriteTextLayout::SetFont(std::shared_ptr<IFont> font) { -  font_ = CheckPlatform<DWriteFont>(font, GetPlatformId()); +  font_ = CheckPlatform<DWriteFont>(font, GetPlatformIdUtf8());    ThrowIfFailed(GetDirectFactory()->GetDWriteFactory()->CreateTextLayout(        reinterpret_cast<const wchar_t*>(text_.c_str()),        static_cast<UINT32>(text_.size()), font_->GetComInterface(), max_width_, | 
