Revert "Revert "Make GPU backend triangulate rects such that they are rendered as tri strips rather than tri fans.""
This reverts commit 62563deb6b4dbb0b1db7f29f35e07dcef043af31.
Reason for revert: change that affected similar set of GMs reverted, relanding now that this is more easily triagable.
Original change's description:
> 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>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: Iefcd16676a7617d32e89fc84206cd4e88e9a06e1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/61160
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 49e7283..9a61154 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -17,6 +17,7 @@
#include "GrGpuResourcePriv.h"
#include "GrOpList.h"
#include "GrPathRenderer.h"
+#include "GrQuad.h"
#include "GrRenderTarget.h"
#include "GrRenderTargetContextPriv.h"
#include "GrResourceProvider.h"
@@ -509,12 +510,12 @@
return;
}
// Does the rect bound the RT?
- SkPoint srcSpaceRTQuad[4];
- invM.mapRectToQuad(srcSpaceRTQuad, rtRect);
- if (rect_contains_inclusive(rect, srcSpaceRTQuad[0]) &&
- rect_contains_inclusive(rect, srcSpaceRTQuad[1]) &&
- rect_contains_inclusive(rect, srcSpaceRTQuad[2]) &&
- rect_contains_inclusive(rect, srcSpaceRTQuad[3])) {
+ GrQuad quad;
+ quad.setFromMappedRect(rtRect, invM);
+ if (rect_contains_inclusive(rect, quad.point(0)) &&
+ rect_contains_inclusive(rect, quad.point(1)) &&
+ rect_contains_inclusive(rect, quad.point(2)) &&
+ rect_contains_inclusive(rect, quad.point(3))) {
// Will it blend?
GrColor clearColor;
if (paint.isConstantBlendedColor(&clearColor)) {