Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: src/core/SkGpuBlurUtils.cpp

Issue 2215323003: Start using RenderTargetProxy (omnibus) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkGpuBlurUtils.h ('k') | src/core/SkImageCacherator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGpuBlurUtils.cpp
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index 8107642783f04ff5045379e4e537f811e41b0562..90ccb4ff741a8de0355d776cdf0623df9c34feb9 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -10,12 +10,14 @@
#include "SkRect.h"
#if SK_SUPPORT_GPU
-#include "effects/GrConvolutionEffect.h"
-#include "effects/GrMatrixConvolutionEffect.h"
-#include "GrContext.h"
#include "GrCaps.h"
-#include "GrRenderTargetContext.h"
+#include "GrContext.h"
#include "GrFixedClip.h"
+#include "GrRenderTargetContext.h"
+#include "GrTextureProxy.h"
+
+#include "effects/GrConvolutionEffect.h"
+#include "effects/GrMatrixConvolutionEffect.h"
#define MAX_BLUR_SIGMA 4.0f
@@ -69,7 +71,7 @@ static void convolve_gaussian_1d(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkIRect& dstRect,
const SkIPoint& srcOffset,
- GrTexture* texture,
+ GrTextureProxy* texture,
Gr1DKernelEffect::Direction direction,
int radius,
float sigma,
@@ -91,7 +93,7 @@ static void convolve_gaussian_2d(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkIRect& dstRect,
const SkIPoint& srcOffset,
- GrTexture* texture,
+ GrTextureProxy* texture,
int radiusX,
int radiusY,
SkScalar sigmaX,
@@ -118,7 +120,7 @@ static void convolve_gaussian_2d(GrRenderTargetContext* renderTargetContext,
static void convolve_gaussian(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkIRect& srcRect,
- GrTexture* texture,
+ GrTextureProxy* texture,
Gr1DKernelEffect::Direction direction,
int radius,
float sigma,
@@ -182,7 +184,7 @@ static void convolve_gaussian(GrRenderTargetContext* renderTargetContext,
namespace SkGpuBlurUtils {
sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
- GrTexture* origSrc,
+ GrTextureProxy* origSrc,
sk_sp<SkColorSpace> colorSpace,
const SkIRect& dstBounds,
const SkIRect* srcBounds,
@@ -216,7 +218,7 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
// setup new clip
GrFixedClip clip(localDstBounds);
- sk_sp<GrTexture> srcTexture(sk_ref_sp(origSrc));
+ sk_sp<GrTextureProxy> srcTexture(sk_ref_sp(origSrc));
SkASSERT(kBGRA_8888_GrPixelConfig == srcTexture->config() ||
kRGBA_8888_GrPixelConfig == srcTexture->config() ||
@@ -229,9 +231,10 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
const int height = dstBounds.height();
const GrPixelConfig config = srcTexture->config();
- sk_sp<GrRenderTargetContext> dstRenderTargetContext(context->makeRenderTargetContext(
- fit, width, height, config, colorSpace, 0, kDefault_GrSurfaceOrigin));
- if (!dstRenderTargetContext) {
+ sk_sp<GrRenderTargetContext> dstDeferredRenderTargetContext(
+ context->makeDeferredRenderTargetContext(fit, width, height, config, colorSpace,
+ 0, kDefault_GrSurfaceOrigin));
+ if (!dstDeferredRenderTargetContext) {
return nullptr;
}
@@ -242,13 +245,13 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
// We shouldn't be scaling because this is a small size blur
SkASSERT((1 == scaleFactorX) && (1 == scaleFactorY));
- convolve_gaussian_2d(dstRenderTargetContext.get(), clip, localDstBounds, srcOffset,
+ convolve_gaussian_2d(dstDeferredRenderTargetContext.get(), clip, localDstBounds, srcOffset,
srcTexture.get(), radiusX, radiusY, sigmaX, sigmaY, srcBounds);
- return dstRenderTargetContext;
+ return dstDeferredRenderTargetContext;
}
- sk_sp<GrRenderTargetContext> tmpRenderTargetContext(context->makeRenderTargetContext(
+ sk_sp<GrRenderTargetContext> tmpRenderTargetContext(context->makeDeferredRenderTargetContext(
fit, width, height, config, colorSpace, 0, kDefault_GrSurfaceOrigin));
if (!tmpRenderTargetContext) {
return nullptr;
@@ -260,7 +263,7 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
for (int i = 1; i < scaleFactorX || i < scaleFactorY; i *= 2) {
GrPaint paint;
- paint.setGammaCorrect(dstRenderTargetContext->isGammaCorrect());
+ paint.setGammaCorrect(dstDeferredRenderTargetContext->isGammaCorrect());
SkMatrix matrix;
matrix.setIDiv(srcTexture->width(), srcTexture->height());
SkIRect dstRect(srcRect);
@@ -286,13 +289,13 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
shrink_irect_by_2(&dstRect, i < scaleFactorX, i < scaleFactorY);
- dstRenderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(),
- SkRect::Make(dstRect), SkRect::Make(srcRect));
+ dstDeferredRenderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(),
+ SkRect::Make(dstRect), SkRect::Make(srcRect));
- srcRenderTargetContext = dstRenderTargetContext;
+ srcRenderTargetContext = dstDeferredRenderTargetContext;
srcRect = dstRect;
- srcTexture = srcRenderTargetContext->asTexture();
- dstRenderTargetContext.swap(tmpRenderTargetContext);
+ srcTexture = sk_ref_sp(srcRenderTargetContext->asDeferredTexture());
+ dstDeferredRenderTargetContext.swap(tmpRenderTargetContext);
localSrcBounds = srcRect;
}
@@ -309,13 +312,13 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
srcRenderTargetContext->clear(&clearRect, 0x0, false);
}
- convolve_gaussian(dstRenderTargetContext.get(), clip, srcRect,
+ convolve_gaussian(dstDeferredRenderTargetContext.get(), clip, srcRect,
srcTexture.get(), Gr1DKernelEffect::kX_Direction, radiusX, sigmaX,
srcBounds, srcOffset);
- srcRenderTargetContext = dstRenderTargetContext;
- srcTexture = srcRenderTargetContext->asTexture();
+ srcRenderTargetContext = dstDeferredRenderTargetContext;
+ srcTexture = sk_ref_sp(srcRenderTargetContext->asDeferredTexture());
srcRect.offsetTo(0, 0);
- dstRenderTargetContext.swap(tmpRenderTargetContext);
+ dstDeferredRenderTargetContext.swap(tmpRenderTargetContext);
localSrcBounds = srcRect;
srcOffset.set(0, 0);
}
@@ -331,13 +334,13 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
srcRenderTargetContext->clear(&clearRect, 0x0, false);
}
- convolve_gaussian(dstRenderTargetContext.get(), clip, srcRect,
+ convolve_gaussian(dstDeferredRenderTargetContext.get(), clip, srcRect,
srcTexture.get(), Gr1DKernelEffect::kY_Direction, radiusY, sigmaY,
srcBounds, srcOffset);
- srcRenderTargetContext = dstRenderTargetContext;
+ srcRenderTargetContext = dstDeferredRenderTargetContext;
srcRect.offsetTo(0, 0);
- dstRenderTargetContext.swap(tmpRenderTargetContext);
+ dstDeferredRenderTargetContext.swap(tmpRenderTargetContext);
}
SkASSERT(srcRenderTargetContext);
@@ -354,22 +357,22 @@ sk_sp<GrRenderTargetContext> GaussianBlur(GrContext* context,
matrix.setIDiv(srcRenderTargetContext->width(), srcRenderTargetContext->height());
GrPaint paint;
- paint.setGammaCorrect(dstRenderTargetContext->isGammaCorrect());
+ paint.setGammaCorrect(dstDeferredRenderTargetContext->isGammaCorrect());
// FIXME: this should be mitchell, not bilinear.
GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_FilterMode);
- sk_sp<GrTexture> tex(srcRenderTargetContext->asTexture());
+ sk_sp<GrTextureProxy> tex(srcRenderTargetContext->asDeferredTexture());
paint.addColorTextureProcessor(tex.get(), nullptr, matrix, params);
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
SkIRect dstRect(srcRect);
scale_irect(&dstRect, scaleFactorX, scaleFactorY);
- dstRenderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(),
- SkRect::Make(dstRect), SkRect::Make(srcRect));
+ dstDeferredRenderTargetContext->fillRectToRect(clip, paint, SkMatrix::I(),
+ SkRect::Make(dstRect), SkRect::Make(srcRect));
- srcRenderTargetContext = dstRenderTargetContext;
+ srcRenderTargetContext = dstDeferredRenderTargetContext;
srcRect = dstRect;
- dstRenderTargetContext.swap(tmpRenderTargetContext);
+ dstDeferredRenderTargetContext.swap(tmpRenderTargetContext);
}
return srcRenderTargetContext;
« no previous file with comments | « src/core/SkGpuBlurUtils.h ('k') | src/core/SkImageCacherator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698