OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |