diff options
author | Mike Reed <reed@google.com> | 2017-03-17 13:09:38 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-03-17 13:09:52 +0000 |
commit | 1eb3fef136bc75bd8e8ed717ec7c5d4ab26def62 (patch) | |
tree | f58f12a44fbbb8bdd4727b923b587cc6d2c34c9d /include | |
parent | 73e21af21390c2806eb1350253233903808edd6b (diff) |
Revert "More SkVertices implementation work"
This reverts commit 14583e11fd622c686993b741499060a6f3527055.
Reason for revert: leaking
Direct leak of 499104 byte(s) in 2112 object(s) allocated from:
#0 0x1e195f0 in operator new(unsigned long) (/b/swarm_slave/w/irazbR79/out/Debug/dm+0x1e195f0)
#1 0x3142b0a in SkVertices::Builder::init(SkCanvas::VertexMode, int, int, SkVertices::Sizes const&) (/b/swarm_slave/w/irazbR79/out/Debug/dm+0x3142b0a)
Original change's description:
> More SkVertices implementation work
>
> - change virtuals to take const SkVertices*, as we do for TextBobs and Images
> - override onDrawVerticesObject in recording canvases
> - deserialize raw-vertices into SkVertices object
>
> Possibly a follow-on would intercept the raw-form directly in canvas,
> and remove the virtual, and only support the object form.
>
> BUG=skia:6366
>
> Change-Id: I57a932667ccb3b3b004beb802ac3ae6898e3c6e0
> Reviewed-on: https://skia-review.googlesource.com/9633
> Commit-Queue: Mike Reed <reed@google.com>
> Reviewed-by: Brian Salomon <bsalomon@google.com>
>
TBR=bsalomon@google.com,reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:6366
Change-Id: I40bb7a20698ef6aa0a9ef71a3d6ac4c1473e081c
Reviewed-on: https://skia-review.googlesource.com/9825
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkCanvas.h | 10 | ||||
-rw-r--r-- | include/private/SkRecords.h | 11 | ||||
-rw-r--r-- | include/utils/SkDumpCanvas.h | 6 | ||||
-rw-r--r-- | include/utils/SkLuaCanvas.h | 6 | ||||
-rw-r--r-- | include/utils/SkNoDrawCanvas.h | 5 |
5 files changed, 24 insertions, 14 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 85531bb74a..81841ba2b4 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -1186,9 +1186,9 @@ public: shader. In this case the colors are combined with the texture using mode, before being drawn using the paint. @param paint Specifies the shader/texture if present. + @param flags Allows the caller to ignore colors or texs on vertices. */ - void drawVertices(const SkVertices* vertices, SkBlendMode mode, const SkPaint& paint); - void drawVertices(const sk_sp<SkVertices>& vertices, SkBlendMode mode, const SkPaint& paint); + void drawVertices(sk_sp<SkVertices> vertices, SkBlendMode mode, const SkPaint& paint); /** Draw a cubic coons patch @@ -1445,10 +1445,12 @@ protected: virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint vertices[], const SkPoint texs[], const SkColor colors[], SkBlendMode, const uint16_t indices[], int indexCount, const SkPaint&); - virtual void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&); + virtual void onDrawVerticesObject(sk_sp<SkVertices> vertices, SkBlendMode mode, + const SkPaint& paint, uint32_t flags); // Subclasses can use this put the vertices object call on the regular draw vertices code path. // This is temporary until we teach recording and other SkCanvas classes about SkVertices. - void devolveSkVerticesToRaw(const SkVertices*, SkBlendMode, const SkPaint&); + void onDrawVerticesObjectFallback(sk_sp<SkVertices> vertices, SkBlendMode mode, + const SkPaint& paint, uint32_t flags); virtual void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int count, SkBlendMode, const SkRect* cull, const SkPaint*); diff --git a/include/private/SkRecords.h b/include/private/SkRecords.h index ac492ec0ea..b81bca87ee 100644 --- a/include/private/SkRecords.h +++ b/include/private/SkRecords.h @@ -21,7 +21,6 @@ #include "SkRSXform.h" #include "SkString.h" #include "SkTextBlob.h" -#include "SkVertices.h" // Windows.h, will pull in all of the GDI defines. GDI #defines // DrawText to DrawTextA or DrawTextW, but SkRecord has a struct @@ -346,8 +345,14 @@ RECORD(DrawAtlas, kDraw_Tag|kHasImage_Tag|kHasPaint_Tag, Optional<SkRect> cull); RECORD(DrawVertices, kDraw_Tag|kHasPaint_Tag, SkPaint paint; - sk_sp<SkVertices> vertices; - SkBlendMode bmode); + SkCanvas::VertexMode vmode; + int vertexCount; + PODArray<SkPoint> vertices; + PODArray<SkPoint> texs; + PODArray<SkColor> colors; + SkBlendMode bmode; + PODArray<uint16_t> indices; + int indexCount); RECORD(DrawAnnotation, 0, // TODO: kDraw_Tag, skia:5548 SkRect rect; SkString key; diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h index 19e5da567d..79a49bcd3b 100644 --- a/include/utils/SkDumpCanvas.h +++ b/include/utils/SkDumpCanvas.h @@ -117,9 +117,9 @@ protected: const SkColor colors[], SkBlendMode, const uint16_t indices[], int indexCount, const SkPaint&) override; - void onDrawVerticesObject(const SkVertices* vertices, SkBlendMode mode, - const SkPaint& paint) override { - this->devolveSkVerticesToRaw(vertices, mode, paint); + void onDrawVerticesObject(sk_sp<SkVertices> vertices, SkBlendMode mode, const SkPaint& paint, + uint32_t flags) override { + this->onDrawVerticesObjectFallback(std::move(vertices), mode, paint, flags); } void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; diff --git a/include/utils/SkLuaCanvas.h b/include/utils/SkLuaCanvas.h index a11d72f26c..ce374137c0 100644 --- a/include/utils/SkLuaCanvas.h +++ b/include/utils/SkLuaCanvas.h @@ -63,9 +63,9 @@ protected: const SkColor colors[], SkBlendMode, const uint16_t indices[], int indexCount, const SkPaint&) override; - void onDrawVerticesObject(const SkVertices* vertices, SkBlendMode mode, - const SkPaint& paint) override { - this->devolveSkVerticesToRaw(vertices, mode, paint); + void onDrawVerticesObject(sk_sp<SkVertices> vertices, SkBlendMode mode, const SkPaint& paint, + uint32_t flags) override { + this->onDrawVerticesObjectFallback(std::move(vertices), mode, paint, flags); } void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; diff --git a/include/utils/SkNoDrawCanvas.h b/include/utils/SkNoDrawCanvas.h index 75c15b201e..14b85549f4 100644 --- a/include/utils/SkNoDrawCanvas.h +++ b/include/utils/SkNoDrawCanvas.h @@ -68,7 +68,10 @@ protected: const SkPaint*) override {} void onDrawVertices(VertexMode, int, const SkPoint[], const SkPoint[], const SkColor[], SkBlendMode, const uint16_t[], int, const SkPaint&) override {} - void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override {} + void onDrawVerticesObject(sk_sp<SkVertices> vertices, SkBlendMode mode, const SkPaint& paint, + uint32_t flags) override { + this->onDrawVerticesObjectFallback(std::move(vertices), mode, paint, flags); + } void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int, SkBlendMode, const SkRect*, const SkPaint*) override {} |