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 "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // TODO: ensure none of the atlased layers contain a clear call! | 88 // TODO: ensure none of the atlased layers contain a clear call! |
89 atlasCanvas->drawRect(bound, paint); | 89 atlasCanvas->drawRect(bound, paint); |
90 | 90 |
91 // info.fCTM maps the layer's top/left to the origin. | 91 // info.fCTM maps the layer's top/left to the origin. |
92 // Since this layer is atlased, the top/left corner needs | 92 // Since this layer is atlased, the top/left corner needs |
93 // to be offset to the correct location in the backing texture. | 93 // to be offset to the correct location in the backing texture. |
94 atlasCanvas->translate(bound.fLeft, bound.fTop); | 94 atlasCanvas->translate(bound.fLeft, bound.fTop); |
95 atlasCanvas->concat(layer->ctm()); | 95 atlasCanvas->concat(layer->ctm()); |
96 | 96 |
97 SkRecordPartialDraw(*picture->fRecord.get(), atlasCanvas, bound, | 97 SkRecordPartialDraw(*picture->fRecord.get(), atlasCanvas, bound, |
98 layer->start()+1, layer->stop()); | 98 layer->start(), layer->stop()); |
99 | 99 |
100 atlasCanvas->restore(); | 100 atlasCanvas->restore(); |
101 } | 101 } |
102 | 102 |
103 atlasCanvas->flush(); | 103 atlasCanvas->flush(); |
104 } | 104 } |
105 | 105 |
106 // Render the non-atlased layers that require it | 106 // Render the non-atlased layers that require it |
107 for (int i = 0; i < nonAtlased.count(); ++i) { | 107 for (int i = 0; i < nonAtlased.count(); ++i) { |
108 GrCachedLayer* layer = nonAtlased[i]; | 108 GrCachedLayer* layer = nonAtlased[i]; |
(...skipping 13 matching lines...) Expand all Loading... |
122 SkIntToScalar(layer->rect().width()), | 122 SkIntToScalar(layer->rect().width()), |
123 SkIntToScalar(layer->rect().height())); | 123 SkIntToScalar(layer->rect().height())); |
124 | 124 |
125 layerCanvas->clipRect(bound); // TODO: still useful? | 125 layerCanvas->clipRect(bound); // TODO: still useful? |
126 | 126 |
127 layerCanvas->clear(SK_ColorTRANSPARENT); | 127 layerCanvas->clear(SK_ColorTRANSPARENT); |
128 | 128 |
129 layerCanvas->concat(layer->ctm()); | 129 layerCanvas->concat(layer->ctm()); |
130 | 130 |
131 SkRecordPartialDraw(*picture->fRecord.get(), layerCanvas, bound, | 131 SkRecordPartialDraw(*picture->fRecord.get(), layerCanvas, bound, |
132 layer->start()+1, layer->stop()); | 132 layer->start(), layer->stop()); |
133 | 133 |
134 layerCanvas->flush(); | 134 layerCanvas->flush(); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 void GrLayerHoister::UnlockLayers(GrLayerCache* layerCache, const SkPicture* pic
ture) { | 138 void GrLayerHoister::UnlockLayers(GrLayerCache* layerCache, const SkPicture* pic
ture) { |
139 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); | 139 SkPicture::AccelData::Key key = GrAccelData::ComputeAccelDataKey(); |
140 | 140 |
141 const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key); | 141 const SkPicture::AccelData* data = picture->EXPERIMENTAL_getAccelData(key); |
142 SkASSERT(data); | 142 SkASSERT(data); |
(...skipping 15 matching lines...) Expand all Loading... |
158 #if DISABLE_CACHING | 158 #if DISABLE_CACHING |
159 // This code completely clears out the atlas. It is required when | 159 // This code completely clears out the atlas. It is required when |
160 // caching is disabled so the atlas doesn't fill up and force more | 160 // caching is disabled so the atlas doesn't fill up and force more |
161 // free floating layers | 161 // free floating layers |
162 layerCache->purge(picture->uniqueID()); | 162 layerCache->purge(picture->uniqueID()); |
163 | 163 |
164 layerCache->purgeAll(); | 164 layerCache->purgeAll(); |
165 #endif | 165 #endif |
166 } | 166 } |
167 | 167 |
OLD | NEW |