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 16 matching lines...) Expand all Loading... |
27 int numSamples) { | 27 int numSamples) { |
28 const SkPicture* pict = info.fPicture ? info.fPicture : topLevelPicture; | 28 const SkPicture* pict = info.fPicture ? info.fPicture : topLevelPicture; |
29 | 29 |
30 SkMatrix combined = SkMatrix::Concat(info.fPreMat, info.fLocalMat); | 30 SkMatrix combined = SkMatrix::Concat(info.fPreMat, info.fLocalMat); |
31 | 31 |
32 GrCachedLayer* layer = layerCache->findLayerOrCreate(pict->uniqueID(), | 32 GrCachedLayer* layer = layerCache->findLayerOrCreate(pict->uniqueID(), |
33 info.fSaveLayerOpID, | 33 info.fSaveLayerOpID, |
34 info.fRestoreOpID, | 34 info.fRestoreOpID, |
35 layerRect, | 35 layerRect, |
36 combined, | 36 combined, |
| 37 info.fKey, |
| 38 info.fKeySize, |
37 info.fPaint); | 39 info.fPaint); |
38 GrSurfaceDesc desc; | 40 GrSurfaceDesc desc; |
39 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 41 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
40 desc.fWidth = layerRect.width(); | 42 desc.fWidth = layerRect.width(); |
41 desc.fHeight = layerRect.height(); | 43 desc.fHeight = layerRect.height(); |
42 desc.fConfig = kSkia8888_GrPixelConfig; | 44 desc.fConfig = kSkia8888_GrPixelConfig; |
43 desc.fSampleCnt = numSamples; | 45 desc.fSampleCnt = numSamples; |
44 | 46 |
45 bool locked, needsRendering; | 47 bool locked, needsRendering; |
46 if (attemptToAtlas) { | 48 if (attemptToAtlas) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // TODO: just replace GrReplacements::ReplacementInfo with GrCachedLayer? | 192 // TODO: just replace GrReplacements::ReplacementInfo with GrCachedLayer? |
191 for (int i = 0; i < layers.count(); ++i) { | 193 for (int i = 0; i < layers.count(); ++i) { |
192 GrCachedLayer* layer = layers[i].fLayer; | 194 GrCachedLayer* layer = layers[i].fLayer; |
193 const SkPicture* picture = layers[i].fPicture; | 195 const SkPicture* picture = layers[i].fPicture; |
194 | 196 |
195 SkMatrix combined = SkMatrix::Concat(layers[i].fPreMat, layers[i].fLocal
Mat); | 197 SkMatrix combined = SkMatrix::Concat(layers[i].fPreMat, layers[i].fLocal
Mat); |
196 | 198 |
197 GrReplacements::ReplacementInfo* layerInfo = | 199 GrReplacements::ReplacementInfo* layerInfo = |
198 replacements->newReplacement(picture->uniqueID(), | 200 replacements->newReplacement(picture->uniqueID(), |
199 layer->start(), | 201 layer->start(), |
200 combined); | 202 layer->key(), layer->keySize())
; |
201 layerInfo->fStop = layer->stop(); | 203 layerInfo->fStop = layer->stop(); |
202 layerInfo->fPos = layers[i].fOffset; | 204 layerInfo->fPos = layers[i].fOffset; |
203 | 205 |
204 SkBitmap bm; | 206 SkBitmap bm; |
205 wrap_texture(layers[i].fLayer->texture(), | 207 wrap_texture(layers[i].fLayer->texture(), |
206 !layers[i].fLayer->isAtlased() ? layers[i].fLayer->rect().w
idth() | 208 !layers[i].fLayer->isAtlased() ? layers[i].fLayer->rect().w
idth() |
207 : layers[i].fLayer->texture(
)->width(), | 209 : layers[i].fLayer->texture(
)->width(), |
208 !layers[i].fLayer->isAtlased() ? layers[i].fLayer->rect().h
eight() | 210 !layers[i].fLayer->isAtlased() ? layers[i].fLayer->rect().h
eight() |
209 : layers[i].fLayer->texture(
)->height(), | 211 : layers[i].fLayer->texture(
)->height(), |
210 &bm); | 212 &bm); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 void GrLayerHoister::PurgeCache(GrContext* context) { | 333 void GrLayerHoister::PurgeCache(GrContext* context) { |
332 #if !GR_CACHE_HOISTED_LAYERS | 334 #if !GR_CACHE_HOISTED_LAYERS |
333 GrLayerCache* layerCache = context->getLayerCache(); | 335 GrLayerCache* layerCache = context->getLayerCache(); |
334 | 336 |
335 // This code completely clears out the atlas. It is required when | 337 // This code completely clears out the atlas. It is required when |
336 // caching is disabled so the atlas doesn't fill up and force more | 338 // caching is disabled so the atlas doesn't fill up and force more |
337 // free floating layers | 339 // free floating layers |
338 layerCache->purgeAll(); | 340 layerCache->purgeAll(); |
339 #endif | 341 #endif |
340 } | 342 } |
OLD | NEW |