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

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

Issue 1406013006: Update Layer Hoisting to store its atlas texture in the resource cache (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Android bug Created 5 years, 1 month 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/gpu/GrTest.cpp ('k') | tests/GpuLayerCacheTest.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 2011 Google Inc. 2 * Copyright 2011 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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 2010 matching lines...) Expand 10 before | Expand all | Expand 10 after
2021 2021
2022 SkIRect iBounds; 2022 SkIRect iBounds;
2023 if (!mainCanvas->getClipDeviceBounds(&iBounds)) { 2023 if (!mainCanvas->getClipDeviceBounds(&iBounds)) {
2024 return false; 2024 return false;
2025 } 2025 }
2026 2026
2027 SkRect clipBounds = SkRect::Make(iBounds); 2027 SkRect clipBounds = SkRect::Make(iBounds);
2028 2028
2029 SkMatrix initialMatrix = mainCanvas->getTotalMatrix(); 2029 SkMatrix initialMatrix = mainCanvas->getTotalMatrix();
2030 2030
2031 GrLayerHoister::Begin(fContext);
2032
2031 GrLayerHoister::FindLayersToAtlas(fContext, mainPicture, 2033 GrLayerHoister::FindLayersToAtlas(fContext, mainPicture,
2032 initialMatrix, 2034 initialMatrix,
2033 clipBounds, 2035 clipBounds,
2034 &atlasedNeedRendering, &atlasedRecycled, 2036 &atlasedNeedRendering, &atlasedRecycled,
2035 fRenderTarget->numColorSamples()); 2037 fRenderTarget->numColorSamples());
2036 2038
2037 GrLayerHoister::DrawLayersToAtlas(fContext, atlasedNeedRendering); 2039 GrLayerHoister::DrawLayersToAtlas(fContext, atlasedNeedRendering);
2038 2040
2039 SkTDArray<GrHoistedLayer> needRendering, recycled; 2041 SkTDArray<GrHoistedLayer> needRendering, recycled;
2040 2042
2041 SkAutoCanvasMatrixPaint acmp(mainCanvas, matrix, paint, mainPicture->cullRec t()); 2043 SkAutoCanvasMatrixPaint acmp(mainCanvas, matrix, paint, mainPicture->cullRec t());
2042 2044
2043 GrLayerHoister::FindLayersToHoist(fContext, mainPicture, 2045 GrLayerHoister::FindLayersToHoist(fContext, mainPicture,
2044 initialMatrix, 2046 initialMatrix,
2045 clipBounds, 2047 clipBounds,
2046 &needRendering, &recycled, 2048 &needRendering, &recycled,
2047 fRenderTarget->numColorSamples()); 2049 fRenderTarget->numColorSamples());
2048 2050
2049 GrLayerHoister::DrawLayers(fContext, needRendering); 2051 GrLayerHoister::DrawLayers(fContext, needRendering);
2050 2052
2051 // Render the entire picture using new layers 2053 // Render the entire picture using new layers
2052 GrRecordReplaceDraw(mainPicture, mainCanvas, fContext->getLayerCache(), 2054 GrRecordReplaceDraw(mainPicture, mainCanvas, fContext->getLayerCache(),
2053 initialMatrix, nullptr); 2055 initialMatrix, nullptr);
2054 2056
2055 GrLayerHoister::UnlockLayers(fContext, needRendering); 2057 GrLayerHoister::UnlockLayers(fContext, needRendering);
2056 GrLayerHoister::UnlockLayers(fContext, recycled); 2058 GrLayerHoister::UnlockLayers(fContext, recycled);
2057 GrLayerHoister::UnlockLayers(fContext, atlasedNeedRendering); 2059 GrLayerHoister::UnlockLayers(fContext, atlasedNeedRendering);
2058 GrLayerHoister::UnlockLayers(fContext, atlasedRecycled); 2060 GrLayerHoister::UnlockLayers(fContext, atlasedRecycled);
2061 GrLayerHoister::End(fContext);
2059 2062
2060 return true; 2063 return true;
2061 #else 2064 #else
2062 return false; 2065 return false;
2063 #endif 2066 #endif
2064 } 2067 }
2065 2068
2066 SkImageFilter::Cache* SkGpuDevice::NewImageFilterCache() { 2069 SkImageFilter::Cache* SkGpuDevice::NewImageFilterCache() {
2067 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 2070 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
2068 } 2071 }
2069 2072
2070 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 2073 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
2071 // We always return a transient cache, so it is freed after each 2074 // We always return a transient cache, so it is freed after each
2072 // filter traversal. 2075 // filter traversal.
2073 return SkGpuDevice::NewImageFilterCache(); 2076 return SkGpuDevice::NewImageFilterCache();
2074 } 2077 }
2075 2078
2076 #endif 2079 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTest.cpp ('k') | tests/GpuLayerCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698