aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/utils/SkPatchGrid.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/SkPatchGrid.h')
-rw-r--r--src/utils/SkPatchGrid.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/utils/SkPatchGrid.h b/src/utils/SkPatchGrid.h
index 5bc2e65df0..ca2a35b912 100644
--- a/src/utils/SkPatchGrid.h
+++ b/src/utils/SkPatchGrid.h
@@ -13,12 +13,12 @@
#include "SkXfermode.h"
/**
- * Class that represents a grid of patches. Adjacent patches share their corners and a color is
+ * Class that represents a grid of patches. Adjacent patches share their corners and a color is
* specified at each one of them. The colors are bilinearly interpolated across the patch.
*
- * This implementation defines a bidimensional array of patches. There are 3 arrays to store the
+ * This implementation defines a bidimensional array of patches. There are 3 arrays to store the
* control points of the patches to avoid storing repeated data since there are several points
- * shared between adjacent patches.
+ * shared between adjacent patches.
*
* The array fCornerPts stores the corner control points of the patches.
* The array fHrzPts holds the intermidiate control points of the top and bottom curves of a patch.
@@ -54,11 +54,11 @@
* \ / \ /
* H8 H9 H10 H11
*
- * When trying to get a patch at a certain position it justs builds it with the corresponding
+ * When trying to get a patch at a certain position it justs builds it with the corresponding
* points.
* When adding a patch it tries to add the points at their corresponding position trying to comply
* with the adjacent points or overwriting them.
- *
+ *
* Based the idea on the SVG2 spec for mesh gradients in which a grid of patches is build as in the
* the following example:
* <meshGradient x="100" y="100">
@@ -77,58 +77,58 @@
* </meshGradient>
*/
class SkPatchGrid {
-
+
public:
-
+
enum VertexType {
kNone_VertexType = 0X00,
kColors_VertexType = 0x01,
kTexs_VertexType = 0x02,
kColorsAndTexs_VertexType = 0x03
};
-
+
SkPatchGrid(int rows = 0, int cols = 0, VertexType flags = kNone_VertexType,
SkXfermode* xfer = nullptr);
-
+
~SkPatchGrid();
-
+
/**
- * Add a patch at location (x,y) overwriting the previous patch and shared points so they
+ * Add a patch at location (x,y) overwriting the previous patch and shared points so they
* mantain C0 connectivity.
* The control points must be passed in a clockwise order starting at the top left corner.
- * The colors and texCoords are the values at the corners of the patch which will be bilerp
+ * The colors and texCoords are the values at the corners of the patch which will be bilerp
* across it, they must also be in counterclockwise order starting at the top left corner.
*/
bool setPatch(int x, int y, const SkPoint cubics[12], const SkColor colors[4],
const SkPoint texCoords[4]);
-
+
/**
* Get patch at location (x,y). If cubics, colors or texCoords is not nullptr it sets patch's
* array with its corresponding values.
- * The function returns false if the cubics parameter is nullptr or if the (x,y) coordinates are
+ * The function returns false if the cubics parameter is nullptr or if the (x,y) coordinates are
* not within the range of the grid.
*/
bool getPatch(int x, int y, SkPoint cubics[12], SkColor colors[4], SkPoint texCoords[4]) const;
-
+
/**
* Resets the grid of patches to contain rows and cols of patches.
*/
void reset(int rows, int cols, VertexType flags, SkXfermode* xMode);
-
+
/**
- * Draws the grid of patches. The patches are drawn starting at patch (0,0) drawing columns, so
- * for a 2x2 grid the order would be (0,0)->(0,1)->(1,0)->(1,1). The order follows the order
+ * Draws the grid of patches. The patches are drawn starting at patch (0,0) drawing columns, so
+ * for a 2x2 grid the order would be (0,0)->(0,1)->(1,0)->(1,1). The order follows the order
* of the parametric coordinates of the coons patch.
*/
void draw(SkCanvas* canvas, SkPaint& paint);
-
+
/**
* Get the dimensions of the grid of patches.
*/
SkISize getDimensions() const {
return SkISize::Make(fCols, fRows);
}
-
+
private:
int fRows, fCols;
VertexType fModeFlags;