Make the src rects of truths in SkLatticeIter be integral.
This will make the non-bleed gpu implementation more sane as we will
know that the input src rects are at integers and if offset by +/-0.5
we will be at pixel centers.
No change in behavior, since src rects really were integral all along.
Bug: b/77917978
Change-Id: I7193ff0b38de5d10debc24a0121e643573c47cda
Reviewed-on: https://skia-review.googlesource.com/125740
Commit-Queue: Leon Scroggins <scroggo@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
diff --git a/src/core/SkLatticeIter.cpp b/src/core/SkLatticeIter.cpp
index 434cce6..fcc12c6 100644
--- a/src/core/SkLatticeIter.cpp
+++ b/src/core/SkLatticeIter.cpp
@@ -76,10 +76,9 @@
/**
* Set points for the src and dst rects on subsequent draw calls.
*/
-static void set_points(float* dst, float* src, const int* divs, int divCount, int srcFixed,
- int srcScalable, float srcStart, float srcEnd, float dstStart, float dstEnd,
+static void set_points(float* dst, int* src, const int* divs, int divCount, int srcFixed,
+ int srcScalable, int srcStart, int srcEnd, float dstStart, float dstEnd,
bool isScalable) {
-
float dstLen = dstEnd - dstStart;
float scale;
if (srcFixed <= dstLen) {
@@ -94,8 +93,8 @@
src[0] = srcStart;
dst[0] = dstStart;
for (int i = 0; i < divCount; i++) {
- src[i + 1] = (float) (divs[i]);
- float srcDelta = src[i + 1] - src[i];
+ src[i + 1] = divs[i];
+ int srcDelta = src[i + 1] - src[i];
float dstDelta;
if (srcFixed <= dstLen) {
dstDelta = isScalable ? scale * srcDelta : srcDelta;
@@ -254,7 +253,7 @@
fNumRectsToDraw = 9;
}
-bool SkLatticeIter::next(SkRect* src, SkRect* dst, bool* isFixedColor, SkColor* fixedColor) {
+bool SkLatticeIter::next(SkIRect* src, SkRect* dst, bool* isFixedColor, SkColor* fixedColor) {
int currRect = fCurrX + fCurrY * (fSrcX.count() - 1);
if (currRect == fNumRectsInLattice) {
return false;