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

Unified Diff: src/gpu/GrLayerHoister.h

Issue 531733003: Reorganize Layer Hoisting code (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review issues Created 6 years, 3 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 | « include/gpu/SkGpuDevice.h ('k') | src/gpu/GrLayerHoister.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrLayerHoister.h
diff --git a/src/gpu/GrLayerHoister.h b/src/gpu/GrLayerHoister.h
new file mode 100644
index 0000000000000000000000000000000000000000..25202ce3458a0750e547f961d0a8f5ab93a163da
--- /dev/null
+++ b/src/gpu/GrLayerHoister.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrLayerHoister_DEFINED
+#define GrLayerHoister_DEFINED
+
+#include "SkPicture.h"
+#include "SkTDArray.h"
+
+class GrAccelData;
+struct GrCachedLayer;
+struct SkRect;
+
+// This class collects the layer hoisting functionality in one place.
+// For each picture rendering:
+// FindLayersToHoist should be called once to collect the required layers
+// DrawLayers should be called once to render them
+// UnlockLayers should be called once to allow the texture resources to be recycled
+class GrLayerHoister {
+public:
+ /** Find the layers in 'gpuData' that need hoisting.
+ @param gpuData Acceleration structure containing layer information for a picture
+ @param ops If a BBH is being used the operations about to be executed; NULL otherwise.
+ @param query The rectangle that is about to be drawn.
+ @param pullForward A gpuData->numSaveLayers -sized Boolean array indicating
+ which layers are to be hoisted
+ Return true if any layers are suitable for hoisting; false otherwise
+ */
+ static bool FindLayersToHoist(const GrAccelData *gpuData,
+ const SkPicture::OperationList* ops,
+ const SkRect& query,
+ bool pullForward[]);
+
+ /** Draw the specified layers of 'picture' into either the atlas or free
+ floating textures.
+ @param picture The picture containing the layers
+ @param atlased The layers to be drawn into the atlas
+ @param nonAtlased The layers to be drawn into their own textures
+ */
+ static void DrawLayers(const SkPicture* picture,
+ const SkTDArray<GrCachedLayer*>& atlased,
+ const SkTDArray<GrCachedLayer*>& nonAtlased);
+
+ /** Unlock all the layers associated with picture in the layer cache.
+ @param layerCache holder of the locked layers
+ @pmara picture the source of the locked layers
+ */
+ static void UnlockLayers(GrLayerCache* layerCache, const SkPicture* picture);
+};
+
+#endif
« no previous file with comments | « include/gpu/SkGpuDevice.h ('k') | src/gpu/GrLayerHoister.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698