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

Side by Side Diff: src/core/SkImageFilter.cpp

Issue 474443003: Check all scratch texture allocations for image filters. (Closed) Base URL: https://skia.googlesource.com/skia.git@m38_2125
Patch Set: Created 6 years, 4 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 | « no previous file | src/effects/SkDisplacementMapEffect.cpp » ('j') | 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 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 "SkImageFilter.h" 8 #include "SkImageFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height()); 249 SkRect dstRect = SkRect::MakeWH(srcRect.width(), srcRect.height());
250 GrContext* context = srcTexture->getContext(); 250 GrContext* context = srcTexture->getContext();
251 251
252 GrTextureDesc desc; 252 GrTextureDesc desc;
253 desc.fFlags = kRenderTarget_GrTextureFlagBit, 253 desc.fFlags = kRenderTarget_GrTextureFlagBit,
254 desc.fWidth = bounds.width(); 254 desc.fWidth = bounds.width();
255 desc.fHeight = bounds.height(); 255 desc.fHeight = bounds.height();
256 desc.fConfig = kRGBA_8888_GrPixelConfig; 256 desc.fConfig = kRGBA_8888_GrPixelConfig;
257 257
258 GrAutoScratchTexture dst(context, desc); 258 GrAutoScratchTexture dst(context, desc);
259 if (NULL == dst.texture()) {
260 return false;
261 }
259 GrContext::AutoMatrix am; 262 GrContext::AutoMatrix am;
260 am.setIdentity(context); 263 am.setIdentity(context);
261 GrContext::AutoRenderTarget art(context, dst.texture()->asRenderTarget()); 264 GrContext::AutoRenderTarget art(context, dst.texture()->asRenderTarget());
262 GrContext::AutoClip acs(context, dstRect); 265 GrContext::AutoClip acs(context, dstRect);
263 GrEffect* effect; 266 GrEffect* effect;
264 offset->fX = bounds.left(); 267 offset->fX = bounds.left();
265 offset->fY = bounds.top(); 268 offset->fY = bounds.top();
266 bounds.offset(-srcOffset); 269 bounds.offset(-srcOffset);
267 SkMatrix matrix(ctx.ctm()); 270 SkMatrix matrix(ctx.ctm());
268 matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.to p())); 271 matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.to p()));
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 } // namespace 492 } // namespace
490 493
491 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { 494 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) {
492 return SkNEW_ARGS(CacheImpl, (maxBytes)); 495 return SkNEW_ARGS(CacheImpl, (maxBytes));
493 } 496 }
494 497
495 SkImageFilter::Cache* SkImageFilter::Cache::Get() { 498 SkImageFilter::Cache* SkImageFilter::Cache::Get() {
496 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); 499 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache);
497 return cache.get(); 500 return cache.get();
498 } 501 }
OLDNEW
« no previous file with comments | « no previous file | src/effects/SkDisplacementMapEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698