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

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

Issue 595543002: Update layer hoisting code to correctly render sub-picture layers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add cast 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 unified diff | Download patch
« no previous file with comments | « no previous file | 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
11 #include "SkPicture.h" 11 #include "SkPicture.h"
12 #include "SkTDArray.h" 12 #include "SkTDArray.h"
13 13
14 class GrAccelData; 14 class GrAccelData;
15 struct GrCachedLayer; 15 struct GrCachedLayer;
16 class GrReplacements; 16 class GrReplacements;
17 struct SkRect; 17 struct SkRect;
18 18
19 // This class collects the layer hoisting functionality in one place. 19 // This class collects the layer hoisting functionality in one place.
20 // For each picture rendering: 20 // For each picture rendering:
21 // FindLayersToHoist should be called once to collect the required layers 21 // FindLayersToHoist should be called once to collect the required layers
22 // DrawLayers should be called once to render them 22 // DrawLayers should be called once to render them
23 // UnlockLayers should be called once to allow the texture resources to be recy cled 23 // UnlockLayers should be called once to allow the texture resources to be recy cled
24 class GrLayerHoister { 24 class GrLayerHoister {
25 public: 25 public:
26 /** Find the layers in 'gpuData' that need hoisting. 26 struct HoistedLayer {
27 @param gpuData Acceleration structure containing layer information fo r a picture 27 const SkPicture* fPicture;
28 @param query The rectangle that is about to be drawn. 28 GrCachedLayer* fLayer;
29 @param atlased Out parameter storing the layers that should be hoiste d to the atlas 29 };
30 @param nonAtlased Out parameter storing the layers that should be hoiste d stand alone 30
31 /** Find the layers in 'topLevelPicture' that need hoisting. Note that the d iscovered
32 layers can be inside nested sub-pictures.
33 @param topLevelPicture The top-level picture that is about to be rendere d
34 @param query The rectangle that is about to be drawn.
35 @param atlased Out parameter storing the layers that should be hoist ed to the atlas
36 @param nonAtlased Out parameter storing the layers that should be hoist ed stand alone
31 @param layerCache The source of new layers 37 @param layerCache The source of new layers
32 Return true if any layers are suitable for hoisting; false otherwise 38 Return true if any layers are suitable for hoisting; false otherwise
33 */ 39 */
34 static bool FindLayersToHoist(const GrAccelData *gpuData, 40 static bool FindLayersToHoist(const SkPicture* topLevelPicture,
35 const SkRect& query, 41 const SkRect& query,
36 SkTDArray<GrCachedLayer*>* altased, 42 SkTDArray<HoistedLayer>* altased,
37 SkTDArray<GrCachedLayer*>* nonAtlased, 43 SkTDArray<HoistedLayer>* nonAtlased,
38 GrLayerCache* layerCache); 44 GrLayerCache* layerCache);
39 45
40 /** Draw the specified layers of 'picture' into either the atlas or free 46 /** Draw the specified layers into either the atlas or free floating texture s.
41 floating textures.
42 @param picture The picture containing the layers
43 @param atlased The layers to be drawn into the atlas 47 @param atlased The layers to be drawn into the atlas
44 @param nonAtlased The layers to be drawn into their own textures 48 @param nonAtlased The layers to be drawn into their own textures
45 @oaram replacements The replacement structure to fill in with the render ed layer info 49 @oaram replacements The replacement structure to fill in with the render ed layer info
46 */ 50 */
47 static void DrawLayers(const SkPicture* picture, 51 static void DrawLayers(const SkTDArray<HoistedLayer>& atlased,
48 const SkTDArray<GrCachedLayer*>& atlased, 52 const SkTDArray<HoistedLayer>& nonAtlased,
49 const SkTDArray<GrCachedLayer*>& nonAtlased,
50 GrReplacements* replacements); 53 GrReplacements* replacements);
51 54
52 /** Unlock all the layers associated with picture in the layer cache. 55 /** Unlock unneeded layers in the layer cache.
53 @param layerCache holder of the locked layers 56 @param layerCache holder of the locked layers
54 @pmara picture the source of the locked layers 57 @param atlased Unneeded layers in the atlas
58 @param nonAtlased Unneeded layers in their own textures
55 */ 59 */
56 static void UnlockLayers(GrLayerCache* layerCache, const SkPicture* picture) ; 60 static void UnlockLayers(GrLayerCache* layerCache,
61 const SkTDArray<HoistedLayer>& atlased,
62 const SkTDArray<HoistedLayer>& nonAtlased);
57 }; 63 };
58 64
59 #endif 65 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrLayerHoister.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698