55 SkASSERT(src.fBounds.contains(bounds));
57 const int dx = bounds.left() - src.fBounds.left();
58 const int dy = bounds.top() - src.fBounds.top();
59 bounds.offsetTo(newX, newY);
60 return SkMask(src.fImage + dy * src.fRowBytes + dx,
92 if (bounds.width() > 0 && bounds.height() > 0) {
99 bounds.fLeft = cx + 1;
101 if (bounds.width() > 0 && bounds.height() > 0) {
109 bounds.fTop = cy + 1;
110 if (bounds.width() > 0 && bounds.height() > 0) {
117 bounds.fLeft = cx + 1;
118 bounds.fTop = cy + 1;
119 if (bounds.width() > 0 && bounds.height() > 0) {
121 outerR.
bottom() - bounds.height());
134 const int innerW = innerR.
width();
135 size_t storageSize = (innerW + 1) * (
sizeof(int16_t) +
sizeof(uint8_t));
137 int16_t* runs = (int16_t*)storage.
get();
138 uint8_t* alpha = (uint8_t*)(runs + innerW + 1);
144 int startY = std::max(0, r.
top() - outerR.
top());
145 int stopY = startY + r.
height();
147 for (
int y = startY;
y < stopY; ++
y) {
158 int stopY = startY + r.
height();
160 for (
int y = startY;
y < stopY; ++
y) {
197 if (!clipper.
done()) {
202 }
while (!clipper.
done());
210 return path.isRect(&rects[0]);
213bool SkMaskFilterBase::filterRRect(
const SkRRect& devRRect,
const SkMatrix& matrix,
225 draw_nine(patch->fMask, patch->fOuterRect, patch->fCenter,
true,
clip, blitter);
229bool SkMaskFilterBase::filterPath(
const SkPath& devPath,
const SkMatrix& matrix,
246 draw_nine(patch->fMask, patch->fOuterRect, patch->fCenter, 1 == rectCount,
clip,
259#if defined(SK_BUILD_FOR_FUZZER)
271 if (!this->
filterMask(&dstM, srcM, matrix,
nullptr)) {
278 blitter = wrapper.getBlitter();
282 if (!clipper.done()) {
283 const SkIRect& cr = clipper.rect();
287 }
while (!clipper.done());
323void SkMaskFilter::RegisterFlattenables() {
void sk_register_blur_maskfilter_createproc()
SkMaskFilterBase * as_MFB(SkMaskFilter *mf)
static void draw_nine(const SkMask &mask, const SkIRect &outerR, const SkIPoint ¢er, bool fillCenter, const SkRasterClip &clip, SkBlitter *blitter)
static SkMask extractMaskSubset(const SkMask &src, SkIRect bounds, int32_t newX, int32_t newY)
static void draw_nine_clipped(const SkMask &mask, const SkIRect &outerR, const SkIPoint ¢er, bool fillCenter, const SkIRect &clipR, SkBlitter *blitter)
static void blitClippedRect(SkBlitter *blitter, const SkIRect &rect, const SkIRect &clipR)
static void blitClippedMask(SkBlitter *blitter, const SkMask &mask, const SkIRect &bounds, const SkIRect &clipR)
static int countNestedRects(const SkPath &path, SkRect rects[2])
std::unique_ptr< uint8_t, SkFunctionObject< SkMaskBuilder::FreeImage > > SkAutoMaskFreeImage
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
static SkScalar center(float pos0, float pos1)
const SkRegion & getRgn() const
virtual void blitMask(const SkMask &, const SkIRect &clip)
virtual void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[])=0
virtual void blitRect(int x, int y, int width, int height)
Blit a solid rectangle one or more pixels wide.
const void * data() const
static bool DrawToMask(const SkPath &devPath, const SkIRect &clipBounds, const SkMaskFilter *, const SkMatrix *filterMatrix, SkMaskBuilder *dst, SkMaskBuilder::CreateMode mode, SkStrokeRec::InitStyle style)
static sk_sp< SkFlattenable > Deserialize(Type, const void *data, size_t length, const SkDeserialProcs *procs=nullptr)
@ kUnimplemented_FilterReturn
virtual sk_sp< SkImageFilter > asImageFilter(const SkMatrix &ctm) const
virtual bool filterMask(SkMaskBuilder *dst, const SkMask &src, const SkMatrix &, SkIPoint *margin) const =0
virtual bool asABlur(BlurRec *) const
virtual FilterReturn filterRRectToNine(const SkRRect &, const SkMatrix &, const SkIRect &clipBounds, SkTLazy< NinePatch > *) const
virtual FilterReturn filterRectsToNine(const SkRect[], int count, const SkMatrix &, const SkIRect &clipBounds, SkTLazy< NinePatch > *) const
virtual void computeFastBounds(const SkRect &src, SkRect *dest) const
static sk_sp< SkMaskFilter > Deserialize(const void *data, size_t size, const SkDeserialProcs *procs=nullptr)
SkRect approximateFilteredBounds(const SkRect &src) const
static const SkMatrix & I()
static bool IsNestedFillRects(const SkPath &, SkRect rect[2], SkPathDirection dirs[2]=nullptr)
const SkRect & getBounds() const
const SkIRect & rect() const
bool intersect(const SkIRect &r)
constexpr int32_t top() const
constexpr int32_t bottom() const
constexpr int32_t height() const
constexpr int32_t right() const
constexpr int32_t width() const
constexpr int32_t left() const
void setLTRB(int32_t left, int32_t top, int32_t right, int32_t bottom)
static void FreeImage(void *image)
@ kComputeBoundsAndRenderImage_CreateMode
compute bounds, alloc image and render into it
@ kA8_Format
8bits per pixel mask (e.g. antialiasing)
const uint8_t * getAddr8(int x, int y) const
uint8_t const *const fImage