Index: src/core/SkStream.cpp |
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp |
index ff14a8b26f5606bbd576043e6729349bdbdcaf43..fe6728d7c270bdb083325eb10dcfdaa890561b57 100644 |
--- a/src/core/SkStream.cpp |
+++ b/src/core/SkStream.cpp |
@@ -87,16 +87,16 @@ bool SkWStream::writeText(const char text[]) |
bool SkWStream::writeDecAsText(int32_t dec) |
{ |
- SkString tmp; |
- tmp.appendS32(dec); |
- return this->write(tmp.c_str(), tmp.size()); |
+ char buffer[SkStrAppendS32_MaxSize]; |
reed1
2014/11/06 21:45:09
does the buffer need to be this const + 1, to have
hal.canary
2014/11/06 22:26:30
SkWStream::write(void*, size_t) doesn't need a ter
reed1
2014/11/07 14:52:28
Ah, right.
I'll add some dox so I can remind myse
|
+ char* stop = SkStrAppendS32(buffer, dec); |
+ return this->write(buffer, stop - buffer); |
} |
bool SkWStream::writeBigDecAsText(int64_t dec, int minDigits) |
{ |
- SkString tmp; |
- tmp.appendS64(dec, minDigits); |
- return this->write(tmp.c_str(), tmp.size()); |
+ char buffer[SkStrAppendU64_MaxSize]; |
+ char* stop = SkStrAppendU64(buffer, dec, minDigits); |
+ return this->write(buffer, stop - buffer); |
} |
bool SkWStream::writeHexAsText(uint32_t hex, int digits) |
@@ -108,9 +108,9 @@ bool SkWStream::writeHexAsText(uint32_t hex, int digits) |
bool SkWStream::writeScalarAsText(SkScalar value) |
{ |
- SkString tmp; |
- tmp.appendScalar(value); |
- return this->write(tmp.c_str(), tmp.size()); |
+ char buffer[SkStrAppendScalar_MaxSize]; |
+ char* stop = SkStrAppendScalar(buffer, value); |
+ return this->write(buffer, stop - buffer); |
} |
bool SkWStream::write8(U8CPU value) { |