OLD | NEW |
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 struct GrCachedLayer; | 14 struct GrCachedLayer; |
15 class GrReplacements; | 15 class GrReplacements; |
16 struct SkRect; | 16 struct SkRect; |
17 | 17 |
18 class GrHoistedLayer { | 18 class GrHoistedLayer { |
19 public: | 19 public: |
20 const SkPicture* fPicture; | 20 const SkPicture* fPicture; // the picture that actually contains the layer |
| 21 // (not necessarily the top-most picture) |
21 GrCachedLayer* fLayer; | 22 GrCachedLayer* fLayer; |
22 SkIPoint fOffset; | 23 SkIPoint fOffset; |
| 24 SkMatrix fInitialMat; |
23 SkMatrix fPreMat; | 25 SkMatrix fPreMat; |
24 SkMatrix fLocalMat; | 26 SkMatrix fLocalMat; |
25 }; | 27 }; |
26 | 28 |
27 // This class collects the layer hoisting functionality in one place. | 29 // This class collects the layer hoisting functionality in one place. |
28 // For each picture rendering: | 30 // For each picture rendering: |
29 // FindLayersToHoist should be called once to collect the required layers | 31 // FindLayersToHoist should be called once to collect the required layers |
30 // DrawLayers should be called once to render them | 32 // DrawLayers should be called once to render them |
31 // UnlockLayers should be called once to allow the texture resources to be recy
cled | 33 // UnlockLayers should be called once to allow the texture resources to be recy
cled |
32 class GrLayerHoister { | 34 class GrLayerHoister { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 /** Draw the specified layers into their own individual textures. | 81 /** Draw the specified layers into their own individual textures. |
80 @param context Owner of the layer cache (and thus the layers) | 82 @param context Owner of the layer cache (and thus the layers) |
81 @param layers The layers to be drawn | 83 @param layers The layers to be drawn |
82 */ | 84 */ |
83 static void DrawLayers(GrContext* context, const SkTDArray<GrHoistedLayer>&
layers); | 85 static void DrawLayers(GrContext* context, const SkTDArray<GrHoistedLayer>&
layers); |
84 | 86 |
85 /** Convert all the layers in 'layers' into replacement objects in 'replacem
ents'. | 87 /** Convert all the layers in 'layers' into replacement objects in 'replacem
ents'. |
86 @param layers The hoisted layers | 88 @param layers The hoisted layers |
87 @param replacements Replacement object that will be used for a replaceme
nt draw | 89 @param replacements Replacement object that will be used for a replaceme
nt draw |
88 */ | 90 */ |
89 static void ConvertLayersToReplacements(const SkTDArray<GrHoistedLayer>& lay
ers, | 91 static void ConvertLayersToReplacements(const SkPicture* topLevelPicture, |
| 92 const SkTDArray<GrHoistedLayer>& lay
ers, |
90 GrReplacements* replacements); | 93 GrReplacements* replacements); |
91 | 94 |
92 /** Unlock a group of layers in the layer cache. | 95 /** Unlock a group of layers in the layer cache. |
93 @param context Owner of the layer cache (and thus the layers) | 96 @param context Owner of the layer cache (and thus the layers) |
94 @param layers Unneeded layers in the atlas | 97 @param layers Unneeded layers in the atlas |
95 */ | 98 */ |
96 static void UnlockLayers(GrContext* context, const SkTDArray<GrHoistedLayer>
& layers); | 99 static void UnlockLayers(GrContext* context, const SkTDArray<GrHoistedLayer>
& layers); |
97 | 100 |
98 /** Forceably remove all cached layers and release the atlas. Useful for deb
ugging and timing. | 101 /** Forceably remove all cached layers and release the atlas. Useful for deb
ugging and timing. |
99 This is only functional when GR_CACHE_HOISTED_LAYERS is set to 1 in GrLa
yerCache.h | 102 This is only functional when GR_CACHE_HOISTED_LAYERS is set to 1 in GrLa
yerCache.h |
100 @param context Owner of the layer cache (and thus the layers) | 103 @param context Owner of the layer cache (and thus the layers) |
101 */ | 104 */ |
102 static void PurgeCache(GrContext* context); | 105 static void PurgeCache(GrContext* context); |
103 }; | 106 }; |
104 | 107 |
105 #endif | 108 #endif |
OLD | NEW |