Flutter Engine
The Flutter Engine
Classes | Namespaces | Functions | Variables
GrBlurUtils.cpp File Reference
#include "src/gpu/ganesh/GrBlurUtils.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkBitmap.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkBlurTypes.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkData.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkM44.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRRect.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkRegion.h"
#include "include/core/SkSamplingOptions.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkSpan.h"
#include "include/core/SkString.h"
#include "include/core/SkStrokeRec.h"
#include "include/core/SkSurface.h"
#include "include/core/SkSurfaceProps.h"
#include "include/core/SkTileMode.h"
#include "include/effects/SkRuntimeEffect.h"
#include "include/gpu/GpuTypes.h"
#include "include/gpu/GrDirectContext.h"
#include "include/gpu/GrRecordingContext.h"
#include "include/gpu/GrTypes.h"
#include "include/private/SkColorData.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkFixed.h"
#include "include/private/base/SkFloatingPoint.h"
#include "include/private/base/SkMath.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/gpu/ganesh/GrTypesPriv.h"
#include "src/base/SkFloatBits.h"
#include "src/base/SkTLazy.h"
#include "src/core/SkBlurMaskFilterImpl.h"
#include "src/core/SkDraw.h"
#include "src/core/SkMask.h"
#include "src/core/SkMaskFilterBase.h"
#include "src/core/SkRRectPriv.h"
#include "src/core/SkRuntimeEffectPriv.h"
#include "src/core/SkTraceEvent.h"
#include "src/gpu/BlurUtils.h"
#include "src/gpu/ResourceKey.h"
#include "src/gpu/SkBackingFit.h"
#include "src/gpu/Swizzle.h"
#include "src/gpu/ganesh/GrCaps.h"
#include "src/gpu/ganesh/GrClip.h"
#include "src/gpu/ganesh/GrColorInfo.h"
#include "src/gpu/ganesh/GrColorSpaceXform.h"
#include "src/gpu/ganesh/GrDirectContextPriv.h"
#include "src/gpu/ganesh/GrFixedClip.h"
#include "src/gpu/ganesh/GrFragmentProcessor.h"
#include "src/gpu/ganesh/GrFragmentProcessors.h"
#include "src/gpu/ganesh/GrPaint.h"
#include "src/gpu/ganesh/GrRecordingContextPriv.h"
#include "src/gpu/ganesh/GrSamplerState.h"
#include "src/gpu/ganesh/GrShaderCaps.h"
#include "src/gpu/ganesh/GrStyle.h"
#include "src/gpu/ganesh/GrSurfaceProxy.h"
#include "src/gpu/ganesh/GrSurfaceProxyView.h"
#include "src/gpu/ganesh/GrTextureProxy.h"
#include "src/gpu/ganesh/GrThreadSafeCache.h"
#include "src/gpu/ganesh/GrUtil.h"
#include "src/gpu/ganesh/SkGr.h"
#include "src/gpu/ganesh/SurfaceContext.h"
#include "src/gpu/ganesh/SurfaceDrawContext.h"
#include "src/gpu/ganesh/SurfaceFillContext.h"
#include "src/gpu/ganesh/effects/GrBlendFragmentProcessor.h"
#include "src/gpu/ganesh/effects/GrMatrixEffect.h"
#include "src/gpu/ganesh/effects/GrSkSLFP.h"
#include "src/gpu/ganesh/effects/GrTextureEffect.h"
#include "src/gpu/ganesh/geometry/GrStyledShape.h"
#include <algorithm>
#include <array>
#include <cstdint>
#include <initializer_list>
#include <memory>
#include <tuple>
#include <utility>

Go to the source code of this file.

Classes

struct  GrBlurUtils::DrawRectData
 

Namespaces

namespace  GrBlurUtils
 

Functions

static bool GrBlurUtils::clip_bounds_quick_reject (const SkIRect &clipBounds, const SkIRect &rect)
 
static bool GrBlurUtils::draw_mask (skgpu::ganesh::SurfaceDrawContext *sdc, const GrClip *clip, const SkMatrix &viewMatrix, const SkIRect &maskBounds, GrPaint &&paint, GrSurfaceProxyView mask)
 
static void GrBlurUtils::mask_release_proc (void *addr, void *)
 
static sk_sp< SkDataGrBlurUtils::create_data (const SkIRect &drawRect, const SkIRect &origDevBounds)
 
static SkIRect GrBlurUtils::extract_draw_rect_from_data (SkData *data, const SkIRect &origDevBounds)
 
static GrSurfaceProxyView GrBlurUtils::sw_create_filtered_mask (GrRecordingContext *rContext, const SkMatrix &viewMatrix, const GrStyledShape &shape, const SkMaskFilter *filter, const SkIRect &unclippedDevShapeBounds, const SkIRect &clipBounds, SkIRect *drawRect, skgpu::UniqueKey *key)
 
static std::unique_ptr< skgpu::ganesh::SurfaceDrawContextGrBlurUtils::create_mask_GPU (GrRecordingContext *rContext, const SkIRect &maskRect, const SkMatrix &origViewMatrix, const GrStyledShape &shape, int sampleCnt)
 
static bool GrBlurUtils::get_unclipped_shape_dev_bounds (const GrStyledShape &shape, const SkMatrix &matrix, SkIRect *devBounds)
 
static bool GrBlurUtils::get_shape_and_clip_bounds (skgpu::ganesh::SurfaceDrawContext *sdc, const GrClip *clip, const GrStyledShape &shape, const SkMatrix &matrix, SkIRect *unclippedDevShapeBounds, SkIRect *devClipBounds)
 
static bool GrBlurUtils::can_filter_mask (const SkMaskFilterBase *maskFilter, const GrStyledShape &shape, const SkIRect &devSpaceShapeBounds, const SkIRect &clipBounds, const SkMatrix &ctm, SkIRect *maskRect)
 
static std::unique_ptr< GrFragmentProcessorGrBlurUtils::create_profile_effect (GrRecordingContext *rContext, const SkRect &circle, float sigma, float *solidRadius, float *textureRadius)
 
static std::unique_ptr< GrFragmentProcessorGrBlurUtils::make_circle_blur (GrRecordingContext *context, const SkRect &circle, float sigma)
 
static std::unique_ptr< GrFragmentProcessorGrBlurUtils::make_rect_integral_fp (GrRecordingContext *rContext, float sixSigma)
 
static std::unique_ptr< GrFragmentProcessorGrBlurUtils::make_rect_blur (GrRecordingContext *context, const GrShaderCaps &caps, const SkRect &srcRect, const SkMatrix &viewMatrix, float transformedSigma)
 
static void GrBlurUtils::make_blurred_rrect_key (skgpu::UniqueKey *key, const SkRRect &rrectToDraw, float xformedSigma)
 
static bool GrBlurUtils::fillin_view_on_gpu (GrDirectContext *dContext, const GrSurfaceProxyView &lazyView, GrThreadSafeCache::Trampoline *trampoline, const SkRRect &rrectToDraw, const SkISize &dimensions, float xformedSigma)
 
static GrSurfaceProxyView GrBlurUtils::create_mask_on_cpu (GrRecordingContext *rContext, const SkRRect &rrectToDraw, const SkISize &dimensions, float xformedSigma)
 
static std::unique_ptr< GrFragmentProcessorGrBlurUtils::find_or_create_rrect_blur_mask_fp (GrRecordingContext *rContext, const SkRRect &rrectToDraw, const SkISize &dimensions, float xformedSigma)
 
static std::unique_ptr< GrFragmentProcessorGrBlurUtils::make_rrect_blur (GrRecordingContext *context, float sigma, float xformedSigma, const SkRRect &srcRRect, const SkRRect &devRRect)
 
static bool GrBlurUtils::direct_filter_mask (GrRecordingContext *context, const SkMaskFilterBase *maskFilter, skgpu::ganesh::SurfaceDrawContext *sdc, GrPaint &&paint, const GrClip *clip, const SkMatrix &viewMatrix, const GrStyledShape &shape)
 
static bool GrBlurUtils::compute_key_and_clip_bounds (skgpu::UniqueKey *maskKey, SkIRect *boundsForClip, const GrCaps *caps, const SkMatrix &viewMatrix, bool inverseFilled, const SkMaskFilterBase *maskFilter, const GrStyledShape &shape, const SkIRect &unclippedDevShapeBounds, const SkIRect &devClipBounds)
 
static GrSurfaceProxyView GrBlurUtils::filter_mask (GrRecordingContext *context, const SkMaskFilterBase *maskFilter, GrSurfaceProxyView srcView, GrColorType srcColorType, SkAlphaType srcAlphaType, const SkMatrix &ctm, const SkIRect &maskRect)
 
static GrSurfaceProxyView GrBlurUtils::hw_create_filtered_mask (GrDirectContext *dContext, skgpu::ganesh::SurfaceDrawContext *sdc, const SkMatrix &viewMatrix, const GrStyledShape &shape, const SkMaskFilterBase *filter, const SkIRect &unclippedDevShapeBounds, const SkIRect &clipBounds, SkIRect *maskRect, skgpu::UniqueKey *key)
 
static void GrBlurUtils::draw_shape_with_mask_filter (GrRecordingContext *rContext, skgpu::ganesh::SurfaceDrawContext *sdc, const GrClip *clip, GrPaint &&paint, const SkMatrix &viewMatrix, const SkMaskFilterBase *maskFilter, const GrStyledShape &origShape)
 
bool GrBlurUtils::ComputeBlurredRRectParams (const SkRRect &srcRRect, const SkRRect &devRRect, SkScalar sigma, SkScalar xformedSigma, SkRRect *rrectToDraw, SkISize *widthHeight, SkScalar rectXs[kBlurRRectMaxDivisions], SkScalar rectYs[kBlurRRectMaxDivisions], SkScalar texXs[kBlurRRectMaxDivisions], SkScalar texYs[kBlurRRectMaxDivisions])
 
void GrBlurUtils::DrawShapeWithMaskFilter (GrRecordingContext *rContext, skgpu::ganesh::SurfaceDrawContext *sdc, const GrClip *clip, const GrStyledShape &shape, GrPaint &&paint, const SkMatrix &viewMatrix, const SkMaskFilter *mf)
 
void GrBlurUtils::DrawShapeWithMaskFilter (GrRecordingContext *rContext, skgpu::ganesh::SurfaceDrawContext *sdc, const GrClip *clip, const SkPaint &paint, const SkMatrix &ctm, const GrStyledShape &shape)
 
static void GrBlurUtils::convolve_gaussian_1d (skgpu::ganesh::SurfaceFillContext *sfc, GrSurfaceProxyView srcView, const SkIRect &srcSubset, SkIVector dstToSrcOffset, const SkIRect &dstRect, SkAlphaType srcAlphaType, Direction direction, int radius, float sigma, SkTileMode mode)
 
static std::unique_ptr< skgpu::ganesh::SurfaceDrawContextGrBlurUtils::convolve_gaussian_2d (GrRecordingContext *rContext, GrSurfaceProxyView srcView, GrColorType srcColorType, const SkIRect &srcBounds, const SkIRect &dstBounds, int radiusX, int radiusY, SkScalar sigmaX, SkScalar sigmaY, SkTileMode mode, sk_sp< SkColorSpace > finalCS, SkBackingFit dstFit)
 
static std::unique_ptr< skgpu::ganesh::SurfaceDrawContextGrBlurUtils::convolve_gaussian (GrRecordingContext *rContext, GrSurfaceProxyView srcView, GrColorType srcColorType, SkAlphaType srcAlphaType, SkIRect srcBounds, SkIRect dstBounds, Direction direction, int radius, float sigma, SkTileMode mode, sk_sp< SkColorSpace > finalCS, SkBackingFit fit)
 
static std::unique_ptr< skgpu::ganesh::SurfaceDrawContextGrBlurUtils::reexpand (GrRecordingContext *rContext, std::unique_ptr< skgpu::ganesh::SurfaceContext > src, const SkRect &srcBounds, SkISize dstSize, sk_sp< SkColorSpace > colorSpace, SkBackingFit fit)
 
static std::unique_ptr< skgpu::ganesh::SurfaceDrawContextGrBlurUtils::two_pass_gaussian (GrRecordingContext *rContext, GrSurfaceProxyView srcView, GrColorType srcColorType, SkAlphaType srcAlphaType, sk_sp< SkColorSpace > colorSpace, SkIRect srcBounds, SkIRect dstBounds, float sigmaX, float sigmaY, int radiusX, int radiusY, SkTileMode mode, SkBackingFit fit)
 
std::unique_ptr< skgpu::ganesh::SurfaceDrawContextGrBlurUtils::GaussianBlur (GrRecordingContext *rContext, GrSurfaceProxyView srcView, GrColorType srcColorType, SkAlphaType srcAlphaType, sk_sp< SkColorSpace > colorSpace, SkIRect dstBounds, SkIRect srcBounds, float sigmaX, float sigmaY, SkTileMode mode, SkBackingFit fit)
 

Variables

static constexpr auto GrBlurUtils::kMaskOrigin = kTopLeft_GrSurfaceOrigin
 
static constexpr auto GrBlurUtils::kBlurredRRectMaskOrigin = kTopLeft_GrSurfaceOrigin