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

Unified Diff: src/gpu/GrLayerHoister.cpp

Issue 533673002: Expose layer hoisting API in GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix No GPU build Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrLayerHoister.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrLayerHoister.cpp
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index 2e42ead8572624ff02e21e8eb271d3dfc36901be..8b0079369d8afd76374bd5dbadf55fc94de66bc2 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -14,14 +14,18 @@
#include "SkSurface.h"
// Return true if any layers are suitable for hoisting
-bool GrLayerHoister::FindLayersToHoist(const SkPicture* topLevelPicture,
+bool GrLayerHoister::FindLayersToHoist(GrContext* context,
+ const SkPicture* topLevelPicture,
const SkRect& query,
- SkTDArray<HoistedLayer>* atlased,
- SkTDArray<HoistedLayer>* nonAtlased,
- SkTDArray<HoistedLayer>* recycled,
- GrLayerCache* layerCache) {
+ SkTDArray<GrHoistedLayer>* atlased,
+ SkTDArray<GrHoistedLayer>* nonAtlased,
+ SkTDArray<GrHoistedLayer>* recycled) {
bool anyHoisted = false;
+ GrLayerCache* layerCache = context->getLayerCache();
+
+ layerCache->processDeletedPictures();
+
SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey();
const SkPicture::AccelData* topLevelData = topLevelPicture->EXPERIMENTAL_getAccelData(key);
@@ -102,7 +106,7 @@ bool GrLayerHoister::FindLayersToHoist(const SkPicture* topLevelPicture,
continue;
}
- HoistedLayer* hl;
+ GrHoistedLayer* hl;
if (needsRendering) {
if (layer->isAtlased()) {
@@ -130,7 +134,7 @@ static void wrap_texture(GrTexture* texture, int width, int height, SkBitmap* re
result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref();
}
-static void convert_layers_to_replacements(const SkTDArray<GrLayerHoister::HoistedLayer>& layers,
+static void convert_layers_to_replacements(const SkTDArray<GrHoistedLayer>& layers,
GrReplacements* replacements) {
// TODO: just replace GrReplacements::ReplacementInfo with GrCachedLayer?
for (int i = 0; i < layers.count(); ++i) {
@@ -164,9 +168,9 @@ static void convert_layers_to_replacements(const SkTDArray<GrLayerHoister::Hoist
}
}
-void GrLayerHoister::DrawLayers(const SkTDArray<HoistedLayer>& atlased,
- const SkTDArray<HoistedLayer>& nonAtlased,
- const SkTDArray<HoistedLayer>& recycled,
+void GrLayerHoister::DrawLayers(const SkTDArray<GrHoistedLayer>& atlased,
+ const SkTDArray<GrHoistedLayer>& nonAtlased,
+ const SkTDArray<GrHoistedLayer>& recycled,
GrReplacements* replacements) {
// Render the atlased layers that require it
if (atlased.count() > 0) {
@@ -276,10 +280,11 @@ static void unlock_layer_in_cache(GrLayerCache* layerCache,
#endif
}
-void GrLayerHoister::UnlockLayers(GrLayerCache* layerCache,
- const SkTDArray<HoistedLayer>& atlased,
- const SkTDArray<HoistedLayer>& nonAtlased,
- const SkTDArray<HoistedLayer>& recycled) {
+void GrLayerHoister::UnlockLayers(GrContext* context,
+ const SkTDArray<GrHoistedLayer>& atlased,
+ const SkTDArray<GrHoistedLayer>& nonAtlased,
+ const SkTDArray<GrHoistedLayer>& recycled) {
+ GrLayerCache* layerCache = context->getLayerCache();
for (int i = 0; i < atlased.count(); ++i) {
unlock_layer_in_cache(layerCache, atlased[i].fPicture, atlased[i].fLayer);
« no previous file with comments | « src/gpu/GrLayerHoister.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698