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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 // textures) when it goes out of scope. | 299 // textures) when it goes out of scope. |
300 SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefau
ltCacheSize)); | 300 SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefau
ltCacheSize)); |
301 SkImageFilter::Context filterContext(totMat, clipBounds, cache); | 301 SkImageFilter::Context filterContext(totMat, clipBounds, cache); |
302 | 302 |
303 SkImageFilter::DeviceProxy proxy(device); | 303 SkImageFilter::DeviceProxy proxy(device); |
304 | 304 |
305 // TODO: should the layer hoister store stand alone layers as SkSpecialImage
s internally? | 305 // TODO: should the layer hoister store stand alone layers as SkSpecialImage
s internally? |
306 const SkIRect subset = SkIRect::MakeWH(layer->texture()->width(), layer->tex
ture()->height()); | 306 const SkIRect subset = SkIRect::MakeWH(layer->texture()->width(), layer->tex
ture()->height()); |
307 sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromGpu(&proxy, subset, | 307 sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromGpu(&proxy, subset, |
308 kNeedNewImageUniqueID_
SpecialImage, | 308 kNeedNewImageUniqueID_
SpecialImage, |
309 layer->texture())); | 309 layer->texture(), |
| 310 &device->surfaceProps(
))); |
310 | 311 |
311 SkIPoint offset = SkIPoint::Make(0, 0); | 312 SkIPoint offset = SkIPoint::Make(0, 0); |
312 sk_sp<SkSpecialImage> result(layer->filter()->filterImage(img.get(), | 313 sk_sp<SkSpecialImage> result(layer->filter()->filterImage(img.get(), |
313 filterContext, | 314 filterContext, |
314 &offset)); | 315 &offset)); |
315 if (!result) { | 316 if (!result) { |
316 // Filtering failed. Press on with the unfiltered version. | 317 // Filtering failed. Press on with the unfiltered version. |
317 return; | 318 return; |
318 } | 319 } |
319 | 320 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 #if !GR_CACHE_HOISTED_LAYERS | 389 #if !GR_CACHE_HOISTED_LAYERS |
389 | 390 |
390 // This code completely clears out the atlas. It is required when | 391 // This code completely clears out the atlas. It is required when |
391 // caching is disabled so the atlas doesn't fill up and force more | 392 // caching is disabled so the atlas doesn't fill up and force more |
392 // free floating layers | 393 // free floating layers |
393 layerCache->purgeAll(); | 394 layerCache->purgeAll(); |
394 #endif | 395 #endif |
395 | 396 |
396 layerCache->end(); | 397 layerCache->end(); |
397 } | 398 } |
OLD | NEW |