| 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 #include "GrLayerCache.h" | 8 #include "GrLayerCache.h" |
| 9 #include "GrLayerHoister.h" | 9 #include "GrLayerHoister.h" |
| 10 #include "GrRecordReplaceDraw.h" | 10 #include "GrRecordReplaceDraw.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 const GrAccelData::SaveLayerInfo& info = topLevelGPUData->saveLayerInfo(
i); | 104 const GrAccelData::SaveLayerInfo& info = topLevelGPUData->saveLayerInfo(
i); |
| 105 | 105 |
| 106 // TODO: ignore perspective projected layers here? | 106 // TODO: ignore perspective projected layers here? |
| 107 bool disallowAtlasing = info.fHasNestedLayers || info.fIsNested || | 107 bool disallowAtlasing = info.fHasNestedLayers || info.fIsNested || |
| 108 (info.fPaint && info.fPaint->getImageFilter()); | 108 (info.fPaint && info.fPaint->getImageFilter()); |
| 109 | 109 |
| 110 if (disallowAtlasing) { | 110 if (disallowAtlasing) { |
| 111 continue; | 111 continue; |
| 112 } | 112 } |
| 113 | 113 |
| 114 SkRect layerRect = SkRect::Make(info.fBounds); | 114 SkRect layerRect = info.fBounds; |
| 115 if (!layerRect.intersect(query)) { | 115 if (!layerRect.intersect(query)) { |
| 116 continue; | 116 continue; |
| 117 } | 117 } |
| 118 | 118 |
| 119 SkIRect ir; | 119 SkIRect ir; |
| 120 layerRect.roundOut(&ir); | 120 layerRect.roundOut(&ir); |
| 121 | 121 |
| 122 if (!GrLayerCache::PlausiblyAtlasable(ir.width(), ir.height())) { | 122 if (!GrLayerCache::PlausiblyAtlasable(ir.width(), ir.height())) { |
| 123 continue; | 123 continue; |
| 124 } | 124 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 150 } | 150 } |
| 151 | 151 |
| 152 // Find and prepare for hoisting all the layers that intersect the query rec
t | 152 // Find and prepare for hoisting all the layers that intersect the query rec
t |
| 153 for (int i = 0; i < topLevelGPUData->numSaveLayers(); ++i) { | 153 for (int i = 0; i < topLevelGPUData->numSaveLayers(); ++i) { |
| 154 const GrAccelData::SaveLayerInfo& info = topLevelGPUData->saveLayerInfo(
i); | 154 const GrAccelData::SaveLayerInfo& info = topLevelGPUData->saveLayerInfo(
i); |
| 155 if (info.fIsNested) { | 155 if (info.fIsNested) { |
| 156 // Parent layers are currently hoisted while nested layers are not. | 156 // Parent layers are currently hoisted while nested layers are not. |
| 157 continue; | 157 continue; |
| 158 } | 158 } |
| 159 | 159 |
| 160 SkRect layerRect = SkRect::Make(info.fBounds); | 160 SkRect layerRect = info.fBounds; |
| 161 if (!layerRect.intersect(query)) { | 161 if (!layerRect.intersect(query)) { |
| 162 continue; | 162 continue; |
| 163 } | 163 } |
| 164 | 164 |
| 165 SkIRect ir; | 165 SkIRect ir; |
| 166 layerRect.roundOut(&ir); | 166 layerRect.roundOut(&ir); |
| 167 | 167 |
| 168 prepare_for_hoisting(layerCache, topLevelPicture, info, ir, | 168 prepare_for_hoisting(layerCache, topLevelPicture, info, ir, |
| 169 needRendering, recycled, false); | 169 needRendering, recycled, false); |
| 170 } | 170 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 void GrLayerHoister::PurgeCache(GrContext* context) { | 320 void GrLayerHoister::PurgeCache(GrContext* context) { |
| 321 #if !GR_CACHE_HOISTED_LAYERS | 321 #if !GR_CACHE_HOISTED_LAYERS |
| 322 GrLayerCache* layerCache = context->getLayerCache(); | 322 GrLayerCache* layerCache = context->getLayerCache(); |
| 323 | 323 |
| 324 // This code completely clears out the atlas. It is required when | 324 // This code completely clears out the atlas. It is required when |
| 325 // caching is disabled so the atlas doesn't fill up and force more | 325 // caching is disabled so the atlas doesn't fill up and force more |
| 326 // free floating layers | 326 // free floating layers |
| 327 layerCache->purgeAll(); | 327 layerCache->purgeAll(); |
| 328 #endif | 328 #endif |
| 329 } | 329 } |
| OLD | NEW |