aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-03-17 12:09:04 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-17 17:03:18 +0000
commitfed9cfdc0216152d7fffe6d838ea7281466ffe74 (patch)
treef492f753a9ec89df2e9725bd5e60b7101f6c9a9a /tools
parente0a34e7dcddf68f0972805894f26c54869c3faba (diff)
remove legacy virtual for vertices, only support object form
BUG=skia:6366 Change-Id: Ic422fa44a788d3488c050c6218dbfba188bb8f3e Reviewed-on: https://skia-review.googlesource.com/9835 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/debugger/SkDebugCanvas.cpp10
-rw-r--r--tools/debugger/SkDebugCanvas.h10
-rw-r--r--tools/debugger/SkDrawCommand.cpp49
-rw-r--r--tools/debugger/SkDrawCommand.h21
4 files changed, 15 insertions, 75 deletions
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index 522f4edbeb..6349810ff9 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -663,12 +663,10 @@ void SkDebugCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4
this->addDrawCommand(new SkDrawPatchCommand(cubics, colors, texCoords, bmode, paint));
}
-void SkDebugCanvas::onDrawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[],
- const SkPoint texs[], const SkColor colors[],
- SkBlendMode bmode, const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
- this->addDrawCommand(new SkDrawVerticesCommand(vmode, vertexCount, vertices,
- texs, colors, bmode, indices, indexCount, paint));
+void SkDebugCanvas::onDrawVerticesObject(const SkVertices* vertices, SkBlendMode bmode,
+ const SkPaint& paint) {
+ this->addDrawCommand(new SkDrawVerticesCommand(sk_ref_sp(const_cast<SkVertices*>(vertices)),
+ bmode, paint));
}
void SkDebugCanvas::willRestore() {
diff --git a/tools/debugger/SkDebugCanvas.h b/tools/debugger/SkDebugCanvas.h
index 2b15bbaf90..0f2ae514dd 100644
--- a/tools/debugger/SkDebugCanvas.h
+++ b/tools/debugger/SkDebugCanvas.h
@@ -225,15 +225,7 @@ protected:
void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override;
void onDrawRRect(const SkRRect&, const SkPaint&) override;
void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override;
- void onDrawVertices(VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- 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(const SkVertices*, SkBlendMode, const SkPaint&) override;
void onDrawPath(const SkPath&, const SkPaint&) override;
void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override;
void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index 09b8ab49ad..691a4f8012 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -3394,61 +3394,20 @@ SkDrawTextRSXformCommand* SkDrawTextRSXformCommand::fromJSON(Json::Value& comman
///////////////////////////////////////////////////////////////////////////////////////////////////
-SkDrawVerticesCommand::SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkBlendMode bmode,
- const uint16_t indices[], int indexCount,
+SkDrawVerticesCommand::SkDrawVerticesCommand(sk_sp<SkVertices> vertices, SkBlendMode bmode,
const SkPaint& paint)
: INHERITED(kDrawVertices_OpType)
+ , fVertices(std::move(vertices))
, fBlendMode(bmode)
+ , fPaint(paint)
{
- fVmode = vmode;
-
- fVertexCount = vertexCount;
-
- fVertices = new SkPoint[vertexCount];
- memcpy(fVertices, vertices, vertexCount * sizeof(SkPoint));
-
- if (texs) {
- fTexs = new SkPoint[vertexCount];
- memcpy(fTexs, texs, vertexCount * sizeof(SkPoint));
- } else {
- fTexs = nullptr;
- }
-
- if (colors) {
- fColors = new SkColor[vertexCount];
- memcpy(fColors, colors, vertexCount * sizeof(SkColor));
- } else {
- fColors = nullptr;
- }
-
- if (indexCount > 0) {
- fIndices = new uint16_t[indexCount];
- memcpy(fIndices, indices, indexCount * sizeof(uint16_t));
- } else {
- fIndices = nullptr;
- }
-
- fIndexCount = indexCount;
- fPaint = paint;
-
// TODO(chudy)
fInfo.push(SkObjectParser::CustomTextToString("To be implemented."));
fInfo.push(SkObjectParser::PaintToString(paint));
}
-SkDrawVerticesCommand::~SkDrawVerticesCommand() {
- delete [] fVertices;
- delete [] fTexs;
- delete [] fColors;
- delete [] fIndices;
-}
-
void SkDrawVerticesCommand::execute(SkCanvas* canvas) const {
- canvas->drawVertices(fVmode, fVertexCount, fVertices,
- fTexs, fColors, fBlendMode, fIndices,
- fIndexCount, fPaint);
+ canvas->drawVertices(fVertices, fBlendMode, fPaint);
}
SkRestoreCommand::SkRestoreCommand()
diff --git a/tools/debugger/SkDrawCommand.h b/tools/debugger/SkDrawCommand.h
index 964badcf58..e23eed138c 100644
--- a/tools/debugger/SkDrawCommand.h
+++ b/tools/debugger/SkDrawCommand.h
@@ -16,6 +16,7 @@
#include "SkRSXform.h"
#include "SkString.h"
#include "SkTDArray.h"
+#include "SkVertices.h"
#include "SkJSONCPP.h"
#include "UrlDataManager.h"
@@ -732,24 +733,14 @@ private:
class SkDrawVerticesCommand : public SkDrawCommand {
public:
- SkDrawVerticesCommand(SkCanvas::VertexMode vmode, int vertexCount,
- const SkPoint vertices[], const SkPoint texs[],
- const SkColor colors[], SkBlendMode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint);
- virtual ~SkDrawVerticesCommand();
+ SkDrawVerticesCommand(sk_sp<SkVertices>, SkBlendMode, const SkPaint&);
+
void execute(SkCanvas* canvas) const override;
private:
- SkCanvas::VertexMode fVmode;
- int fVertexCount;
- SkPoint* fVertices;
- SkPoint* fTexs;
- SkColor* fColors;
- SkBlendMode fBlendMode;
- uint16_t* fIndices;
- int fIndexCount;
- SkPaint fPaint;
+ sk_sp<SkVertices> fVertices;
+ SkBlendMode fBlendMode;
+ SkPaint fPaint;
typedef SkDrawCommand INHERITED;
};