#include "src/core/SkImageFilterTypes.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkBlender.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkClipOp.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorType.h"
#include "include/core/SkImage.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkM44.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPicture.h"
#include "include/core/SkShader.h"
#include "include/effects/SkRuntimeEffect.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkFloatingPoint.h"
#include "src/base/SkMathPriv.h"
#include "src/base/SkVx.h"
#include "src/core/SkBitmapDevice.h"
#include "src/core/SkBlenderBase.h"
#include "src/core/SkBlurEngine.h"
#include "src/core/SkCanvasPriv.h"
#include "src/core/SkColorSpacePriv.h"
#include "src/core/SkDevice.h"
#include "src/core/SkImageFilterCache.h"
#include "src/core/SkImageFilter_Base.h"
#include "src/core/SkKnownRuntimeEffects.h"
#include "src/core/SkMatrixPriv.h"
#include "src/core/SkRectPriv.h"
#include "src/core/SkTraceEvent.h"
#include "src/effects/colorfilters/SkColorFilterBase.h"
#include <algorithm>
#include <cmath>
namespace skif {
namespace {
static constexpr float kRoundEpsilon = …;
std::pair<bool, bool> are_axes_nearly_integer_aligned(const LayerSpace<SkMatrix>& m,
LayerSpace<SkIPoint>* out=nullptr) { … }
bool is_nearly_integer_translation(const LayerSpace<SkMatrix>& m,
LayerSpace<SkIPoint>* out=nullptr) { … }
void decompose_transform(const SkMatrix& transform, SkPoint representativePoint,
SkMatrix* postScaling, SkMatrix* scaling) { … }
std::optional<LayerSpace<SkMatrix>> periodic_axis_transform(
SkTileMode tileMode,
const LayerSpace<SkIRect>& crop,
const LayerSpace<SkIRect>& output) { … }
class RasterBackend : public Backend { … };
}
Backend::Backend(sk_sp<SkImageFilterCache> cache,
const SkSurfaceProps& surfaceProps,
const SkColorType colorType)
: … { … }
Backend::~Backend() = default;
sk_sp<Backend> MakeRasterBackend(const SkSurfaceProps& surfaceProps, SkColorType colorType) { … }
void Stats::dumpStats() const { … }
void Stats::reportStats() const { … }
SkIRect RoundOut(SkRect r) { … }
SkIRect RoundIn(SkRect r) { … }
bool Mapping::decomposeCTM(const SkMatrix& ctm, MatrixCapability capability,
const skif::ParameterSpace<SkPoint>& representativePt) { … }
bool Mapping::decomposeCTM(const SkMatrix& ctm,
const SkImageFilter* filter,
const skif::ParameterSpace<SkPoint>& representativePt) { … }
bool Mapping::adjustLayerSpace(const SkMatrix& layer) { … }
template<>
SkRect Mapping::map<SkRect>(const SkRect& geom, const SkMatrix& matrix) { … }
template<>
SkIRect Mapping::map<SkIRect>(const SkIRect& geom, const SkMatrix& matrix) { … }
template<>
SkIPoint Mapping::map<SkIPoint>(const SkIPoint& geom, const SkMatrix& matrix) { … }
template<>
SkPoint Mapping::map<SkPoint>(const SkPoint& geom, const SkMatrix& matrix) { … }
template<>
Vector Mapping::map<Vector>(const Vector& geom, const SkMatrix& matrix) { … }
template<>
IVector Mapping::map<IVector>(const IVector& geom, const SkMatrix& matrix) { … }
template<>
SkSize Mapping::map<SkSize>(const SkSize& geom, const SkMatrix& matrix) { … }
template<>
SkISize Mapping::map<SkISize>(const SkISize& geom, const SkMatrix& matrix) { … }
template<>
SkMatrix Mapping::map<SkMatrix>(const SkMatrix& m, const SkMatrix& matrix) { … }
LayerSpace<SkIRect> LayerSpace<SkIRect>::relevantSubset(const LayerSpace<SkIRect> dstRect,
SkTileMode tileMode) const { … }
LayerSpace<SkISize> LayerSpace<SkSize>::round() const { … }
LayerSpace<SkISize> LayerSpace<SkSize>::ceil() const { … }
LayerSpace<SkISize> LayerSpace<SkSize>::floor() const { … }
LayerSpace<SkRect> LayerSpace<SkMatrix>::mapRect(const LayerSpace<SkRect>& r) const { … }
LayerSpace<SkIRect> LayerSpace<SkMatrix>::mapRect(const LayerSpace<SkIRect>& r) const { … }
LayerSpace<SkPoint> LayerSpace<SkMatrix>::mapPoint(const LayerSpace<SkPoint>& p) const { … }
LayerSpace<Vector> LayerSpace<SkMatrix>::mapVector(const LayerSpace<Vector>& v) const { … }
LayerSpace<SkSize> LayerSpace<SkMatrix>::mapSize(const LayerSpace<SkSize>& s) const { … }
bool LayerSpace<SkMatrix>::inverseMapRect(const LayerSpace<SkRect>& r,
LayerSpace<SkRect>* out) const { … }
bool LayerSpace<SkMatrix>::inverseMapRect(const LayerSpace<SkIRect>& rect,
LayerSpace<SkIRect>* out) const { … }
class FilterResult::AutoSurface { … };
sk_sp<SkSpecialImage> FilterResult::imageAndOffset(const Context& ctx, SkIPoint* offset) const { … }
std::pair<sk_sp<SkSpecialImage>, LayerSpace<SkIPoint>>FilterResult::imageAndOffset(
const Context& ctx) const { … }
FilterResult FilterResult::insetForSaveLayer() const { … }
FilterResult FilterResult::insetByPixel() const { … }
SkEnumBitMask<FilterResult::BoundsAnalysis> FilterResult::analyzeBounds(
const SkMatrix& xtraTransform,
const SkIRect& dstBounds,
BoundsScope scope) const { … }
void FilterResult::updateTileMode(const Context& ctx, SkTileMode tileMode) { … }
FilterResult FilterResult::applyCrop(const Context& ctx,
const LayerSpace<SkIRect>& crop,
SkTileMode tileMode) const { … }
FilterResult FilterResult::applyColorFilter(const Context& ctx,
sk_sp<SkColorFilter> colorFilter) const { … }
static bool compatible_sampling(const SkSamplingOptions& currentSampling,
bool currentXformWontAffectNearest,
SkSamplingOptions* nextSampling,
bool nextXformWontAffectNearest) { … }
FilterResult FilterResult::applyTransform(const Context& ctx,
const LayerSpace<SkMatrix> &transform,
const SkSamplingOptions &sampling) const { … }
FilterResult FilterResult::resolve(const Context& ctx,
LayerSpace<SkIRect> dstBounds,
bool preserveDstBounds) const { … }
FilterResult FilterResult::subset(const LayerSpace<SkIPoint>& knownOrigin,
const LayerSpace<SkIRect>& subsetBounds,
bool clampSrcIfDisjoint) const { … }
void FilterResult::draw(const Context& ctx, SkDevice* target, const SkBlender* blender) const { … }
void FilterResult::draw(const Context& ctx,
SkDevice* device,
bool preserveDeviceState,
const SkBlender* blender) const { … }
void FilterResult::drawAnalyzedImage(const Context& ctx,
SkDevice* device,
const SkSamplingOptions& finalSampling,
SkEnumBitMask<BoundsAnalysis> analysis,
const SkBlender* blender) const { … }
sk_sp<SkShader> FilterResult::asShader(const Context& ctx,
const SkSamplingOptions& xtraSampling,
SkEnumBitMask<ShaderFlags> flags,
const LayerSpace<SkIRect>& sampleBounds) const { … }
sk_sp<SkShader> FilterResult::getAnalyzedShaderView(
const Context& ctx,
const SkSamplingOptions& finalSampling,
SkEnumBitMask<BoundsAnalysis> analysis) const { … }
namespace {
PixelSpace;
int downscale_step_count(float netScaleFactor) { … }
PixelSpace<SkRect> scale_about_center(const PixelSpace<SkRect> src, float sx, float sy) { … }
void draw_color_filtered_border(SkCanvas* canvas,
PixelSpace<SkIRect> border,
sk_sp<SkColorFilter> colorFilter) { … }
void draw_tiled_border(SkCanvas* canvas,
SkTileMode tileMode,
const SkPaint& paint,
const PixelSpace<SkMatrix>& srcToDst,
PixelSpace<SkRect> srcBorder,
PixelSpace<SkRect> dstBorder) { … }
}
FilterResult FilterResult::rescale(const Context& ctx,
const LayerSpace<SkSize>& scale,
bool enforceDecal) const { … }
FilterResult FilterResult::MakeFromPicture(const Context& ctx,
sk_sp<SkPicture> pic,
ParameterSpace<SkRect> cullRect) { … }
FilterResult FilterResult::MakeFromShader(const Context& ctx,
sk_sp<SkShader> shader,
bool dither) { … }
FilterResult FilterResult::MakeFromImage(const Context& ctx,
sk_sp<SkImage> image,
SkRect srcRect,
ParameterSpace<SkRect> dstRect,
const SkSamplingOptions& sampling) { … }
FilterResult::Builder::Builder(const Context& context) : … { … }
FilterResult::Builder::~Builder() = default;
SkSpan<sk_sp<SkShader>> FilterResult::Builder::createInputShaders(
const LayerSpace<SkIRect>& outputBounds,
bool evaluateInParameterSpace) { … }
LayerSpace<SkIRect> FilterResult::Builder::outputBounds(
std::optional<LayerSpace<SkIRect>> explicitOutput) const { … }
FilterResult FilterResult::Builder::drawShader(sk_sp<SkShader> shader,
const LayerSpace<SkIRect>& outputBounds,
bool evaluateInParameterSpace) const { … }
FilterResult FilterResult::Builder::merge() { … }
FilterResult FilterResult::Builder::blur(const LayerSpace<SkSize>& sigma) { … }
}