572 {},
576 !localToDst.
invert(&dstToLocal)) {
577 return {};
578 }
579
582
583
584
588 if (filter) {
589 capability =
std::min(capability,
as_IFB(filter)->getCTMCapability());
590 }
591 }
593 return {};
594 }
595
596
597 if (scaleFactor != 1.0f &&
599 return {};
600 }
601
602
603
604
605
606
607 static const int kMinDimThreshold = 2048;
609 SkIRect(targetOutput).height64())),
610 kMinDimThreshold);
611
613 if (contentBounds) {
614
615
617 if (!baseLayerBounds.intersect(knownBounds)) {
619 }
620 }
621
623 if (!filters.empty()) {
625 return filters[i] ? as_IFB(filters[i])
626 ->getInputBounds(mapping, targetOutput, contentBounds)
627 : baseLayerBounds;
628 });
629
630
631 if (layerBounds.
width() > maxLayerDim || layerBounds.
height() > maxLayerDim) {
634 if (filter) {
636 idealMapping, targetOutput, contentBounds);
638 idealLayerBounds.height()),
639 maxLayerDim);
640 }
641 }
642 }
643 } else {
644 if (baseLayerBounds.isEmpty()) {
645 return {};
646 }
647 layerBounds = baseLayerBounds;
648 }
649
650 if (layerBounds.
width() > maxLayerDim || layerBounds.
height() > maxLayerDim) {
658 return {};
659 } else {
660 layerBounds = newLayerBounds;
661 }
662 }
663
664 return std::make_pair(mapping, layerBounds);
665}
static void Union(SkRegion *rgn, const SkIRect &rect)
static skif::ParameterSpace< SkPoint > compute_decomposition_center(const SkMatrix &dstToLocal, std::optional< skif::ParameterSpace< SkRect > > contentBounds, const skif::DeviceSpace< SkIRect > &targetOutput)
static SkImageFilter_Base * as_IFB(SkImageFilter *filter)
static constexpr int32_t Sk64_pin_to_s32(int64_t x)
skif::LayerSpace< SkIRect > getInputBounds(const skif::Mapping &mapping, const skif::DeviceSpace< SkIRect > &desiredOutput, std::optional< skif::ParameterSpace< SkRect > > knownContentBounds) const
static SkMatrix Scale(SkScalar sx, SkScalar sy)
@ kFill_ScaleToFit
scales in x and y to fill destination SkRect
bool invert(SkMatrix *inverse) const
static SkMatrix MakeRectToRect(const SkRect &src, const SkRect &dst, ScaleToFit stf)
const SkMatrix & deviceToLayer() const
bool decomposeCTM(const SkMatrix &ctm, const SkImageFilter *filter, const skif::ParameterSpace< SkPoint > &representativePt)
const SkMatrix & layerMatrix() const
LayerSpace< T > paramToLayer(const ParameterSpace< T > ¶mGeometry) const
bool adjustLayerSpace(const SkMatrix &layer)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
SK_API sk_sp< SkShader > Empty()
static constexpr SkIRect MakeWH(int32_t w, int32_t h)
static SkRect Make(const SkISize &size)