mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-27 00:26:51 +00:00
common: retyped the color value size_t -> uint8_t
since it's range is 0 - 255. Change-Id: I16e0569341c4a94acab9488d076f235bf90ff4db
This commit is contained in:
parent
98edb4112b
commit
dc5f9f7430
4 changed files with 13 additions and 13 deletions
|
@ -142,13 +142,13 @@ public:
|
||||||
|
|
||||||
//Stroke
|
//Stroke
|
||||||
int stroke(float width) noexcept;
|
int stroke(float width) noexcept;
|
||||||
int stroke(size_t r, size_t g, size_t b, size_t a) noexcept;
|
int stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept;
|
||||||
int stroke(const size_t* dashPattern, size_t cnt) noexcept;
|
int stroke(const size_t* dashPattern, size_t cnt) noexcept;
|
||||||
int stroke(StrokeCap cap) noexcept;
|
int stroke(StrokeCap cap) noexcept;
|
||||||
int stroke(StrokeJoin join) noexcept;
|
int stroke(StrokeJoin join) noexcept;
|
||||||
|
|
||||||
//Fill
|
//Fill
|
||||||
int fill(size_t r, size_t g, size_t b, size_t a) noexcept;
|
int fill(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept;
|
||||||
|
|
||||||
//Transform
|
//Transform
|
||||||
int rotate(float degree) noexcept override;
|
int rotate(float degree) noexcept override;
|
||||||
|
@ -158,11 +158,11 @@ public:
|
||||||
//Getters
|
//Getters
|
||||||
size_t pathCommands(const PathCommand** cmds) const noexcept;
|
size_t pathCommands(const PathCommand** cmds) const noexcept;
|
||||||
size_t pathCoords(const Point** pts) const noexcept;
|
size_t pathCoords(const Point** pts) const noexcept;
|
||||||
int fill(size_t* r, size_t* g, size_t* b, size_t* a) const noexcept;
|
int fill(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const noexcept;
|
||||||
int bounds(float* x, float* y, float* w, float* h) const noexcept override;
|
int bounds(float* x, float* y, float* w, float* h) const noexcept override;
|
||||||
|
|
||||||
float strokeWidth() const noexcept;
|
float strokeWidth() const noexcept;
|
||||||
int strokeColor(size_t* r, size_t* g, size_t* b, size_t* a) const noexcept;
|
int strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const noexcept;
|
||||||
size_t strokeDash(const size_t** dashPattern) const noexcept;
|
size_t strokeDash(const size_t** dashPattern) const noexcept;
|
||||||
StrokeCap strokeCap() const noexcept;
|
StrokeCap strokeCap() const noexcept;
|
||||||
StrokeJoin strokeJoin() const noexcept;
|
StrokeJoin strokeJoin() const noexcept;
|
||||||
|
|
|
@ -62,7 +62,7 @@ bool SwRenderer::render(const Shape& shape, void *data)
|
||||||
SwShape* sdata = static_cast<SwShape*>(data);
|
SwShape* sdata = static_cast<SwShape*>(data);
|
||||||
if (!sdata) return false;
|
if (!sdata) return false;
|
||||||
|
|
||||||
size_t r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
|
|
||||||
shape.fill(&r, &g, &b, &a);
|
shape.fill(&r, &g, &b, &a);
|
||||||
if (a > 0) rasterShape(surface, *sdata, r, g, b, a);
|
if (a > 0) rasterShape(surface, *sdata, r, g, b, a);
|
||||||
|
@ -100,7 +100,7 @@ void* SwRenderer::prepare(const Shape& shape, void* data, const RenderTransform*
|
||||||
//Shape
|
//Shape
|
||||||
if (flags & (RenderUpdateFlag::Path | RenderUpdateFlag::Transform)) {
|
if (flags & (RenderUpdateFlag::Path | RenderUpdateFlag::Transform)) {
|
||||||
|
|
||||||
size_t alpha = 0;
|
uint8_t alpha = 0;
|
||||||
shape.fill(nullptr, nullptr, nullptr, &alpha);
|
shape.fill(nullptr, nullptr, nullptr, &alpha);
|
||||||
|
|
||||||
if (alpha > 0) {
|
if (alpha > 0) {
|
||||||
|
@ -116,7 +116,7 @@ void* SwRenderer::prepare(const Shape& shape, void* data, const RenderTransform*
|
||||||
|
|
||||||
if (shape.strokeWidth() > 0.5) {
|
if (shape.strokeWidth() > 0.5) {
|
||||||
shapeResetStroke(shape, *sdata);
|
shapeResetStroke(shape, *sdata);
|
||||||
size_t alpha = 0;
|
uint8_t alpha = 0;
|
||||||
shape.strokeColor(nullptr, nullptr, nullptr, &alpha);
|
shape.strokeColor(nullptr, nullptr, nullptr, &alpha);
|
||||||
if (alpha > 0) {
|
if (alpha > 0) {
|
||||||
if (!shapeGenStrokeRle(shape, *sdata, clip)) return sdata;
|
if (!shapeGenStrokeRle(shape, *sdata, clip)) return sdata;
|
||||||
|
|
|
@ -213,7 +213,7 @@ int Shape::appendRect(float x, float y, float w, float h, float cornerRadius) no
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Shape::fill(size_t r, size_t g, size_t b, size_t a) noexcept
|
int Shape::fill(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept
|
||||||
{
|
{
|
||||||
auto impl = pImpl.get();
|
auto impl = pImpl.get();
|
||||||
assert(impl);
|
assert(impl);
|
||||||
|
@ -228,7 +228,7 @@ int Shape::fill(size_t r, size_t g, size_t b, size_t a) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Shape::fill(size_t* r, size_t* g, size_t* b, size_t* a) const noexcept
|
int Shape::fill(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const noexcept
|
||||||
{
|
{
|
||||||
auto impl = pImpl.get();
|
auto impl = pImpl.get();
|
||||||
assert(impl);
|
assert(impl);
|
||||||
|
@ -301,7 +301,7 @@ float Shape::strokeWidth() const noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Shape::stroke(size_t r, size_t g, size_t b, size_t a) noexcept
|
int Shape::stroke(uint8_t r, uint8_t g, uint8_t b, uint8_t a) noexcept
|
||||||
{
|
{
|
||||||
auto impl = pImpl.get();
|
auto impl = pImpl.get();
|
||||||
assert(impl);
|
assert(impl);
|
||||||
|
@ -312,7 +312,7 @@ int Shape::stroke(size_t r, size_t g, size_t b, size_t a) noexcept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Shape::strokeColor(size_t* r, size_t* g, size_t* b, size_t* a) const noexcept
|
int Shape::strokeColor(uint8_t* r, uint8_t* g, uint8_t* b, uint8_t* a) const noexcept
|
||||||
{
|
{
|
||||||
auto impl = pImpl.get();
|
auto impl = pImpl.get();
|
||||||
assert(impl);
|
assert(impl);
|
||||||
|
|
|
@ -31,7 +31,7 @@ struct ShapeFill
|
||||||
struct ShapeStroke
|
struct ShapeStroke
|
||||||
{
|
{
|
||||||
float width = 0;
|
float width = 0;
|
||||||
size_t color[4] = {0, 0, 0, 0};
|
uint8_t color[4] = {0, 0, 0, 0};
|
||||||
size_t* dashPattern = nullptr;
|
size_t* dashPattern = nullptr;
|
||||||
size_t dashCnt = 0;
|
size_t dashCnt = 0;
|
||||||
StrokeCap cap = StrokeCap::Square;
|
StrokeCap cap = StrokeCap::Square;
|
||||||
|
@ -188,7 +188,7 @@ struct Shape::Impl
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool strokeColor(size_t r, size_t g, size_t b, size_t a)
|
bool strokeColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||||
{
|
{
|
||||||
if (!stroke) stroke = new ShapeStroke();
|
if (!stroke) stroke = new ShapeStroke();
|
||||||
assert(stroke);
|
assert(stroke);
|
||||||
|
|
Loading…
Add table
Reference in a new issue