| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // FindLayersToHoist should be called once to collect the required layers | 29 // FindLayersToHoist should be called once to collect the required layers |
| 30 // DrawLayers should be called once to render them | 30 // DrawLayers should be called once to render them |
| 31 // UnlockLayers should be called once to allow the texture resources to be recy
cled | 31 // UnlockLayers should be called once to allow the texture resources to be recy
cled |
| 32 class GrLayerHoister { | 32 class GrLayerHoister { |
| 33 public: | 33 public: |
| 34 | 34 |
| 35 /** Find the layers in 'topLevelPicture' that can be atlased. Note that the
discovered | 35 /** Find the layers in 'topLevelPicture' that can be atlased. Note that the
discovered |
| 36 layers can be inside nested sub-pictures. | 36 layers can be inside nested sub-pictures. |
| 37 @param context Owner of the layer cache (the source of new layers) | 37 @param context Owner of the layer cache (the source of new layers) |
| 38 @param topLevelPicture The top-level picture that is about to be rendere
d | 38 @param topLevelPicture The top-level picture that is about to be rendere
d |
| 39 @param initialMat The CTM of the canvas into which the layers will be d
rawn |
| 39 @param query The rectangle that is about to be drawn. | 40 @param query The rectangle that is about to be drawn. |
| 40 @param atlasedNeedRendering Out parameter storing the layers that | 41 @param atlasedNeedRendering Out parameter storing the layers that |
| 41 should be hoisted to the atlas | 42 should be hoisted to the atlas |
| 42 @param recycled Out parameter storing layers that are atlased but do
not need rendering | 43 @param recycled Out parameter storing layers that are atlased but do
not need rendering |
| 43 @param numSamples The number if MSAA samples required | 44 @param numSamples The number if MSAA samples required |
| 44 */ | 45 */ |
| 45 static void FindLayersToAtlas(GrContext* context, | 46 static void FindLayersToAtlas(GrContext* context, |
| 46 const SkPicture* topLevelPicture, | 47 const SkPicture* topLevelPicture, |
| 48 const SkMatrix& initialMat, |
| 47 const SkRect& query, | 49 const SkRect& query, |
| 48 SkTDArray<GrHoistedLayer>* atlasedNeedRenderin
g, | 50 SkTDArray<GrHoistedLayer>* atlasedNeedRenderin
g, |
| 49 SkTDArray<GrHoistedLayer>* recycled, | 51 SkTDArray<GrHoistedLayer>* recycled, |
| 50 int numSamples); | 52 int numSamples); |
| 51 | 53 |
| 52 /** Find the layers in 'topLevelPicture' that need hoisting. Note that the d
iscovered | 54 /** Find the layers in 'topLevelPicture' that need hoisting. Note that the d
iscovered |
| 53 layers can be inside nested sub-pictures. | 55 layers can be inside nested sub-pictures. |
| 54 @param context Owner of the layer cache (the source of new layers) | 56 @param context Owner of the layer cache (the source of new layers) |
| 55 @param topLevelPicture The top-level picture that is about to be rendere
d | 57 @param topLevelPicture The top-level picture that is about to be rendere
d |
| 58 @param initialMat The CTM of the canvas into which the layers will be d
rawn |
| 56 @param query The rectangle that is about to be drawn. | 59 @param query The rectangle that is about to be drawn. |
| 57 @param needRendering Out parameter storing the layers that need renderin
g. | 60 @param needRendering Out parameter storing the layers that need renderin
g. |
| 58 This should never include atlased layers. | 61 This should never include atlased layers. |
| 59 @param recycled Out parameter storing layers that need hoisting but n
ot rendering | 62 @param recycled Out parameter storing layers that need hoisting but n
ot rendering |
| 60 @param numSamples The number if MSAA samples required | 63 @param numSamples The number if MSAA samples required |
| 61 */ | 64 */ |
| 62 static void FindLayersToHoist(GrContext* context, | 65 static void FindLayersToHoist(GrContext* context, |
| 63 const SkPicture* topLevelPicture, | 66 const SkPicture* topLevelPicture, |
| 67 const SkMatrix& initialMat, |
| 64 const SkRect& query, | 68 const SkRect& query, |
| 65 SkTDArray<GrHoistedLayer>* needRendering, | 69 SkTDArray<GrHoistedLayer>* needRendering, |
| 66 SkTDArray<GrHoistedLayer>* recycled, | 70 SkTDArray<GrHoistedLayer>* recycled, |
| 67 int numSamples); | 71 int numSamples); |
| 68 | 72 |
| 69 /** Draw the specified layers into the atlas. | 73 /** Draw the specified layers into the atlas. |
| 70 @param context Owner of the layer cache (and thus the layers) | 74 @param context Owner of the layer cache (and thus the layers) |
| 71 @param layers The layers to be drawn into the atlas | 75 @param layers The layers to be drawn into the atlas |
| 72 */ | 76 */ |
| 73 static void DrawLayersToAtlas(GrContext* context, const SkTDArray<GrHoistedL
ayer>& layers); | 77 static void DrawLayersToAtlas(GrContext* context, const SkTDArray<GrHoistedL
ayer>& layers); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 92 static void UnlockLayers(GrContext* context, const SkTDArray<GrHoistedLayer>
& layers); | 96 static void UnlockLayers(GrContext* context, const SkTDArray<GrHoistedLayer>
& layers); |
| 93 | 97 |
| 94 /** Forceably remove all cached layers and release the atlas. Useful for deb
ugging and timing. | 98 /** Forceably remove all cached layers and release the atlas. Useful for deb
ugging and timing. |
| 95 This is only functional when GR_CACHE_HOISTED_LAYERS is set to 1 in GrLa
yerCache.h | 99 This is only functional when GR_CACHE_HOISTED_LAYERS is set to 1 in GrLa
yerCache.h |
| 96 @param context Owner of the layer cache (and thus the layers) | 100 @param context Owner of the layer cache (and thus the layers) |
| 97 */ | 101 */ |
| 98 static void PurgeCache(GrContext* context); | 102 static void PurgeCache(GrContext* context); |
| 99 }; | 103 }; |
| 100 | 104 |
| 101 #endif | 105 #endif |
| OLD | NEW |