aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils
diff options
context:
space:
mode:
authorGravatar Stephan Altmueller <stephana@google.com>2017-03-20 14:22:58 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-20 14:23:11 +0000
commit006c8da9c65e234f102f671e5abd41f697864c89 (patch)
tree59b46b5d8618952ab3f07b62f4f6b5a96e0cf3ce /include/utils
parent1c1c740d2775bb19e3791e528586a73dec638ecb (diff)
Revert "remove unused SkMeshUtils and SkBoundaryPatch"
This reverts commit 5e21e0991968271ee37f446de7e08620ad1b50bb. Reason for revert: Breaks Pdfium build see: https://chromium-swarm.appspot.com/task?id=3504e60d4bc10810&refresh=10 Original change's description: > remove unused SkMeshUtils and SkBoundaryPatch > > BUG=skia:6366 > > Change-Id: Ibacd397e0a246dbeefde074c98712ada3848a7b6 > Reviewed-on: https://skia-review.googlesource.com/9852 > Reviewed-by: Mike Reed <reed@google.com> > Commit-Queue: Mike Reed <reed@google.com> > TBR=djsollen@google.com,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:6366 Change-Id: I2403bae0a17bce8eeec743c6f433bb51b214e669 Reviewed-on: https://skia-review.googlesource.com/9891 Reviewed-by: Stephan Altmueller <stephana@google.com> Commit-Queue: Stephan Altmueller <stephana@google.com>
Diffstat (limited to 'include/utils')
-rw-r--r--include/utils/SkBoundaryPatch.h66
-rw-r--r--include/utils/SkMeshUtils.h50
2 files changed, 116 insertions, 0 deletions
diff --git a/include/utils/SkBoundaryPatch.h b/include/utils/SkBoundaryPatch.h
new file mode 100644
index 0000000000..f8edd594b9
--- /dev/null
+++ b/include/utils/SkBoundaryPatch.h
@@ -0,0 +1,66 @@
+
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef SkBoundaryPatch_DEFINED
+#define SkBoundaryPatch_DEFINED
+
+#include "SkPoint.h"
+#include "SkRefCnt.h"
+
+class SkBoundary : public SkRefCnt {
+public:
+
+
+ // These must be 0, 1, 2, 3 for efficiency in the subclass implementations
+ enum Edge {
+ kTop = 0,
+ kRight = 1,
+ kBottom = 2,
+ kLeft = 3
+ };
+ // Edge index goes clockwise around the boundary, beginning at the "top"
+ virtual SkPoint eval(Edge, SkScalar unitInterval) = 0;
+
+private:
+ typedef SkRefCnt INHERITED;
+};
+
+class SkBoundaryPatch {
+public:
+ SkBoundaryPatch();
+ ~SkBoundaryPatch();
+
+ SkBoundary* getBoundary() const { return fBoundary; }
+ SkBoundary* setBoundary(SkBoundary*);
+
+ SkPoint eval(SkScalar unitU, SkScalar unitV);
+ bool evalPatch(SkPoint verts[], int rows, int cols);
+
+private:
+ SkBoundary* fBoundary;
+};
+
+////////////////////////////////////////////////////////////////////////
+
+class SkLineBoundary : public SkBoundary {
+public:
+ SkPoint fPts[4];
+
+ // override
+ virtual SkPoint eval(Edge, SkScalar);
+};
+
+class SkCubicBoundary : public SkBoundary {
+public:
+ // the caller sets the first 12 entries. The 13th is used by the impl.
+ SkPoint fPts[13];
+
+ // override
+ virtual SkPoint eval(Edge, SkScalar);
+};
+
+#endif
diff --git a/include/utils/SkMeshUtils.h b/include/utils/SkMeshUtils.h
new file mode 100644
index 0000000000..7e0e8f4de2
--- /dev/null
+++ b/include/utils/SkMeshUtils.h
@@ -0,0 +1,50 @@
+
+/*
+ * Copyright 2011 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef SkMeshUtils_DEFINED
+#define SkMeshUtils_DEFINED
+
+#include "SkPoint.h"
+#include "SkColor.h"
+
+class SkBitmap;
+class SkCanvas;
+class SkPaint;
+
+class SkMeshIndices {
+public:
+ SkMeshIndices();
+ ~SkMeshIndices();
+
+ bool init(int texW, int texH, int rows, int cols) {
+ return this->init(NULL, NULL, texW, texH, rows, cols);
+ }
+
+ bool init(SkPoint tex[], uint16_t indices[],
+ int texW, int texH, int rows, int cols);
+
+ int indexCount() const { return fIndexCount; }
+ const uint16_t* indices() const { return fIndices; }
+
+ size_t texCount() const { return fTexCount; }
+ const SkPoint* tex() const { return fTex; }
+
+private:
+ int fIndexCount, fTexCount;
+ SkPoint* fTex;
+ uint16_t* fIndices;
+ void* fStorage; // may be null
+};
+
+class SkMeshUtils {
+public:
+ static void Draw(SkCanvas*, const SkBitmap&, int rows, int cols,
+ const SkPoint verts[], const SkColor colors[],
+ const SkPaint& paint);
+};
+
+#endif