| 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 "GrAtlas.h" | 8 #include "GrAtlas.h" |
| 9 #include "GrGpu.h" | 9 #include "GrGpu.h" |
| 10 #include "GrLayerCache.h" | 10 #include "GrLayerCache.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 241 } |
| 242 | 242 |
| 243 bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n
eedsRendering) { | 243 bool GrLayerCache::lock(GrCachedLayer* layer, const GrSurfaceDesc& desc, bool* n
eedsRendering) { |
| 244 if (layer->locked()) { | 244 if (layer->locked()) { |
| 245 // This layer is already locked | 245 // This layer is already locked |
| 246 *needsRendering = false; | 246 *needsRendering = false; |
| 247 return true; | 247 return true; |
| 248 } | 248 } |
| 249 | 249 |
| 250 // TODO: make the test for exact match depend on the image filters themselve
s | 250 // TODO: make the test for exact match depend on the image filters themselve
s |
| 251 GrContext::ScratchTexMatch usage = GrContext::kApprox_ScratchTexMatch; | 251 GrTextureProvider::ScratchTexMatch usage = GrTextureProvider::kApprox_Scratc
hTexMatch; |
| 252 if (layer->fFilter) { | 252 if (layer->fFilter) { |
| 253 usage = GrContext::kExact_ScratchTexMatch; | 253 usage = GrTextureProvider::kExact_ScratchTexMatch; |
| 254 } | 254 } |
| 255 | 255 |
| 256 SkAutoTUnref<GrTexture> tex(fContext->refScratchTexture(desc, usage)); | 256 SkAutoTUnref<GrTexture> tex(fContext->textureProvider()->refScratchTexture(d
esc, usage)); |
| 257 if (!tex) { | 257 if (!tex) { |
| 258 return false; | 258 return false; |
| 259 } | 259 } |
| 260 | 260 |
| 261 layer->setTexture(tex, SkIRect::MakeWH(desc.fWidth, desc.fHeight)); | 261 layer->setTexture(tex, SkIRect::MakeWH(desc.fWidth, desc.fHeight)); |
| 262 layer->setLocked(true); | 262 layer->setLocked(true); |
| 263 *needsRendering = true; | 263 *needsRendering = true; |
| 264 return true; | 264 return true; |
| 265 } | 265 } |
| 266 | 266 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 fileName.appendf("\\%d", layer->fKey.pictureID()); | 503 fileName.appendf("\\%d", layer->fKey.pictureID()); |
| 504 for (int i = 0; i < layer->fKey.keySize(); ++i) { | 504 for (int i = 0; i < layer->fKey.keySize(); ++i) { |
| 505 fileName.appendf("-%d", layer->fKey.key()[i]); | 505 fileName.appendf("-%d", layer->fKey.key()[i]); |
| 506 } | 506 } |
| 507 fileName.appendf(".png"); | 507 fileName.appendf(".png"); |
| 508 | 508 |
| 509 layer->texture()->surfacePriv().savePixels(fileName.c_str()); | 509 layer->texture()->surfacePriv().savePixels(fileName.c_str()); |
| 510 } | 510 } |
| 511 } | 511 } |
| 512 #endif | 512 #endif |
| OLD | NEW |