diff options
author | 2014-06-26 14:31:06 -0700 | |
---|---|---|
committer | 2014-06-26 14:31:06 -0700 | |
commit | e1c55869f37bf7c5f365fddc38207dc3ec336b6c (patch) | |
tree | 45d546dad6de4ecad012631e557a95afe7509503 /src/pdf/SkPDFImage.cpp | |
parent | c1dfa14b645ae274780f026dd86c9b633fbdad06 (diff) |
Revert of Switch SkPDFStream's internal storage from SkStream to SkData (https://codereview.chromium.org/340783013/)
Reason for revert:
Causes canary failures
Original issue's description:
> Switch SkPDFStream's internal storage from SkStream to SkData
>
> Motivation: This makes SkPDFStream thread-safe for two threads
> serializing it at once, since a SkStream has an internal position.
>
> Updated SkPDFFont, SkPDFGraphicState, and SkPDFPage's use of
> SkPDFStream to use the SkData constructor rather than the SkStream
> constructor (saving a memcpy).
>
> BUG=skia:2683
>
> Committed: https://skia.googlesource.com/skia/+/c1dfa14b645ae274780f026dd86c9b633fbdad06
R=mtklein@google.com, djsollen@google.com, halcanary@google.com
TBR=djsollen@google.com, halcanary@google.com, mtklein@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:2683
Author: rmistry@google.com
Review URL: https://codereview.chromium.org/354043005
Diffstat (limited to 'src/pdf/SkPDFImage.cpp')
-rw-r--r-- | src/pdf/SkPDFImage.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/pdf/SkPDFImage.cpp b/src/pdf/SkPDFImage.cpp index 7e17f98a15..77fd84eff9 100644 --- a/src/pdf/SkPDFImage.cpp +++ b/src/pdf/SkPDFImage.cpp @@ -512,7 +512,7 @@ SkPDFImage::SkPDFImage(SkStream* stream, } if (stream != NULL) { - this->setData(stream); + setData(stream); fStreamValid = true; } else { fStreamValid = false; @@ -598,11 +598,13 @@ bool SkPDFImage::populate(SkPDFCatalog* catalog) { SkAutoTUnref<SkData> data(fEncoder(&pixelRefOffset, subset)); if (data.get() && data->size() < get_uncompressed_size(fBitmap, fSrcRect)) { - this->setData(data.get()); + SkAutoTUnref<SkStream> stream(SkNEW_ARGS(SkMemoryStream, + (data))); + setData(stream.get()); insertName("Filter", "DCTDecode"); insertInt("ColorTransform", kNoColorTransform); - insertInt("Length", this->dataSize()); + insertInt("Length", getData()->getLength()); setState(kCompressed_State); return true; } @@ -611,7 +613,7 @@ bool SkPDFImage::populate(SkPDFCatalog* catalog) { if (!fStreamValid) { SkAutoTUnref<SkStream> stream( extract_image_data(fBitmap, fSrcRect, fIsAlpha, NULL)); - this->setData(stream); + setData(stream); fStreamValid = true; } return INHERITED::populate(catalog); |