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

Side by Side Diff: trunk/src/core/SkFontStream.cpp

Issue 12465009: rewind at the start of each FontStream api (since we rewinding internally anyway) (Closed) Base URL: http://skia.googlecode.com/svn/
Patch Set: Created 7 years, 9 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 | « trunk/src/core/SkFontStream.h ('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 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
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 #include "SkEndian.h" 8 #include "SkEndian.h"
9 #include "SkFontStream.h" 9 #include "SkFontStream.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 SfntHeader() : fCount(0), fDir(NULL) {} 82 SfntHeader() : fCount(0), fDir(NULL) {}
83 ~SfntHeader() { sk_free(fDir); } 83 ~SfntHeader() { sk_free(fDir); }
84 84
85 /** If it returns true, then fCount and fDir are properly initialized. 85 /** If it returns true, then fCount and fDir are properly initialized.
86 Note: fDir will point to the raw array of SkSFNTDirEntry values, 86 Note: fDir will point to the raw array of SkSFNTDirEntry values,
87 meaning they will still be in the file's native endianness (BE). 87 meaning they will still be in the file's native endianness (BE).
88 88
89 fDir will be automatically freed when this object is destroyed 89 fDir will be automatically freed when this object is destroyed
90 */ 90 */
91 bool init(SkStream* stream) { 91 bool init(SkStream* stream) {
92 stream->rewind();
93
92 size_t offsetToDir; 94 size_t offsetToDir;
93 fCount = count_tables(stream, &offsetToDir); 95 fCount = count_tables(stream, &offsetToDir);
94 if (0 == fCount) { 96 if (0 == fCount) {
95 return false; 97 return false;
96 } 98 }
97 99
98 stream->rewind(); 100 stream->rewind();
99 if (stream->skip(offsetToDir) != offsetToDir) { 101 if (stream->skip(offsetToDir) != offsetToDir) {
100 return false; 102 return false;
101 } 103 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 160 }
159 if (stream->read(data, length) != length) { 161 if (stream->read(data, length) != length) {
160 return 0; 162 return 0;
161 } 163 }
162 } 164 }
163 return length; 165 return length;
164 } 166 }
165 } 167 }
166 return 0; 168 return 0;
167 } 169 }
OLDNEW
« no previous file with comments | « trunk/src/core/SkFontStream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698