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

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

Issue 1172693002: remove subclassing from ImageFilter::Proxy (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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
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"
11 11
12 #include "SkBigPicture.h" 12 #include "SkBigPicture.h"
13 #include "SkCanvas.h" 13 #include "SkCanvas.h"
14 #include "SkDeviceImageFilterProxy.h"
15 #include "SkDeviceProperties.h" 14 #include "SkDeviceProperties.h"
16 #include "SkGpuDevice.h" 15 #include "SkGpuDevice.h"
17 #include "SkGrPixelRef.h" 16 #include "SkGrPixelRef.h"
18 #include "SkLayerInfo.h" 17 #include "SkLayerInfo.h"
19 #include "SkRecordDraw.h" 18 #include "SkRecordDraw.h"
20 #include "SkSurface.h" 19 #include "SkSurface.h"
21 #include "SkSurface_Gpu.h" 20 #include "SkSurface_Gpu.h"
22 21
23 // Create the layer information for the hoisted layer and secure the 22 // Create the layer information for the hoisted layer and secure the
24 // required texture/render target resources. 23 // required texture/render target resources.
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 totMat.postTranslate(-SkIntToScalar(filterOffset.fX), -SkIntToScalar(filterO ffset.fY)); 307 totMat.postTranslate(-SkIntToScalar(filterOffset.fX), -SkIntToScalar(filterO ffset.fY));
309 308
310 SkASSERT(0 == layer->rect().fLeft && 0 == layer->rect().fTop); 309 SkASSERT(0 == layer->rect().fLeft && 0 == layer->rect().fTop);
311 SkIRect clipBounds = layer->rect(); 310 SkIRect clipBounds = layer->rect();
312 311
313 // This cache is transient, and is freed (along with all its contained 312 // This cache is transient, and is freed (along with all its contained
314 // textures) when it goes out of scope. 313 // textures) when it goes out of scope.
315 SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefau ltCacheSize)); 314 SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(kDefau ltCacheSize));
316 SkImageFilter::Context filterContext(totMat, clipBounds, cache); 315 SkImageFilter::Context filterContext(totMat, clipBounds, cache);
317 316
318 SkDeviceImageFilterProxy proxy(device, SkSurfaceProps(0, kUnknown_SkPixelGeo metry)); 317 SkImageFilter::Proxy proxy(device, SkSurfaceProps(0, kUnknown_SkPixelGeometr y));
319 const SkBitmap src = wrap_texture(layer->texture()); 318 const SkBitmap src = wrap_texture(layer->texture());
320 319
321 if (!layer->filter()->filterImage(&proxy, src, filterContext, &filteredBitma p, &offset)) { 320 if (!layer->filter()->filterImage(&proxy, src, filterContext, &filteredBitma p, &offset)) {
322 // Filtering failed. Press on with the unfiltered version. 321 // Filtering failed. Press on with the unfiltered version.
323 return; 322 return;
324 } 323 }
325 324
326 SkIRect newRect = SkIRect::MakeWH(filteredBitmap.width(), filteredBitmap.hei ght()); 325 SkIRect newRect = SkIRect::MakeWH(filteredBitmap.width(), filteredBitmap.hei ght());
327 layer->setTexture(filteredBitmap.getTexture(), newRect); 326 layer->setTexture(filteredBitmap.getTexture(), newRect);
328 layer->setOffset(offset); 327 layer->setOffset(offset);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 void GrLayerHoister::PurgeCache(GrContext* context) { 384 void GrLayerHoister::PurgeCache(GrContext* context) {
386 #if !GR_CACHE_HOISTED_LAYERS 385 #if !GR_CACHE_HOISTED_LAYERS
387 GrLayerCache* layerCache = context->getLayerCache(); 386 GrLayerCache* layerCache = context->getLayerCache();
388 387
389 // This code completely clears out the atlas. It is required when 388 // This code completely clears out the atlas. It is required when
390 // caching is disabled so the atlas doesn't fill up and force more 389 // caching is disabled so the atlas doesn't fill up and force more
391 // free floating layers 390 // free floating layers
392 layerCache->purgeAll(); 391 layerCache->purgeAll();
393 #endif 392 #endif
394 } 393 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698