Added SkPDFStream::setData(SkData*) in preparation for move from SkStream to SkData

R=vandebo@chromium.org, edisonn@google.com

Author: richardlin@chromium.org

Review URL: https://chromiumcodereview.appspot.com/18328026

git-svn-id: http://skia.googlecode.com/svn/trunk@9916 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
commit-bot@chromium.org 2013-07-08 23:17:57 +00:00
parent a7df69865c
commit d8d976e7d2
2 changed files with 8 additions and 3 deletions

View File

@ -25,9 +25,7 @@ SkPDFStream::SkPDFStream(SkStream* stream)
}
SkPDFStream::SkPDFStream(SkData* data) : fState(kUnused_State) {
SkMemoryStream* stream = new SkMemoryStream;
stream->setData(data);
fData.reset(stream); // Transfer ownership.
setData(data);
}
SkPDFStream::SkPDFStream(const SkPDFStream& pdfStream)
@ -84,6 +82,12 @@ size_t SkPDFStream::getOutputSize(SkPDFCatalog* catalog, bool indirect) {
SkPDFStream::SkPDFStream() : fState(kUnused_State) {}
void SkPDFStream::setData(SkData* data) {
SkMemoryStream* stream = new SkMemoryStream;
stream->setData(data);
fData.reset(stream); // Transfer ownership.
}
void SkPDFStream::setData(SkStream* stream) {
fData.reset(stream);
SkSafeRef(stream);

View File

@ -68,6 +68,7 @@ protected:
return fSubstitute.get();
}
void setData(SkData* data);
void setData(SkStream* stream);
SkStream* getData() {