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

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

Issue 1812023002: Switch SkSpecialImage & SkSpecialSurface classes over to smart pointers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix build Created 4 years, 9 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/SkPaintImageFilter.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 "GrLayerCache.h" 8 #include "GrLayerCache.h"
9 #include "GrLayerHoister.h" 9 #include "GrLayerHoister.h"
10 #include "GrRecordReplaceDraw.h" 10 #include "GrRecordReplaceDraw.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 297
298 // This cache is transient, and is freed (along with all its contained 298 // This cache is transient, and is freed (along with all its contained
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 SkAutoTUnref<SkSpecialImage> img(SkSpecialImage::NewFromGpu(&proxy, subset, 307 sk_sp<SkSpecialImage> img(SkSpecialImage::MakeFromGpu(&proxy, subset,
308 kNeedNewImageUni queID_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, 312 SkAutoTUnref<SkSpecialImage> result(layer->filter()->filterImage(img.get(),
313 filterConte xt, 313 filterConte xt,
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);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « src/effects/SkPaintImageFilter.cpp ('k') | tests/ImageFilterCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698