78 bool fDone, fNeedsTiling;
82 return dev->
width() > kMaxDim || dev->
height() > kMaxDim;
96 fNeedsTiling = clipR.
right() > kMaxDim || clipR.
bottom() > kMaxDim;
114 fNeedsTiling = fSrcBounds.
right() > kMaxDim || fSrcBounds.
bottom() > kMaxDim;
116 fNeedsTiling =
false;
126 fDraw.
fRC = &fTileRC;
128 fOrigin.
set(fSrcBounds.
fLeft - kMaxDim, fSrcBounds.
fTop);
131 fDraw.
fDst = fRootPixmap;
133 fDraw.
fRC = &dev->fRCStack.
rc();
148 this->stepAndSetupTileDraw();
149 }
while (!fDone && fTileRC.
isEmpty());
163 void stepAndSetupTileDraw() {
168 if (fOrigin.
fX >= fSrcBounds.
fRight - kMaxDim) {
170 fOrigin.
fY += kMaxDim;
172 fOrigin.
fX += kMaxDim;
175 fDone = fOrigin.
fX >= fSrcBounds.
fRight - kMaxDim &&
176 fOrigin.
fY >= fSrcBounds.
fBottom - kMaxDim;
185 fTileMatrix->postTranslate(-fOrigin.
x(), -fOrigin.
y());
186 fDraw.
fCTM = fTileMatrix.
get();
187 fDevice->fRCStack.
rc().
translate(-fOrigin.
x(), -fOrigin.
y(), &fTileRC);
196#define LOOP_TILER(code, boundsPtr) \
197 SkDrawTiler priv_tiler(this, boundsPtr); \
198 while (const SkDraw* priv_draw = priv_tiler.next()) { \
212 fRC = &dev->fRCStack.
rc();
242 , fRasterHandle(hndl)
264 }
else if (allocator) {
269 }
else if (
info.isOpaque()) {
286void SkBitmapDevice::replaceBitmapBackendForRasterSurface(
const SkBitmap& bm) {
364#ifdef SK_IGNORE_BLURRED_RRECT_OPT
375 bool pathIsMutable) {
378 bounds = &path.getBounds();
382 pathIsMutable =
false;
385 draw->drawPath(path,
paint,
nullptr, pathIsMutable);
398 storage = *
b.bounds();
406 if (!
paint.getMaskFilter()) {
427 SkRect bitmapBounds, tmpSrc, tmpDst;
436 tmpSrc = bitmapBounds;
440 const SkRect* dstPtr = &dst;
445 bool srcIsSubset =
false;
452 matrix.mapRect(&tmpDst, tmpSrc);
458 srcIsSubset = !tmpSrc.
contains(bitmapBounds);
474 if (!
bitmap.extractSubset(&tmpBitmap, srcIR)) {
477 bitmapPtr = &tmpBitmap;
481 if (srcIR.
fLeft > 0) {
484 if (srcIR.
fTop > 0) {
488 matrix.preTranslate(dx, dy);
491#ifdef SK_DRAWBITMAPRECT_FAST_OFFSET
496 SkRect extractedBitmapBounds;
499 if (extractedBitmapBounds == tmpSrc) {
509 this->drawBitmap(*bitmapPtr, matrix, dstPtr, sampling,
paint);
529 this->
drawRect(*dstPtr, paintWithShader);
542 bool skipColorXform) {
543#ifdef SK_LEGACY_IGNORE_DRAW_VERTICES_BLEND_WITH_NO_SHADER
544 if (!
paint.getShader()) {
582 if (SkSpecialImages::AsBitmap(src, &resultBM)) {
588 draw.fRC = &fRCStack.
rc();
593 return SkSpecialImages::MakeFromRaster(
bitmap.bounds(),
bitmap, this->surfaceProps());
599 this->surfaceProps());
646 if (origin.
fX | origin.
fY) {
663 return rc.isBW() && rc.bwRgn().isRect() &&
673 return !rc.isEmpty() && rc.isRect() && !
SkToBool(rc.clipShader());
678 return !rc.isEmpty() && rc.isAA();
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
@ kOpaque_SkAlphaType
pixel is opaque
#define SkASSERT_RELEASE(cond)
static bool valid_for_bitmap_device(const SkImageInfo &info, SkAlphaType *newAlphaType)
static bool CanApplyDstMatrixAsCTM(const SkMatrix &m, const SkPaint &paint)
#define LOOP_TILER(code, boundsPtr)
@ kUnknown_SkColorType
uninitialized
static SkColorType colorType(AImageDecoder *decoder, const AImageDecoderHeaderInfo *headerInfo)
SK_API bool SkColorTypeIsAlwaysOpaque(SkColorType ct)
@ kNever_SkCopyPixelsMode
never copy src pixels (even if they are marked mutable)
sk_sp< SkShader > SkMakeBitmapShaderForPaint(const SkPaint &paint, const SkBitmap &src, SkTileMode, SkTileMode, const SkSamplingOptions &, const SkMatrix *localMatrix, SkCopyPixelsMode)
static SkImage_Base * as_IB(SkImage *image)
static constexpr bool SkToBool(const T &x)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
BDDraw(SkBitmapDevice *dev)
bool isClipEmpty() const override
void drawVertices(const SkVertices *, sk_sp< SkBlender >, const SkPaint &, bool) override
void drawMesh(const SkMesh &, sk_sp< SkBlender >, const SkPaint &) override
bool onWritePixels(const SkPixmap &, int, int) override
void drawPath(const SkPath &, const SkPaint &, bool pathIsMutable) override
void drawImageRect(const SkImage *, const SkRect *src, const SkRect &dst, const SkSamplingOptions &, const SkPaint &, SkCanvas::SrcRectConstraint) override
bool isClipAntiAliased() const override
void popClipStack() override
bool onPeekPixels(SkPixmap *) override
sk_sp< SkSurface > makeSurface(const SkImageInfo &, const SkSurfaceProps &) override
void android_utils_clipAsRgn(SkRegion *) const override
sk_sp< SkSpecialImage > makeSpecial(const SkBitmap &) override
SkIRect devClipBounds() const override
void clipPath(const SkPath &path, SkClipOp, bool aa) override
void clipRegion(const SkRegion &deviceRgn, SkClipOp) override
sk_sp< SkDevice > createDevice(const CreateInfo &, const SkPaint *) override
static sk_sp< SkBitmapDevice > Create(const SkImageInfo &, const SkSurfaceProps &, SkRasterHandleAllocator *=nullptr)
void drawRRect(const SkRRect &rr, const SkPaint &paint) override
bool onReadPixels(const SkPixmap &, int x, int y) override
SkBitmapDevice(const SkBitmap &bitmap)
bool isClipRect() const override
bool onAccessPixels(SkPixmap *) override
void onClipShader(sk_sp< SkShader >) override
void drawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint[], const SkPaint &paint) override
void drawPaint(const SkPaint &paint) override
void drawOval(const SkRect &oval, const SkPaint &paint) override
void drawAtlas(const SkRSXform[], const SkRect[], const SkColor[], int count, sk_sp< SkBlender >, const SkPaint &) override
void drawSpecial(SkSpecialImage *, const SkMatrix &, const SkSamplingOptions &, const SkPaint &, SkCanvas::SrcRectConstraint) override
void clipRect(const SkRect &rect, SkClipOp, bool aa) override
bool isClipWideOpen() const override
void drawRect(const SkRect &r, const SkPaint &paint) override
void replaceClip(const SkIRect &rect) override
void pushClipStack() override
void clipRRect(const SkRRect &rrect, SkClipOp, bool aa) override
void onDrawGlyphRunList(SkCanvas *, const sktext::GlyphRunList &, const SkPaint &paint) override
void notifyPixelsChanged() const
bool writePixels(const SkPixmap &src, int dstX, int dstY)
const SkImageInfo & info() const
bool readPixels(const SkImageInfo &dstInfo, void *dstPixels, size_t dstRowBytes, int srcX, int srcY) const
@ kZeroPixels_AllocFlag
zero pixel memory. No effect. This is the default.
static sk_sp< SkBlender > Mode(SkBlendMode mode)
@ kFast_SrcRectConstraint
sample outside bounds; faster
const SkImageInfo & imageInfo() const
SkIPoint getOrigin() const
virtual void drawAtlas(const SkRSXform[], const SkRect[], const SkColor[], int count, sk_sp< SkBlender >, const SkPaint &)
void drawGlyphRunList(SkCanvas *, const sktext::GlyphRunList &glyphRunList, const SkPaint &paint)
const SkM44 & globalToDevice() const
sk_sp< SkSpecialImage > snapSpecial()
bool accessPixels(SkPixmap *pmap)
const SkMatrix & localToDevice() const
const SkSurfaceProps & surfaceProps() const
void drawPaint(const SkPaint &) const
const SkSurfaceProps * fProps
SkDrawTiler(SkBitmapDevice *dev, const SkRect *bounds)
static bool NeedsTiling(SkBitmapDevice *dev)
void drawAtlas(const SkRSXform[], const SkRect[], const SkColor[], int count, sk_sp< SkBlender >, const SkPaint &)
void drawVertices(const SkVertices *, sk_sp< SkBlender >, const SkPaint &, bool skipColorXform) const
virtual GrDirectContext * directContext() const
sk_sp< SkImage > makeNonTextureImage(GrDirectContext *=nullptr) const
static SkRect MapRect(const SkM44 &m, const SkRect &r)
static SkMatrix RectToRect(const SkRect &src, const SkRect &dst, ScaleToFit mode=kFill_ScaleToFit)
static const SkMatrix & I()
bool mapRect(SkRect *dst, const SkRect &src, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
@ kTranslate_Mask
translation SkMatrix
void setStyle(Style style)
@ kFill_Style
set to fill geometry
void setShader(sk_sp< SkShader > shader)
SkImageFilter * getImageFilter() const
static SkPath RRect(const SkRRect &, SkPathDirection dir=SkPathDirection::kCW)
static SkPath Oval(const SkRect &, SkPathDirection=SkPathDirection::kCW)
SkISize dimensions() const
bool extractSubset(SkPixmap *subset, const SkIRect &area) const
const SkRect & getBounds() const
void clipShader(sk_sp< SkShader > sh)
void clipPath(const SkMatrix &ctm, const SkPath &path, SkClipOp op, bool aa)
void replaceClip(const SkIRect &rect)
void clipRegion(const SkRegion &rgn, SkClipOp op)
const SkRasterClip & rc() const
void clipRect(const SkMatrix &ctm, const SkRect &rect, SkClipOp op, bool aa)
void clipRRect(const SkMatrix &ctm, const SkRRect &rrect, SkClipOp op, bool aa)
const SkIRect & getBounds() const
void translate(int dx, int dy, SkRasterClip *dst) const
bool op(const SkIRect &, SkClipOp)
void translate(int dx, int dy)
bool setRect(const SkIRect &rect)
SkSurfaceProps cloneWithPixelGeometry(SkPixelGeometry newPixelGeometry) const
T * init(Args &&... args)
Optional< SkRect > bounds
SK_API sk_sp< SkSurface > Raster(const SkImageInfo &imageInfo, size_t rowBytes, const SkSurfaceProps *surfaceProps)
const SkRect * bounds() const
Bounder(const SkRect &r, const SkPaint &paint)
const SkPixelGeometry fPixelGeometry
SkRasterHandleAllocator * fAllocator
constexpr int32_t y() const
void set(int32_t x, int32_t y)
constexpr int32_t x() const
bool intersect(const SkIRect &r)
int32_t fBottom
larger y-axis bounds
constexpr int32_t bottom() const
constexpr int32_t right() const
int32_t fTop
smaller y-axis bounds
static constexpr SkIRect MakeSize(const SkISize &size)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static constexpr SkIRect MakeXYWH(int32_t x, int32_t y, int32_t w, int32_t h)
int32_t fLeft
smaller x-axis bounds
int32_t fRight
larger x-axis bounds
SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const
SkAlphaType alphaType() const
SkImageInfo makeColorType(SkColorType newColorType) const
static SkRect Make(const SkISize &size)
bool intersect(const SkRect &r)
static SkRect MakeIWH(int w, int h)
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
bool contains(SkScalar x, SkScalar y) const
void roundOut(SkIRect *dst) const
void round(SkIRect *dst) const
void setIWH(int32_t width, int32_t height)