mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
LibGfx: Move to_skia_cap, to_skia_join to SkiaUtils
This commit is contained in:
parent
23151de217
commit
12968ff025
Notes:
github-actions[bot]
2025-03-15 13:03:33 +00:00
Author: https://github.com/mehrankamal Commit: https://github.com/LadybirdBrowser/ladybird/commit/12968ff025b Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3944 Reviewed-by: https://github.com/gmta Reviewed-by: https://github.com/nico ✅
2 changed files with 27 additions and 26 deletions
|
@ -18,6 +18,7 @@
|
|||
#include <core/SkColor.h>
|
||||
#include <core/SkColorType.h>
|
||||
#include <core/SkImageFilter.h>
|
||||
#include <core/SkPaint.h>
|
||||
#include <core/SkPath.h>
|
||||
#include <core/SkSamplingOptions.h>
|
||||
|
||||
|
@ -49,6 +50,32 @@ constexpr SkColor to_skia_color(Gfx::Color const& color)
|
|||
return SkColorSetARGB(color.alpha(), color.red(), color.green(), color.blue());
|
||||
}
|
||||
|
||||
constexpr SkPaint::Join to_skia_join(Gfx::Path::JoinStyle const& join_style)
|
||||
{
|
||||
switch (join_style) {
|
||||
case Gfx::Path::JoinStyle::Round:
|
||||
return SkPaint::kRound_Join;
|
||||
case Gfx::Path::JoinStyle::Bevel:
|
||||
return SkPaint::kBevel_Join;
|
||||
case Gfx::Path::JoinStyle::Miter:
|
||||
return SkPaint::kMiter_Join;
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
constexpr SkPaint::Cap to_skia_cap(Gfx::Path::CapStyle const& cap_style)
|
||||
{
|
||||
switch (cap_style) {
|
||||
case Gfx::Path::CapStyle::Butt:
|
||||
return SkPaint::kButt_Cap;
|
||||
case Gfx::Path::CapStyle::Round:
|
||||
return SkPaint::kRound_Cap;
|
||||
case Gfx::Path::CapStyle::Square:
|
||||
return SkPaint::kSquare_Cap;
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
constexpr SkColor4f to_skia_color4f(Color const& color)
|
||||
{
|
||||
return {
|
||||
|
|
|
@ -651,32 +651,6 @@ void DisplayListPlayerSkia::fill_path_using_paint_style(FillPathUsingPaintStyle
|
|||
surface().canvas().drawPath(path, paint);
|
||||
}
|
||||
|
||||
static SkPaint::Cap to_skia_cap(Gfx::Path::CapStyle const& cap_style)
|
||||
{
|
||||
switch (cap_style) {
|
||||
case Gfx::Path::CapStyle::Butt:
|
||||
return SkPaint::kButt_Cap;
|
||||
case Gfx::Path::CapStyle::Round:
|
||||
return SkPaint::kRound_Cap;
|
||||
case Gfx::Path::CapStyle::Square:
|
||||
return SkPaint::kSquare_Cap;
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
static SkPaint::Join to_skia_join(Gfx::Path::JoinStyle const& join_style)
|
||||
{
|
||||
switch (join_style) {
|
||||
case Gfx::Path::JoinStyle::Round:
|
||||
return SkPaint::kRound_Join;
|
||||
case Gfx::Path::JoinStyle::Bevel:
|
||||
return SkPaint::kBevel_Join;
|
||||
case Gfx::Path::JoinStyle::Miter:
|
||||
return SkPaint::kMiter_Join;
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void DisplayListPlayerSkia::stroke_path_using_color(StrokePathUsingColor const& command)
|
||||
{
|
||||
// Skia treats zero thickness as a special case and will draw a hairline, while we want to draw nothing.
|
||||
|
|
Loading…
Add table
Reference in a new issue