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

Unified Diff: src/effects/SkMorphologyImageFilter.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/effects/SkLightingImageFilter.cpp ('k') | src/effects/SkXfermodeImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkMorphologyImageFilter.cpp
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 630f782f90b59ca35f05e88b5b22b3e258a14459..87373c0bc267c1a24164e9d3d695b3231daed130 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -21,6 +21,7 @@
#include "GrFixedClip.h"
#include "GrInvariantOutput.h"
#include "GrTexture.h"
+#include "GrTextureProxy.h"
#include "SkGr.h"
#include "SkGrPriv.h"
#include "effects/Gr1DKernelEffect.h"
@@ -155,6 +156,16 @@ public:
return sk_sp<GrFragmentProcessor>(new GrMorphologyEffect(tex, dir, radius, type, bounds));
}
+ static sk_sp<GrFragmentProcessor> Make(GrTextureProxy* tex, Direction dir, int radius,
+ MorphologyType type) {
+ return sk_sp<GrFragmentProcessor>(new GrMorphologyEffect(tex, dir, radius, type));
+ }
+
+ static sk_sp<GrFragmentProcessor> Make(GrTextureProxy* tex, Direction dir, int radius,
+ MorphologyType type, float bounds[2]) {
+ return sk_sp<GrFragmentProcessor>(new GrMorphologyEffect(tex, dir, radius, type, bounds));
+ }
+
virtual ~GrMorphologyEffect();
MorphologyType type() const { return fType; }
@@ -179,8 +190,10 @@ private:
void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType);
- GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType,
- float bounds[2]);
+ GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType, float bounds[2]);
+
+ GrMorphologyEffect(GrTextureProxy*, Direction, int radius, MorphologyType);
+ GrMorphologyEffect(GrTextureProxy*, Direction, int radius, MorphologyType, float bounds[2]);
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
@@ -387,7 +400,7 @@ sk_sp<GrFragmentProcessor> GrMorphologyEffect::TestCreate(GrProcessorTestData* d
static void apply_morphology_rect(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
- GrTexture* texture,
+ GrTextureProxy* texture,
const SkIRect& srcRect,
const SkIRect& dstRect,
int radius,
@@ -408,7 +421,7 @@ static void apply_morphology_rect(GrRenderTargetContext* renderTargetContext,
static void apply_morphology_rect_no_bounds(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
- GrTexture* texture,
+ GrTextureProxy* texture,
const SkIRect& srcRect,
const SkIRect& dstRect,
int radius,
@@ -425,7 +438,7 @@ static void apply_morphology_rect_no_bounds(GrRenderTargetContext* renderTargetC
static void apply_morphology_pass(GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
- GrTexture* texture,
+ GrTextureProxy* texture,
const SkIRect& srcRect,
const SkIRect& dstRect,
int radius,
@@ -476,7 +489,7 @@ static sk_sp<SkSpecialImage> apply_morphology(
GrMorphologyEffect::MorphologyType morphType,
SkISize radius,
const SkImageFilter::OutputProperties& outputProperties) {
- sk_sp<GrTexture> srcTexture(input->asTextureRef(context));
+ sk_sp<GrTextureProxy> srcTexture(input->asTextureProxy(context));
SkASSERT(srcTexture);
sk_sp<SkColorSpace> colorSpace = sk_ref_sp(outputProperties.colorSpace());
GrPixelConfig config = GrRenderableConfigForColorSpace(colorSpace.get());
@@ -506,7 +519,7 @@ static sk_sp<SkSpecialImage> apply_morphology(
: SK_ColorTRANSPARENT;
dstRenderTargetContext->clear(&clearRect, clearColor, false);
- srcTexture = dstRenderTargetContext->asTexture();
+ srcTexture = dstRenderTargetContext->asDeferredTexture();
srcRect = dstRect;
}
if (radius.fHeight > 0) {
@@ -520,13 +533,13 @@ static sk_sp<SkSpecialImage> apply_morphology(
srcRect, dstRect, radius.fHeight, morphType,
Gr1DKernelEffect::kY_Direction);
- srcTexture = dstRenderTargetContext->asTexture();
+ srcTexture = dstRenderTargetContext->asDeferredTexture();
}
- return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(rect.width(), rect.height()),
- kNeedNewImageUniqueID_SpecialImage,
- std::move(srcTexture), std::move(colorSpace),
- &input->props());
+ return SkSpecialImage::MakeDeferredFromGpu(SkIRect::MakeWH(rect.width(), rect.height()),
+ kNeedNewImageUniqueID_SpecialImage,
+ std::move(srcTexture), std::move(colorSpace),
+ &input->props());
}
#endif
« no previous file with comments | « src/effects/SkLightingImageFilter.cpp ('k') | src/effects/SkXfermodeImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698