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

Side by Side Diff: src/image/SkImage_Gpu.cpp

Issue 1414653003: use (temp) gpu-imagefilter-cache for applyFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmapCache.h" 8 #include "SkBitmapCache.h"
9 #include "SkImage_Gpu.h" 9 #include "SkImage_Gpu.h"
10 #include "GrCaps.h" 10 #include "GrCaps.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 SkImage* SkImage_Gpu::onApplyFilter(SkImageFilter* filter, SkIPoint* offsetResul t, 231 SkImage* SkImage_Gpu::onApplyFilter(SkImageFilter* filter, SkIPoint* offsetResul t,
232 bool forceResultToOriginalSize) const { 232 bool forceResultToOriginalSize) const {
233 const SkIRect srcBounds = SkIRect::MakeWH(this->width(), this->height()); 233 const SkIRect srcBounds = SkIRect::MakeWH(this->width(), this->height());
234 234
235 if (forceResultToOriginalSize) { 235 if (forceResultToOriginalSize) {
236 SkBitmap src; 236 SkBitmap src;
237 GrWrapTextureInBitmap(fTexture, this->width(), this->height(), this->isO paque(), &src); 237 GrWrapTextureInBitmap(fTexture, this->width(), this->height(), this->isO paque(), &src);
238 238
239 const SkIRect clipBounds = srcBounds; 239 const SkIRect clipBounds = srcBounds;
240 SkGpuImageFilterProxy proxy(fTexture->getContext()); 240 SkGpuImageFilterProxy proxy(fTexture->getContext());
241 SkImageFilter::Context ctx(SkMatrix::I(), clipBounds, SkImageFilter::Cac he::Get()); 241 SkAutoTUnref<SkImageFilter::Cache> cache(SkGpuDevice::NewImageFilterCach e());
242 SkImageFilter::Context ctx(SkMatrix::I(), clipBounds, cache);
242 243
243 SkBitmap dst; 244 SkBitmap dst;
244 if (!filter->filterImage(&proxy, src, ctx, &dst, offsetResult)) { 245 if (!filter->filterImage(&proxy, src, ctx, &dst, offsetResult)) {
245 return nullptr; 246 return nullptr;
246 } 247 }
247 return new SkImage_Gpu(dst.width(), dst.height(), kNeedNewImageUniqueID, dst.alphaType(), 248 return new SkImage_Gpu(dst.width(), dst.height(), kNeedNewImageUniqueID, dst.alphaType(),
248 dst.getTexture(), SkSurface::kNo_Budgeted); 249 dst.getTexture(), SkSurface::kNo_Budgeted);
249 } 250 }
250 251
251 const SkIRect dstR = compute_fast_ibounds(filter, srcBounds); 252 const SkIRect dstR = compute_fast_ibounds(filter, srcBounds);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if (!dst) { 405 if (!dst) {
405 return nullptr; 406 return nullptr;
406 } 407 }
407 408
408 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); 409 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
409 const SkIPoint dstP = SkIPoint::Make(0, 0); 410 const SkIPoint dstP = SkIPoint::Make(0, 0);
410 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); 411 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp);
411 return dst; 412 return dst;
412 } 413 }
413 414
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698