diff options
Diffstat (limited to 'src/platform/graphics')
| -rw-r--r-- | src/platform/graphics/Geometry.cpp | 12 | ||||
| -rw-r--r-- | src/platform/graphics/SvgGeometryBuilderMixin.cpp | 4 | ||||
| -rw-r--r-- | src/platform/graphics/cairo/CairoGeometry.cpp | 2 | ||||
| -rw-r--r-- | src/platform/graphics/cairo/CairoImageFactory.cpp | 6 | ||||
| -rw-r--r-- | src/platform/graphics/cairo/CairoPainter.cpp | 26 | ||||
| -rw-r--r-- | src/platform/graphics/cairo/PangoTextLayout.cpp | 4 | ||||
| -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 | ||||
| -rw-r--r-- | src/platform/graphics/quartz/Factory.cpp | 2 | ||||
| -rw-r--r-- | src/platform/graphics/quartz/Image.cpp | 2 | ||||
| -rw-r--r-- | src/platform/graphics/quartz/ImageFactory.cpp | 12 | ||||
| -rw-r--r-- | src/platform/graphics/quartz/Painter.cpp | 24 | ||||
| -rw-r--r-- | src/platform/graphics/quartz/TextLayout.cpp | 2 | ||||
| -rw-r--r-- | src/platform/graphics/web_canvas/Painter.cpp | 2 | 
16 files changed, 69 insertions, 69 deletions
| diff --git a/src/platform/graphics/Geometry.cpp b/src/platform/graphics/Geometry.cpp index b9503c4e..2c842a6e 100644 --- a/src/platform/graphics/Geometry.cpp +++ b/src/platform/graphics/Geometry.cpp @@ -15,9 +15,9 @@ bool IGeometry::StrokeContains(float width, const Point& point) {  std::unique_ptr<IGeometry> IGeometry::CreateStrokeGeometry(      [[maybe_unused]] float width) { -  throw PlatformUnsupportedException(GetPlatformId(), u"CreateStrokeGeometry", -                                     u"Create stroke geometry of a geometry is " -                                     u"not supported on this platform."); +  throw PlatformUnsupportedException(GetPlatformIdUtf8(), "CreateStrokeGeometry", +                                     "Create stroke geometry of a geometry is " +                                     "not supported on this platform.");  }  void IGeometryBuilder::RelativeMoveTo(const Point& offset) { @@ -227,7 +227,7 @@ void IGeometryBuilder::ParseAndApplySvgPathData(StringView path_d) {    auto read_number = [&] {      if (read_spaces()) { -      throw Exception(u"Unexpected eof of svg path data command."); +      throw Exception("Unexpected eof of svg path data command.");      }      if (path_d[position] == ',') { @@ -239,7 +239,7 @@ void IGeometryBuilder::ParseAndApplySvgPathData(StringView path_d) {      auto result = path_d.substr(position).ParseToFloat(          &processed_count, StringToNumberFlags::kAllowTrailingJunk); -    if (std::isnan(result)) throw Exception(u"Invalid svg path data number."); +    if (std::isnan(result)) throw Exception("Invalid svg path data number.");      position += processed_count; @@ -415,7 +415,7 @@ void IGeometryBuilder::ParseAndApplySvgPathData(StringView path_d) {          CloseFigure(true);          break;        default: -        throw Exception(u"Invalid svg path command."); +        throw Exception("Invalid svg path command.");      }      return true;    }; diff --git a/src/platform/graphics/SvgGeometryBuilderMixin.cpp b/src/platform/graphics/SvgGeometryBuilderMixin.cpp index bf5275c5..73290da5 100644 --- a/src/platform/graphics/SvgGeometryBuilderMixin.cpp +++ b/src/platform/graphics/SvgGeometryBuilderMixin.cpp @@ -10,8 +10,8 @@ SvgGeometryBuilderMixin::~SvgGeometryBuilderMixin() {}  Point SvgGeometryBuilderMixin::GetCurrentPosition() {    throw PlatformUnsupportedException( -      GetPlatformId(), u"GetCurrentPosition", -      u"Svg-based geometry does not support get current position."); +      GetPlatformIdUtf8(), "GetCurrentPosition", +      "Svg-based geometry does not support get current position.");  }  void SvgGeometryBuilderMixin::MoveTo(const Point& point) { diff --git a/src/platform/graphics/cairo/CairoGeometry.cpp b/src/platform/graphics/cairo/CairoGeometry.cpp index 2d415884..1f680c34 100644 --- a/src/platform/graphics/cairo/CairoGeometry.cpp +++ b/src/platform/graphics/cairo/CairoGeometry.cpp @@ -72,7 +72,7 @@ std::unique_ptr<IGeometry> CairoGeometry::Transform(const Matrix& matrix) {  }  std::unique_ptr<IGeometry> CairoGeometry::CreateStrokeGeometry(float width) { -  throw Exception(u"Not implemented"); +  throw Exception("Not implemented");  }  CairoGeometryBuilder::CairoGeometryBuilder(CairoGraphicsFactory* factory) diff --git a/src/platform/graphics/cairo/CairoImageFactory.cpp b/src/platform/graphics/cairo/CairoImageFactory.cpp index 912226d9..ff922e77 100644 --- a/src/platform/graphics/cairo/CairoImageFactory.cpp +++ b/src/platform/graphics/cairo/CairoImageFactory.cpp @@ -207,19 +207,19 @@ std::unique_ptr<IImage> CairoImageFactory::DecodeFromStream(      return DecodePng(GetCairoGraphicsFactory(), stream);    } -  throw Exception(u"Image format unknown. Currently only support png."); +  throw Exception("Image format unknown. Currently only support png.");  }  void CairoImageFactory::EncodeToStream(IImage* image, io::Stream* stream,                                         ImageFormat format, float quality) { -  auto cairo_image = CheckPlatform<CairoImage>(image, GetPlatformId()); +  auto cairo_image = CheckPlatform<CairoImage>(image, GetPlatformIdUtf8());    if (format == ImageFormat::Png) {      EncodePng(cairo_image->GetCairoSurface(), stream);      return;    } -  throw Exception(u"Not implemented. Currently only support png."); +  throw Exception("Not implemented. Currently only support png.");  }  std::unique_ptr<IImage> CairoImageFactory::CreateBitmap(int width, int height) { diff --git a/src/platform/graphics/cairo/CairoPainter.cpp b/src/platform/graphics/cairo/CairoPainter.cpp index b9babaa2..94111098 100644 --- a/src/platform/graphics/cairo/CairoPainter.cpp +++ b/src/platform/graphics/cairo/CairoPainter.cpp @@ -56,7 +56,7 @@ void CairoPainter::Clear(const Color& color) {  void CairoPainter::DrawLine(const Point& start, const Point& end, IBrush* brush,                              float width) {    CheckValidation(); -  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformId()); +  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformIdUtf8());    auto cairo_pattern = cairo_brush->GetCairoPattern();    cairo_save(cairo_);    cairo_set_source(cairo_, cairo_pattern); @@ -71,7 +71,7 @@ void CairoPainter::DrawLine(const Point& start, const Point& end, IBrush* brush,  void CairoPainter::StrokeRectangle(const Rect& rectangle, IBrush* brush,                                     float width) {    CheckValidation(); -  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformId()); +  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformIdUtf8());    auto cairo_pattern = cairo_brush->GetCairoPattern();    cairo_save(cairo_);    cairo_set_source(cairo_, cairo_pattern); @@ -85,7 +85,7 @@ void CairoPainter::StrokeRectangle(const Rect& rectangle, IBrush* brush,  void CairoPainter::FillRectangle(const Rect& rectangle, IBrush* brush) {    CheckValidation(); -  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformId()); +  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformIdUtf8());    auto cairo_pattern = cairo_brush->GetCairoPattern();    cairo_save(cairo_);    cairo_set_source(cairo_, cairo_pattern); @@ -99,7 +99,7 @@ void CairoPainter::FillRectangle(const Rect& rectangle, IBrush* brush) {  void CairoPainter::StrokeEllipse(const Rect& outline_rect, IBrush* brush,                                   float width) {    CheckValidation(); -  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformId()); +  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformIdUtf8());    auto cairo_pattern = cairo_brush->GetCairoPattern();    cairo_save(cairo_);    cairo_set_source(cairo_, cairo_pattern); @@ -122,7 +122,7 @@ void CairoPainter::StrokeEllipse(const Rect& outline_rect, IBrush* brush,  void CairoPainter::FillEllipse(const Rect& outline_rect, IBrush* brush) {    CheckValidation(); -  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformId()); +  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformIdUtf8());    auto cairo_pattern = cairo_brush->GetCairoPattern();    cairo_save(cairo_);    cairo_set_source(cairo_, cairo_pattern); @@ -145,8 +145,8 @@ void CairoPainter::FillEllipse(const Rect& outline_rect, IBrush* brush) {  void CairoPainter::StrokeGeometry(IGeometry* geometry, IBrush* brush,                                    float width) {    CheckValidation(); -  auto cairo_geometry = CheckPlatform<CairoGeometry>(geometry, GetPlatformId()); -  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformId()); +  auto cairo_geometry = CheckPlatform<CairoGeometry>(geometry, GetPlatformIdUtf8()); +  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformIdUtf8());    auto cairo_path = cairo_geometry->GetCairoPath();    auto cairo_pattern = cairo_brush->GetCairoPattern(); @@ -162,8 +162,8 @@ void CairoPainter::StrokeGeometry(IGeometry* geometry, IBrush* brush,  void CairoPainter::FillGeometry(IGeometry* geometry, IBrush* brush) {    CheckValidation(); -  auto cairo_geometry = CheckPlatform<CairoGeometry>(geometry, GetPlatformId()); -  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformId()); +  auto cairo_geometry = CheckPlatform<CairoGeometry>(geometry, GetPlatformIdUtf8()); +  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformIdUtf8());    auto cairo_path = cairo_geometry->GetCairoPath();    auto cairo_pattern = cairo_brush->GetCairoPattern(); @@ -181,9 +181,9 @@ void CairoPainter::DrawText(const Point& offset, ITextLayout* text_layout,    CheckValidation();    auto pango_text_layout = -      CheckPlatform<PangoTextLayout>(text_layout, GetPlatformId()); +      CheckPlatform<PangoTextLayout>(text_layout, GetPlatformIdUtf8()); -  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformId()); +  auto cairo_brush = CheckPlatform<CairoBrush>(brush, GetPlatformIdUtf8());    auto cairo_pattern = cairo_brush->GetCairoPattern();    cairo_save(cairo_); @@ -196,7 +196,7 @@ void CairoPainter::DrawText(const Point& offset, ITextLayout* text_layout,  void CairoPainter::DrawImage(const Point& offset, IImage* image) {    CheckValidation(); -  auto cairo_image = CheckPlatform<CairoImage>(image, GetPlatformId()); +  auto cairo_image = CheckPlatform<CairoImage>(image, GetPlatformIdUtf8());    cairo_save(cairo_);    cairo_set_source_surface(cairo_, cairo_image->GetCairoSurface(), 0, 0);    cairo_new_path(cairo_); @@ -251,7 +251,7 @@ void CairoPainter::EndDraw() {  void CairoPainter::CheckValidation() {    if (!valid_) { -    throw ReuseException(u"Painter already ended drawing."); +    throw ReuseException("Painter already ended drawing.");    }  }  }  // namespace cru::platform::graphics::cairo diff --git a/src/platform/graphics/cairo/PangoTextLayout.cpp b/src/platform/graphics/cairo/PangoTextLayout.cpp index 8dfd59d5..746056e2 100644 --- a/src/platform/graphics/cairo/PangoTextLayout.cpp +++ b/src/platform/graphics/cairo/PangoTextLayout.cpp @@ -24,7 +24,7 @@ PangoTextLayout::PangoTextLayout(CairoGraphicsFactory* factory,                                   std::shared_ptr<IFont> font)      : CairoResource(factory) {    Expects(font); -  font_ = CheckPlatform<PangoFont>(font, GetPlatformId()); +  font_ = CheckPlatform<PangoFont>(font, GetPlatformIdUtf8());    pango_layout_ = pango_cairo_create_layout(factory->GetDefaultCairo());    pango_layout_set_font_description(pango_layout_,                                      font_->GetPangoFontDescription()); @@ -44,7 +44,7 @@ std::shared_ptr<IFont> PangoTextLayout::GetFont() { return font_; }  void PangoTextLayout::SetFont(std::shared_ptr<IFont> font) {    Expects(font); -  font_ = CheckPlatform<PangoFont>(font, GetPlatformId()); +  font_ = CheckPlatform<PangoFont>(font, GetPlatformIdUtf8());    pango_layout_set_font_description(pango_layout_,                                      font_->GetPangoFontDescription());  } 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_, diff --git a/src/platform/graphics/quartz/Factory.cpp b/src/platform/graphics/quartz/Factory.cpp index 862c0966..5d5b48b5 100644 --- a/src/platform/graphics/quartz/Factory.cpp +++ b/src/platform/graphics/quartz/Factory.cpp @@ -33,7 +33,7 @@ std::unique_ptr<IFont> QuartzGraphicsFactory::CreateFont(String font_family,  std::unique_ptr<ITextLayout> QuartzGraphicsFactory::CreateTextLayout(      std::shared_ptr<IFont> font, String text) { -  auto f = CheckPlatform<OsxCTFont>(font, GetPlatformId()); +  auto f = CheckPlatform<OsxCTFont>(font, GetPlatformIdUtf8());    return std::make_unique<OsxCTTextLayout>(this, f, text);  } diff --git a/src/platform/graphics/quartz/Image.cpp b/src/platform/graphics/quartz/Image.cpp index 966ce6be..d4ccd416 100644 --- a/src/platform/graphics/quartz/Image.cpp +++ b/src/platform/graphics/quartz/Image.cpp @@ -35,7 +35,7 @@ std::unique_ptr<IImage> QuartzImage::CreateWithRect(const Rect& rect) {  std::unique_ptr<IPainter> QuartzImage::CreatePainter() {    if (!buffer_)      throw Exception( -        u"Failed to create painter for image because failed to get its " +        "Failed to create painter for image because failed to get its "          u"buffer.");    auto width = CGImageGetWidth(image_); diff --git a/src/platform/graphics/quartz/ImageFactory.cpp b/src/platform/graphics/quartz/ImageFactory.cpp index 93e452e1..62229bcb 100644 --- a/src/platform/graphics/quartz/ImageFactory.cpp +++ b/src/platform/graphics/quartz/ImageFactory.cpp @@ -39,17 +39,17 @@ static String GetImageFormatUniformTypeIdentifier(ImageFormat format) {      case ImageFormat::Gif:        return u"com.compuserve.gif";      default: -      throw Exception(u"Unknown image format."); +      throw Exception("Unknown image format.");    }  }  void QuartzImageFactory::EncodeToStream(IImage* image, io::Stream* stream,                                          ImageFormat format, float quality) {    if (quality <= 0 || quality > 1) { -    throw Exception(u"Invalid quality value."); +    throw Exception("Invalid quality value.");    } -  auto quartz_image = CheckPlatform<QuartzImage>(image, GetPlatformId()); +  auto quartz_image = CheckPlatform<QuartzImage>(image, GetPlatformIdUtf8());    auto cg_image = quartz_image->GetCGImage();    auto uti = ToCFString(GetImageFormatUniformTypeIdentifier(format)); @@ -67,7 +67,7 @@ void QuartzImageFactory::EncodeToStream(IImage* image, io::Stream* stream,    CGImageDestinationAddImage(destination, cg_image, properties);    if (!CGImageDestinationFinalize(destination)) { -    throw Exception(u"Failed to finalize image destination."); +    throw Exception("Failed to finalize image destination.");    }    CFRelease(quality_wrap); @@ -78,8 +78,8 @@ void QuartzImageFactory::EncodeToStream(IImage* image, io::Stream* stream,  std::unique_ptr<IImage> QuartzImageFactory::CreateBitmap(int width,                                                           int height) { -  if (width <= 0) throw Exception(u"Image width should be greater than 0."); -  if (height <= 0) throw Exception(u"Image height should be greater than 0."); +  if (width <= 0) throw Exception("Image width should be greater than 0."); +  if (height <= 0) throw Exception("Image height should be greater than 0.");    CGColorSpaceRef color_space = CGColorSpaceCreateDeviceRGB(); diff --git a/src/platform/graphics/quartz/Painter.cpp b/src/platform/graphics/quartz/Painter.cpp index 69e187c3..fe0f5d43 100644 --- a/src/platform/graphics/quartz/Painter.cpp +++ b/src/platform/graphics/quartz/Painter.cpp @@ -66,7 +66,7 @@ void QuartzCGContextPainter::DrawLine(const Point& start, const Point& end,    CGContextMoveToPoint(cg_context_, start.x, start.y);    CGContextAddLineToPoint(cg_context_, end.x, end.y); -  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformId()); +  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformIdUtf8());    b->Select(cg_context_);    SetLineWidth(width); @@ -77,7 +77,7 @@ void QuartzCGContextPainter::StrokeRectangle(const Rect& rectangle,                                               IBrush* brush, float width) {    Validate(); -  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformId()); +  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformIdUtf8());    b->Select(cg_context_);    CGContextStrokeRectWithWidth(cg_context_, Convert(rectangle), width);  } @@ -86,7 +86,7 @@ void QuartzCGContextPainter::FillRectangle(const Rect& rectangle,                                             IBrush* brush) {    Validate(); -  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformId()); +  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformIdUtf8());    b->Select(cg_context_);    CGContextFillRect(cg_context_, Convert(rectangle));  } @@ -95,7 +95,7 @@ void QuartzCGContextPainter::StrokeEllipse(const Rect& outline_rect,                                             IBrush* brush, float width) {    Validate(); -  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformId()); +  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformIdUtf8());    b->Select(cg_context_);    SetLineWidth(width); @@ -106,7 +106,7 @@ void QuartzCGContextPainter::FillEllipse(const Rect& outline_rect,                                           IBrush* brush) {    Validate(); -  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformId()); +  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformIdUtf8());    b->Select(cg_context_);    CGContextFillEllipseInRect(cg_context_, Convert(outline_rect));  } @@ -115,8 +115,8 @@ void QuartzCGContextPainter::StrokeGeometry(IGeometry* geometry, IBrush* brush,                                              float width) {    Validate(); -  QuartzGeometry* g = CheckPlatform<QuartzGeometry>(geometry, GetPlatformId()); -  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformId()); +  QuartzGeometry* g = CheckPlatform<QuartzGeometry>(geometry, GetPlatformIdUtf8()); +  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformIdUtf8());    b->Select(cg_context_);    SetLineWidth(width); @@ -129,8 +129,8 @@ void QuartzCGContextPainter::StrokeGeometry(IGeometry* geometry, IBrush* brush,  void QuartzCGContextPainter::FillGeometry(IGeometry* geometry, IBrush* brush) {    Validate(); -  QuartzGeometry* g = CheckPlatform<QuartzGeometry>(geometry, GetPlatformId()); -  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformId()); +  QuartzGeometry* g = CheckPlatform<QuartzGeometry>(geometry, GetPlatformIdUtf8()); +  QuartzBrush* b = CheckPlatform<QuartzBrush>(brush, GetPlatformIdUtf8());    b->Select(cg_context_);    CGContextBeginPath(cg_context_); @@ -142,7 +142,7 @@ void QuartzCGContextPainter::DrawText(const Point& offset,                                        ITextLayout* text_layout, IBrush* brush) {    Validate(); -  auto tl = CheckPlatform<OsxCTTextLayout>(text_layout, GetPlatformId()); +  auto tl = CheckPlatform<OsxCTTextLayout>(text_layout, GetPlatformIdUtf8());    Color color; @@ -169,7 +169,7 @@ void QuartzCGContextPainter::DrawText(const Point& offset,  void QuartzCGContextPainter::DrawImage(const Point& offset, IImage* image) {    Validate(); -  auto i = CheckPlatform<QuartzImage>(image, GetPlatformId()); +  auto i = CheckPlatform<QuartzImage>(image, GetPlatformIdUtf8());    auto cg_image = i->GetCGImage(); @@ -225,6 +225,6 @@ void QuartzCGContextPainter::DoEndDraw() {  void QuartzCGContextPainter::Validate() {    if (cg_context_ == nullptr) -    throw ReuseException(u"QuartzCGContextPainter has already be released."); +    throw ReuseException("QuartzCGContextPainter has already be released.");  }  }  // namespace cru::platform::graphics::quartz diff --git a/src/platform/graphics/quartz/TextLayout.cpp b/src/platform/graphics/quartz/TextLayout.cpp index 8c573c7a..41a2f176 100644 --- a/src/platform/graphics/quartz/TextLayout.cpp +++ b/src/platform/graphics/quartz/TextLayout.cpp @@ -31,7 +31,7 @@ OsxCTTextLayout::~OsxCTTextLayout() {  }  void OsxCTTextLayout::SetFont(std::shared_ptr<IFont> font) { -  font_ = CheckPlatform<OsxCTFont>(font, GetPlatformId()); +  font_ = CheckPlatform<OsxCTFont>(font, GetPlatformIdUtf8());    RecreateFrame();  } diff --git a/src/platform/graphics/web_canvas/Painter.cpp b/src/platform/graphics/web_canvas/Painter.cpp index c9184165..f928de35 100644 --- a/src/platform/graphics/web_canvas/Painter.cpp +++ b/src/platform/graphics/web_canvas/Painter.cpp @@ -94,7 +94,7 @@ void WebCanvasPainter::SetFillStyle(IBrush* brush) {  }  WebCanvasBrush* WebCanvasPainter::ConvertBrush(IBrush* brush) const { -  return CheckPlatform<WebCanvasBrush>(brush, GetPlatformId()); +  return CheckPlatform<WebCanvasBrush>(brush, GetPlatformIdUtf8());  }  WebCanvasRef WebCanvasPainter::GetCanvas() { | 
