Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: src/gpu/GrLayerHoister.cpp

Issue 1913743002: Add another dollop of sk_sp to SkSpecialImage and SkSpecialSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rm std::move Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | tests/ImageFilterCacheTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "GrContext.h" 8 #include "GrContext.h"
9 #include "GrLayerCache.h" 9 #include "GrLayerCache.h"
10 #include "GrLayerHoister.h" 10 #include "GrLayerHoister.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 296
297 // This cache is transient, and is freed (along with all its contained 297 // This cache is transient, and is freed (along with all its contained
298 // textures) when it goes out of scope. 298 // textures) when it goes out of scope.
299 SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefau ltCacheSize)); 299 SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefau ltCacheSize));
300 SkImageFilter::Context filterContext(totMat, clipBounds, cache); 300 SkImageFilter::Context filterContext(totMat, clipBounds, cache);
301 301
302 // TODO: should the layer hoister store stand alone layers as SkSpecialImage s internally? 302 // TODO: should the layer hoister store stand alone layers as SkSpecialImage s internally?
303 const SkIRect subset = SkIRect::MakeWH(layer->texture()->width(), layer->tex ture()->height()); 303 const SkIRect subset = SkIRect::MakeWH(layer->texture()->width(), layer->tex ture()->height());
304 sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromGpu(subset, 304 sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromGpu(subset,
305 kNeedNewImageUniqueID_ SpecialImage, 305 kNeedNewImageUniqueID_ SpecialImage,
306 layer->texture(), 306 sk_ref_sp(layer->textu re()),
307 props)); 307 props));
308 308
309 SkIPoint offset = SkIPoint::Make(0, 0); 309 SkIPoint offset = SkIPoint::Make(0, 0);
310 sk_sp<SkSpecialImage> result(layer->filter()->filterImage(img.get(), 310 sk_sp<SkSpecialImage> result(layer->filter()->filterImage(img.get(),
311 filterContext, 311 filterContext,
312 &offset)); 312 &offset));
313 if (!result) { 313 if (!result) {
314 // Filtering failed. Press on with the unfiltered version. 314 // Filtering failed. Press on with the unfiltered version.
315 return; 315 return;
316 } 316 }
317 317
318 SkASSERT(result->isTextureBacked()); 318 SkASSERT(result->isTextureBacked());
319 SkAutoTUnref<GrTexture> texture(result->asTextureRef(context)); 319 sk_sp<GrTexture> texture(result->asTextureRef(context));
320 layer->setTexture(texture, result->subset(), false); 320 layer->setTexture(texture.get(), result->subset(), false);
321 layer->setOffset(offset); 321 layer->setOffset(offset);
322 } 322 }
323 323
324 void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay er>& layers) { 324 void GrLayerHoister::DrawLayers(GrContext* context, const SkTDArray<GrHoistedLay er>& layers) {
325 for (int i = 0; i < layers.count(); ++i) { 325 for (int i = 0; i < layers.count(); ++i) {
326 GrCachedLayer* layer = layers[i].fLayer; 326 GrCachedLayer* layer = layers[i].fLayer;
327 const SkBigPicture* pict = layers[i].fPicture->asSkBigPicture(); 327 const SkBigPicture* pict = layers[i].fPicture->asSkBigPicture();
328 if (!pict) { 328 if (!pict) {
329 // TODO: can we assume / assert this? 329 // TODO: can we assume / assert this?
330 continue; 330 continue;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 #if !GR_CACHE_HOISTED_LAYERS 385 #if !GR_CACHE_HOISTED_LAYERS
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
393 layerCache->end(); 393 layerCache->end();
394 } 394 }
OLDNEW
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | tests/ImageFilterCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698