aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-02-17 20:18:54 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-17 20:19:04 +0000
commiteae7524c59a030bec0fe365dd10c033a8de9d542 (patch)
tree004c03432141ba4316275de0ac3ede383c0ab727 /src
parent310f4d02c1e2d01181c1db18acf05f2846f94cd4 (diff)
Revert "Expand use of GrMakeCachedBitmapProxy"
This reverts commit 561d1f8153c591dac670148a574a7638f3fe8c2d. Reason for revert: ios-device-xcode-clang Original change's description: > Expand use of GrMakeCachedBitmapProxy > > Change-Id: Ic276b9d772763dc16ac6b15a0896578d2d02e06e > Reviewed-on: https://skia-review.googlesource.com/8666 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Robert Phillips <robertphillips@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I5349cfea983cb65c11b5c250e674a841b9691c40 Reviewed-on: https://skia-review.googlesource.com/8677 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkSpecialImage.cpp4
-rw-r--r--src/effects/SkPerlinNoiseShader.cpp39
-rw-r--r--src/effects/SkTableColorFilter.cpp18
3 files changed, 24 insertions, 37 deletions
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index 0ae84d305b..cef87b75be 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -261,7 +261,9 @@ public:
sk_sp<GrTextureProxy> onAsTextureProxy(GrContext* context) const override {
if (context) {
- return GrMakeCachedBitmapProxy(context, fBitmap);
+ sk_sp<GrTexture> tex(sk_ref_sp(GrRefCachedBitmapTexture(
+ context, fBitmap, GrSamplerParams::ClampNoFilter(), nullptr)));
+ return GrSurfaceProxy::MakeWrapped(std::move(tex));
}
return nullptr;
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 5f8fe32f08..b67fb34692 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -19,7 +19,6 @@
#include "GrContext.h"
#include "GrCoordTransform.h"
#include "SkGr.h"
-#include "SkGrPriv.h"
#include "effects/GrConstColorProcessor.h"
#include "glsl/GrGLSLFragmentProcessor.h"
#include "glsl/GrGLSLFragmentShaderBuilder.h"
@@ -486,16 +485,14 @@ private:
class GrPerlinNoiseEffect : public GrFragmentProcessor {
public:
- static sk_sp<GrFragmentProcessor> Make(GrTextureProvider* textureProvider,
- SkPerlinNoiseShader::Type type,
+ static sk_sp<GrFragmentProcessor> Make(SkPerlinNoiseShader::Type type,
int numOctaves, bool stitchTiles,
SkPerlinNoiseShader::PaintingData* paintingData,
- sk_sp<GrTextureProxy> permutationsProxy,
- sk_sp<GrTextureProxy> noiseProxy,
+ GrTexture* permutationsTexture, GrTexture* noiseTexture,
const SkMatrix& matrix) {
return sk_sp<GrFragmentProcessor>(
- new GrPerlinNoiseEffect(textureProvider, type, numOctaves, stitchTiles, paintingData,
- std::move(permutationsProxy), std::move(noiseProxy), matrix));
+ new GrPerlinNoiseEffect(type, numOctaves, stitchTiles, paintingData,
+ permutationsTexture, noiseTexture, matrix));
}
virtual ~GrPerlinNoiseEffect() { delete fPaintingData; }
@@ -528,18 +525,17 @@ private:
fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataInit;
}
- GrPerlinNoiseEffect(GrTextureProvider* textureProvider,
- SkPerlinNoiseShader::Type type, int numOctaves, bool stitchTiles,
+ GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type, int numOctaves, bool stitchTiles,
SkPerlinNoiseShader::PaintingData* paintingData,
- sk_sp<GrTextureProxy> permutationsProxy, sk_sp<GrTextureProxy> noiseProxy,
+ GrTexture* permutationsTexture, GrTexture* noiseTexture,
const SkMatrix& matrix)
: INHERITED(kNone_OptimizationFlags)
, fType(type)
, fCoordTransform(matrix)
, fNumOctaves(numOctaves)
, fStitchTiles(stitchTiles)
- , fPermutationsSampler(textureProvider, std::move(permutationsProxy))
- , fNoiseSampler(textureProvider, std::move(noiseProxy))
+ , fPermutationsSampler(permutationsTexture)
+ , fNoiseSampler(noiseTexture)
, fPaintingData(paintingData) {
this->initClassID<GrPerlinNoiseEffect>();
this->addTextureSampler(&fPermutationsSampler);
@@ -915,24 +911,23 @@ sk_sp<GrFragmentProcessor> SkPerlinNoiseShader::asFragmentProcessor(const AsFPAr
SkPerlinNoiseShader::PaintingData* paintingData =
new PaintingData(fTileSize, fSeed, fBaseFrequencyX, fBaseFrequencyY, matrix);
- sk_sp<GrTextureProxy> permutationsProxy(GrMakeCachedBitmapProxy(
- args.fContext,
- paintingData->getPermutationsBitmap()));
- sk_sp<GrTextureProxy> noiseProxy(GrMakeCachedBitmapProxy(args.fContext,
- paintingData->getNoiseBitmap()));
+ sk_sp<GrTexture> permutationsTexture(
+ GrRefCachedBitmapTexture(args.fContext, paintingData->getPermutationsBitmap(),
+ GrSamplerParams::ClampNoFilter(), nullptr));
+ sk_sp<GrTexture> noiseTexture(
+ GrRefCachedBitmapTexture(args.fContext, paintingData->getNoiseBitmap(),
+ GrSamplerParams::ClampNoFilter(), nullptr));
SkMatrix m = *args.fViewMatrix;
m.setTranslateX(-localMatrix.getTranslateX() + SK_Scalar1);
m.setTranslateY(-localMatrix.getTranslateY() + SK_Scalar1);
- if (permutationsProxy && noiseProxy) {
+ if ((permutationsTexture) && (noiseTexture)) {
sk_sp<GrFragmentProcessor> inner(
- GrPerlinNoiseEffect::Make(args.fContext->textureProvider(),
- fType,
+ GrPerlinNoiseEffect::Make(fType,
fNumOctaves,
fStitchTiles,
paintingData,
- std::move(permutationsProxy),
- std::move(noiseProxy),
+ permutationsTexture.get(), noiseTexture.get(),
m));
return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
}
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 8e660f8ee0..8960449eb1 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -10,7 +10,6 @@
#include "SkArenaAlloc.h"
#include "SkBitmap.h"
#include "SkColorPriv.h"
-#include "SkGrPriv.h"
#include "SkRasterPipeline.h"
#include "SkReadBuffer.h"
#include "SkString.h"
@@ -371,9 +370,7 @@ sk_sp<SkColorFilter> SkTable_ColorFilter::makeComposed(sk_sp<SkColorFilter> inne
class ColorTableEffect : public GrFragmentProcessor {
public:
- static sk_sp<GrFragmentProcessor> Make(GrContext* context,
- const SkBitmap& bitmap,
- unsigned flags);
+ static sk_sp<GrFragmentProcessor> Make(GrContext* context, SkBitmap bitmap, unsigned flags);
virtual ~ColorTableEffect();
@@ -483,7 +480,7 @@ void GLColorTableEffect::emitCode(EmitArgs& args) {
}
///////////////////////////////////////////////////////////////////////////////
-sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, const SkBitmap& bitmap,
+sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, SkBitmap bitmap,
unsigned flags) {
GrTextureStripAtlas::Desc desc;
@@ -497,19 +494,12 @@ sk_sp<GrFragmentProcessor> ColorTableEffect::Make(GrContext* context, const SkBi
sk_sp<GrTexture> texture;
if (-1 == row) {
atlas = nullptr;
-
- sk_sp<GrTextureProxy> proxy = GrMakeCachedBitmapProxy(context, bitmap);
- if (proxy) {
- texture.reset(proxy->instantiate(context->textureProvider()));
- }
+ texture.reset(
+ GrRefCachedBitmapTexture(context, bitmap, GrSamplerParams::ClampNoFilter(), nullptr));
} else {
texture.reset(SkRef(atlas->getTexture()));
}
- if (!texture) {
- return nullptr;
- }
-
return sk_sp<GrFragmentProcessor>(new ColorTableEffect(texture.get(), atlas, row, flags));
}