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

Unified Diff: include/core/SkCanvas.h

Issue 2382893002: Add a src rect to drawImageLattice() API (Closed)
Patch Set: Simplify impl Created 4 years, 3 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 | « gm/lattice.cpp ('k') | include/private/SkRecords.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkCanvas.h
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 7bf84c978fed4aa0d549c4c29ab94b3f19084aa6..03673b30db8d8036b686bb3aab0a130fba8e62de 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -956,6 +956,9 @@ public:
/**
* Specifies coordinates to divide a bitmap into (xCount*yCount) rects.
+ *
+ * If the lattice divs or bounds are invalid, the entire lattice
+ * struct will be ignored on the draw call.
*/
struct Lattice {
enum Flags : uint8_t {
@@ -964,29 +967,34 @@ public:
};
// An array of x-coordinates that divide the bitmap vertically.
- // These must be unique, increasing, and in the set [0, width).
+ // These must be unique, increasing, and in the set [fBounds.fLeft, fBounds.fRight).
// Does not have ownership.
- const int* fXDivs;
+ const int* fXDivs;
// An array of y-coordinates that divide the bitmap horizontally.
- // These must be unique, increasing, and in the set [0, height).
+ // These must be unique, increasing, and in the set [fBounds.fTop, fBounds.fBottom).
// Does not have ownership.
- const int* fYDivs;
+ const int* fYDivs;
// If non-null, the length of this array must be equal to
// (fXCount + 1) * (fYCount + 1). Note that we allow the first rect
- // in each direction to empty (divs[0] = 0). In this case, the
- // caller still must specify a flag (as a placeholder) for these
- // empty rects.
+ // in each direction to be empty (ex: fXDivs[0] = fBounds.fLeft).
+ // In this case, the caller still must specify a flag (as a placeholder)
+ // for these empty rects.
// The flags correspond to the rects in the lattice, first moving
// left to right and then top to bottom.
- const Flags* fFlags;
+ const Flags* fFlags;
// The number of fXDivs.
- int fXCount;
+ int fXCount;
// The number of fYDivs.
- int fYCount;
+ int fYCount;
+
+ // The bound to draw from. Must be contained by the src that is being drawn,
+ // non-empty, and non-inverted.
+ // If nullptr, the bounds are the entire src.
+ const SkIRect* fBounds;
};
/**
« no previous file with comments | « gm/lattice.cpp ('k') | include/private/SkRecords.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698