| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 GrContext::ScratchTexMatch usage = GrContext::kApprox_ScratchTexMatch; |
| 252 if (layer->fFilter) { | 252 if (layer->fFilter) { |
| 253 usage = GrContext::kExact_ScratchTexMatch; | 253 usage = GrContext::kExact_ScratchTexMatch; |
| 254 } | 254 } |
| 255 | 255 |
| 256 SkAutoTUnref<GrTexture> tex( | 256 SkAutoTUnref<GrTexture> tex(fContext->refScratchTexture(desc, usage)); |
| 257 fContext->refScratchTexture(desc, usage)); | |
| 258 | |
| 259 if (!tex) { | 257 if (!tex) { |
| 260 return false; | 258 return false; |
| 261 } | 259 } |
| 262 | 260 |
| 263 layer->setTexture(tex, SkIRect::MakeWH(desc.fWidth, desc.fHeight)); | 261 layer->setTexture(tex, SkIRect::MakeWH(desc.fWidth, desc.fHeight)); |
| 264 layer->setLocked(true); | 262 layer->setLocked(true); |
| 265 *needsRendering = true; | 263 *needsRendering = true; |
| 266 return true; | 264 return true; |
| 267 } | 265 } |
| 268 | 266 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 fileName.appendf("\\%d", layer->fKey.pictureID()); | 503 fileName.appendf("\\%d", layer->fKey.pictureID()); |
| 506 for (int i = 0; i < layer->fKey.keySize(); ++i) { | 504 for (int i = 0; i < layer->fKey.keySize(); ++i) { |
| 507 fileName.appendf("-%d", layer->fKey.key()[i]); | 505 fileName.appendf("-%d", layer->fKey.key()[i]); |
| 508 } | 506 } |
| 509 fileName.appendf(".png"); | 507 fileName.appendf(".png"); |
| 510 | 508 |
| 511 layer->texture()->surfacePriv().savePixels(fileName.c_str()); | 509 layer->texture()->surfacePriv().savePixels(fileName.c_str()); |
| 512 } | 510 } |
| 513 } | 511 } |
| 514 #endif | 512 #endif |
| OLD | NEW |