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

Side by Side Diff: src/core/SkStream.cpp

Issue 19677002: Add a detachAsStream to SkDynamicMemoryWStream. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Spel beter. Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkStream.h ('k') | tests/StreamTest.cpp » ('j') | 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 /* 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 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 } 774 }
775 775
776 private: 776 private:
777 SkAutoTUnref<SkBlockMemoryRefCnt> const fBlockMemory; 777 SkAutoTUnref<SkBlockMemoryRefCnt> const fBlockMemory;
778 SkDynamicMemoryWStream::Block const * fCurrent; 778 SkDynamicMemoryWStream::Block const * fCurrent;
779 size_t const fSize; 779 size_t const fSize;
780 size_t fOffset; 780 size_t fOffset;
781 size_t fCurrentOffset; 781 size_t fCurrentOffset;
782 }; 782 };
783 783
784 SkStreamAsset* SkDynamicMemoryWStream::detatchAsStream() { 784 SkStreamAsset* SkDynamicMemoryWStream::detachAsStream() {
785 if (fCopy) { 785 if (fCopy) {
786 SkMemoryStream* stream = SkNEW_ARGS(SkMemoryStream, (fCopy)); 786 SkMemoryStream* stream = SkNEW_ARGS(SkMemoryStream, (fCopy));
787 this->reset(); 787 this->reset();
788 return stream; 788 return stream;
789 } 789 }
790 SkBlockMemoryStream* stream = SkNEW_ARGS(SkBlockMemoryStream, (fHead, fBytes Written)); 790 SkBlockMemoryStream* stream = SkNEW_ARGS(SkBlockMemoryStream, (fHead, fBytes Written));
791 fHead = 0; 791 fHead = 0;
792 this->reset(); 792 this->reset();
793 return stream; 793 return stream;
794 } 794 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 837
838 // If we get here, then our attempt at using mmap failed, so try normal 838 // If we get here, then our attempt at using mmap failed, so try normal
839 // file access. 839 // file access.
840 SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path)); 840 SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path));
841 if (!stream->isValid()) { 841 if (!stream->isValid()) {
842 stream->unref(); 842 stream->unref();
843 stream = NULL; 843 stream = NULL;
844 } 844 }
845 return stream; 845 return stream;
846 } 846 }
OLDNEW
« no previous file with comments | « include/core/SkStream.h ('k') | tests/StreamTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698