| 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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 311 |
| 312 SkIPoint offset = SkIPoint::Make(0, 0); | 312 SkIPoint offset = SkIPoint::Make(0, 0); |
| 313 sk_sp<SkSpecialImage> result(layer->filter()->filterImage(img.get(), | 313 sk_sp<SkSpecialImage> result(layer->filter()->filterImage(img.get(), |
| 314 filterContext, | 314 filterContext, |
| 315 &offset)); | 315 &offset)); |
| 316 if (!result) { | 316 if (!result) { |
| 317 // Filtering failed. Press on with the unfiltered version. | 317 // Filtering failed. Press on with the unfiltered version. |
| 318 return; | 318 return; |
| 319 } | 319 } |
| 320 | 320 |
| 321 SkASSERT(result->peekTexture()); | 321 SkASSERT(result->isTextureBacked()); |
| 322 layer->setTexture(result->peekTexture(), result->subset(), false); | 322 SkAutoTUnref<GrTexture> texture(result->asTextureRef(context)); |
| 323 layer->setTexture(texture, result->subset(), false); |
| 323 layer->setOffset(offset); | 324 layer->setOffset(offset); |
| 324 } | 325 } |
| 325 | 326 |
| 326 void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay
er>& layers) { | 327 void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay
er>& layers) { |
| 327 for (int i = 0; i < layers.count(); ++i) { | 328 for (int i = 0; i < layers.count(); ++i) { |
| 328 GrCachedLayer* layer = layers[i].fLayer; | 329 GrCachedLayer* layer = layers[i].fLayer; |
| 329 const SkBigPicture* pict = layers[i].fPicture->asSkBigPicture(); | 330 const SkBigPicture* pict = layers[i].fPicture->asSkBigPicture(); |
| 330 if (!pict) { | 331 if (!pict) { |
| 331 // TODO: can we assume / assert this? | 332 // TODO: can we assume / assert this? |
| 332 continue; | 333 continue; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 #if !GR_CACHE_HOISTED_LAYERS | 390 #if !GR_CACHE_HOISTED_LAYERS |
| 390 | 391 |
| 391 // This code completely clears out the atlas. It is required when | 392 // This code completely clears out the atlas. It is required when |
| 392 // caching is disabled so the atlas doesn't fill up and force more | 393 // caching is disabled so the atlas doesn't fill up and force more |
| 393 // free floating layers | 394 // free floating layers |
| 394 layerCache->purgeAll(); | 395 layerCache->purgeAll(); |
| 395 #endif | 396 #endif |
| 396 | 397 |
| 397 layerCache->end(); | 398 layerCache->end(); |
| 398 } | 399 } |
| OLD | NEW |