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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); | 125 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); |
126 result->setInfo(info); | 126 result->setInfo(info); |
127 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); | 127 result->setPixelRef(SkNEW_ARGS(SkGrPixelRef, (info, texture)))->unref(); |
128 } | 128 } |
129 | 129 |
130 static void convert_layers_to_replacements(const SkTDArray<GrLayerHoister::Hoist
edLayer>& layers, | 130 static void convert_layers_to_replacements(const SkTDArray<GrLayerHoister::Hoist
edLayer>& layers, |
131 GrReplacements* replacements) { | 131 GrReplacements* replacements) { |
132 // TODO: just replace GrReplacements::ReplacementInfo with GrCachedLayer? | 132 // TODO: just replace GrReplacements::ReplacementInfo with GrCachedLayer? |
133 for (int i = 0; i < layers.count(); ++i) { | 133 for (int i = 0; i < layers.count(); ++i) { |
134 GrCachedLayer* layer = layers[i].fLayer; | 134 GrCachedLayer* layer = layers[i].fLayer; |
| 135 const SkPicture* picture = layers[i].fPicture; |
135 | 136 |
136 GrReplacements::ReplacementInfo* layerInfo = replacements->push(); | 137 GrReplacements::ReplacementInfo* layerInfo = |
137 layerInfo->fStart = layer->start(); | 138 replacements->newReplacement(picture->uniqueID(), |
| 139 layer->start(), |
| 140 layers[i].fCTM); |
138 layerInfo->fStop = layer->stop(); | 141 layerInfo->fStop = layer->stop(); |
139 layerInfo->fPos = layers[i].fOffset; | 142 layerInfo->fPos = layers[i].fOffset; |
140 | 143 |
141 SkBitmap bm; | 144 SkBitmap bm; |
142 wrap_texture(layers[i].fLayer->texture(), | 145 wrap_texture(layers[i].fLayer->texture(), |
143 !layers[i].fLayer->isAtlased() ? layers[i].fLayer->rect().w
idth() | 146 !layers[i].fLayer->isAtlased() ? layers[i].fLayer->rect().w
idth() |
144 : layers[i].fLayer->texture(
)->width(), | 147 : layers[i].fLayer->texture(
)->width(), |
145 !layers[i].fLayer->isAtlased() ? layers[i].fLayer->rect().h
eight() | 148 !layers[i].fLayer->isAtlased() ? layers[i].fLayer->rect().h
eight() |
146 : layers[i].fLayer->texture(
)->height(), | 149 : layers[i].fLayer->texture(
)->height(), |
147 &bm); | 150 &bm); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 } | 284 } |
282 | 285 |
283 #if DISABLE_CACHING | 286 #if DISABLE_CACHING |
284 // This code completely clears out the atlas. It is required when | 287 // This code completely clears out the atlas. It is required when |
285 // caching is disabled so the atlas doesn't fill up and force more | 288 // caching is disabled so the atlas doesn't fill up and force more |
286 // free floating layers | 289 // free floating layers |
287 layerCache->purgeAll(); | 290 layerCache->purgeAll(); |
288 #endif | 291 #endif |
289 } | 292 } |
290 | 293 |
OLD | NEW |