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

Unified Diff: src/image/SkImage_Gpu.cpp

Issue 1573653002: remove SkImage::applyFilter() -- unused, can always re-add later (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months 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/image/SkImage_Gpu.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Gpu.cpp
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index e773aed9484d4d0c7a7d552ce94bfb471d068d87..1d25635e870f3843fd675a2979cee4959dc91dab 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -152,82 +152,6 @@ SkImage* SkImage_Gpu::onNewSubset(const SkIRect& subset) const {
///////////////////////////////////////////////////////////////////////////////////////////////////
-class SkGpuImageFilterProxy : public SkImageFilter::Proxy {
- GrContext* fCtx;
-
-public:
- SkGpuImageFilterProxy(GrContext* ctx) : fCtx(ctx) {}
-
- SkBaseDevice* createDevice(int width, int height) override {
- GrSurfaceDesc desc;
- desc.fConfig = kSkia8888_GrPixelConfig;
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = width;
- desc.fHeight = height;
- desc.fSampleCnt = 0;
-
- SkAutoTUnref<GrTexture> texture(fCtx->textureProvider()->createTexture(desc, true));
-
- if (texture) {
- SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
- return SkGpuDevice::Create(texture->asRenderTarget(), width, height, &props,
- SkGpuDevice::kClear_InitContents);
- } else {
- return nullptr;
- }
- }
-
- bool filterImage(const SkImageFilter* filter, const SkBitmap& src,
- const SkImageFilter::Context& ctx, SkBitmap* dst, SkIPoint* offset) override {
- return filter->canFilterImageGPU() &&
- filter->filterImageGPU(this, src, ctx, dst, offset);
- }
-};
-
-static SkIRect compute_fast_ibounds(SkImageFilter* filter, const SkIRect& srcBounds) {
- SkRect fastBounds;
- fastBounds.set(srcBounds);
- filter->computeFastBounds(fastBounds, &fastBounds);
- return fastBounds.roundOut();
-}
-
-SkImage* SkImage_Gpu::onApplyFilter(SkImageFilter* filter, SkIPoint* offsetResult,
- bool forceResultToOriginalSize) const {
- const SkIRect srcBounds = SkIRect::MakeWH(this->width(), this->height());
-
- if (forceResultToOriginalSize) {
- SkBitmap src;
- GrWrapTextureInBitmap(fTexture, this->width(), this->height(), this->isOpaque(), &src);
-
- const SkIRect clipBounds = srcBounds;
- SkGpuImageFilterProxy proxy(fTexture->getContext());
- SkAutoTUnref<SkImageFilter::Cache> cache(SkGpuDevice::NewImageFilterCache());
- SkImageFilter::Context ctx(SkMatrix::I(), clipBounds, cache, SkImageFilter::kExact_SizeConstraint);
-
- SkBitmap dst;
- if (!filter->filterImage(&proxy, src, ctx, &dst, offsetResult)) {
- return nullptr;
- }
- return new SkImage_Gpu(dst.width(), dst.height(), kNeedNewImageUniqueID, dst.alphaType(),
- dst.getTexture(), SkSurface::kNo_Budgeted);
- }
-
- const SkIRect dstR = compute_fast_ibounds(filter, srcBounds);
-
- SkImageInfo info = SkImageInfo::MakeN32Premul(dstR.width(), dstR.height());
- SkAutoTUnref<SkSurface> surface(this->onNewSurface(info));
-
- SkPaint paint;
- paint.setImageFilter(filter);
- surface->getCanvas()->drawImage(this, SkIntToScalar(-dstR.x()), SkIntToScalar(-dstR.y()),
- &paint);
-
- offsetResult->set(dstR.x(), dstR.y());
- return surface->newImageSnapshot();
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
static SkImage* new_wrapped_texture_common(GrContext* ctx, const GrBackendTextureDesc& desc,
SkAlphaType at, GrWrapOwnership ownership,
SkImage::TextureReleaseProc releaseProc,
« no previous file with comments | « src/image/SkImage_Gpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698