| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkStream.h" | 10 #include "SkStream.h" |
| (...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 that->fOffset = this->fOffset; | 788 that->fOffset = this->fOffset; |
| 789 that->fCurrentOffset = this->fCurrentOffset; | 789 that->fCurrentOffset = this->fCurrentOffset; |
| 790 return that.detach(); | 790 return that.detach(); |
| 791 } | 791 } |
| 792 | 792 |
| 793 size_t getLength() const override { | 793 size_t getLength() const override { |
| 794 return fSize; | 794 return fSize; |
| 795 } | 795 } |
| 796 | 796 |
| 797 const void* getMemoryBase() override { | 797 const void* getMemoryBase() override { |
| 798 if (nullptr == fBlockMemory->fHead->fNext) { | 798 if (nullptr != fBlockMemory->fHead && |
| 799 nullptr == fBlockMemory->fHead->fNext) { |
| 799 return fBlockMemory->fHead->start(); | 800 return fBlockMemory->fHead->start(); |
| 800 } | 801 } |
| 801 return nullptr; | 802 return nullptr; |
| 802 } | 803 } |
| 803 | 804 |
| 804 private: | 805 private: |
| 805 SkAutoTUnref<SkBlockMemoryRefCnt> const fBlockMemory; | 806 SkAutoTUnref<SkBlockMemoryRefCnt> const fBlockMemory; |
| 806 SkDynamicMemoryWStream::Block const * fCurrent; | 807 SkDynamicMemoryWStream::Block const * fCurrent; |
| 807 size_t const fSize; | 808 size_t const fSize; |
| 808 size_t fOffset; | 809 size_t fOffset; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 while (true) { | 967 while (true) { |
| 967 count = input->read(scratch, sizeof(scratch)); | 968 count = input->read(scratch, sizeof(scratch)); |
| 968 if (0 == count) { | 969 if (0 == count) { |
| 969 return true; | 970 return true; |
| 970 } | 971 } |
| 971 if (!out->write(scratch, count)) { | 972 if (!out->write(scratch, count)) { |
| 972 return false; | 973 return false; |
| 973 } | 974 } |
| 974 } | 975 } |
| 975 } | 976 } |
| OLD | NEW |