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