Add convenience overload of SkPointPriv::SetRectTriStrip that takes SkRect
authorBrian Salomon <bsalomon@google.com>
Fri, 18 May 2018 16:52:22 +0000 (12:52 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Fri, 18 May 2018 18:11:14 +0000 (18:11 +0000)
Change-Id: Idf5bfafaf19c20f074f12d706b8b8984c5935e6d
Reviewed-on: https://skia-review.googlesource.com/129185
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>

gm/beziereffects.cpp
gm/convexpolyeffect.cpp
src/core/SkPointPriv.h
src/gpu/ops/GrLatticeOp.cpp
src/gpu/ops/GrRegionOp.cpp
src/gpu/ops/GrSmallPathRenderer.cpp
tests/OnFlushCallbackTest.cpp

index 226ce315ec8550ab0c1224e4a1a4ce0e7f7b0165..51e8415556fff2be230cf921d29f301bfa65c196 100644 (file)
@@ -95,7 +95,7 @@ private:
             return;
         }
         SkRect rect = this->rect();
-        SkPointPriv::SetRectTriStrip(pts, rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vertexStride);
+        SkPointPriv::SetRectTriStrip(pts, rect, vertexStride);
         helper.recordDraw(target, this->gp(), this->makePipeline(target));
     }
 
@@ -495,8 +495,7 @@ private:
             return;
         }
         SkRect rect = this->rect();
-        SkPointPriv::SetRectTriStrip(&verts[0].fPosition, rect.fLeft, rect.fTop, rect.fRight,
-                                     rect.fBottom, sizeof(Vertex));
+        SkPointPriv::SetRectTriStrip(&verts[0].fPosition, rect, sizeof(Vertex));
         fDevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts);
         helper.recordDraw(target, this->gp(), this->makePipeline(target));
     }
index ca27e285e2654973cf0f84e34662361a731e21a2..8942602fb9a937a59811d70d0e59930379ace877 100644 (file)
@@ -86,8 +86,7 @@ private:
             return;
         }
 
-        SkPointPriv::SetRectTriStrip(verts, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom,
-                               sizeof(SkPoint));
+        SkPointPriv::SetRectTriStrip(verts, fRect, sizeof(SkPoint));
 
         helper.recordDraw(
                 target, gp.get(),
index 6c8fd480a7d1ccbf54e893d8163d5d406557235c..40c7e1043c4e85a7d02727d087c3688c96cf5d39 100644 (file)
@@ -9,6 +9,7 @@
 #define SkPointPriv_DEFINED
 
 #include "SkPoint.h"
+#include "SkRect.h"
 
 class SkPointPriv {
 public:
@@ -127,7 +128,9 @@ public:
         ((SkPoint*)((intptr_t)v + 2 * stride))->set(r, t);
         ((SkPoint*)((intptr_t)v + 3 * stride))->set(r, b);
     }
-
+    static void SetRectTriStrip(SkPoint v[], const SkRect& rect, size_t stride) {
+        SetRectTriStrip(v, rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, stride);
+    }
 };
 
 #endif
index f1359c62fd44eeb6c600c0d24c3c0bd5b95d943a..0d600ed30535c85f9166f1344a215fe5eb1dd69a 100644 (file)
@@ -239,8 +239,7 @@ private:
             static const Sk4f kFlipMuls(1.f, -1.f, 1.f, -1.f);
             while (patch.fIter->next(&srcR, &dstR)) {
                 auto vertices = reinterpret_cast<LatticeGP::Vertex*>(verts);
-                SkPointPriv::SetRectTriStrip(&vertices->fPosition, dstR.fLeft, dstR.fTop,
-                                             dstR.fRight, dstR.fBottom, vertexStride);
+                SkPointPriv::SetRectTriStrip(&vertices->fPosition, dstR, vertexStride);
                 Sk4f coords(SkIntToScalar(srcR.fLeft), SkIntToScalar(srcR.fTop),
                             SkIntToScalar(srcR.fRight), SkIntToScalar(srcR.fBottom));
                 Sk4f domain = coords + kDomainOffsets;
index c8d82daa4089c2695c78a97c3604d4d6a019b5d5..5f63f099888399c7b64251d86e761d28792e7693 100644 (file)
@@ -35,8 +35,7 @@ static void tesselate_region(intptr_t vertices,
     while (!iter.done()) {
         SkRect rect = SkRect::Make(iter.rect());
         SkPoint* position = (SkPoint*)verts;
-        SkPointPriv::SetRectTriStrip(position, rect.fLeft, rect.fTop, rect.fRight, rect.fBottom,
-                vertexStride);
+        SkPointPriv::SetRectTriStrip(position, rect, vertexStride);
 
         static const int kColorOffset = sizeof(SkPoint);
         GrColor* vertColor = reinterpret_cast<GrColor*>(verts + kColorOffset);
index 3e2134891831fcffb3dd63d855b3c17f0db95e9b..48de75aab4e3d1bb27eb6d0ca0fcaacaba043813 100644 (file)
@@ -758,12 +758,7 @@ private:
             position = (SkPoint*)positionOffset;
             *position = quad.point(3);
         } else {
-            SkPointPriv::SetRectTriStrip(positions,
-                                         translatedBounds.left(),
-                                         translatedBounds.top(),
-                                         translatedBounds.right(),
-                                         translatedBounds.bottom(),
-                                         vertexStride);
+            SkPointPriv::SetRectTriStrip(positions, translatedBounds, vertexStride);
         }
 
         // colors
index a503bc3a56dbf2e7ced1989118a42fa98be8b1f7..8fb8a38d7521e485af3a97385eef94b4c1464b27 100644 (file)
@@ -139,8 +139,7 @@ private:
 
         // Setup positions
         SkPoint* position = (SkPoint*) vertices;
-        SkPointPriv::SetRectTriStrip(position, fRect.fLeft, fRect.fTop, fRect.fRight, fRect.fBottom,
-                                     vertexStride);
+        SkPointPriv::SetRectTriStrip(position, fRect, vertexStride);
 
         // Setup vertex colors
         GrColor* color = (GrColor*)((intptr_t)vertices + kColorOffset);