| 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 "GrLayerAtlas.h" | 8 #include "GrLayerAtlas.h" |
| 9 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n
eedsRendering) { | 248 bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n
eedsRendering) { |
| 249 if (layer->locked()) { | 249 if (layer->locked()) { |
| 250 // This layer is already locked | 250 // This layer is already locked |
| 251 *needsRendering = false; | 251 *needsRendering = false; |
| 252 return true; | 252 return true; |
| 253 } | 253 } |
| 254 | 254 |
| 255 // TODO: make the test for exact match depend on the image filters themselve
s | 255 // TODO: make the test for exact match depend on the image filters themselve
s |
| 256 SkAutoTUnref<GrTexture> tex; | 256 SkAutoTUnref<GrTexture> tex; |
| 257 if (layer->fFilter) { | 257 if (layer->fFilter) { |
| 258 tex.reset(fContext->textureProvider()->createTexture(desc, true)); | 258 tex.reset(fContext->textureProvider()->createTexture(desc, SkBudgeted::k
Yes)); |
| 259 } else { | 259 } else { |
| 260 tex.reset(fContext->textureProvider()->createApproxTexture(desc)); | 260 tex.reset(fContext->textureProvider()->createApproxTexture(desc)); |
| 261 } | 261 } |
| 262 | 262 |
| 263 if (!tex) { | 263 if (!tex) { |
| 264 return false; | 264 return false; |
| 265 } | 265 } |
| 266 | 266 |
| 267 layer->setTexture(tex, SkIRect::MakeWH(desc.fWidth, desc.fHeight), false); | 267 layer->setTexture(tex, SkIRect::MakeWH(desc.fWidth, desc.fHeight), false); |
| 268 layer->setLocked(true); | 268 layer->setLocked(true); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 fileName.appendf("\\%d", layer->fKey.pictureID()); | 548 fileName.appendf("\\%d", layer->fKey.pictureID()); |
| 549 for (int i = 0; i < layer->fKey.keySize(); ++i) { | 549 for (int i = 0; i < layer->fKey.keySize(); ++i) { |
| 550 fileName.appendf("-%d", layer->fKey.key()[i]); | 550 fileName.appendf("-%d", layer->fKey.key()[i]); |
| 551 } | 551 } |
| 552 fileName.appendf(".png"); | 552 fileName.appendf(".png"); |
| 553 | 553 |
| 554 layer->texture()->surfacePriv().savePixels(fileName.c_str()); | 554 layer->texture()->surfacePriv().savePixels(fileName.c_str()); |
| 555 } | 555 } |
| 556 } | 556 } |
| 557 #endif | 557 #endif |
| OLD | NEW |