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

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

Issue 1950523002: Remove GrLayerHoister (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Forgot to remove some files Created 4 years, 5 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 | « src/gpu/GrLayerCache.cpp ('k') | 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
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef GrLayerHoister_DEFINED
9 #define GrLayerHoister_DEFINED
10
11 #define SK_IGNORE_GPU_LAYER_HOISTING
12
13
14 #include "SkPicture.h"
15 #include "SkTDArray.h"
16
17 #if !defined(SK_IGNORE_GPU_LAYER_HOISTING) && SK_SUPPORT_GPU
18
19 struct GrCachedLayer;
20 class GrReplacements;
21 class SkGpuDevice;
22 struct SkRect;
23
24 class GrHoistedLayer {
25 public:
26 const SkPicture* fPicture; // the picture that actually contains the layer
27 // (not necessarily the top-most picture)
28 GrCachedLayer* fLayer;
29 SkMatrix fInitialMat;
30 SkMatrix fPreMat;
31 SkMatrix fLocalMat;
32 };
33
34 // This class collects the layer hoisting functionality in one place.
35 // For each picture rendering:
36 // FindLayersToHoist should be called once to collect the required layers
37 // DrawLayers should be called once to render them
38 // UnlockLayers should be called once to allow the texture resources to be recy cled
39 class GrLayerHoister {
40 public:
41 /** Attempt to reattach layers that may have been atlased in the past
42 */
43 static void Begin(GrContext* context);
44
45 /** Release cache resources
46 */
47 static void End(GrContext* context);
48
49 /** Find the layers in 'topLevelPicture' that can be atlased. Note that the discovered
50 layers can be inside nested sub-pictures.
51 @param context Owner of the layer cache (the source of new layers)
52 @param topLevelPicture The top-level picture that is about to be rendere d
53 @param initialMat The CTM of the canvas into which the layers will be d rawn
54 @param query The rectangle that is about to be drawn.
55 @param atlasedNeedRendering Out parameter storing the layers that
56 should be hoisted to the atlas
57 @param recycled Out parameter storing layers that are atlased but do not need rendering
58 @param numSamples The number if MSAA samples required
59 */
60 static void FindLayersToAtlas(GrContext* context,
61 const SkPicture* topLevelPicture,
62 const SkMatrix& initialMat,
63 const SkRect& query,
64 SkTDArray<GrHoistedLayer>* atlasedNeedRenderin g,
65 SkTDArray<GrHoistedLayer>* recycled,
66 int numSamples);
67
68 /** Find the layers in 'topLevelPicture' that need hoisting. Note that the d iscovered
69 layers can be inside nested sub-pictures.
70 @param context Owner of the layer cache (the source of new layers)
71 @param topLevelPicture The top-level picture that is about to be rendere d
72 @param initialMat The CTM of the canvas into which the layers will be d rawn
73 @param query The rectangle that is about to be drawn.
74 @param needRendering Out parameter storing the layers that need renderin g.
75 This should never include atlased layers.
76 @param recycled Out parameter storing layers that need hoisting but n ot rendering
77 @param numSamples The number if MSAA samples required
78 */
79 static void FindLayersToHoist(GrContext* context,
80 const SkPicture* topLevelPicture,
81 const SkMatrix& initialMat,
82 const SkRect& query,
83 SkTDArray<GrHoistedLayer>* needRendering,
84 SkTDArray<GrHoistedLayer>* recycled,
85 int numSamples);
86
87 /** Draw the specified layers into the atlas.
88 @param context Owner of the layer cache (and thus the layers)
89 @param layers The layers to be drawn into the atlas
90 */
91 static void DrawLayersToAtlas(GrContext* context, const SkTDArray<GrHoistedL ayer>& layers);
92
93 /** Draw the specified layers into their own individual textures.
94 @param context Owner of the layer cache (and thus the layers)
95 @param layers The layers to be drawn
96 */
97 static void DrawLayers(GrContext* context, const SkTDArray<GrHoistedLayer>& layers);
98
99 /** Convert all the layers in 'layers' into replacement objects in 'replacem ents'.
100 @param layers The hoisted layers
101 @param replacements Replacement object that will be used for a replaceme nt draw
102 */
103 static void ConvertLayersToReplacements(const SkPicture* topLevelPicture,
104 const SkTDArray<GrHoistedLayer>& lay ers,
105 GrReplacements* replacements);
106
107 /** Unlock a group of layers in the layer cache.
108 @param context Owner of the layer cache (and thus the layers)
109 @param layers Unneeded layers in the atlas
110 */
111 static void UnlockLayers(GrContext* context, const SkTDArray<GrHoistedLayer> & layers);
112
113 /** Forceably remove all cached layers and release the atlas. Useful for deb ugging and timing.
114 This is only functional when GR_CACHE_HOISTED_LAYERS is set to 1 in GrLa yerCache.h
115 @param context Owner of the layer cache (and thus the layers)
116 */
117 static void PurgeCache(GrContext* context);
118
119 private:
120 /** Update the GrTexture in 'layer' with its filtered version
121 @param context Owner of the layer cache (and thus the layers)
122 @param props Surface properties
123 @param info Layer info for a layer needing filtering prior to bein g composited
124 */
125 static void FilterLayer(GrContext* context, const SkSurfaceProps*, const GrH oistedLayer& info);
126
127 };
128 #endif
129
130 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrLayerCache.cpp ('k') | src/gpu/GrLayerHoister.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698