OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include <new> | 7 #include <new> |
8 #include "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
9 #include "SkPicturePlayback.h" | 9 #include "SkPicturePlayback.h" |
10 #include "SkPictureRecord.h" | 10 #include "SkPictureRecord.h" |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 if (it.isValid()) { | 852 if (it.isValid()) { |
853 uint32_t skipTo = it.nextDraw(); | 853 uint32_t skipTo = it.nextDraw(); |
854 if (kDrawComplete == skipTo) { | 854 if (kDrawComplete == skipTo) { |
855 return; | 855 return; |
856 } | 856 } |
857 reader.setOffset(skipTo); | 857 reader.setOffset(skipTo); |
858 } | 858 } |
859 | 859 |
860 // Record this, so we can concat w/ it if we encounter a setMatrix() | 860 // Record this, so we can concat w/ it if we encounter a setMatrix() |
861 SkMatrix initialMatrix = canvas.getTotalMatrix(); | 861 SkMatrix initialMatrix = canvas.getTotalMatrix(); |
862 int originalSaveCount = canvas.getSaveCount(); | 862 |
| 863 SkAutoCanvasRestore acr(&canvas, false); |
863 | 864 |
864 #ifdef SK_BUILD_FOR_ANDROID | 865 #ifdef SK_BUILD_FOR_ANDROID |
865 fAbortCurrentPlayback = false; | 866 fAbortCurrentPlayback = false; |
866 #endif | 867 #endif |
867 | 868 |
868 #ifdef SK_DEVELOPER | 869 #ifdef SK_DEVELOPER |
869 int opIndex = -1; | 870 int opIndex = -1; |
870 #endif | 871 #endif |
871 | 872 |
872 while (!reader.eof()) { | 873 while (!reader.eof()) { |
873 if (callback && callback->abortDrawing()) { | 874 if (callback && callback->abortDrawing()) { |
874 canvas.restoreToCount(originalSaveCount); | |
875 return; | 875 return; |
876 } | 876 } |
877 #ifdef SK_BUILD_FOR_ANDROID | 877 #ifdef SK_BUILD_FOR_ANDROID |
878 if (fAbortCurrentPlayback) { | 878 if (fAbortCurrentPlayback) { |
879 return; | 879 return; |
880 } | 880 } |
881 #endif | 881 #endif |
882 if (0 != fStart || 0 != fStop) { | 882 if (0 != fStart || 0 != fStop) { |
883 size_t offset = reader.offset() ; | 883 size_t offset = reader.offset() ; |
884 if (offset >= fStop) { | 884 if (offset >= fStop) { |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 for (index = 0; index < fPictureCount; index++) | 1838 for (index = 0; index < fPictureCount; index++) |
1839 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), | 1839 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), |
1840 "picture%p, ", fPictureRefs[index]); | 1840 "picture%p, ", fPictureRefs[index]); |
1841 if (fPictureCount > 0) | 1841 if (fPictureCount > 0) |
1842 SkDebugf("%s0};\n", pBuffer); | 1842 SkDebugf("%s0};\n", pBuffer); |
1843 | 1843 |
1844 const_cast<SkPicturePlayback*>(this)->dumpStream(); | 1844 const_cast<SkPicturePlayback*>(this)->dumpStream(); |
1845 } | 1845 } |
1846 | 1846 |
1847 #endif | 1847 #endif |
OLD | NEW |