class SkSpriteBlitter_Memcpy final : public SkSpriteBlitter {
public: staticbool Supports(const SkPixmap& dst, const SkPixmap& src, const SkPaint& paint) { // the caller has already inspected the colorspace on src and dst
SkASSERT(0 == SkColorSpaceXformSteps(src,dst).fFlags.mask());
if (SkColorTypeIsAlphaOnly(fSource.colorType())) { // The color for A8 images comes from the (sRGB) paint color.
p.appendSetRGB(fAlloc, fPaintColor);
p.append(SkRasterPipelineOp::premul);
} if (auto dstCS = fDst.colorSpace()) { auto srcCS = fSource.colorSpace(); if (!srcCS || SkColorTypeIsAlphaOnly(fSource.colorType())) { // We treat untagged images as sRGB. // Alpha-only images get their r,g,b from the paint color, so they're also sRGB.
srcCS = sk_srgb_singleton();
} auto srcAT = fSource.isOpaque() ? kOpaque_SkAlphaType
: kPremul_SkAlphaType;
fAlloc->make<SkColorSpaceXformSteps>(srcCS, srcAT,
dstCS, kPremul_SkAlphaType)
->apply(&p);
} if (fPaintColor.fA != 1.0f) {
p.append(SkRasterPipelineOp::scale_1_float, &fPaintColor.fA);
}
void blitRect(int x, int y, int width, int height) override {
fSrcPtr.stride = fSource.rowBytesAsPixels();
// We really want fSrcPtr.pixels = fSource.addr(-fLeft, -fTop) here, but that asserts. // Instead we ask for addr(-fLeft+x, -fTop+y), then back up (x,y) manually. // Representing bpp as a size_t keeps all this math in size_t instead of int, // which could wrap around with large enough fSrcPtr.stride and y.
size_t bpp = fSource.info().bytesPerPixel();
fSrcPtr.pixels = (char*)fSource.writable_addr(-fLeft+x, -fTop+y) - bpp * x
- bpp * y * fSrcPtr.stride;
// returning null means the caller will call SkBlitter::Choose() and // have wrapped the source bitmap inside a shader
SkBlitter* SkBlitter::ChooseSprite(const SkPixmap& dst, const SkPaint& paint, const SkPixmap& source, int left, int top,
SkArenaAlloc* alloc, sk_sp<SkShader> clipShader) { /* We currently ignore antialiasing and filtertype, meaning we will take our specialblittersregardlessofthesesettings.Ignoringfiltertypeseemsfine sincebydefinitionthereisnoscaleinthematrix.Ignoringantialiasingis abitofahack,sincewe"could"passinthefractionalleft/topforthebitmap, andrespectthatbyblendingtheedgesofthebitmapagainstthedevice.Tosupport thiswecouldeitheraddmorespecialblittershere,ordetectantialiasinginthe paintandreturnnullifitisset,forcingtheclienttotaketheslowshadercase (whichdoesrespectsoftedges).
*/
SkASSERT(alloc != nullptr);
// TODO: in principle SkRasterPipelineSpriteBlitter could be made to handle this. if (source.alphaType() == kUnpremul_SkAlphaType) { return nullptr;
}
SkSpriteBlitter* blitter = nullptr;
if (gSkForceRasterPipelineBlitter) { // Do not use any of these optimized memory blitters
} elseif (0 == SkColorSpaceXformSteps(source,dst).fFlags.mask() && !clipShader) { if (!blitter && SkSpriteBlitter_Memcpy::Supports(dst, source, paint)) {
blitter = alloc->make<SkSpriteBlitter_Memcpy>(source);
} if (!blitter) { switch (dst.colorType()) { case kN32_SkColorType:
blitter = SkSpriteBlitter::ChooseL32(source, paint, alloc); break; default: break;
}
}
} if (!blitter && !paint.getMaskFilter()) {
blitter = alloc->make<SkRasterPipelineSpriteBlitter>(source, alloc, clipShader);
}
if (blitter && blitter->setup(dst, left,top, paint)) { return blitter;
}
return nullptr;
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet am 2026-08-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.