mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
path_coarse.comp: tighten variable scopes, delete unused variables
No functional changes. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
parent
c50d3f17ea
commit
2068171f96
|
@ -101,12 +101,6 @@ void main() {
|
||||||
if (element_ix < n_pathseg) {
|
if (element_ix < n_pathseg) {
|
||||||
tag = PathSeg_tag(ref);
|
tag = PathSeg_tag(ref);
|
||||||
}
|
}
|
||||||
// Setup for coverage algorithm.
|
|
||||||
float a, b, c;
|
|
||||||
// Bounding box of element in pixel coordinates.
|
|
||||||
float xmin, xmax, ymin, ymax;
|
|
||||||
PathStrokeLine line;
|
|
||||||
float dx;
|
|
||||||
switch (tag) {
|
switch (tag) {
|
||||||
case PathSeg_FillCubic:
|
case PathSeg_FillCubic:
|
||||||
case PathSeg_StrokeCubic:
|
case PathSeg_StrokeCubic:
|
||||||
|
@ -162,22 +156,24 @@ void main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output line segment
|
// Output line segment
|
||||||
xmin = min(p0.x, p1.x) - cubic.stroke.x;
|
|
||||||
xmax = max(p0.x, p1.x) + cubic.stroke.x;
|
// Bounding box of element in pixel coordinates.
|
||||||
ymin = min(p0.y, p1.y) - cubic.stroke.y;
|
float xmin = min(p0.x, p1.x) - cubic.stroke.x;
|
||||||
ymax = max(p0.y, p1.y) + cubic.stroke.y;
|
float xmax = max(p0.x, p1.x) + cubic.stroke.x;
|
||||||
|
float ymin = min(p0.y, p1.y) - cubic.stroke.y;
|
||||||
|
float ymax = max(p0.y, p1.y) + cubic.stroke.y;
|
||||||
float dx = p1.x - p0.x;
|
float dx = p1.x - p0.x;
|
||||||
float dy = p1.y - p0.y;
|
float dy = p1.y - p0.y;
|
||||||
// Set up for per-scanline coverage formula, below.
|
// Set up for per-scanline coverage formula, below.
|
||||||
float invslope = abs(dy) < 1e-9 ? 1e9 : dx / dy;
|
float invslope = abs(dy) < 1e-9 ? 1e9 : dx / dy;
|
||||||
c = (cubic.stroke.x + abs(invslope) * (0.5 * float(TILE_HEIGHT_PX) + cubic.stroke.y)) * SX;
|
float c = (cubic.stroke.x + abs(invslope) * (0.5 * float(TILE_HEIGHT_PX) + cubic.stroke.y)) * SX;
|
||||||
b = invslope; // Note: assumes square tiles, otherwise scale.
|
float b = invslope; // Note: assumes square tiles, otherwise scale.
|
||||||
a = (p0.x - (p0.y - 0.5 * float(TILE_HEIGHT_PX)) * b) * SX;
|
float a = (p0.x - (p0.y - 0.5 * float(TILE_HEIGHT_PX)) * b) * SX;
|
||||||
|
|
||||||
int x0 = int(floor((xmin) * SX));
|
int x0 = int(floor(xmin * SX));
|
||||||
int x1 = int(ceil((xmax) * SX));
|
int x1 = int(ceil(xmax * SX));
|
||||||
int y0 = int(floor((ymin) * SY));
|
int y0 = int(floor(ymin * SY));
|
||||||
int y1 = int(ceil((ymax) * SY));
|
int y1 = int(ceil(ymax * SY));
|
||||||
|
|
||||||
x0 = clamp(x0, bbox.x, bbox.z);
|
x0 = clamp(x0, bbox.x, bbox.z);
|
||||||
y0 = clamp(y0, bbox.y, bbox.w);
|
y0 = clamp(y0, bbox.y, bbox.w);
|
||||||
|
|
Binary file not shown.
Loading…
Reference in a new issue