Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: include/core/SkPatch.h

Issue 424663006: SkCanvas interface for drawing a patch. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Approx arc length for LOD and improved GM tests Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/core/SkPatch.h
diff --git a/include/core/SkPatch.h b/include/core/SkPatch.h
index 2354423aba21f8004fac0c66649d22a37f49aa20..b92fa10710cc3a78da6178c8f21ec135f35da368 100644
--- a/include/core/SkPatch.h
+++ b/include/core/SkPatch.h
@@ -46,6 +46,7 @@ public:
}
};
+ // Enums for control points based on the order specified in the constructor (clockwise).
enum CubicCtrlPts {
kTopP0_CubicCtrlPts = 0,
kTopP1_CubicCtrlPts = 1,
@@ -68,6 +69,17 @@ public:
kLeftP3_CubicCtrlPts = 9,
};
+ // Enum for corner colors also clockwise.
+ enum CornerColors {
+ kTopLeft_CornerColors = 0,
+ kTopRight_CornerColors,
+ kBottomRight_CornerColors,
+ kBottomLeft_CornerColors
+ };
+
+ // size in pixels of each partition per axis, adjust this knob
+ static const int kPartitionSize = 10;
bsalomon 2014/08/01 13:30:27 Does this really belong in the public interface of
dandov 2014/08/01 15:11:13 moved it to SkPatchUtils
+
/**
* Points are in the following order:
* (top curve)
@@ -76,49 +88,62 @@ public:
* 10 5
* 9 8 7 6
* (bottom curve)
- * Used pointer to an array to guarantee that this method receives an array of 4 SkColors
*/
SkPatch(SkPoint points[12], SkColor colors[4]);
/**
* Function that evaluates the coons patch interpolation.
* data refers to the pointer of the PatchData struct in which the tessellation data is set.
- * divisions defines the number of steps in which the SkPatch is going to be subdivided per
- * axis.
+ * lod refers the level of detail for each axis.
*/
- bool getVertexData(SkPatch::VertexData* data, int divisions);
+ bool getVertexData(SkPatch::VertexData* data, int lodX, int lodY) const;
- void getTopPoints(SkPoint points[4]) {
+ void getTopPoints(SkPoint points[4]) const {
points[0] = fCtrlPoints[kTopP0_CubicCtrlPts];
points[1] = fCtrlPoints[kTopP1_CubicCtrlPts];
points[2] = fCtrlPoints[kTopP2_CubicCtrlPts];
points[3] = fCtrlPoints[kTopP3_CubicCtrlPts];
}
- void getBottomPoints(SkPoint points[4]) {
+ void getBottomPoints(SkPoint points[4]) const {
points[0] = fCtrlPoints[kBottomP0_CubicCtrlPts];
points[1] = fCtrlPoints[kBottomP1_CubicCtrlPts];
points[2] = fCtrlPoints[kBottomP2_CubicCtrlPts];
points[3] = fCtrlPoints[kBottomP3_CubicCtrlPts];
}
- void getLeftPoints(SkPoint points[4]) {
+ void getLeftPoints(SkPoint points[4]) const {
points[0] = fCtrlPoints[kLeftP0_CubicCtrlPts];
points[1] = fCtrlPoints[kLeftP1_CubicCtrlPts];
points[2] = fCtrlPoints[kLeftP2_CubicCtrlPts];
points[3] = fCtrlPoints[kLeftP3_CubicCtrlPts];
}
- void getRightPoints(SkPoint points[4]) {
+ void getRightPoints(SkPoint points[4]) const {
points[0] = fCtrlPoints[kRightP0_CubicCtrlPts];
points[1] = fCtrlPoints[kRightP1_CubicCtrlPts];
points[2] = fCtrlPoints[kRightP2_CubicCtrlPts];
points[3] = fCtrlPoints[kRightP3_CubicCtrlPts];
}
+ void getCornerPoints(SkPoint points[4]) const {
+ points[0] = fCtrlPoints[kTopP0_CubicCtrlPts];
+ points[1] = fCtrlPoints[kTopP3_CubicCtrlPts];
+ points[2] = fCtrlPoints[kBottomP3_CubicCtrlPts];
+ points[3] = fCtrlPoints[kBottomP0_CubicCtrlPts];
+ }
+
+ const SkPoint* getControlPoints() const {
+ return fCtrlPoints;
+ }
+
+ const SkColor* getColors() const {
+ return fCornerColors;
+ }
+
private:
SkPoint fCtrlPoints[12];
- SkPMColor fCornerColors[4];
+ SkColor fCornerColors[4];
};
#endif

Powered by Google App Engine
This is Rietveld 408576698