238 : fNumXDivisions(numXDivisions)
239 , fNumYDivisions(numYDivisions)
240 , fTiles(numXDivisions * numYDivisions)
241 , fDstCharacterization(dstChar) {
242 SkASSERT(fNumXDivisions > 0 && fNumYDivisions > 0);
243
244 int xTileSize = viewport.
width()/fNumXDivisions;
245 int yTileSize = viewport.
height()/fNumYDivisions;
246
248
249
250 for (
int y = 0, yOff = 0;
y < fNumYDivisions; ++
y, yOff += yTileSize) {
251 int ySize = (
y < fNumYDivisions-1) ? yTileSize : viewport.
height()-yOff;
252
253 for (
int x = 0, xOff = 0;
x < fNumXDivisions; ++
x, xOff += xTileSize) {
254 int xSize = (
x < fNumXDivisions-1) ? xTileSize : viewport.
width()-xOff;
255
257
259
260 static const uint32_t kMaxPad = 64;
261 int32_t lPad = addRandomPaddingToDst ? rand.
nextRangeU(0, kMaxPad) : 0;
262 int32_t tPad = addRandomPaddingToDst ? rand.
nextRangeU(0, kMaxPad) : 0;
263 int32_t rPad = addRandomPaddingToDst ? rand.
nextRangeU(0, kMaxPad) : 0;
264 int32_t bPad = addRandomPaddingToDst ? rand.
nextRangeU(0, kMaxPad) : 0;
265
266 fTiles[
y*fNumXDivisions+
x].init(
y*fNumXDivisions+
x, direct, dstChar,
clip,
267 {lPad, tPad, rPad, bPad});
268 }
269 }
270}
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
uint32_t nextRangeU(uint32_t min, uint32_t max)
constexpr int32_t height() const
constexpr int32_t width() const
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
bool contains(int32_t x, int32_t y) const