aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-10-17 19:14:05 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-10-17 19:14:15 +0000
commit62563deb6b4dbb0b1db7f29f35e07dcef043af31 (patch)
tree66d808c7c81cfe96056188c4137d50a32baecce3 /include/core
parentd4faecd2dcd2de6e8ae01ccc497ba74d1f6a59b1 (diff)
Revert "Make GPU backend triangulate rects such that they are rendered as tri strips rather than tri fans."
This reverts commit fa2d604a7ded95a3ace905519b476129cd0fffcb. Reason for revert: <INSERT REASONING HERE> Original change's description: > Make GPU backend triangulate rects such that they are rendered as tri strips rather than tri fans. > > Right now when we turn rects into quads we use a vertex order compatible with a tri fan rather than a tri strip. > > I wanted it to be the case that the same code could be used to generate a non-indexed mesh for a single rect or indexed using the quad index buffer when batching. Triangle fanning is not available in all APIS (e.g. is emulated in ANGLE and not supported in Metal) so it seems better to use a triangle strip over a fan in the single rect case. > > > Change-Id: I31eebd794e7328f4b39e3ec3377bf2ec556360ca > Reviewed-on: https://skia-review.googlesource.com/60081 > Commit-Queue: Brian Salomon <bsalomon@google.com> > Reviewed-by: Robert Phillips <robertphillips@google.com> TBR=bsalomon@google.com,robertphillips@google.com Change-Id: I7c4c23aa418da09c9708b28cce64ab58e282dd3a No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/60683 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkPoint.h17
-rw-r--r--include/core/SkRSXform.h1
2 files changed, 8 insertions, 10 deletions
diff --git a/include/core/SkPoint.h b/include/core/SkPoint.h
index 70437340b6..4aceff7a49 100644
--- a/include/core/SkPoint.h
+++ b/include/core/SkPoint.h
@@ -205,6 +205,14 @@ struct SK_API SkPoint {
void setIRectFan(int l, int t, int r, int b, size_t stride);
// counter-clockwise fan
+ void setRectFan(SkScalar l, SkScalar t, SkScalar r, SkScalar b) {
+ SkPoint* v = this;
+ v[0].set(l, t);
+ v[1].set(l, b);
+ v[2].set(r, b);
+ v[3].set(r, t);
+ }
+
void setRectFan(SkScalar l, SkScalar t, SkScalar r, SkScalar b, size_t stride) {
SkASSERT(stride >= sizeof(SkPoint));
@@ -214,15 +222,6 @@ struct SK_API SkPoint {
((SkPoint*)((intptr_t)this + 3 * stride))->set(r, t);
}
- // tri strip with two counter-clockwise triangles
- void setRectTriStrip(SkScalar l, SkScalar t, SkScalar r, SkScalar b, size_t stride) {
- SkASSERT(stride >= sizeof(SkPoint));
-
- ((SkPoint*)((intptr_t)this + 0 * stride))->set(l, t);
- ((SkPoint*)((intptr_t)this + 1 * stride))->set(l, b);
- ((SkPoint*)((intptr_t)this + 2 * stride))->set(r, t);
- ((SkPoint*)((intptr_t)this + 3 * stride))->set(r, b);
- }
static void Offset(SkPoint points[], int count, const SkPoint& offset) {
Offset(points, count, offset.fX, offset.fY);
diff --git a/include/core/SkRSXform.h b/include/core/SkRSXform.h
index b11dea7723..706617e313 100644
--- a/include/core/SkRSXform.h
+++ b/include/core/SkRSXform.h
@@ -62,7 +62,6 @@ struct SkRSXform {
void toQuad(const SkSize& size, SkPoint quad[4]) const {
this->toQuad(size.width(), size.height(), quad);
}
- void toTriStrip(SkScalar width, SkScalar height, SkPoint strip[4]) const;
};
#endif