80 : fMsg(
key, contextUniqueID) {}
90 auto listener = sk_make_sp<Listener>(*
key, contextID);
93 auto invalidateListener = [](
const void* ptr,
void* ) {
95 (*listener)->markShouldDeregister();
103 key->setCustomData(std::move(
data));
110 std::string_view label,
123 std::move(baseProxy),
139 auto origin =
src.origin();
140 auto swizzle =
src.swizzle();
141 auto proxy =
src.refProxy();
143 context, proxy, origin,
"CopyBaseMipMapToView", budgeted),
191 std::string_view label,
193 if (!
bitmap.peekPixels(
nullptr)) {
210 bitmap.pixelRef()->addGenIDChangeListener(std::move(listener));
223 installKey(proxy.
get());
249 installKey(mippedProxy->asTextureProxy());
280 return color.premul();
299#ifndef SK_IGNORE_GPU_DITHER
302 std::unique_ptr<GrFragmentProcessor> inputFP,
305 if (range == 0 || inputFP ==
nullptr) {
343 "uniform half range;"
344 "uniform shader inputFP;"
345 "uniform shader table;"
346 "half4 main(float2 xy) {"
347 "half4 color = inputFP.eval(xy);"
348 "half value = table.eval(sk_FragCoord.xy).a - 0.5;"
351 "return half4(clamp(color.rgb + value * range, 0.0, color.a), color.a);"
357 "inputFP", std::move(inputFP),
367 std::optional<std::unique_ptr<GrFragmentProcessor>> shaderFP,
378 std::unique_ptr<GrFragmentProcessor> paintFP;
379 const bool gpProvidesShader = shaderFP.has_value() && !*shaderFP;
381 if (shaderFP.has_value()) {
382 paintFP = std::move(*shaderFP);
386 if (paintFP ==
nullptr) {
396 bool applyColorFilterToPaintColor =
false;
398 if (primColorBlender) {
406 SkPMColor4f shaderInput = origColor.makeOpaque().premul();
418 if (1.0f != paintAlpha) {
422 std::move(paintFP), {paintAlpha, paintAlpha, paintAlpha, paintAlpha});
426 if (paintAlpha != 1.0f) {
435 grPaint->
setColor4f({origColor.fR, origColor.fG, origColor.fB, origColor.fA});
445 if (primColorBlender) {
466 if (paintAlpha != 1.0f) {
470 std::move(paintFP), {paintAlpha, paintAlpha, paintAlpha, paintAlpha});
476 applyColorFilterToPaintColor = !gpProvidesShader;
482 if (applyColorFilterToPaintColor) {
487 context, colorFilter, std::move(paintFP), dstColorInfo, surfaceProps);
491 paintFP = std::move(
fp);
501#ifndef SK_IGNORE_GPU_DITHER
503 if (paintFP !=
nullptr && (
507 context, std::move(paintFP), ditherRange, context->
priv().
caps());
535 if (paintFP !=
nullptr) {
574 std::unique_ptr<GrFragmentProcessor> shaderFP,
static constexpr SkColorType GrColorTypeToSkColorType(GrColorType ct)
static constexpr GrClampType GrColorTypeClampType(GrColorType colorType)
static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct)
@ kTopLeft_GrSurfaceOrigin
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kSrcOver
r = s + (1-sa)*d
SkBlenderBase * as_BB(SkBlender *blend)
constexpr SkPMColor4f SK_PMColor4fWHITE
bool SkPaintToGrPaintReplaceShader(GrRecordingContext *context, const GrColorInfo &dstColorInfo, const SkPaint &skPaint, const SkMatrix &ctm, std::unique_ptr< GrFragmentProcessor > shaderFP, const SkSurfaceProps &surfaceProps, GrPaint *grPaint)
GrSurfaceProxyView GrCopyBaseMipMapToView(GrRecordingContext *context, GrSurfaceProxyView src, skgpu::Budgeted budgeted)
void GrMakeKeyFromImageID(skgpu::UniqueKey *key, uint32_t imageID, const SkIRect &imageBounds)
static std::unique_ptr< GrFragmentProcessor > make_dither_effect(GrRecordingContext *rContext, std::unique_ptr< GrFragmentProcessor > inputFP, float range, const GrCaps *caps)
std::tuple< GrSurfaceProxyView, GrColorType > GrMakeUncachedBitmapProxyView(GrRecordingContext *rContext, const SkBitmap &bitmap, skgpu::Mipmapped mipmapped, SkBackingFit fit, skgpu::Budgeted budgeted)
SkColor4f SkColor4fPrepForDst(SkColor4f color, const GrColorInfo &colorInfo)
static sk_sp< GrTextureProxy > make_bmp_proxy(GrProxyProvider *proxyProvider, const SkBitmap &bitmap, GrColorType ct, skgpu::Mipmapped mipmapped, SkBackingFit fit, skgpu::Budgeted budgeted)
sk_sp< SkIDChangeListener > GrMakeUniqueKeyInvalidationListener(skgpu::UniqueKey *key, uint32_t contextID)
SkPMColor4f SkColorToPMColor4f(SkColor c, const GrColorInfo &colorInfo)
sk_sp< GrSurfaceProxy > GrCopyBaseMipMapToTextureProxy(GrRecordingContext *ctx, sk_sp< GrSurfaceProxy > baseProxy, GrSurfaceOrigin origin, std::string_view label, skgpu::Budgeted budgeted)
bool SkPaintToGrPaintWithBlend(GrRecordingContext *context, const GrColorInfo &dstColorInfo, const SkPaint &skPaint, const SkMatrix &ctm, SkBlender *primColorBlender, const SkSurfaceProps &surfaceProps, GrPaint *grPaint)
static bool skpaint_to_grpaint_impl(GrRecordingContext *context, const GrColorInfo &dstColorInfo, const SkPaint &skPaint, const SkMatrix &ctm, std::optional< std::unique_ptr< GrFragmentProcessor > > shaderFP, SkBlender *primColorBlender, const SkSurfaceProps &surfaceProps, GrPaint *grPaint)
bool SkPaintToGrPaint(GrRecordingContext *context, const GrColorInfo &dstColorInfo, const SkPaint &skPaint, const SkMatrix &ctm, const SkSurfaceProps &surfaceProps, GrPaint *grPaint)
static skgpu::Mipmapped adjust_mipmapped(skgpu::Mipmapped mipmapped, const SkBitmap &bitmap, const GrCaps *caps)
static GrColorType choose_bmp_texture_colortype(const GrCaps *caps, const SkBitmap &bitmap)
static bool blender_requires_shader(const SkBlender *blender)
std::tuple< GrSurfaceProxyView, GrColorType > GrMakeCachedBitmapProxyView(GrRecordingContext *rContext, const SkBitmap &bitmap, std::string_view label, skgpu::Mipmapped mipmapped)
SkRuntimeEffect * SkMakeRuntimeEffect(SkRuntimeEffect::Result(*make)(SkString, const SkRuntimeEffect::Options &), const char *sksl, SkRuntimeEffect::Options options=SkRuntimeEffect::Options{})
SkShaderBase * as_SB(SkShader *shader)
static void copy(void *dst, const uint8_t *src, int width, int bpp, int deltaSrc, int offset, const SkPMColor ctable[])
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
const GrCaps * caps() const
bool mipmapSupport() const
virtual bool isFormatCopyable(const GrBackendFormat &) const =0
GrBackendFormat getDefaultBackendFormat(GrColorType, GrRenderable) const
bool avoidDithering() const
skgpu::Swizzle getReadSwizzle(const GrBackendFormat &format, GrColorType colorType) const
SkColorSpace * colorSpace() const
GrColorType colorType() const
GrColorSpaceXform * colorSpaceXformFromSRGB() const
static std::unique_ptr< GrFragmentProcessor > ClampOutput(std::unique_ptr< GrFragmentProcessor >)
static std::unique_ptr< GrFragmentProcessor > MakeColor(SkPMColor4f color)
static std::unique_ptr< GrFragmentProcessor > ModulateRGBA(std::unique_ptr< GrFragmentProcessor > child, const SkPMColor4f &color)
static std::unique_ptr< GrFragmentProcessor > OverrideInput(std::unique_ptr< GrFragmentProcessor >, const SkPMColor4f &)
static std::unique_ptr< GrFragmentProcessor > SurfaceColor()
static std::unique_ptr< GrFragmentProcessor > ApplyPaintAlpha(std::unique_ptr< GrFragmentProcessor > child)
static std::unique_ptr< GrFragmentProcessor > DisableCoverageAsAlpha(std::unique_ptr< GrFragmentProcessor >)
void setXPFactory(const GrXPFactory *xpFactory)
const GrXPFactory * getXPFactory() const
const SkPMColor4f & getColor4f() const
void setColorFragmentProcessor(std::unique_ptr< GrFragmentProcessor > fp)
void setColor4f(const SkPMColor4f &color)
void setCoverageFragmentProcessor(std::unique_ptr< GrFragmentProcessor > fp)
uint32_t contextID() const
void removeUniqueKeyFromProxy(GrTextureProxy *)
bool assignUniqueKeyToProxy(const skgpu::UniqueKey &, GrTextureProxy *)
sk_sp< GrTextureProxy > findOrCreateProxyByUniqueKey(const skgpu::UniqueKey &, UseAllocator=UseAllocator::kYes)
sk_sp< GrTextureProxy > createProxyFromBitmap(const SkBitmap &, skgpu::Mipmapped, SkBackingFit, skgpu::Budgeted)
GrProxyProvider * proxyProvider()
GrRecordingContextPriv priv()
static GrIgnoreOptFlags IgnoreOptFlags(std::unique_ptr< GrFragmentProcessor > child)
static std::unique_ptr< GrSkSLFP > Make(const SkRuntimeEffect *effect, const char *name, std::unique_ptr< GrFragmentProcessor > inputFP, OptFlags optFlags, Args &&... args)
const GrBackendFormat & backendFormat() const
static sk_sp< GrSurfaceProxy > Copy(GrRecordingContext *, sk_sp< GrSurfaceProxy > src, GrSurfaceOrigin, skgpu::Mipmapped, SkIRect srcRect, SkBackingFit, skgpu::Budgeted, std::string_view label, RectsMustMatch=RectsMustMatch::kNo, sk_sp< GrRenderTask > *outTask=nullptr)
static std::unique_ptr< GrFragmentProcessor > Make(GrSurfaceProxyView, SkAlphaType, const SkMatrix &=SkMatrix::I(), GrSamplerState::Filter=GrSamplerState::Filter::kNearest, GrSamplerState::MipmapMode mipmapMode=GrSamplerState::MipmapMode::kNone)
const skgpu::UniqueKey & getUniqueKey() const override
skgpu::Mipmapped mipmapped() const
static const GrXPFactory * FromBlendMode(SkBlendMode)
const SkPixmap & pixmap() const
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
virtual std::optional< SkBlendMode > asBlendMode() const
SkColor4f filterColor4f(const SkColor4f &srcColor, SkColorSpace *srcCS, SkColorSpace *dstCS) const
static sk_sp< SkData > MakeWithProc(const void *ptr, size_t length, ReleaseProc proc, void *ctx)
static const SkMatrix & I()
static void Post(Message m)
static bool ShouldDither(const SkPaint &, SkColorType)
SkColorFilter * getColorFilter() const
SkColor4f getColor4f() const
SkMaskFilter * getMaskFilter() const
SkBlender * getBlender() const
SkShader * getShader() const
std::optional< SkBlendMode > asBlendMode() const
static Result MakeForShader(SkString sksl, const Options &)
bool isAlwaysDither() const
static Domain GenerateDomain()
std::unique_ptr< GrFragmentProcessor > Make(const SkMaskFilter *maskfilter, const GrFPArgs &args, const SkMatrix &ctm)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
float DitherRangeForConfig(SkColorType dstColorType)
int32_t fBottom
larger y-axis bounds
int32_t fTop
smaller y-axis bounds
int32_t fLeft
smaller x-axis bounds
static constexpr SkIRect MakePtSize(SkIPoint pt, SkISize size)
int32_t fRight
larger x-axis bounds
std::shared_ptr< const fml::Mapping > data