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

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: Fixed implicit casting in patch.cpp Created 6 years, 4 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
« no previous file with comments | « include/core/SkDevice.h ('k') | include/utils/SkDeferredCanvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPatch.h
diff --git a/include/core/SkPatch.h b/include/core/SkPatch.h
index 2354423aba21f8004fac0c66649d22a37f49aa20..3e06c3fc91f9ce5bf5df56d2da680f8cefc36068 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,14 @@ public:
kLeftP3_CubicCtrlPts = 9,
};
+ // Enum for corner colors also clockwise.
+ enum CornerColors {
+ kTopLeft_CornerColors = 0,
+ kTopRight_CornerColors,
+ kBottomRight_CornerColors,
+ kBottomLeft_CornerColors
+ };
+
/**
* Points are in the following order:
* (top curve)
@@ -76,49 +85,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
« no previous file with comments | « include/core/SkDevice.h ('k') | include/utils/SkDeferredCanvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698