| 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 struct SkRect; | 16 struct SkRect; |
| 17 | 17 |
| 18 // This class collects the layer hoisting functionality in one place. | 18 // This class collects the layer hoisting functionality in one place. |
| 19 // For each picture rendering: | 19 // For each picture rendering: |
| 20 // FindLayersToHoist should be called once to collect the required layers | 20 // FindLayersToHoist should be called once to collect the required layers |
| 21 // DrawLayers should be called once to render them | 21 // DrawLayers should be called once to render them |
| 22 // UnlockLayers should be called once to allow the texture resources to be recy
cled | 22 // UnlockLayers should be called once to allow the texture resources to be recy
cled |
| 23 class GrLayerHoister { | 23 class GrLayerHoister { |
| 24 public: | 24 public: |
| 25 /** Find the layers in 'gpuData' that need hoisting. | 25 /** Find the layers in 'gpuData' that need hoisting. |
| 26 @param gpuData Acceleration structure containing layer information for
a picture | 26 @param gpuData Acceleration structure containing layer information for
a picture |
| 27 @param ops If a BBH is being used the operations about to be execut
ed; NULL otherwise. | |
| 28 @param query The rectangle that is about to be drawn. | 27 @param query The rectangle that is about to be drawn. |
| 29 @param pullForward A gpuData->numSaveLayers -sized Boolean array indicat
ing | 28 @param pullForward A gpuData->numSaveLayers -sized Boolean array indicat
ing |
| 30 which layers are to be hoisted | 29 which layers are to be hoisted |
| 31 Return true if any layers are suitable for hoisting; false otherwise | 30 Return true if any layers are suitable for hoisting; false otherwise |
| 32 */ | 31 */ |
| 33 static bool FindLayersToHoist(const GrAccelData *gpuData, | 32 static bool FindLayersToHoist(const GrAccelData *gpuData, |
| 34 const SkPicture::OperationList* ops, | |
| 35 const SkRect& query, | 33 const SkRect& query, |
| 36 bool pullForward[]); | 34 bool pullForward[]); |
| 37 | 35 |
| 38 /** Draw the specified layers of 'picture' into either the atlas or free | 36 /** Draw the specified layers of 'picture' into either the atlas or free |
| 39 floating textures. | 37 floating textures. |
| 40 @param picture The picture containing the layers | 38 @param picture The picture containing the layers |
| 41 @param atlased The layers to be drawn into the atlas | 39 @param atlased The layers to be drawn into the atlas |
| 42 @param nonAtlased The layers to be drawn into their own textures | 40 @param nonAtlased The layers to be drawn into their own textures |
| 43 */ | 41 */ |
| 44 static void DrawLayers(const SkPicture* picture, | 42 static void DrawLayers(const SkPicture* picture, |
| 45 const SkTDArray<GrCachedLayer*>& atlased, | 43 const SkTDArray<GrCachedLayer*>& atlased, |
| 46 const SkTDArray<GrCachedLayer*>& nonAtlased); | 44 const SkTDArray<GrCachedLayer*>& nonAtlased); |
| 47 | 45 |
| 48 /** Unlock all the layers associated with picture in the layer cache. | 46 /** Unlock all the layers associated with picture in the layer cache. |
| 49 @param layerCache holder of the locked layers | 47 @param layerCache holder of the locked layers |
| 50 @pmara picture the source of the locked layers | 48 @pmara picture the source of the locked layers |
| 51 */ | 49 */ |
| 52 static void UnlockLayers(GrLayerCache* layerCache, const SkPicture* picture)
; | 50 static void UnlockLayers(GrLayerCache* layerCache, const SkPicture* picture)
; |
| 53 }; | 51 }; |
| 54 | 52 |
| 55 #endif | 53 #endif |
| OLD | NEW |