aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFStream.h
Commit message (Collapse)AuthorAge
* SkPDF: Simplify PDFStream / emitObject() constGravatar halcanary2015-08-19
| | | | | | | | | | Compress SkPDFStream's data on setData(), not emitObject(); no longer stateful. SkPDFObject::emitObject is now const. This makes it easier to reason about state. Minimal performance gains. Review URL: https://codereview.chromium.org/1304493002
* remove SkInstCntGravatar mtklein2015-06-26
| | | | | | | | | | | | | | It's been outclassed by Valgrind and leak sanitizer, and it seems to be causing problems for external folks building Skia. I'm not sure why our own builds seem unaffected. Latest thread: https://groups.google.com/forum/#!topic/skia-discuss/oj9FsQwwSF0 BUG=skia: Review URL: https://codereview.chromium.org/1217573002
* Update more directories under src/ to follow C++11 style rule for ↵Gravatar tfarina2015-04-27
| | | | | | | | | | | | | | | | | | | | {virtual,override}. The Google style guide states that only one of {virtual,override,final} should be used for each declaration, since override implies virtual and final implies both virtual and override. The entries were found using the following command line: $ find src/ -iname "*.h" -o -iname "*.cpp" | xargs pcregrep -M "[^\n/]+virtual\ [^;{]+\ [a-zA-Z0-9_]+\([^;{]+\ override[ \n]*[;{]" The regex was a courtesy of nick@chromium.org BUG=None R=mtklein@google.com Review URL: https://codereview.chromium.org/1110013002
* SkPDF: Factor SkPDFCatalog into SkPDFObjNumMap and SkPDFSubstituteMapGravatar halcanary2015-03-31
| | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: Keep separate features separate. Also, future linearization work will need to have several objNumMap objects share a substituteMap. Also "catalog" has a specific meaning in PDF. This catalog did not map to that catalog. - Modify SkPDFObject::emitObject and SkPDFObject::addResources interface to requiore SkPDFObjNumMap and SkPDFSubstituteMap. - SkPDFObjNumMap const in SkPDFObject::emitObject. - Remove SkPDFCatalog.cpp/.h - Modify SkDocument_PDF.cpp to use new functions - Fold in SkPDFStream::populate - Fold in SkPDFBitmap::emitDict - Move SkPDFObjNumMap and SkPDFSubstituteMap to SkPDFTypes.h - Note (via assert) that SkPDFArray & SkPDFDict don't need to check substitutes. - Remove extra space from SkPDFDict serialization. - SkPDFBitmap SkPDFType0Font SkPDFGraphicState SkPDFStream updated to new interface. - PDFPrimitivesTest updated for new interface. BUG=skia:3585 Review URL: https://codereview.chromium.org/1049753002
* SkPDF: remove SK_NO_FLATE & dead code in SkPDFStreamGravatar halcanary2015-03-31
| | | | | | | | | | | | SkPDFStream copy constructor SkPDFStream Substitute mechanism SkPDFStream::setData(NULL); SkPDFStream SK_NO_FLATE logic BUG=skia:3585 TBR=bsalomon@google.com,reed@google.com Review URL: https://codereview.chromium.org/1041183002
* 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
* PDF: remove unnecessary mutexes.Gravatar halcanary2015-02-20
| | | | | | | | We now force all SkPDFObjects to stay on one thread. TBR=mtklein@google.com Review URL: https://codereview.chromium.org/942153002
* 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
* In SkPDFDocument::emitPDF(), stop pre-calculating file offsets.Gravatar halcanary2015-01-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add Streamer utility class which measures the current pdf offset by calling SkWStream::bytesWritten(). Calls SkPDFCatalog::setFileOffset() and SkPDFObject::emit() at the same time to guarantee that everything works out. * SkPDFCatalog::setFileOffset() no longer calculates the object's size. * SkPDFCatalog::setSubstituteResourcesOffsets() removed. * SkPDFCatalog::emitSubstituteResources() removed and getSubstituteList() made public in its place. * Remove SkPDFPage::getPageSize and SkPDFPage::emitPage. Replace with SkPDFPage::getContentStream(). * SkPDFObject::getOutputSize no longer virtual, only used in unit tests. All SkPDFObject subclasses getOutputSize() overrides removed. * SkPDFObject::getIndirectOutputSize removed. * PDFPrimitivesTest updated for new functions. Review URL: https://codereview.chromium.org/846023003
* Change function signature of SkPDFObject::emitObject.Gravatar halcanary2015-01-12
| | | | | | | | | | | | | Replace virutal SkPDFObject::emitObject(s, c, true) with non-virtual SkPDFObject::emitIndirectObject(s, c), since none of the subclasses do (or should do) anything different. Replace object->emitObject(s, c, false) with object->emitObject(s, c) This is one step in simplifying the SkPDFObject interface to allow for the next step in refactoring. Review URL: https://codereview.chromium.org/827733004
* 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
* Add lock to SkPDFDictGravatar halcanary2014-06-27
| | | | | | | | | | | | Add mutex lock to all functions. Remove dictionary iterator, and replace with new thread-safe functions. BUG=skia:2683 R=mtklein@google.com, djsollen@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/360473005
* Revert of Switch SkPDFStream's internal storage from SkStream to SkData ↵Gravatar rmistry2014-06-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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
* Switch SkPDFStream's internal storage from SkStream to SkDataGravatar halcanary2014-06-26
| | | | | | | | | | | | | | | | 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 R=mtklein@google.com, djsollen@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/340783013
* 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
* [PDF] Fix printing crashes caused by font streams that don't support ↵Gravatar vandebo@chromium.org2013-08-26
| | | | | | | | | | | | | getMemoryBase(). An apparently recently change started putting web fonts into SkStream objects that don't support getMemoryBase(). This change uses writeStream to avoid needing to call getMemoryBase(). BUG=chromium:274440 R=bungeman@google.com Review URL: https://codereview.chromium.org/23437004 git-svn-id: http://skia.googlecode.com/svn/trunk@10928 2bbb7eff-a529-9590-31e7-b0007b416f81
* Added SkPDFStream::setData(SkData*) in preparation for move from SkStream to ↵Gravatar commit-bot@chromium.org2013-07-08
| | | | | | | | | | | | 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
* Sanitizing source files in Skia_Periodic_House_KeepingGravatar skia.committer@gmail.com2013-04-25
| | | | git-svn-id: http://skia.googlecode.com/svn/trunk@8851 2bbb7eff-a529-9590-31e7-b0007b416f81
* Encode images with DCTDecode (JPEG) in PDFs if it makes sense. Fallback to ↵Gravatar edisonn@google.com2013-04-24
| | | | | | | | | FlateDecode (zip) if it makes sense. Otherewise include uncompressed stream. This change will reduce the size of PDFs to 50% (in the case of the existing SKPs, we reduce the total size of PDFs from 105MB to 50MB) Review URL: https://codereview.appspot.com/7068055 git-svn-id: http://skia.googlecode.com/svn/trunk@8835 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove SkRefPtrGravatar vandebo@chromium.org2013-01-04
| | | | | | | | | (resubmit of https://codereview.appspot.com/7030059/) TBR=junov@google.com Review URL: https://codereview.appspot.com/7030065 git-svn-id: http://skia.googlecode.com/svn/trunk@7030 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "Remove SkRefPtr" - r7021Gravatar vandebo@chromium.org2013-01-04
| | | | | | | | samplecode/ still needs to be updated. Review URL: https://codereview.appspot.com/7032048 git-svn-id: http://skia.googlecode.com/svn/trunk@7022 2bbb7eff-a529-9590-31e7-b0007b416f81
* Remove SkRefPtrGravatar vandebo@chromium.org2013-01-04
| | | | | | Review URL: https://codereview.appspot.com/7030059 git-svn-id: http://skia.googlecode.com/svn/trunk@7021 2bbb7eff-a529-9590-31e7-b0007b416f81
* [PDF] Move most of the headers to be private.Gravatar vandebo@chromium.org2012-03-22
| | | | | | | | | | Compute font stats in SkPDFDocument in order to make more of the headers private. Previous review: https://codereview.appspot.com/5868049/ Review URL: https://codereview.appspot.com/5875049 git-svn-id: http://skia.googlecode.com/svn/trunk@3470 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "[PDF] Move most of the headers to be private."Gravatar vandebo@chromium.org2012-03-21
| | | | | | | | | | This reverts r3457 TBR=epoger@google.com Review URL: https://codereview.appspot.com/5866051 git-svn-id: http://skia.googlecode.com/svn/trunk@3458 2bbb7eff-a529-9590-31e7-b0007b416f81
* [PDF] Move most of the headers to be private.Gravatar vandebo@chromium.org2012-03-21
| | | | | | | | | | Compute font stats in SkPDFDocument in order to make more of the headers private. Previous review: https://codereview.appspot.com/5865048/ Review URL: https://codereview.appspot.com/5868049 git-svn-id: http://skia.googlecode.com/svn/trunk@3457 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "[PDF] Move most of the headers to be private."Gravatar vandebo@chromium.org2012-03-21
| | | | | | | | | | This reverts r3453 TBR=epoger@google.com Review URL: https://codereview.appspot.com/5869048 git-svn-id: http://skia.googlecode.com/svn/trunk@3454 2bbb7eff-a529-9590-31e7-b0007b416f81
* [PDF] Move most of the headers to be private.Gravatar vandebo@chromium.org2012-03-21
Compute font stats in SkPDFDocument in order to make more of the headers private. Review URL: https://codereview.appspot.com/5865048 git-svn-id: http://skia.googlecode.com/svn/trunk@3453 2bbb7eff-a529-9590-31e7-b0007b416f81