Updated skia
This commit is contained in:
parent
720081c3bb
commit
f6961fbf8d
19 changed files with 105 additions and 89 deletions
|
|
@ -55,3 +55,7 @@ sources:
|
|||
url:
|
||||
- "https://github.com/google/skia/archive/f4ed99d2443962782cf5f8b4dd27179f131e7cbe.zip"
|
||||
sha256: "2e00dcdb54942c1da7b2f6cfd9fef8c4899115206d940931f6c040bac08b6b79"
|
||||
"143.20251028.0":
|
||||
url:
|
||||
- "https://github.com/google/skia/archive/da51f0d60ea2b14e845a823dc11b405dbeef42d8.zip"
|
||||
sha256: "1f5140d5908031d8cdd06429a633a1583b12fc43dc1c768374ed1e91ab9fa596"
|
||||
|
|
|
|||
|
|
@ -27,3 +27,5 @@ versions:
|
|||
folder: all
|
||||
"142.20250802.0":
|
||||
folder: all
|
||||
"143.20251028.0":
|
||||
folder: all
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
conan export %0/../libjuice/all/conanfile.py --version=1.6.1
|
||||
conan export %0/../libdatachannel/all/conanfile.py --version=0.23.1
|
||||
conan export %0/../conan-skia/recipes/skia/all/conanfile.py --version=142.20250802.0
|
||||
conan export %0/../conan-skia/recipes/skia/all/conanfile.py --version=143.20251028.0
|
||||
conan export %0/../sdl3/3.x/conanfile.py --version=3.2.26
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|||
conan export "$(dirname "$0")/libjuice/all/conanfile.py" --version=1.6.1
|
||||
conan export "$(dirname "$0")/libdatachannel/all/conanfile.py" --version=0.23.1
|
||||
conan export "$(dirname "$0")/mpg123/all/conanfile.py" --version=1.32.10
|
||||
conan export "$(dirname "$0")/conan-skia/recipes/skia/all/conanfile.py" --version=142.20250802.0
|
||||
conan export "$(dirname "$0")/conan-skia/recipes/skia/all/conanfile.py" --version=143.20251028.0
|
||||
conan export "$(dirname "$0")/sdl3/3.x/conanfile.py" --version=3.2.26
|
||||
#conan create . -o use_system_expat=False -o use_system_freetype=False -o use_system_harfbuzz=False -o use_system_icu=False -o use_system_libjpeg_turbo=False -o use_system_libpng=False -o use_system_libwebp=False -o use_system_zlib=False --build=missing --version=134.20250327.0
|
||||
#cd ../../../..
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class CompressorRecipe(ConanFile):
|
|||
|
||||
def requirements(self):
|
||||
if self.settings.os == "Emscripten":
|
||||
self.requires("skia/142.20250802.0", options = {
|
||||
self.requires("skia/143.20251028.0", options = {
|
||||
"enable_svg": True,
|
||||
"use_freetype": True,
|
||||
"use_system_freetype": True,
|
||||
|
|
@ -34,7 +34,7 @@ class CompressorRecipe(ConanFile):
|
|||
"use_conan_libwebp": False
|
||||
})
|
||||
else:
|
||||
self.requires("skia/142.20250802.0", options = {
|
||||
self.requires("skia/143.20251028.0", options = {
|
||||
"use_system_expat": False,
|
||||
"use_freetype": True,
|
||||
"use_system_freetype": True,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "DrawCollision.hpp"
|
||||
#include <include/core/SkPaint.h>
|
||||
#include <include/core/SkPath.h>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
|
||||
void draw_collider(SkCanvas* canvas, const DrawData& drawData, const SCollision::AABB<float>& aabb, const SkPaint& p) {
|
||||
SkRect r = SkRect::MakeLTRB(aabb.min.x(), aabb.min.y(), aabb.max.x(), aabb.max.y());
|
||||
|
|
@ -12,12 +13,12 @@ void draw_collider(SkCanvas* canvas, const DrawData& drawData, const SCollision:
|
|||
}
|
||||
|
||||
void draw_collider(SkCanvas* canvas, const DrawData& drawData, const SCollision::Triangle<float>& triangle, const SkPaint& p) {
|
||||
SkPath path;
|
||||
SkPathBuilder path;
|
||||
path.moveTo(convert_vec2<SkPoint>(triangle.p[0]));
|
||||
path.lineTo(convert_vec2<SkPoint>(triangle.p[1]));
|
||||
path.lineTo(convert_vec2<SkPoint>(triangle.p[2]));
|
||||
path.close();
|
||||
canvas->drawPath(path, p);
|
||||
canvas->drawPath(path.detach(), p);
|
||||
}
|
||||
|
||||
void draw_collider(SkCanvas* canvas, const DrawData& drawData, const SCollision::ColliderCollection<float>& collection, const SkPaint& p) {
|
||||
|
|
|
|||
|
|
@ -113,13 +113,17 @@ void DrawBrushStroke::initialize_draw_data(DrawingProgram& drawP) {
|
|||
return false;
|
||||
};
|
||||
|
||||
brushPath = std::make_shared<SkPath>();
|
||||
brushPathLOD[0] = std::make_shared<SkPath>();
|
||||
brushPathLOD[1] = std::make_shared<SkPath>();
|
||||
auto brushPathBuilder = std::make_shared<SkPathBuilder>();
|
||||
auto brushPathLOD0Builder = std::make_shared<SkPathBuilder>();
|
||||
auto brushPathLOD1Builder = std::make_shared<SkPathBuilder>();
|
||||
|
||||
create_triangles(triangleFunc, points, 0, brushPath);
|
||||
create_triangles(triangleFunc, points, 4, brushPathLOD[0]);
|
||||
create_triangles(triangleFunc, points, 30, brushPathLOD[1]);
|
||||
create_triangles(triangleFunc, points, 0, brushPathBuilder);
|
||||
create_triangles(triangleFunc, points, 4, brushPathLOD0Builder);
|
||||
create_triangles(triangleFunc, points, 30, brushPathLOD1Builder);
|
||||
|
||||
brushPath = std::make_shared<SkPath>(brushPathBuilder->detach());
|
||||
brushPathLOD[0] = std::make_shared<SkPath>(brushPathLOD0Builder->detach());
|
||||
brushPathLOD[1] = std::make_shared<SkPath>(brushPathLOD1Builder->detach());
|
||||
}
|
||||
create_collider();
|
||||
}
|
||||
|
|
@ -223,7 +227,7 @@ std::vector<DrawBrushStrokePoint> DrawBrushStroke::every_nth_point_include_front
|
|||
return toRet;
|
||||
}
|
||||
|
||||
void DrawBrushStroke::create_triangles(const std::function<bool(Vector2f, Vector2f, Vector2f)>& passTriangleFunc, const std::vector<DrawBrushStrokePoint>& smoothedPoints, size_t skipVertexCount, std::shared_ptr<SkPath> bPath) {
|
||||
void DrawBrushStroke::create_triangles(const std::function<bool(Vector2f, Vector2f, Vector2f)>& passTriangleFunc, const std::vector<DrawBrushStrokePoint>& smoothedPoints, size_t skipVertexCount, std::shared_ptr<SkPathBuilder> bPathBuilder) {
|
||||
const int ARC_SMOOTHNESS = 10;
|
||||
const int CIRCLE_SMOOTHNESS = 20;
|
||||
const std::vector<DrawBrushStrokePoint>& pointsN = d->points;
|
||||
|
|
@ -239,8 +243,8 @@ void DrawBrushStroke::create_triangles(const std::function<bool(Vector2f, Vector
|
|||
}
|
||||
|
||||
if(pointsN.size() < 2) {
|
||||
if(bPath && !topPoints.empty())
|
||||
bPath->addPoly({topPoints.data(), topPoints.size()}, false);
|
||||
if(bPathBuilder && !topPoints.empty())
|
||||
bPathBuilder->addPolygon({topPoints.data(), topPoints.size()}, false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -387,9 +391,9 @@ void DrawBrushStroke::create_triangles(const std::function<bool(Vector2f, Vector
|
|||
}
|
||||
}
|
||||
|
||||
if(bPath && !topPoints.empty()) {
|
||||
if(bPathBuilder && !topPoints.empty()) {
|
||||
topPoints.insert(topPoints.begin(), bottomPoints.rbegin(), bottomPoints.rend());
|
||||
bPath->addPoly({topPoints.data(), topPoints.size()}, false);
|
||||
bPathBuilder->addPolygon({topPoints.data(), topPoints.size()}, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#ifndef IS_SERVER
|
||||
#include <include/core/SkPath.h>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
#endif
|
||||
|
||||
#define DRAW_MINIMUM_LIMIT 0.3
|
||||
|
|
@ -57,7 +58,7 @@ class DrawBrushStroke : public DrawComponent {
|
|||
|
||||
void add_precheck_aabb_level(size_t level, const std::vector<SCollision::BVHContainer<float>>& levelArray);
|
||||
std::vector<SCollision::AABB<float>> precheckAABBLevels;
|
||||
void create_triangles(const std::function<bool(Vector2f, Vector2f, Vector2f)>& passTriangleFunc, const std::vector<DrawBrushStrokePoint>& smoothedPoints, size_t skipVertexCount, std::shared_ptr<SkPath> bPath);
|
||||
void create_triangles(const std::function<bool(Vector2f, Vector2f, Vector2f)>& passTriangleFunc, const std::vector<DrawBrushStrokePoint>& smoothedPoints, size_t skipVertexCount, std::shared_ptr<SkPathBuilder> bPath);
|
||||
std::vector<size_t> get_wedge_indices(const std::vector<DrawBrushStrokePoint>& points);
|
||||
std::vector<DrawBrushStrokePoint> smooth_points(size_t beginIndex, size_t endIndex, unsigned numOfDivisions);
|
||||
std::vector<DrawBrushStrokePoint> smooth_points_avg(size_t beginIndex, size_t endIndex, unsigned numOfDivisions);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include "DrawEllipse.hpp"
|
||||
#include "Helpers/ConvertVec.hpp"
|
||||
#include "Helpers/SCollision.hpp"
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
|
||||
#ifndef IS_SERVER
|
||||
#include "../DrawCollision.hpp"
|
||||
|
|
@ -70,9 +71,10 @@ void DrawEllipse::draw(SkCanvas* canvas, const DrawData& drawData) {
|
|||
}
|
||||
|
||||
void DrawEllipse::create_draw_data() {
|
||||
ellipsePath = SkPath();
|
||||
SkPathBuilder ellipsePathBuilder;
|
||||
SkRect newRect = SkRect::MakeLTRB(d.p1.x(), d.p1.y(), d.p2.x(), d.p2.y());
|
||||
ellipsePath.addOval(newRect);
|
||||
ellipsePathBuilder.addOval(newRect);
|
||||
ellipsePath = ellipsePathBuilder.detach();
|
||||
}
|
||||
|
||||
void DrawEllipse::initialize_draw_data(DrawingProgram& drawP) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "Helpers/MathExtras.hpp"
|
||||
#include "Helpers/SCollision.hpp"
|
||||
#include <include/core/SkPaint.h>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
#include "../SharedTypes.hpp"
|
||||
|
||||
#ifndef IS_SERVER
|
||||
|
|
@ -87,14 +88,16 @@ bool DrawRectangle::collides_within_coords(const SCollision::ColliderCollection<
|
|||
}
|
||||
|
||||
void DrawRectangle::create_draw_data() {
|
||||
rectPath = SkPath();
|
||||
SkPathBuilder rectPathBuilder;
|
||||
if(d.p1.x() == d.p2.x() || d.p1.y() == d.p2.y()) {
|
||||
rectPath.moveTo(convert_vec2<SkPoint>(d.p1));
|
||||
rectPath.lineTo(convert_vec2<SkPoint>(d.p2));
|
||||
rectPathBuilder.moveTo(convert_vec2<SkPoint>(d.p1));
|
||||
rectPathBuilder.lineTo(convert_vec2<SkPoint>(d.p2));
|
||||
rectPath = rectPathBuilder.detach();
|
||||
}
|
||||
else {
|
||||
SkRect newRect = SkRect::MakeLTRB(d.p1.x(), d.p1.y(), d.p2.x(), d.p2.y());
|
||||
rectPath.addRoundRect(newRect, d.cornerRadius, d.cornerRadius);
|
||||
SkRRect newRect = SkRRect::MakeRectXY(SkRect::MakeLTRB(d.p1.x(), d.p1.y(), d.p2.x(), d.p2.y()), d.cornerRadius, d.cornerRadius);
|
||||
rectPathBuilder.addRRect(newRect);
|
||||
rectPath = rectPathBuilder.detach();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#endif
|
||||
|
||||
#include <include/effects/SkImageFilters.h>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
|
||||
#define ROTATION_POINT_RADIUS_MULTIPLIER 0.7f
|
||||
#define ROTATION_POINTS_DISTANCE 20.0f
|
||||
|
|
@ -515,14 +516,14 @@ void DrawingProgramSelection::draw_components(SkCanvas* canvas, const DrawData&
|
|||
|
||||
void DrawingProgramSelection::draw_gui(SkCanvas* canvas, const DrawData& drawData) {
|
||||
if(is_something_selected() && !camSpaceSelection.triangle.empty()) {
|
||||
SkPath selectionRectPath;
|
||||
SkPathBuilder selectionRectPath;
|
||||
selectionRectPath.moveTo(convert_vec2<SkPoint>(camSpaceSelection.triangle[0].p[0]));
|
||||
selectionRectPath.lineTo(convert_vec2<SkPoint>(camSpaceSelection.triangle[0].p[1]));
|
||||
selectionRectPath.lineTo(convert_vec2<SkPoint>(camSpaceSelection.triangle[0].p[2]));
|
||||
selectionRectPath.lineTo(convert_vec2<SkPoint>(camSpaceSelection.triangle[1].p[2]));
|
||||
selectionRectPath.close();
|
||||
SkPaint p{SkColor4f{0.3f, 0.6f, 0.9f, 0.4f}};
|
||||
canvas->drawPath(selectionRectPath, p);
|
||||
canvas->drawPath(selectionRectPath.detach(), p);
|
||||
|
||||
if(drawP.is_actual_selection_tool(drawP.drawTool->get_type())) {
|
||||
if(transformOpHappening == TransformOperation::NONE || transformOpHappening == TransformOperation::ROTATE || transformOpHappening == TransformOperation::ROTATE_RELOCATE_CENTER)
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "DrawingProgram.hpp"
|
||||
#include "../MainProgram.hpp"
|
||||
#include "../DrawData.hpp"
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
|
||||
EraserTool::EraserTool(DrawingProgram& initDrawP):
|
||||
DrawingProgramToolBase(initDrawP)
|
||||
|
|
@ -81,9 +82,9 @@ void EraserTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
|||
linePaint.setStyle(SkPaint::kStroke_Style);
|
||||
linePaint.setStrokeCap(SkPaint::kRound_Cap);
|
||||
linePaint.setStrokeWidth(drawP.controls.relativeWidth * 2.0f);
|
||||
SkPath erasePath;
|
||||
SkPathBuilder erasePath;
|
||||
erasePath.moveTo(convert_vec2<SkPoint>(drawData.main->input.mouse.lastPos));
|
||||
erasePath.lineTo(convert_vec2<SkPoint>(drawData.main->input.mouse.pos));
|
||||
canvas->drawPath(erasePath, linePaint);
|
||||
canvas->drawPath(erasePath.detach(), linePaint);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
#include <ranges>
|
||||
#include "../DrawCollision.hpp"
|
||||
#include <earcut.hpp>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
|
||||
namespace mapbox {
|
||||
namespace util {
|
||||
|
|
@ -111,12 +112,12 @@ void LassoSelectTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
|||
canvas->save();
|
||||
controls.coords.transform_sk_canvas(canvas, drawData);
|
||||
|
||||
SkPath lassoPath;
|
||||
SkPathBuilder lassoPath;
|
||||
lassoPath.moveTo(convert_vec2<SkPoint>(controls.lassoPoints.front()));
|
||||
for(Vector2f& p : controls.lassoPoints | std::views::drop(1))
|
||||
lassoPath.lineTo(convert_vec2<SkPoint>(p));
|
||||
|
||||
canvas->drawPath(lassoPath, drawP.select_tool_line_paint());
|
||||
canvas->drawPath(lassoPath.detach(), drawP.select_tool_line_paint());
|
||||
|
||||
canvas->restore();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
#include <include/core/SkSurface.h>
|
||||
#include <include/core/SkImage.h>
|
||||
#include <include/core/SkData.h>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
#include <include/svg/SkSVGCanvas.h>
|
||||
#include <include/encode/SkPngEncoder.h>
|
||||
#include <include/encode/SkWebpEncoder.h>
|
||||
|
|
@ -491,9 +492,10 @@ void ScreenshotTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
|||
float y2 = std::max(controls.rectY1, controls.rectY2);
|
||||
SkPoint p1{x1, y1};
|
||||
SkPoint p2{x2, y2};
|
||||
SkPath path1;
|
||||
path1.addRect(p1.x(), p1.y(), p2.x(), p2.y());
|
||||
path1.setFillType(SkPathFillType::kInverseWinding);
|
||||
SkPathBuilder path1B;
|
||||
path1B.addRect(SkRect::MakeLTRB(p1.x(), p1.y(), p2.x(), p2.y()));
|
||||
path1B.setFillType(SkPathFillType::kInverseWinding);
|
||||
SkPath path1 = path1B.detach();
|
||||
SkPaint paint1;
|
||||
paint1.setColor4f({0.0f, 0.0f, 0.0f, 0.3f});
|
||||
canvas->drawPath(path1, paint1);
|
||||
|
|
|
|||
|
|
@ -5,12 +5,7 @@
|
|||
#include <include/core/SkTextBlob.h>
|
||||
#include <iostream>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#elif _WIN32
|
||||
#include <include/ports/SkTypeface_win.h>
|
||||
#elif __APPLE__
|
||||
#include <include/ports/SkFontMgr_mac_ct.h>
|
||||
#elif __linux__
|
||||
#ifndef __EMSCRIPTEN__
|
||||
#include <include/ports/SkFontMgr_fontconfig.h>
|
||||
#include <include/ports/SkFontScanner_FreeType.h>
|
||||
#endif
|
||||
|
|
@ -21,14 +16,8 @@ FontData::FontData()
|
|||
{
|
||||
#ifdef __EMSCRIPTEN__
|
||||
localFontMgr = SkFontMgr_New_Custom_Empty();
|
||||
#elif _WIN32
|
||||
localFontMgr = SkFontMgr_New_GDI();
|
||||
#elif __APPLE__
|
||||
localFontMgr = SkFontMgr_New_Custom_Empty();
|
||||
#elif __linux__
|
||||
localFontMgr = SkFontMgr_New_FontConfig(nullptr, SkFontScanner_Make_FreeType());
|
||||
#else
|
||||
localFontMgr = SkFontMgr_New_Custom_Empty();
|
||||
localFontMgr = SkFontMgr_New_FontConfig(nullptr, SkFontScanner_Make_FreeType());
|
||||
#endif
|
||||
|
||||
defaultFontMgr = SkFontMgr_New_Custom_Directory("data/fonts");
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "CheckBox.hpp"
|
||||
#include <include/core/SkPath.h>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
#include <iostream>
|
||||
|
||||
namespace GUIStuff {
|
||||
|
|
@ -53,7 +54,7 @@ void CheckBox::clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderComma
|
|||
checkP.setStrokeCap(SkPaint::kRound_Cap);
|
||||
checkP.setStrokeJoin(SkPaint::kRound_Join);
|
||||
|
||||
SkPath checkPath;
|
||||
SkPathBuilder checkPathB;
|
||||
Vector2f checkP1{(4.5/17.0) - 0.5, (8.5/17.0) - 0.5};
|
||||
Vector2f checkP2{(7.5/17.0) - 0.5, (12.0/17.0) - 0.5};
|
||||
Vector2f checkP3{(12.5/17.0) - 0.5, (6.0/17.0) - 0.5};
|
||||
|
|
@ -75,11 +76,12 @@ void CheckBox::clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderComma
|
|||
points[3] = lerp_vec(checkP2, rectP4, lerpTime2);
|
||||
points[4] = points[0];
|
||||
|
||||
checkPath.moveTo(points[0].x(), points[0].y());
|
||||
checkPathB.moveTo(points[0].x(), points[0].y());
|
||||
for(unsigned i = 1; i < 5; i++)
|
||||
checkPath.lineTo(points[i].x(), points[i].y());
|
||||
checkPath.close();
|
||||
checkPathB.lineTo(points[i].x(), points[i].y());
|
||||
checkPathB.close();
|
||||
|
||||
SkPath checkPath = checkPathB.detach();
|
||||
canvas->drawPath(checkPath, checkP);
|
||||
checkP.setStyle(SkPaint::kStroke_Style);
|
||||
canvas->drawPath(checkPath, checkP);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "PaintCircleMenu.hpp"
|
||||
#include "Helpers/ConvertVec.hpp"
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
|
||||
namespace GUIStuff {
|
||||
|
||||
|
|
@ -150,7 +151,7 @@ void PaintCircleMenu::draw_palette_bar(SkCanvas* canvas, UpdateInputData& io) {
|
|||
SkRect startOval = SkRect::MakeLTRB(-PALETTE_START, -PALETTE_START, PALETTE_START, PALETTE_START);
|
||||
SkRect endOval = SkRect::MakeLTRB(-ROTATE_START, -ROTATE_START, ROTATE_START, ROTATE_START);
|
||||
if(colorBarSelect.hovered) {
|
||||
SkPath selectionPath;
|
||||
SkPathBuilder selectionPathBuilder;
|
||||
double angleStart = colorSelectionIndex * colorDistribution;
|
||||
double angleEnd = (colorSelectionIndex + 1) * colorDistribution;
|
||||
Vector2f lineDir1{std::cos(angleStart), std::sin(angleStart)};
|
||||
|
|
@ -159,17 +160,17 @@ void PaintCircleMenu::draw_palette_bar(SkCanvas* canvas, UpdateInputData& io) {
|
|||
lineP.setStrokeWidth(5.0f);
|
||||
lineP.setStroke(true);
|
||||
lineP.setStrokeJoin(SkPaint::kRound_Join);
|
||||
selectionPath.moveTo(lineDir1.x() * PALETTE_START, lineDir1.y() * PALETTE_START);
|
||||
selectionPath.lineTo(lineDir1.x() * ROTATE_START, lineDir1.y() * ROTATE_START);
|
||||
selectionPath.arcTo(endOval, angleStart * 180.0 / std::numbers::pi, (angleEnd - angleStart) * 180.0 / std::numbers::pi, false);
|
||||
selectionPath.lineTo(lineDir2.x() * PALETTE_START, lineDir2.y() * PALETTE_START);
|
||||
selectionPath.arcTo(startOval, angleEnd * 180.0 / std::numbers::pi, (angleStart - angleEnd) * 180.0 / std::numbers::pi, false);
|
||||
selectionPath.close();
|
||||
canvas->drawPath(selectionPath, lineP);
|
||||
selectionPathBuilder.moveTo(lineDir1.x() * PALETTE_START, lineDir1.y() * PALETTE_START);
|
||||
selectionPathBuilder.lineTo(lineDir1.x() * ROTATE_START, lineDir1.y() * ROTATE_START);
|
||||
selectionPathBuilder.arcTo(endOval, angleStart * 180.0 / std::numbers::pi, (angleEnd - angleStart) * 180.0 / std::numbers::pi, false);
|
||||
selectionPathBuilder.lineTo(lineDir2.x() * PALETTE_START, lineDir2.y() * PALETTE_START);
|
||||
selectionPathBuilder.arcTo(startOval, angleEnd * 180.0 / std::numbers::pi, (angleStart - angleEnd) * 180.0 / std::numbers::pi, false);
|
||||
selectionPathBuilder.close();
|
||||
canvas->drawPath(selectionPathBuilder.detach(), lineP);
|
||||
}
|
||||
for(unsigned i = 0; i < d.palette.size(); i++) {
|
||||
if(d.palette[i].x() == d.selectedColor->x() && d.palette[i].y() == d.selectedColor->y() && d.palette[i].z() == d.selectedColor->z()) {
|
||||
SkPath selectionPath;
|
||||
SkPathBuilder selectionPathBuilder;
|
||||
double angleStart = i * colorDistribution;
|
||||
double angleEnd = (i + 1) * colorDistribution;
|
||||
Vector2f lineDir1{std::cos(angleStart), std::sin(angleStart)};
|
||||
|
|
@ -178,13 +179,13 @@ void PaintCircleMenu::draw_palette_bar(SkCanvas* canvas, UpdateInputData& io) {
|
|||
lineP.setStrokeWidth(5.0f);
|
||||
lineP.setStroke(true);
|
||||
lineP.setStrokeJoin(SkPaint::kRound_Join);
|
||||
selectionPath.moveTo(lineDir1.x() * PALETTE_START, lineDir1.y() * PALETTE_START);
|
||||
selectionPath.lineTo(lineDir1.x() * ROTATE_START, lineDir1.y() * ROTATE_START);
|
||||
selectionPath.arcTo(endOval, angleStart * 180.0 / std::numbers::pi, (angleEnd - angleStart) * 180.0 / std::numbers::pi, false);
|
||||
selectionPath.lineTo(lineDir2.x() * PALETTE_START, lineDir2.y() * PALETTE_START);
|
||||
selectionPath.arcTo(startOval, angleEnd * 180.0 / std::numbers::pi, (angleStart - angleEnd) * 180.0 / std::numbers::pi, false);
|
||||
selectionPath.close();
|
||||
canvas->drawPath(selectionPath, lineP);
|
||||
selectionPathBuilder.moveTo(lineDir1.x() * PALETTE_START, lineDir1.y() * PALETTE_START);
|
||||
selectionPathBuilder.lineTo(lineDir1.x() * ROTATE_START, lineDir1.y() * ROTATE_START);
|
||||
selectionPathBuilder.arcTo(endOval, angleStart * 180.0 / std::numbers::pi, (angleEnd - angleStart) * 180.0 / std::numbers::pi, false);
|
||||
selectionPathBuilder.lineTo(lineDir2.x() * PALETTE_START, lineDir2.y() * PALETTE_START);
|
||||
selectionPathBuilder.arcTo(startOval, angleEnd * 180.0 / std::numbers::pi, (angleStart - angleEnd) * 180.0 / std::numbers::pi, false);
|
||||
selectionPathBuilder.close();
|
||||
canvas->drawPath(selectionPathBuilder.detach(), lineP);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <include/core/SkFont.h>
|
||||
#include <include/core/SkFontMetrics.h>
|
||||
#include <include/core/SkPath.h>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
#include "Elements/SVGIcon.hpp"
|
||||
#include "Elements/FontPicker.hpp"
|
||||
#include "Elements/SelectableButton.hpp"
|
||||
|
|
@ -139,75 +140,75 @@ void GUIManager::draw(SkCanvas* canvas) {
|
|||
float halfLineWidth = 0.0f;
|
||||
// Top Left corner
|
||||
if (config->cornerRadius.topLeft > 0.0f) {
|
||||
SkPath path;
|
||||
SkPathBuilder path;
|
||||
float lineWidth = config->width.top;
|
||||
p.setStrokeWidth(lineWidth);
|
||||
path.moveTo(bb.x + halfLineWidth, bb.y + config->cornerRadius.topLeft + halfLineWidth);
|
||||
path.arcTo((bb.x + halfLineWidth), (bb.y + halfLineWidth), (bb.x + config->cornerRadius.topLeft + halfLineWidth), (bb.y + halfLineWidth), config->cornerRadius.topLeft);
|
||||
canvas->drawPath(path, p);
|
||||
path.arcTo(SkPoint{(bb.x + halfLineWidth), (bb.y + halfLineWidth)}, SkPoint{(bb.x + config->cornerRadius.topLeft + halfLineWidth), (bb.y + halfLineWidth)}, config->cornerRadius.topLeft);
|
||||
canvas->drawPath(path.detach(), p);
|
||||
}
|
||||
// Top border
|
||||
if (config->width.top > 0.0f) {
|
||||
SkPath path;
|
||||
SkPathBuilder path;
|
||||
float lineWidth = config->width.top;
|
||||
p.setStrokeWidth(lineWidth);
|
||||
path.moveTo((bb.x + config->cornerRadius.topLeft + halfLineWidth), (bb.y + halfLineWidth));
|
||||
path.lineTo((bb.x + bb.width - config->cornerRadius.topRight - halfLineWidth), (bb.y + halfLineWidth));
|
||||
canvas->drawPath(path, p);
|
||||
canvas->drawPath(path.detach(), p);
|
||||
}
|
||||
// Top Right Corner
|
||||
if (config->cornerRadius.topRight > 0.0f) {
|
||||
SkPath path;
|
||||
SkPathBuilder path;
|
||||
float lineWidth = config->width.top;
|
||||
p.setStrokeWidth(lineWidth);
|
||||
path.moveTo((bb.x + bb.width - config->cornerRadius.topRight - halfLineWidth), (bb.y + halfLineWidth));
|
||||
path.arcTo((bb.x + bb.width - halfLineWidth), (bb.y + halfLineWidth), (bb.x + bb.width - halfLineWidth), (bb.y + config->cornerRadius.topRight + halfLineWidth), config->cornerRadius.topRight);
|
||||
canvas->drawPath(path, p);
|
||||
path.arcTo(SkPoint{(bb.x + bb.width - halfLineWidth), (bb.y + halfLineWidth)}, SkPoint{(bb.x + bb.width - halfLineWidth), (bb.y + config->cornerRadius.topRight + halfLineWidth)}, config->cornerRadius.topRight);
|
||||
canvas->drawPath(path.detach(), p);
|
||||
}
|
||||
// Right border
|
||||
if (config->width.right > 0.0f) {
|
||||
SkPath path;
|
||||
SkPathBuilder path;
|
||||
float lineWidth = config->width.right;
|
||||
p.setStrokeWidth(lineWidth);
|
||||
path.moveTo((bb.x + bb.width - halfLineWidth), (bb.y + config->cornerRadius.topRight + halfLineWidth));
|
||||
path.lineTo((bb.x + bb.width - halfLineWidth), (bb.y + bb.height - config->cornerRadius.bottomRight - halfLineWidth));
|
||||
canvas->drawPath(path, p);
|
||||
canvas->drawPath(path.detach(), p);
|
||||
}
|
||||
// Bottom Right Corner
|
||||
if (config->cornerRadius.bottomRight > 0.0f) {
|
||||
SkPath path;
|
||||
SkPathBuilder path;
|
||||
float lineWidth = config->width.bottom;
|
||||
p.setStrokeWidth(lineWidth);
|
||||
path.moveTo((bb.x + bb.width - halfLineWidth), (bb.y + bb.height - config->cornerRadius.bottomRight - halfLineWidth));
|
||||
path.arcTo((bb.x + bb.width - halfLineWidth), (bb.y + bb.height - halfLineWidth), (bb.x + bb.width - config->cornerRadius.bottomRight - halfLineWidth), (bb.y + bb.height - halfLineWidth), config->cornerRadius.bottomRight);
|
||||
canvas->drawPath(path, p);
|
||||
path.arcTo(SkPoint{(bb.x + bb.width - halfLineWidth), (bb.y + bb.height - halfLineWidth)}, SkPoint{(bb.x + bb.width - config->cornerRadius.bottomRight - halfLineWidth), (bb.y + bb.height - halfLineWidth)}, config->cornerRadius.bottomRight);
|
||||
canvas->drawPath(path.detach(), p);
|
||||
}
|
||||
// Bottom Border
|
||||
if (config->width.bottom > 0.0f) {
|
||||
SkPath path;
|
||||
SkPathBuilder path;
|
||||
float lineWidth = config->width.bottom;
|
||||
p.setStrokeWidth(lineWidth);
|
||||
path.moveTo((bb.x + config->cornerRadius.bottomLeft + halfLineWidth), (bb.y + bb.height - halfLineWidth));
|
||||
path.lineTo((bb.x + bb.width - config->cornerRadius.bottomRight - halfLineWidth), (bb.y + bb.height - halfLineWidth));
|
||||
canvas->drawPath(path, p);
|
||||
canvas->drawPath(path.detach(), p);
|
||||
}
|
||||
// Bottom Left Corner
|
||||
if (config->cornerRadius.bottomLeft > 0.0f) {
|
||||
SkPath path;
|
||||
SkPathBuilder path;
|
||||
float lineWidth = config->width.bottom;
|
||||
p.setStrokeWidth(lineWidth);
|
||||
path.moveTo((bb.x + config->cornerRadius.bottomLeft + halfLineWidth), (bb.y + bb.height - halfLineWidth));
|
||||
path.arcTo((bb.x + halfLineWidth), (bb.y + bb.height - halfLineWidth), (bb.x + halfLineWidth), (bb.y + bb.height - config->cornerRadius.bottomLeft - halfLineWidth), config->cornerRadius.bottomLeft);
|
||||
canvas->drawPath(path, p);
|
||||
path.arcTo(SkPoint{(bb.x + halfLineWidth), (bb.y + bb.height - halfLineWidth)}, SkPoint{(bb.x + halfLineWidth), (bb.y + bb.height - config->cornerRadius.bottomLeft - halfLineWidth)}, config->cornerRadius.bottomLeft);
|
||||
canvas->drawPath(path.detach(), p);
|
||||
}
|
||||
// Left Border
|
||||
if (config->width.left > 0.0f) {
|
||||
SkPath path;
|
||||
SkPathBuilder path;
|
||||
float lineWidth = config->width.left;
|
||||
p.setStrokeWidth(lineWidth);
|
||||
path.moveTo((bb.x + halfLineWidth), (bb.y + bb.height - config->cornerRadius.bottomLeft - halfLineWidth));
|
||||
path.lineTo((bb.x + halfLineWidth), (bb.y + config->cornerRadius.topRight + halfLineWidth));
|
||||
canvas->drawPath(path, p);
|
||||
canvas->drawPath(path.detach(), p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "Helpers/MathExtras.hpp"
|
||||
#include "MainProgram.hpp"
|
||||
#include <include/core/SkFontMetrics.h>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
|
||||
sk_sp<SkRuntimeEffect> WorldGrid::circlePointEffect;
|
||||
sk_sp<SkRuntimeEffect> WorldGrid::squarePointEffect;
|
||||
|
|
@ -313,13 +314,13 @@ void WorldGrid::draw(GridManager& gMan, SkCanvas* canvas, const DrawData& drawDa
|
|||
Vector2f b2 = drawData.cam.c.to_space(b.top_right());
|
||||
Vector2f b3 = drawData.cam.c.to_space(b.max);
|
||||
Vector2f b4 = drawData.cam.c.to_space(b.bottom_left());
|
||||
SkPath clipPath;
|
||||
SkPathBuilder clipPath;
|
||||
clipPath.moveTo(b1.x(), b1.y());
|
||||
clipPath.lineTo(b2.x(), b2.y());
|
||||
clipPath.lineTo(b3.x(), b3.y());
|
||||
clipPath.lineTo(b4.x(), b4.y());
|
||||
clipPath.close();
|
||||
canvas->clipPath(clipPath);
|
||||
canvas->clipPath(clipPath.detach());
|
||||
}
|
||||
canvas->rotate(-drawData.cam.c.rotation * 180.0 / std::numbers::pi);
|
||||
canvas->drawPaint(linePaint);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue