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 15 matching lines...) Expand all Loading... |
26 const SkPicture* pict = info.fPicture ? info.fPicture : topLevelPicture; | 26 const SkPicture* pict = info.fPicture ? info.fPicture : topLevelPicture; |
27 | 27 |
28 SkMatrix combined = SkMatrix::Concat(info.fPreMat, info.fLocalMat); | 28 SkMatrix combined = SkMatrix::Concat(info.fPreMat, info.fLocalMat); |
29 | 29 |
30 GrCachedLayer* layer = layerCache->findLayerOrCreate(pict->uniqueID(), | 30 GrCachedLayer* layer = layerCache->findLayerOrCreate(pict->uniqueID(), |
31 info.fSaveLayerOpID, | 31 info.fSaveLayerOpID, |
32 info.fRestoreOpID, | 32 info.fRestoreOpID, |
33 layerRect, | 33 layerRect, |
34 combined, | 34 combined, |
35 info.fPaint); | 35 info.fPaint); |
36 GrTextureDesc desc; | 36 GrSurfaceDesc desc; |
37 desc.fFlags = kRenderTarget_GrTextureFlagBit; | 37 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
38 desc.fWidth = layerRect.width(); | 38 desc.fWidth = layerRect.width(); |
39 desc.fHeight = layerRect.height(); | 39 desc.fHeight = layerRect.height(); |
40 desc.fConfig = kSkia8888_GrPixelConfig; | 40 desc.fConfig = kSkia8888_GrPixelConfig; |
41 // TODO: need to deal with sample count | 41 // TODO: need to deal with sample count |
42 | 42 |
43 bool locked, needsRendering; | 43 bool locked, needsRendering; |
44 if (attemptToAtlas) { | 44 if (attemptToAtlas) { |
45 locked = layerCache->tryToAtlas(layer, desc, &needsRendering); | 45 locked = layerCache->tryToAtlas(layer, desc, &needsRendering); |
46 } else { | 46 } else { |
47 locked = layerCache->lock(layer, desc, &needsRendering); | 47 locked = layerCache->lock(layer, desc, &needsRendering); |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 #if DISABLE_CACHING | 317 #if DISABLE_CACHING |
318 // This code completely clears out the atlas. It is required when | 318 // This code completely clears out the atlas. It is required when |
319 // caching is disabled so the atlas doesn't fill up and force more | 319 // caching is disabled so the atlas doesn't fill up and force more |
320 // free floating layers | 320 // free floating layers |
321 layerCache->purgeAll(); | 321 layerCache->purgeAll(); |
322 #endif | 322 #endif |
323 | 323 |
324 SkDEBUGCODE(layerCache->validate();) | 324 SkDEBUGCODE(layerCache->validate();) |
325 } | 325 } |
326 | 326 |
OLD | NEW |