OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 | 8 |
9 #include "SkStream.h" | 9 #include "SkStream.h" |
10 #include "SkStreamPriv.h" | 10 #include "SkStreamPriv.h" |
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 SkBlockMemoryStream* stream = new SkBlockMemoryStream(fHead, fBytesWritten); | 810 SkBlockMemoryStream* stream = new SkBlockMemoryStream(fHead, fBytesWritten); |
811 fHead = 0; | 811 fHead = 0; |
812 this->reset(); | 812 this->reset(); |
813 return stream; | 813 return stream; |
814 } | 814 } |
815 | 815 |
816 /////////////////////////////////////////////////////////////////////////////// | 816 /////////////////////////////////////////////////////////////////////////////// |
817 | 817 |
818 void SkDebugWStream::newline() | 818 void SkDebugWStream::newline() |
819 { | 819 { |
820 #if defined(SK_DEBUG) || defined(SK_DEVELOPER) | 820 #if defined(SK_DEBUG) |
821 SkDebugf("\n"); | 821 SkDebugf("\n"); |
822 fBytesWritten++; | 822 fBytesWritten++; |
823 #endif | 823 #endif |
824 } | 824 } |
825 | 825 |
826 bool SkDebugWStream::write(const void* buffer, size_t size) | 826 bool SkDebugWStream::write(const void* buffer, size_t size) |
827 { | 827 { |
828 #if defined(SK_DEBUG) || defined(SK_DEVELOPER) | 828 #if defined(SK_DEBUG) |
829 char* s = new char[size+1]; | 829 char* s = new char[size+1]; |
830 memcpy(s, buffer, size); | 830 memcpy(s, buffer, size); |
831 s[size] = 0; | 831 s[size] = 0; |
832 SkDebugf("%s", s); | 832 SkDebugf("%s", s); |
833 delete[] s; | 833 delete[] s; |
834 fBytesWritten += size; | 834 fBytesWritten += size; |
835 #endif | 835 #endif |
836 return true; | 836 return true; |
837 } | 837 } |
838 | 838 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 while (true) { | 899 while (true) { |
900 count = input->read(scratch, sizeof(scratch)); | 900 count = input->read(scratch, sizeof(scratch)); |
901 if (0 == count) { | 901 if (0 == count) { |
902 return true; | 902 return true; |
903 } | 903 } |
904 if (!out->write(scratch, count)) { | 904 if (!out->write(scratch, count)) { |
905 return false; | 905 return false; |
906 } | 906 } |
907 } | 907 } |
908 } | 908 } |
OLD | NEW |