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

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

Issue 719133002: Rename GrAccelData to SkLayerInfo and move it to src/core (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix up unit test Created 6 years, 1 month 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/GrLayerHoister.h ('k') | src/gpu/GrPictureUtils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "GrLayerCache.h" 8 #include "GrLayerCache.h"
9 #include "GrLayerHoister.h" 9 #include "GrLayerHoister.h"
10 #include "GrRecordReplaceDraw.h" 10 #include "GrRecordReplaceDraw.h"
11 11
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkGrPixelRef.h" 13 #include "SkGrPixelRef.h"
14 #include "SkLayerInfo.h"
14 #include "SkRecordDraw.h" 15 #include "SkRecordDraw.h"
15 #include "SkSurface.h" 16 #include "SkSurface.h"
16 17
17 // Create the layer information for the hoisted layer and secure the 18 // Create the layer information for the hoisted layer and secure the
18 // required texture/render target resources. 19 // required texture/render target resources.
19 static void prepare_for_hoisting(GrLayerCache* layerCache, 20 static void prepare_for_hoisting(GrLayerCache* layerCache,
20 const SkPicture* topLevelPicture, 21 const SkPicture* topLevelPicture,
21 const GrAccelData::SaveLayerInfo& info, 22 const SkLayerInfo::BlockInfo& info,
22 const SkIRect& layerRect, 23 const SkIRect& layerRect,
23 SkTDArray<GrHoistedLayer>* needRendering, 24 SkTDArray<GrHoistedLayer>* needRendering,
24 SkTDArray<GrHoistedLayer>* recycled, 25 SkTDArray<GrHoistedLayer>* recycled,
25 bool attemptToAtlas, 26 bool attemptToAtlas,
26 int numSamples) { 27 int numSamples) {
27 const SkPicture* pict = info.fPicture ? info.fPicture : topLevelPicture; 28 const SkPicture* pict = info.fPicture ? info.fPicture : topLevelPicture;
28 29
29 SkMatrix combined = SkMatrix::Concat(info.fPreMat, info.fLocalMat); 30 SkMatrix combined = SkMatrix::Concat(info.fPreMat, info.fLocalMat);
30 31
31 GrCachedLayer* layer = layerCache->findLayerOrCreate(pict->uniqueID(), 32 GrCachedLayer* layer = layerCache->findLayerOrCreate(pict->uniqueID(),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 int numSamples) { 87 int numSamples) {
87 if (0 != numSamples) { 88 if (0 != numSamples) {
88 // MSAA layers are currently never atlased 89 // MSAA layers are currently never atlased
89 return; 90 return;
90 } 91 }
91 92
92 GrLayerCache* layerCache = context->getLayerCache(); 93 GrLayerCache* layerCache = context->getLayerCache();
93 94
94 layerCache->processDeletedPictures(); 95 layerCache->processDeletedPictures();
95 96
96 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); 97 SkPicture::AccelData::Key key = SkLayerInfo::ComputeKey();
97 98
98 const SkPicture::AccelData* topLevelData = topLevelPicture->EXPERIMENTAL_get AccelData(key); 99 const SkPicture::AccelData* topLevelData = topLevelPicture->EXPERIMENTAL_get AccelData(key);
99 if (!topLevelData) { 100 if (!topLevelData) {
100 return; 101 return;
101 } 102 }
102 103
103 const GrAccelData *topLevelGPUData = static_cast<const GrAccelData*>(topLeve lData); 104 const SkLayerInfo *topLevelGPUData = static_cast<const SkLayerInfo*>(topLeve lData);
104 if (0 == topLevelGPUData->numSaveLayers()) { 105 if (0 == topLevelGPUData->numBlocks()) {
105 return; 106 return;
106 } 107 }
107 108
108 atlased->setReserve(atlased->count() + topLevelGPUData->numSaveLayers()); 109 atlased->setReserve(atlased->count() + topLevelGPUData->numBlocks());
109 110
110 for (int i = 0; i < topLevelGPUData->numSaveLayers(); ++i) { 111 for (int i = 0; i < topLevelGPUData->numBlocks(); ++i) {
111 const GrAccelData::SaveLayerInfo& info = topLevelGPUData->saveLayerInfo( i); 112 const SkLayerInfo::BlockInfo& info = topLevelGPUData->block(i);
112 113
113 // TODO: ignore perspective projected layers here? 114 // TODO: ignore perspective projected layers here?
114 bool disallowAtlasing = info.fHasNestedLayers || info.fIsNested || 115 bool disallowAtlasing = info.fHasNestedLayers || info.fIsNested ||
115 (info.fPaint && info.fPaint->getImageFilter()); 116 (info.fPaint && info.fPaint->getImageFilter());
116 117
117 if (disallowAtlasing) { 118 if (disallowAtlasing) {
118 continue; 119 continue;
119 } 120 }
120 121
121 SkRect layerRect = info.fBounds; 122 SkRect layerRect = info.fBounds;
(...skipping 16 matching lines...) Expand all
138 void GrLayerHoister::FindLayersToHoist(GrContext* context, 139 void GrLayerHoister::FindLayersToHoist(GrContext* context,
139 const SkPicture* topLevelPicture, 140 const SkPicture* topLevelPicture,
140 const SkRect& query, 141 const SkRect& query,
141 SkTDArray<GrHoistedLayer>* needRendering, 142 SkTDArray<GrHoistedLayer>* needRendering,
142 SkTDArray<GrHoistedLayer>* recycled, 143 SkTDArray<GrHoistedLayer>* recycled,
143 int numSamples) { 144 int numSamples) {
144 GrLayerCache* layerCache = context->getLayerCache(); 145 GrLayerCache* layerCache = context->getLayerCache();
145 146
146 layerCache->processDeletedPictures(); 147 layerCache->processDeletedPictures();
147 148
148 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); 149 SkPicture::AccelData::Key key = SkLayerInfo::ComputeKey();
149 150
150 const SkPicture::AccelData* topLevelData = topLevelPicture->EXPERIMENTAL_get AccelData(key); 151 const SkPicture::AccelData* topLevelData = topLevelPicture->EXPERIMENTAL_get AccelData(key);
151 if (!topLevelData) { 152 if (!topLevelData) {
152 return; 153 return;
153 } 154 }
154 155
155 const GrAccelData *topLevelGPUData = static_cast<const GrAccelData*>(topLeve lData); 156 const SkLayerInfo *topLevelGPUData = static_cast<const SkLayerInfo*>(topLeve lData);
156 if (0 == topLevelGPUData->numSaveLayers()) { 157 if (0 == topLevelGPUData->numBlocks()) {
157 return; 158 return;
158 } 159 }
159 160
160 // Find and prepare for hoisting all the layers that intersect the query rec t 161 // Find and prepare for hoisting all the layers that intersect the query rec t
161 for (int i = 0; i < topLevelGPUData->numSaveLayers(); ++i) { 162 for (int i = 0; i < topLevelGPUData->numBlocks(); ++i) {
162 const GrAccelData::SaveLayerInfo& info = topLevelGPUData->saveLayerInfo( i); 163 const SkLayerInfo::BlockInfo& info = topLevelGPUData->block(i);
163 if (info.fIsNested) { 164 if (info.fIsNested) {
164 // Parent layers are currently hoisted while nested layers are not. 165 // Parent layers are currently hoisted while nested layers are not.
165 continue; 166 continue;
166 } 167 }
167 168
168 SkRect layerRect = info.fBounds; 169 SkRect layerRect = info.fBounds;
169 if (!layerRect.intersect(query)) { 170 if (!layerRect.intersect(query)) {
170 continue; 171 continue;
171 } 172 }
172 173
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 void GrLayerHoister::PurgeCache(GrContext* context) { 329 void GrLayerHoister::PurgeCache(GrContext* context) {
329 #if !GR_CACHE_HOISTED_LAYERS 330 #if !GR_CACHE_HOISTED_LAYERS
330 GrLayerCache* layerCache = context->getLayerCache(); 331 GrLayerCache* layerCache = context->getLayerCache();
331 332
332 // This code completely clears out the atlas. It is required when 333 // This code completely clears out the atlas. It is required when
333 // caching is disabled so the atlas doesn't fill up and force more 334 // caching is disabled so the atlas doesn't fill up and force more
334 // free floating layers 335 // free floating layers
335 layerCache->purgeAll(); 336 layerCache->purgeAll();
336 #endif 337 #endif
337 } 338 }
OLDNEW
« no previous file with comments | « src/gpu/GrLayerHoister.h ('k') | src/gpu/GrPictureUtils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698