| 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, SkImageFilte
r::kApprox_SizeConstraint); | 314 SkImageFilter::Context filterContext(totMat, clipBounds, cache); |
| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 #if !GR_CACHE_HOISTED_LAYERS | 392 #if !GR_CACHE_HOISTED_LAYERS |
| 393 | 393 |
| 394 // This code completely clears out the atlas. It is required when | 394 // This code completely clears out the atlas. It is required when |
| 395 // caching is disabled so the atlas doesn't fill up and force more | 395 // caching is disabled so the atlas doesn't fill up and force more |
| 396 // free floating layers | 396 // free floating layers |
| 397 layerCache->purgeAll(); | 397 layerCache->purgeAll(); |
| 398 #endif | 398 #endif |
| 399 | 399 |
| 400 layerCache->end(); | 400 layerCache->end(); |
| 401 } | 401 } |
| OLD | NEW |