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

Side by Side Diff: src/images/SkImageRef_ashmem.cpp

Issue 15179008: Add buffer helper to read directly into SkString to avoid extra copying (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebasing Created 7 years, 7 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 | « src/core/SkPaintOptionsAndroid.cpp ('k') | 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 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 #include "SkImageRef_ashmem.h" 8 #include "SkImageRef_ashmem.h"
9 #include "SkImageDecoder.h" 9 #include "SkImageDecoder.h"
10 #include "SkFlattenableBuffers.h" 10 #include "SkFlattenableBuffers.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 buffer.writeString(getURI()); 216 buffer.writeString(getURI());
217 } 217 }
218 218
219 SkImageRef_ashmem::SkImageRef_ashmem(SkFlattenableReadBuffer& buffer) 219 SkImageRef_ashmem::SkImageRef_ashmem(SkFlattenableReadBuffer& buffer)
220 : INHERITED(buffer) { 220 : INHERITED(buffer) {
221 fRec.fFD = -1; 221 fRec.fFD = -1;
222 fRec.fAddr = NULL; 222 fRec.fAddr = NULL;
223 fRec.fSize = 0; 223 fRec.fSize = 0;
224 fRec.fPinned = false; 224 fRec.fPinned = false;
225 fCT = NULL; 225 fCT = NULL;
226 char* uri = buffer.readString(); 226
227 if (uri) { 227 SkString uri;
228 setURI(uri); 228 buffer.readString(&uri);
229 sk_free(uri); 229 this->setURI(uri);
230 }
231 } 230 }
OLDNEW
« no previous file with comments | « src/core/SkPaintOptionsAndroid.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698