Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkLatticeIter.h
Go to the documentation of this file.
1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkLatticeIter_DEFINED
9#define SkLatticeIter_DEFINED
10
13#include "include/core/SkRect.h"
17
18class SkMatrix;
19
20/**
21 * Disect a lattice request into an sequence of src-rect / dst-rect pairs
22 */
24public:
25
26 static bool Valid(int imageWidth, int imageHeight, const SkCanvas::Lattice& lattice);
27
28 SkLatticeIter(const SkCanvas::Lattice& lattice, const SkRect& dst);
29
30 static bool Valid(int imageWidth, int imageHeight, const SkIRect& center);
31
32 SkLatticeIter(int imageWidth, int imageHeight, const SkIRect& center, const SkRect& dst);
33
34 /**
35 * While it returns true, use src/dst to draw the image/bitmap. Optional parameters
36 * isFixedColor and fixedColor specify if the rectangle is filled with a fixed color.
37 * If (*isFixedColor) is true, then (*fixedColor) contains the rectangle color.
38 */
39 bool next(SkIRect* src, SkRect* dst, bool* isFixedColor = nullptr,
40 SkColor* fixedColor = nullptr);
41
42 /** Version of above that converts the integer src rect to a scalar rect. */
43 bool next(SkRect* src, SkRect* dst, bool* isFixedColor = nullptr,
44 SkColor* fixedColor = nullptr) {
45 SkIRect isrcR;
46 if (this->next(&isrcR, dst, isFixedColor, fixedColor)) {
47 *src = SkRect::Make(isrcR);
48 return true;
49 }
50 return false;
51 }
52
53 /**
54 * Apply a matrix to the dst points.
55 */
56 void mapDstScaleTranslate(const SkMatrix& matrix);
57
58 /**
59 * Returns the number of rects that will actually be drawn.
60 */
61 int numRectsToDraw() const {
62 return fNumRectsToDraw;
63 }
64
65private:
72
73 int fCurrX;
74 int fCurrY;
75 int fNumRectsInLattice;
76 int fNumRectsToDraw;
77};
78
79#endif
static float next(float f)
#define SK_SPI
Definition SkAPI.h:41
uint32_t SkColor
Definition SkColor.h:37
static SkScalar center(float pos0, float pos1)
bool next(SkRect *src, SkRect *dst, bool *isFixedColor=nullptr, SkColor *fixedColor=nullptr)
int numRectsToDraw() const
static SkRect Make(const SkISize &size)
Definition SkRect.h:669