aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkStream.cpp
Commit message (Collapse)AuthorAge
* Repurpose Release_Developer BUILDTYPE and remove SK_DEVELOPER.Gravatar djsollen2016-04-29
| | | | | | | | | | | | | The Release_Developer build type is now used to build Skia with release level optimizations but still enable SK_DEBUG. This in turn means that SkASSERTS and SkRTConf are available in this mode. Further we can then remove SK_DEVELOPER as a define as it is true iff SK_DEBUG is true. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1931903002 DOCS_PREVIEW= https://skia.org/?cl=1931903002 Review-Url: https://codereview.chromium.org/1931903002
* Revert of Repurpose Release_Developer BUILDTYPE and remove SK_DEVELOPER. ↵Gravatar reed2016-04-28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #2 id:20001 of https://codereview.chromium.org/1927583002/ ) Reason for revert: still blocking DEPS roll Original issue's description: > Repurpose Release_Developer BUILDTYPE and remove SK_DEVELOPER. > > The Release_Developer build type is now used to build Skia with > release level optimizations but still enable SK_DEBUG. This in turn > means that SkASSERTS and SkRTConf are available in this mode. > > Further we can then remove SK_DEVELOPER as a define as it is true > iff SK_DEBUG is true. > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1927583002 > DOCS_PREVIEW= https://skia.org/?cl=1927583002 > > Committed: https://skia.googlesource.com/skia/+/48d6f88479e72efaf9b9d8f9c0769acb1ba773db TBR=bungeman@gmail.com,bungeman@google.com,benjaminwagner@google.com,djsollen@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review-Url: https://codereview.chromium.org/1918253006
* Repurpose Release_Developer BUILDTYPE and remove SK_DEVELOPER.Gravatar djsollen2016-04-27
| | | | | | | | | | | | | The Release_Developer build type is now used to build Skia with release level optimizations but still enable SK_DEBUG. This in turn means that SkASSERTS and SkRTConf are available in this mode. Further we can then remove SK_DEVELOPER as a define as it is true iff SK_DEBUG is true. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1927583002 DOCS_PREVIEW= https://skia.org/?cl=1927583002 Review-Url: https://codereview.chromium.org/1927583002
* SkWStream::writeText inlined.Gravatar halcanary2016-04-11
| | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: This function is used throughout SkPDF. Note that the compiler can usually inline the result of strlen() for literal strings. Before: out/Release/nanobench -m WStreamWriteText -q Timer overhead: 24.2ns ! -> high variance, ? -> moderate variance micros bench 6.10 WStreamWriteText nonrendering After: out/Release/nanobench -m WStreamWriteText -q Timer overhead: 23.9ns ! -> high variance, ? -> moderate variance micros bench 2.51 WStreamWriteText nonrendering PDF runtime change: -0.8% ±0.04%. GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1844343004 Review URL: https://codereview.chromium.org/1844343004
* Style bikeshed - remove extraneous whitespaceGravatar halcanary2016-03-29
| | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1842753002 Review URL: https://codereview.chromium.org/1842753002
* detach -> releaseGravatar mtklein2016-03-16
| | | | | | | | | | | | | The C++ standard library uses the name "release" for the operation we call "detach". Rewriting each "detach(" to "release(" brings us a step closer to using standard library types directly (e.g. std::unique_ptr instead of SkAutoTDelete). This was a fairly blind transformation. There may have been unintentional conversions in here, but it's probably for the best to have everything uniformly say "release". BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1809733002 Review URL: https://codereview.chromium.org/1809733002
* Make sp variants for SkDataGravatar reed2016-03-11
| | | | Review URL: https://codereview.chromium.org/1779263003
* Revert of Consolidate SkStream copying methods (patchset #1 id:1 of ↵Gravatar msarett2016-01-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | https://codereview.chromium.org/1640793002/ ) Reason for revert: Test to see if this fixes the bots. Original issue's description: > Consolidate SkStream copying methods > > Make SkCopyStreamToData call SkStreamCopy, removing duplicate code. > > The former still has its own method of copying with a length, since > it saves one copy. > > BUG=skia:4788 > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1640793002 > > Committed: https://skia.googlesource.com/skia/+/440c5a98dee428c661b77d149e30c794d264b8cd TBR=halcanary@google.com,scroggo@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4788 Review URL: https://codereview.chromium.org/1641853002
* Consolidate SkStream copying methodsGravatar scroggo2016-01-27
| | | | | | | | | | | | Make SkCopyStreamToData call SkStreamCopy, removing duplicate code. The former still has its own method of copying with a length, since it saves one copy. BUG=skia:4788 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1640793002 Review URL: https://codereview.chromium.org/1640793002
* SkStream/Priv cleanupsGravatar scroggo2016-01-19
| | | | | | | | | | | | Replace all callers of SkCopyStreamToStorage with SkCopyStreamToData, which is simpler and does the same thing. Remove SkStreamRewindableFromSkStream, which is unused. BUG=skia:4788 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1604963002 Review URL: https://codereview.chromium.org/1604963002
* add fsync to try to get complete skps from webpage picture captureGravatar caryclark2015-12-16
| | | | | | | | R=reed@google.com,mtklein@google.com BUG=skia:4691 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1530783003 Review URL: https://codereview.chromium.org/1530783003
* Allow SkStream::peek() to partially succeedGravatar scroggo2015-12-07
| | | | | | | | | | | | | | | | | | | | If the stream can peek less than requested, peek that amount. Return the number of bytes peeked. This simplifies crrev.com/1472123002. For a stream that is smaller than 14 bytes, it can successfully peek, meaning the client will not need to fall back to read() + rewind(), which may fail if the stream can peek but not rewind. This CL revives code from patch set 3 of crrev.com/1044953002, where I initially introduced peek() (including tests). Add a test for SkFrontBufferedStream that verifies that peeking does not make rewind() fail (i.e. by reading past the internal buffer). BUG=skia:3257 Review URL: https://codereview.chromium.org/1490923005
* Eliminate SkFILE: it always is the same as FILE.Gravatar halcanary2015-11-20
| | | | Review URL: https://codereview.chromium.org/1467533003
* Modifications to get 'blaze build -c opt //third_party/skia/HEAD/...' to work.Gravatar benjaminwagner2015-10-19
| | | | | | BUG=skia: Review URL: https://codereview.chromium.org/1413973002
* SkBlockMemoryStream: correct test in getMemoryBase().Gravatar halcanary2015-09-28
| | | | | | | | | The test "nullptr == fBlockMemory->fHead->fNext" tests that all of the data is in one block, but it is also necessary to test "fBlockMemory->fHead" to ensure that there is a first block with data in it. Review URL: https://codereview.chromium.org/1374493002
* Style Change: NULL->nullptrGravatar halcanary2015-08-27
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002
* Style Change: SkNEW->new; SkDELETE->deleteGravatar halcanary2015-08-26
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316123003 Review URL: https://codereview.chromium.org/1316123003
* SkPDF/Deflate: clean up old SkFlate codeGravatar halcanary2015-08-18
| | | | | | | | Factor out some of https://crrev.com/1227913008 BUG=skia:3030 Review URL: https://codereview.chromium.org/1298243002
* SkBlockMemoryStream implements peek()Gravatar halcanary2015-05-21
| | | | Review URL: https://codereview.chromium.org/1146903004
* Add a method to read a stream without advancing it.Gravatar scroggo2015-04-02
| | | | | | | | | | | | | | | | | | | | | Add a virtual method on SkStream which will do a "peek" some bytes, so that those bytes are read, but the next call to read will be unaffected. Implement peek for SkMemoryStream, where the implementation is simple and obvious. Implement peek on SkFrontBufferedStream. Add tests. Motivated by decoding streams which cannot be rewound. TBR=reed@google.com BUG=skia:3257 Review URL: https://codereview.chromium.org/1044953002
* C++11 override should now be supported by all of {bots,Chrome,Android,Mozilla}Gravatar mtklein2015-03-25
| | | | | | | | | NOPRESUBMIT=true BUG=skia: DOCS_PREVIEW= https://skia.org/?cl=1037793002 Review URL: https://codereview.chromium.org/1037793002
* SkStream: Add SkDynamicMemoryWStream::writeToStream(SkWStream*)Gravatar halcanary2015-02-23
| | | | Review URL: https://codereview.chromium.org/943423002
* Make SkStream *not* ref counted.Gravatar scroggo2015-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SkStream is a stateful object, so it does not make sense for it to have multiple owners. Make SkStream inherit directly from SkNoncopyable. Update methods which previously called SkStream::ref() (e.g. SkImageDecoder::buildTileIndex() and SkFrontBufferedStream::Create(), which required the existing owners to call SkStream::unref()) to take ownership of their SkStream parameters and delete when done (including on failure). Switch all SkAutoTUnref<SkStream>s to SkAutoTDelete<SkStream>s. In some cases this means heap allocating streams that were previously stack allocated. Respect ownership rules of SkTypeface::CreateFromStream() and SkImageDecoder::buildTileIndex(). Update the comments for exceptional methods which do not affect the ownership of their SkStream parameters (e.g. SkPicture::CreateFromStream() and SkTypeface::Deserialize()) to be explicit about ownership. Remove test_stream_life, which tested that buildTileIndex() behaved correctly when SkStream was a ref counted object. The test does not make sense now that it is not. In SkPDFStream, remove the SkMemoryStream member. Instead of using it, create a new SkMemoryStream to pass to fDataStream (which is now an SkAutoTDelete). Make other pdf rasterizers behave like SkPDFDocumentToBitmap. SkPDFDocumentToBitmap delete the SkStream, so do the same in the following pdf rasterizers: SkPopplerRasterizePDF SkNativeRasterizePDF SkNoRasterizePDF Requires a change to Android, which currently treats SkStreams as ref counted objects. Review URL: https://codereview.chromium.org/849103004
* Fix up all the easy virtual ... SK_OVERRIDE cases.Gravatar mtklein2015-01-09
| | | | | | | | | | | | This fixes every case where virtual and SK_OVERRIDE were on the same line, which should be the bulk of cases. We'll have to manually clean up the rest over time unless I level up in regexes. for f in (find . -type f); perl -p -i -e 's/virtual (.*)SK_OVERRIDE/\1SK_OVERRIDE/g' $f; end BUG=skia: Review URL: https://codereview.chromium.org/806653007
* for X in {Dec,BigDec,Scalar}, SkWStream::write"X"AsText no longer mallocsGravatar halcanary2014-11-07
| | | | Review URL: https://codereview.chromium.org/706063002
* use SkData::NewUninitializedGravatar reed2014-09-12
| | | | | | | | | BUG=skia: R=bungeman@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/565803005
* remove confusing/unused stream methodsGravatar reed2014-09-12
| | | | | | | | | BUG=skia: R=bungeman@google.com, djsollen@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/563273003
* SkData can allocate room for its contents in the same blockGravatar reed2014-09-11
| | | | | | | | | BUG=skia: R=bungeman@google.com, mtklein@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/560653004
* "NULL !=" = NULLGravatar bsalomon2014-09-05
| | | | | | | | R=reed@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/544233002
* Move SkPDFStream back to SkStream to save memory.Gravatar halcanary2014-07-14
| | | | | | | | | | | | | | | SkPDFStream stores data as a SkStreamRewindable to minimize deep duplication and memory overhead. SkStreamToStreamRewindable function to deal with fact that SkTypeface returns a SkStream. BUG=skia:2743 R=djsollen@google.com, mtklein@google.com, bungeman@google.com, reed@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/387863005
* Switch SkPDFStream's internal storage from SkStream to SkDataGravatar halcanary2014-06-27
| | | | | | | | | | | | | | | | | | | 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, rmistry@google.com, robertphillips@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/340783013
* fix size_t/int warningsGravatar commit-bot@chromium.org2014-04-23
| | | | | | | | | | | BUG=skia: R=mtklein@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/247753003 git-svn-id: http://skia.googlecode.com/svn/trunk@14332 2bbb7eff-a529-9590-31e7-b0007b416f81
* Actually, we wrote only size bytes.Gravatar commit-bot@chromium.org2014-03-06
| | | | | | | | | | | BUG=skia: R=halcanary@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/188343004 git-svn-id: http://skia.googlecode.com/svn/trunk@13688 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add size_t bytesWritten() const to SkWStream.Gravatar commit-bot@chromium.org2014-03-06
| | | | | | | | | | | BUG=skia: R=reed@google.com, mtklein@google.com, robertphillips@google.com, bungeman@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/187653003 git-svn-id: http://skia.googlecode.com/svn/trunk@13684 2bbb7eff-a529-9590-31e7-b0007b416f81
* This CL is motivated by the desire to make the skpinfo tool work a bit ↵Gravatar commit-bot@chromium.org2014-03-05
| | | | | | | | | | | | better. The main concern is that the assumptions made w.r.t. written bytes may not be valid for all SkWStream sub-classes. R=bungeman@gmail.com, bungeman@google.com, reed@google.com, mtklein@google.com Author: robertphillips@google.com Review URL: https://codereview.chromium.org/182733008 git-svn-id: http://skia.googlecode.com/svn/trunk@13673 2bbb7eff-a529-9590-31e7-b0007b416f81
* Prevent SkBlockMemoryStream::skip from writing to low memory.Gravatar bungeman@google.com2014-03-05
| | | | | | | | | | | | | | SkBlockMemoryStream::read was modeled on SkDynamicMemoryWStream::read. However, SkDynamicMemoryWStream::read does not allow passing a NULL buffer and SkBlockMemoryStream::read must correctly handle this case for skips. In the current code, if a 'skip' crosses a block boundary, 'read' may attempt to write to low memory. R=robertphillips@google.com Review URL: https://codereview.chromium.org/187683003 git-svn-id: http://skia.googlecode.com/svn/trunk@13671 2bbb7eff-a529-9590-31e7-b0007b416f81
* DM: read image files without an extra copyGravatar commit-bot@chromium.org2014-03-05
| | | | | | | | | | | BUG=skia: R=halcanary@google.com, reed@google.com, bsalomon@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/185263012 git-svn-id: http://skia.googlecode.com/svn/trunk@13669 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fix compilation with SK_ENABLE_INST_COUNT=1Gravatar commit-bot@chromium.org2013-12-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add INHERITED declarations to class declarations that prevent compilation with the flag. Remove SK_DEFINE_INST_COUNT from all class implementations. Instead, use function-local static variables in the reference count helper classes to create the global instances to store the needed info. The accessor functions are defined inline in the helper classes, so definitions are not needed. The initialization point of the variables should be as well defined as previously. Remove SK_DECLARE_INST_COUNT_TEMPLATE and use SK_DECLARE_INST_COUNT instead. This avoids possible future compilation errors further. For SK_ENABLE_INST_COUNT=0 compilation, add an empty static member function to all classes that use SK_DECLARE_INST_COUNT and SK_DECLARE_INST_COUNT_ROOT macros. The function ensures that classes contain public INHERITED typedef. This member function seems to be compiled away. This shouĺd ensure that part of the compilation errors are caught earlier. Also adds DSK_DECLARE_INST_COUNT to few SkPDFDict subclasses. R=robertphillips@google.com, richardlin@chromium.org, bsalomon@google.com Author: kkinnunen@nvidia.com Review URL: https://codereview.chromium.org/98703002 git-svn-id: http://skia.googlecode.com/svn/trunk@12501 2bbb7eff-a529-9590-31e7-b0007b416f81
* SkMemoryStream::setData should also set the current offset to 0.Gravatar bungeman@google.com2013-11-18
| | | | | | | | R=scroggo@google.com Review URL: https://codereview.chromium.org/73273004 git-svn-id: http://skia.googlecode.com/svn/trunk@12308 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add a detachAsStream to SkDynamicMemoryWStream.Gravatar bungeman@google.com2013-07-19
| | | | | | | | | | | | R=reed@google.com Committed: https://code.google.com/p/skia/source/detail?r=10171 Committed: https://code.google.com/p/skia/source/detail?r=10178 Review URL: https://codereview.chromium.org/19677002 git-svn-id: http://skia.googlecode.com/svn/trunk@10218 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add a detachAsStream to SkDynamicMemoryWStream.Gravatar bungeman@google.com2013-07-19
| | | | | | | | | | R=reed@google.com Committed: https://code.google.com/p/skia/source/detail?r=10171 Review URL: https://codereview.chromium.org/19677002 git-svn-id: http://skia.googlecode.com/svn/trunk@10178 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert r10171 due to test failure in StreamTestGravatar robertphillips@google.com2013-07-18
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@10172 2bbb7eff-a529-9590-31e7-b0007b416f81
* Add a detachAsStream to SkDynamicMemoryWStream.Gravatar bungeman@google.com2013-07-18
| | | | | | | | R=reed@google.com Review URL: https://codereview.chromium.org/19677002 git-svn-id: http://skia.googlecode.com/svn/trunk@10171 2bbb7eff-a529-9590-31e7-b0007b416f81
* Change SkStream.Gravatar bungeman@google.com2013-05-29
| | | | | | | https://codereview.chromium.org/15298009/ git-svn-id: http://skia.googlecode.com/svn/trunk@9312 2bbb7eff-a529-9590-31e7-b0007b416f81
* Move MMap to SkData.Gravatar commit-bot@chromium.org2013-04-24
| | | | | | | | | | R=reed@google.com Author: bungeman@google.com Review URL: https://chromiumcodereview.appspot.com/14336003 git-svn-id: http://skia.googlecode.com/svn/trunk@8848 2bbb7eff-a529-9590-31e7-b0007b416f81
* Sanitizing source files in Skia_Periodic_House_KeepingGravatar skia.committer@gmail.com2013-03-19
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8211 2bbb7eff-a529-9590-31e7-b0007b416f81
* update coding styleGravatar mike@reedtribe.org2013-03-19
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8209 2bbb7eff-a529-9590-31e7-b0007b416f81
* reland 8200 w/ fix for android (use fullpath instead of path)Gravatar reed@google.com2013-03-18
| | | | | | Review URL: https://codereview.chromium.org/12921003 git-svn-id: http://skia.googlecode.com/svn/trunk@8206 2bbb7eff-a529-9590-31e7-b0007b416f81
* revert 8204 -- what is happening???Gravatar reed@google.com2013-03-18
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8205 2bbb7eff-a529-9590-31e7-b0007b416f81
* reland 8200 w/ fix for android (need fullpath instead of path)Gravatar reed@google.com2013-03-18
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8204 2bbb7eff-a529-9590-31e7-b0007b416f81