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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 310 |
311 SkIPoint offset = SkIPoint::Make(0, 0); | 311 SkIPoint offset = SkIPoint::Make(0, 0); |
312 SkAutoTUnref<SkSpecialImage> result(layer->filter()->filterImage(img.get(), | 312 sk_sp<SkSpecialImage> result(layer->filter()->filterImage(img.get(), |
313 filterConte
xt, | 313 filterContext, |
314 &offset)); | 314 &offset)); |
315 if (!result) { | 315 if (!result) { |
316 // Filtering failed. Press on with the unfiltered version. | 316 // Filtering failed. Press on with the unfiltered version. |
317 return; | 317 return; |
318 } | 318 } |
319 | 319 |
320 SkASSERT(result->peekTexture()); | 320 SkASSERT(result->peekTexture()); |
321 layer->setTexture(result->peekTexture(), result->subset(), false); | 321 layer->setTexture(result->peekTexture(), result->subset(), false); |
322 layer->setOffset(offset); | 322 layer->setOffset(offset); |
323 } | 323 } |
324 | 324 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 #if !GR_CACHE_HOISTED_LAYERS | 388 #if !GR_CACHE_HOISTED_LAYERS |
389 | 389 |
390 // This code completely clears out the atlas. It is required when | 390 // 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 | 391 // caching is disabled so the atlas doesn't fill up and force more |
392 // free floating layers | 392 // free floating layers |
393 layerCache->purgeAll(); | 393 layerCache->purgeAll(); |
394 #endif | 394 #endif |
395 | 395 |
396 layerCache->end(); | 396 layerCache->end(); |
397 } | 397 } |
OLD | NEW |