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

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

Issue 657383004: Alter layer hoisting to only hoist layers for one canvas at a time (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix noGPU build Created 6 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/GrLayerCache.cpp ('k') | src/gpu/GrLayerHoister.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 #ifndef GrLayerHoister_DEFINED 8 #ifndef GrLayerHoister_DEFINED
9 #define GrLayerHoister_DEFINED 9 #define GrLayerHoister_DEFINED
10 10
(...skipping 15 matching lines...) Expand all
26 }; 26 };
27 27
28 // This class collects the layer hoisting functionality in one place. 28 // This class collects the layer hoisting functionality in one place.
29 // For each picture rendering: 29 // For each picture rendering:
30 // FindLayersToHoist should be called once to collect the required layers 30 // FindLayersToHoist should be called once to collect the required layers
31 // DrawLayers should be called once to render them 31 // DrawLayers should be called once to render them
32 // UnlockLayers should be called once to allow the texture resources to be recy cled 32 // UnlockLayers should be called once to allow the texture resources to be recy cled
33 class GrLayerHoister { 33 class GrLayerHoister {
34 public: 34 public:
35 35
36 /** Find the layers in 'topLevelPicture' that can be atlased. Note that the discovered
37 layers can be inside nested sub-pictures.
38 @param context Owner of the layer cache (the source of new layers)
39 @param topLevelPicture The top-level picture that is about to be rendere d
40 @param query The rectangle that is about to be drawn.
41 @param atlasedNeedRendering Out parameter storing the layers that
42 should be hoisted to the atlas
43 @param recycled Out parameter storing layers that are atlased but do not need rendering
44 */
45 static void FindLayersToAtlas(GrContext* context,
46 const SkPicture* topLevelPicture,
47 const SkRect& query,
48 SkTDArray<GrHoistedLayer>* atlasedNeedRenderin g,
49 SkTDArray<GrHoistedLayer>* recycled);
50
36 /** Find the layers in 'topLevelPicture' that need hoisting. Note that the d iscovered 51 /** Find the layers in 'topLevelPicture' that need hoisting. Note that the d iscovered
37 layers can be inside nested sub-pictures. 52 layers can be inside nested sub-pictures.
38 @param context Owner of the layer cache (the source of new layers) 53 @param context Owner of the layer cache (the source of new layers)
39 @param topLevelPicture The top-level picture that is about to be rendere d 54 @param topLevelPicture The top-level picture that is about to be rendere d
40 @param query The rectangle that is about to be drawn. 55 @param query The rectangle that is about to be drawn.
41 @param atlased Out parameter storing the layers that should be hoist ed to the atlas 56 @param needRendering Out parameter storing the layers that need renderin g.
42 @param nonAtlased Out parameter storing the layers that should be hoist ed stand alone 57 This should never include atlased layers.
43 @param recycled Out parameter storing layers that need hoisting but n ot rendering 58 @param recycled Out parameter storing layers that need hoisting but n ot rendering
44 Return true if any layers are suitable for hoisting; false otherwise
45 */ 59 */
46 static bool FindLayersToHoist(GrContext* context, 60 static void FindLayersToHoist(GrContext* context,
47 const SkPicture* topLevelPicture, 61 const SkPicture* topLevelPicture,
48 const SkRect& query, 62 const SkRect& query,
49 SkTDArray<GrHoistedLayer>* atlased, 63 SkTDArray<GrHoistedLayer>* needRendering,
50 SkTDArray<GrHoistedLayer>* nonAtlased,
51 SkTDArray<GrHoistedLayer>* recycled); 64 SkTDArray<GrHoistedLayer>* recycled);
52 65
53 /** Draw the specified layers into either the atlas or free floating texture s. 66 /** Draw the specified layers into the atlas.
54 @param context Owner of the layer cache (and thus the layers) 67 @param context Owner of the layer cache (and thus the layers)
55 @param atlased The layers to be drawn into the atlas 68 @param layers The layers to be drawn into the atlas
56 @param nonAtlased The layers to be drawn into their own textures
57 @param recycled Layers that don't need rendering but do need to go i nto the
58 replacements object
59 @param replacements The replacement structure to fill in with the render ed layer info
60 */ 69 */
61 static void DrawLayers(GrContext* context, 70 static void DrawLayersToAtlas(GrContext* context, const SkTDArray<GrHoistedL ayer>& layers);
62 const SkTDArray<GrHoistedLayer>& atlased,
63 const SkTDArray<GrHoistedLayer>& nonAtlased,
64 const SkTDArray<GrHoistedLayer>& recycled,
65 GrReplacements* replacements);
66 71
67 /** Unlock unneeded layers in the layer cache. 72 /** Draw the specified layers into their own individual textures.
73 @param context Owner of the layer cache (and thus the layers)
74 @param layers The layers to be drawn
75 */
76 static void DrawLayers(GrContext* context, const SkTDArray<GrHoistedLayer>& layers);
77
78 /** Convert all the layers in 'layers' into replacement objects in 'replacem ents'.
79 @param layers The hoisted layers
80 @param replacements Replacement object that will be used for a replaceme nt draw
81 */
82 static void ConvertLayersToReplacements(const SkTDArray<GrHoistedLayer>& lay ers,
83 GrReplacements* replacements);
84
85 /** Unlock a group of layers in the layer cache.
68 @param context Owner of the layer cache (and thus the layers) 86 @param context Owner of the layer cache (and thus the layers)
69 @param atlased Unneeded layers in the atlas 87 @param layers Unneeded layers in the atlas
70 @param nonAtlased Unneeded layers in their own textures
71 @param recycled Unneeded layers that did not require rendering
72 */ 88 */
73 static void UnlockLayers(GrContext* context, 89 static void UnlockLayers(GrContext* context, const SkTDArray<GrHoistedLayer> & layers);
74 const SkTDArray<GrHoistedLayer>& atlased,
75 const SkTDArray<GrHoistedLayer>& nonAtlased,
76 const SkTDArray<GrHoistedLayer>& recycled);
77 }; 90 };
78 91
79 #endif 92 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrLayerCache.cpp ('k') | src/gpu/GrLayerHoister.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698