Lines Matching refs:stream

44 bool find_name_and_attributes(SkStream* stream, SkString* name,
59 SkMMAPStream stream(fullpath.c_str());
60 if (stream.getLength() > 0) {
61 return find_name_and_attributes(&stream, name, style, isFixedWidth);
64 SkFILEStream stream(fullpath.c_str());
65 if (stream.getLength() > 0) {
66 return find_name_and_attributes(&stream, name, style, isFixedWidth);
76 static SkTypeface* deserializeLocked(SkStream* stream);
83 static SkTypeface* createTypefaceFromStreamLocked(SkStream* stream);
344 StreamTypeface(Style style, bool sysFont, SkStream* stream, bool isFixedWidth)
346 SkASSERT(stream);
347 stream->ref();
348 fStream = stream;
357 // we just ref our existing stream, since the caller will call unref()
360 // must rewind each time, since the caller assumes a "new" stream
382 SkStream* stream = SkNEW_ARGS(SkMMAPStream, (fPath.c_str()));
385 if (stream->getLength() <= 0) {
386 SkDELETE(stream);
388 stream = SkNEW_ARGS(SkFILEStream, (fPath.c_str()));
389 if (stream->getLength() <= 0) {
390 SkDELETE(stream);
391 stream = NULL;
394 return stream;
832 void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream) {
835 stream->writeBool(isCustomFont);
842 stream->write32(len);
844 // store the entire font in the serialized stream
848 stream->write(fontData, len);
857 stream->write8((uint8_t)face->style());
860 stream->writePackedUInt(0);
864 stream->writePackedUInt(len);
865 stream->write(name, len);
871 SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
873 return deserializeLocked(stream);
876 static SkTypeface* deserializeLocked(SkStream* stream) {
880 bool isCustomFont = stream->readBool();
884 // read the length of the custom font from the stream
885 uint32_t len = stream->readU32();
887 // generate a new stream to store the custom typeface
889 stream->read((void*)fontStream->getMemoryBase(), len);
899 int style = stream->readU8();
901 int len = stream->readPackedUInt();
905 stream->read(str.writable_str(), len);
967 SkStream* stream = tf ? tf->openStream() : NULL;
969 if (stream && stream->getLength() == 0) {
970 stream->unref();
971 stream = NULL;
973 return stream;
1059 SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream* stream) {
1061 return createTypefaceFromStreamLocked(stream);
1064 static SkTypeface* createTypefaceFromStreamLocked(SkStream* stream) {
1065 if (NULL == stream || stream->getLength() <= 0) {
1076 if (find_name_and_attributes(stream, NULL, &style, &isFixedWidth)) {
1077 SkTypeface* typeface = SkNEW_ARGS(StreamTypeface, (style, false, stream, isFixedWidth));
1086 SkStream* stream = SkNEW_ARGS(SkMMAPStream, (path));
1087 SkTypeface* face = SkFontHost::CreateTypefaceFromStream(stream);
1088 // since we created the stream, we let go of our ref() here
1089 stream->unref();