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

Side by Side Diff: src/gpu/GrLayerHoister.cpp

Issue 1421493003: tunnel down texture-size-constraint to imagefilters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix formating 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/effects/SkMorphologyImageFilter.cpp ('k') | src/gpu/SkGpuDevice.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 2014 Google Inc. 2 * Copyright 2014 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 "GrLayerCache.h" 8 #include "GrLayerCache.h"
9 #include "GrLayerHoister.h" 9 #include "GrLayerHoister.h"
10 #include "GrRecordReplaceDraw.h" 10 #include "GrRecordReplaceDraw.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 totMat.preConcat(info.fPreMat); 304 totMat.preConcat(info.fPreMat);
305 totMat.preConcat(info.fLocalMat); 305 totMat.preConcat(info.fLocalMat);
306 totMat.postTranslate(-SkIntToScalar(filterOffset.fX), -SkIntToScalar(filterO ffset.fY)); 306 totMat.postTranslate(-SkIntToScalar(filterOffset.fX), -SkIntToScalar(filterO ffset.fY));
307 307
308 SkASSERT(0 == layer->rect().fLeft && 0 == layer->rect().fTop); 308 SkASSERT(0 == layer->rect().fLeft && 0 == layer->rect().fTop);
309 SkIRect clipBounds = layer->rect(); 309 SkIRect clipBounds = layer->rect();
310 310
311 // This cache is transient, and is freed (along with all its contained 311 // This cache is transient, and is freed (along with all its contained
312 // textures) when it goes out of scope. 312 // textures) when it goes out of scope.
313 SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefau ltCacheSize)); 313 SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefau ltCacheSize));
314 SkImageFilter::Context filterContext(totMat, clipBounds, cache); 314 SkImageFilter::Context filterContext(totMat, clipBounds, cache, SkImageFilte r::kApprox_SizeConstraint);
315 315
316 SkImageFilter::DeviceProxy proxy(device); 316 SkImageFilter::DeviceProxy proxy(device);
317 const SkBitmap src = wrap_texture(layer->texture()); 317 const SkBitmap src = wrap_texture(layer->texture());
318 318
319 if (!layer->filter()->filterImage(&proxy, src, filterContext, &filteredBitma p, &offset)) { 319 if (!layer->filter()->filterImage(&proxy, src, filterContext, &filteredBitma p, &offset)) {
320 // Filtering failed. Press on with the unfiltered version. 320 // Filtering failed. Press on with the unfiltered version.
321 return; 321 return;
322 } 322 }
323 323
324 SkIRect newRect = SkIRect::MakeWH(filteredBitmap.width(), filteredBitmap.hei ght()); 324 SkIRect newRect = SkIRect::MakeWH(filteredBitmap.width(), filteredBitmap.hei ght());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 void GrLayerHoister::PurgeCache(GrContext* context) { 383 void GrLayerHoister::PurgeCache(GrContext* context) {
384 #if !GR_CACHE_HOISTED_LAYERS 384 #if !GR_CACHE_HOISTED_LAYERS
385 GrLayerCache* layerCache = context->getLayerCache(); 385 GrLayerCache* layerCache = context->getLayerCache();
386 386
387 // This code completely clears out the atlas. It is required when 387 // This code completely clears out the atlas. It is required when
388 // caching is disabled so the atlas doesn't fill up and force more 388 // caching is disabled so the atlas doesn't fill up and force more
389 // free floating layers 389 // free floating layers
390 layerCache->purgeAll(); 390 layerCache->purgeAll();
391 #endif 391 #endif
392 } 392 }
OLDNEW
« no previous file with comments | « src/effects/SkMorphologyImageFilter.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698