Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(599)

Side by Side Diff: src/gpu/GrLayerCache.cpp

Issue 654653006: Add GrLayerCache::writeLayersToDisk (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrLayerCache.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "GrSurfacePriv.h"
11 12
12 DECLARE_SKMESSAGEBUS_MESSAGE(GrPictureDeletedMessage); 13 DECLARE_SKMESSAGEBUS_MESSAGE(GrPictureDeletedMessage);
13 14
14 #ifdef SK_DEBUG 15 #ifdef SK_DEBUG
15 void GrCachedLayer::validate(const GrTexture* backingTexture) const { 16 void GrCachedLayer::validate(const GrTexture* backingTexture) const {
16 SkASSERT(SK_InvalidGenID != fKey.pictureID()); 17 SkASSERT(SK_InvalidGenID != fKey.pictureID());
17 SkASSERT(fKey.start() >= 0); 18 SkASSERT(fKey.start() >= 0);
18 19
19 if (fTexture) { 20 if (fTexture) {
20 // If the layer is in some texture then it must occupy some rectangle 21 // If the layer is in some texture then it must occupy some rectangle
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 428
428 void GrLayerCache::processDeletedPictures() { 429 void GrLayerCache::processDeletedPictures() {
429 SkTDArray<GrPictureDeletedMessage> deletedPictures; 430 SkTDArray<GrPictureDeletedMessage> deletedPictures;
430 fPictDeletionInbox.poll(&deletedPictures); 431 fPictDeletionInbox.poll(&deletedPictures);
431 432
432 for (int i = 0; i < deletedPictures.count(); i++) { 433 for (int i = 0; i < deletedPictures.count(); i++) {
433 this->purge(deletedPictures[i].pictureID); 434 this->purge(deletedPictures[i].pictureID);
434 } 435 }
435 } 436 }
436 437
438 #ifdef SK_DEVELOPER
439 void GrLayerCache::writeLayersToDisk(const SkString& dirName) {
440
441 GrTexture* atlasTexture = fAtlas->getTexture();
442 if (NULL != atlasTexture) {
443 SkString fileName(dirName);
444 fileName.append("\\atlas.png");
445
446 atlasTexture->surfacePriv().savePixels(fileName.c_str());
447 }
448
449 SkTDynamicHash<GrCachedLayer, GrCachedLayer::Key>::Iter iter(&fLayerHash);
450 for (; !iter.done(); ++iter) {
451 GrCachedLayer* layer = &(*iter);
452
453 if (layer->isAtlased() || !layer->texture()) {
454 continue;
455 }
456
457 SkString fileName(dirName);
458 fileName.append("\\");
459 fileName.appendU32(layer->fKey.pictureID());
460 fileName.append("-");
461 fileName.appendU32(layer->fKey.start());
462 fileName.append(".png");
463
464 layer->texture()->surfacePriv().savePixels(fileName.c_str());
465 }
466 }
467 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrLayerCache.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698