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

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

Issue 73273004: SkMemoryStream::setData should also set the current offset to 0. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 | « no previous file | 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 /* 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 } 357 }
358 358
359 SkData* SkMemoryStream::setData(SkData* data) { 359 SkData* SkMemoryStream::setData(SkData* data) {
360 fData->unref(); 360 fData->unref();
361 if (NULL == data) { 361 if (NULL == data) {
362 fData = SkData::NewEmpty(); 362 fData = SkData::NewEmpty();
363 } else { 363 } else {
364 fData = data; 364 fData = data;
365 fData->ref(); 365 fData->ref();
366 } 366 }
367 fOffset = 0;
367 return data; 368 return data;
368 } 369 }
369 370
370 void SkMemoryStream::skipToAlign4() { 371 void SkMemoryStream::skipToAlign4() {
371 // cast to remove unary-minus warning 372 // cast to remove unary-minus warning
372 fOffset += -(int)fOffset & 0x03; 373 fOffset += -(int)fOffset & 0x03;
373 } 374 }
374 375
375 size_t SkMemoryStream::read(void* buffer, size_t size) { 376 size_t SkMemoryStream::read(void* buffer, size_t size) {
376 size_t dataSize = fData->size(); 377 size_t dataSize = fData->size();
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 838
838 // If we get here, then our attempt at using mmap failed, so try normal 839 // If we get here, then our attempt at using mmap failed, so try normal
839 // file access. 840 // file access.
840 SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path)); 841 SkFILEStream* stream = SkNEW_ARGS(SkFILEStream, (path));
841 if (!stream->isValid()) { 842 if (!stream->isValid()) {
842 stream->unref(); 843 stream->unref();
843 stream = NULL; 844 stream = NULL;
844 } 845 }
845 return stream; 846 return stream;
846 } 847 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698