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 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 struct HoistedLayer { | 26 struct HoistedLayer { |
27 const SkPicture* fPicture; | 27 const SkPicture* fPicture; |
28 GrCachedLayer* fLayer; | 28 GrCachedLayer* fLayer; |
| 29 SkIPoint fOffset; |
| 30 SkMatrix fCTM; |
29 }; | 31 }; |
30 | 32 |
31 /** Find the layers in 'topLevelPicture' that need hoisting. Note that the d
iscovered | 33 /** Find the layers in 'topLevelPicture' that need hoisting. Note that the d
iscovered |
32 layers can be inside nested sub-pictures. | 34 layers can be inside nested sub-pictures. |
33 @param topLevelPicture The top-level picture that is about to be rendere
d | 35 @param topLevelPicture The top-level picture that is about to be rendere
d |
34 @param query The rectangle that is about to be drawn. | 36 @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 | 37 @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 | 38 @param nonAtlased Out parameter storing the layers that should be hoist
ed stand alone |
37 @param layerCache The source of new layers | 39 @param layerCache The source of new layers |
38 Return true if any layers are suitable for hoisting; false otherwise | 40 Return true if any layers are suitable for hoisting; false otherwise |
(...skipping 17 matching lines...) Expand all Loading... |
56 @param layerCache holder of the locked layers | 58 @param layerCache holder of the locked layers |
57 @param atlased Unneeded layers in the atlas | 59 @param atlased Unneeded layers in the atlas |
58 @param nonAtlased Unneeded layers in their own textures | 60 @param nonAtlased Unneeded layers in their own textures |
59 */ | 61 */ |
60 static void UnlockLayers(GrLayerCache* layerCache, | 62 static void UnlockLayers(GrLayerCache* layerCache, |
61 const SkTDArray<HoistedLayer>& atlased, | 63 const SkTDArray<HoistedLayer>& atlased, |
62 const SkTDArray<HoistedLayer>& nonAtlased); | 64 const SkTDArray<HoistedLayer>& nonAtlased); |
63 }; | 65 }; |
64 | 66 |
65 #endif | 67 #endif |
OLD | NEW |