Switch GPU blur code over to using GrRecordingContext

This is split out of: https://skia-review.googlesource.com/c/skia/+/191287 (Move DrawingManager to RecordingContext)

Change-Id: I305249f1e63bd4720264b0531733a219c79fe10a
Reviewed-on: https://skia-review.googlesource.com/c/192686
Auto-Submit: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
This commit is contained in:
Robert Phillips 2019-02-14 17:27:00 -05:00 committed by Skia Commit-Bot
parent f5cdd9b7f8
commit 7af8fe55bd
10 changed files with 43 additions and 36 deletions

View File

@ -20,9 +20,9 @@
#if SK_SUPPORT_GPU
#include "GrClip.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrFragmentProcessor.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrResourceProvider.h"
#include "GrShaderCaps.h"
@ -55,13 +55,13 @@ public:
const SkIRect& clipBounds,
const SkMatrix& ctm,
SkIRect* maskRect) const override;
bool directFilterMaskGPU(GrContext*,
bool directFilterMaskGPU(GrRecordingContext*,
GrRenderTargetContext* renderTargetContext,
GrPaint&&,
const GrClip&,
const SkMatrix& viewMatrix,
const GrShape& shape) const override;
sk_sp<GrTextureProxy> filterMaskGPU(GrContext*,
sk_sp<GrTextureProxy> filterMaskGPU(GrRecordingContext*,
sk_sp<GrTextureProxy> srcProxy,
const SkMatrix& ctm,
const SkIRect& maskRect) const override;
@ -716,7 +716,7 @@ void SkBlurMaskFilterImpl::flatten(SkWriteBuffer& buffer) const {
#if SK_SUPPORT_GPU
bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrContext* context,
bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext,
GrPaint&& paint,
const GrClip& clip,
@ -868,7 +868,7 @@ bool SkBlurMaskFilterImpl::canFilterMaskGPU(const GrShape& shape,
return true;
}
sk_sp<GrTextureProxy> SkBlurMaskFilterImpl::filterMaskGPU(GrContext* context,
sk_sp<GrTextureProxy> SkBlurMaskFilterImpl::filterMaskGPU(GrRecordingContext* context,
sk_sp<GrTextureProxy> srcProxy,
const SkMatrix& ctm,
const SkIRect& maskRect) const {

View File

@ -11,8 +11,9 @@
#if SK_SUPPORT_GPU
#include "GrCaps.h"
#include "GrContext.h"
#include "GrFixedClip.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetContextPriv.h"
#include "effects/GrGaussianConvolutionFragmentProcessor.h"
@ -103,7 +104,7 @@ static GrPixelConfig get_blur_config(GrTextureProxy* proxy) {
return config;
}
static sk_sp<GrRenderTargetContext> convolve_gaussian_2d(GrContext* context,
static sk_sp<GrRenderTargetContext> convolve_gaussian_2d(GrRecordingContext* context,
sk_sp<GrTextureProxy> proxy,
const SkIRect& srcBounds,
const SkIPoint& srcOffset,
@ -150,7 +151,7 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian_2d(GrContext* context,
return renderTargetContext;
}
static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
static sk_sp<GrRenderTargetContext> convolve_gaussian(GrRecordingContext* context,
sk_sp<GrTextureProxy> proxy,
const SkIRect& srcRect,
const SkIPoint& srcOffset,
@ -259,7 +260,7 @@ static sk_sp<GrRenderTargetContext> convolve_gaussian(GrContext* context,
return dstRenderTargetContext;
}
static sk_sp<GrTextureProxy> decimate(GrContext* context,
static sk_sp<GrTextureProxy> decimate(GrRecordingContext* context,
sk_sp<GrTextureProxy> src,
SkIPoint* srcOffset,
SkIRect* contentRect,
@ -373,7 +374,7 @@ static sk_sp<GrTextureProxy> decimate(GrContext* context,
}
// Expand the contents of 'srcRenderTargetContext' to fit in 'dstII'.
static sk_sp<GrRenderTargetContext> reexpand(GrContext* context,
static sk_sp<GrRenderTargetContext> reexpand(GrRecordingContext* context,
sk_sp<GrRenderTargetContext> srcRenderTargetContext,
const SkIRect& localSrcBounds,
int scaleFactorX, int scaleFactorY,
@ -449,7 +450,7 @@ static sk_sp<GrRenderTargetContext> reexpand(GrContext* context,
namespace SkGpuBlurUtils {
sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
sk_sp<GrRenderTargetContext> GaussianBlur(GrRecordingContext* context,
sk_sp<GrTextureProxy> srcProxy,
sk_sp<SkColorSpace> colorSpace,
const SkIRect& dstBounds,

View File

@ -36,7 +36,7 @@ namespace SkGpuBlurUtils {
* @return The renderTargetContext containing the blurred result.
*/
sk_sp<GrRenderTargetContext> GaussianBlur(
GrContext* context,
GrRecordingContext* context,
sk_sp<GrTextureProxy> src,
sk_sp<SkColorSpace> colorSpace,
const SkIRect& dstBounds,

View File

@ -331,7 +331,7 @@ bool SkMaskFilterBase::canFilterMaskGPU(const GrShape& shape,
return false;
}
bool SkMaskFilterBase::directFilterMaskGPU(GrContext*,
bool SkMaskFilterBase::directFilterMaskGPU(GrRecordingContext*,
GrRenderTargetContext*,
GrPaint&&,
const GrClip&,
@ -340,7 +340,7 @@ bool SkMaskFilterBase::directFilterMaskGPU(GrContext*,
return false;
}
sk_sp<GrTextureProxy> SkMaskFilterBase::filterMaskGPU(GrContext*,
sk_sp<GrTextureProxy> SkMaskFilterBase::filterMaskGPU(GrRecordingContext*,
sk_sp<GrTextureProxy> srcProxy,
const SkMatrix& ctm,
const SkIRect& maskRect) const {

View File

@ -17,10 +17,10 @@
#include "SkStrokeRec.h"
class GrClip;
class GrContext;
struct GrFPArgs;
class GrFragmentProcessor;
class GrPaint;
class GrRecordingContext;
class GrRenderTarget;
class GrRenderTargetContext;
class GrResourceProvider;
@ -108,7 +108,7 @@ public:
* Try to directly render the mask filter into the target. Returns true if drawing was
* successful. If false is returned then paint is unmodified.
*/
virtual bool directFilterMaskGPU(GrContext*,
virtual bool directFilterMaskGPU(GrRecordingContext*,
GrRenderTargetContext*,
GrPaint&& paint,
const GrClip&,
@ -122,7 +122,7 @@ public:
* Implementations are free to get the GrContext from the src texture in order to create
* additional textures and perform multiple passes.
*/
virtual sk_sp<GrTextureProxy> filterMaskGPU(GrContext*,
virtual sk_sp<GrTextureProxy> filterMaskGPU(GrRecordingContext*,
sk_sp<GrTextureProxy> srcProxy,
const SkMatrix& ctm,
const SkIRect& maskRect) const;

View File

@ -8,10 +8,10 @@
#include "GrBlurUtils.h"
#include "GrCaps.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrFixedClip.h"
#include "GrProxyProvider.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrRenderTargetContextPriv.h"
#include "GrShape.h"
@ -58,7 +58,7 @@ static void mask_release_proc(void* addr, void* /*context*/) {
SkMask::FreeImage(addr);
}
static bool sw_draw_with_mask_filter(GrContext* context,
static bool sw_draw_with_mask_filter(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext,
const GrClip& clipData,
const SkMatrix& viewMatrix,
@ -170,7 +170,7 @@ static bool sw_draw_with_mask_filter(GrContext* context,
}
// Create a mask of 'shape' and place the result in 'mask'.
static sk_sp<GrTextureProxy> create_mask_GPU(GrContext* context,
static sk_sp<GrTextureProxy> create_mask_GPU(GrRecordingContext* context,
const SkIRect& maskRect,
const SkMatrix& origViewMatrix,
const GrShape& shape,
@ -249,7 +249,7 @@ static bool get_shape_and_clip_bounds(GrRenderTargetContext* renderTargetContext
return true;
}
static void draw_shape_with_mask_filter(GrContext* context,
static void draw_shape_with_mask_filter(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrPaint&& paint,
@ -430,7 +430,7 @@ static void draw_shape_with_mask_filter(GrContext* context,
maskFilter, *boundsForClip, std::move(paint), maskKey);
}
void GrBlurUtils::drawShapeWithMaskFilter(GrContext* context,
void GrBlurUtils::drawShapeWithMaskFilter(GrRecordingContext* context,
GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const GrShape& shape,

View File

@ -13,6 +13,7 @@
class GrClip;
class GrContext;
class GrPaint;
class GrRecordingContext;
class GrRenderTarget;
class GrRenderTargetContext;
class GrShape;
@ -43,7 +44,7 @@ namespace GrBlurUtils {
* Draw a shape handling the mask filter. The mask filter is not optional.
* The GrPaint will be modified after return.
*/
void drawShapeWithMaskFilter(GrContext*,
void drawShapeWithMaskFilter(GrRecordingContext*,
GrRenderTargetContext*,
const GrClip&,
const GrShape&,

View File

@ -10,7 +10,8 @@
**************************************************************************************************/
#include "GrRRectBlurEffect.h"
std::unique_ptr<GrFragmentProcessor> GrRRectBlurEffect::Make(GrContext* context, float sigma,
std::unique_ptr<GrFragmentProcessor> GrRRectBlurEffect::Make(GrRecordingContext* context,
float sigma,
float xformedSigma,
const SkRRect& srcRRect,
const SkRRect& devRRect) {

View File

@ -14,10 +14,10 @@ uniform half blurRadius;
@header {
#include "GrClip.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrPaint.h"
#include "GrProxyProvider.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrStyle.h"
#include "SkBlurMaskFilter.h"
@ -27,7 +27,7 @@ uniform half blurRadius;
}
@class {
static sk_sp<GrTextureProxy> find_or_create_rrect_blur_mask(GrContext* context,
static sk_sp<GrTextureProxy> find_or_create_rrect_blur_mask(GrRecordingContext* context,
const SkRRect& rrectToDraw,
const SkISize& size,
float xformedSigma) {
@ -105,14 +105,16 @@ uniform half blurRadius;
}
@make {
static std::unique_ptr<GrFragmentProcessor> Make(GrContext* context, float sigma,
static std::unique_ptr<GrFragmentProcessor> Make(GrRecordingContext* context,
float sigma,
float xformedSigma,
const SkRRect& srcRRect,
const SkRRect& devRRect);
}
@cpp {
std::unique_ptr<GrFragmentProcessor> GrRRectBlurEffect::Make(GrContext* context, float sigma,
std::unique_ptr<GrFragmentProcessor> GrRRectBlurEffect::Make(GrRecordingContext* context,
float sigma,
float xformedSigma,
const SkRRect& srcRRect,
const SkRRect& devRRect) {

View File

@ -13,10 +13,10 @@
#include "SkTypes.h"
#include "GrClip.h"
#include "GrContext.h"
#include "GrContextPriv.h"
#include "GrPaint.h"
#include "GrProxyProvider.h"
#include "GrRecordingContext.h"
#include "GrRecordingContextPriv.h"
#include "GrRenderTargetContext.h"
#include "GrStyle.h"
#include "SkBlurMaskFilter.h"
@ -27,7 +27,7 @@
#include "GrCoordTransform.h"
class GrRRectBlurEffect : public GrFragmentProcessor {
public:
static sk_sp<GrTextureProxy> find_or_create_rrect_blur_mask(GrContext* context,
static sk_sp<GrTextureProxy> find_or_create_rrect_blur_mask(GrRecordingContext* context,
const SkRRect& rrectToDraw,
const SkISize& size,
float xformedSigma) {
@ -102,8 +102,10 @@ public:
const SkRect& rect() const { return fRect; }
float cornerRadius() const { return fCornerRadius; }
static std::unique_ptr<GrFragmentProcessor> Make(GrContext* context, float sigma,
float xformedSigma, const SkRRect& srcRRect,
static std::unique_ptr<GrFragmentProcessor> Make(GrRecordingContext* context,
float sigma,
float xformedSigma,
const SkRRect& srcRRect,
const SkRRect& devRRect);
GrRRectBlurEffect(const GrRRectBlurEffect& src);
std::unique_ptr<GrFragmentProcessor> clone() const override;