aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/pdf/SkPDFShader.h
Commit message (Collapse)AuthorAge
* SkTypes: more into SkMacrosGravatar Hal Canary2018-06-12
| | | | | | | | Change-Id: I4c9a2d81a1bc4ccebc78eea56c0de116b98d415e Reviewed-on: https://skia-review.googlesource.com/134330 Commit-Queue: Hal Canary <halcanary@google.com> Auto-Submit: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* SkPDF: SkPDFMakeShader takes the paint color.Gravatar Hal Canary2017-07-19
| | | | | | | | | | | This allows alpha blending and also alpha shaders with color blended in. fixes GMs: composeshader_alpha, composeshader_bitmap Change-Id: I3ab9cbef216f7733798d2e29541b4211c627dab2 Reviewed-on: https://skia-review.googlesource.com/24760 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
* SkPDF: Change some identifiers.Gravatar Hal Canary2017-07-06
| | | | | | | | | | | s/SkPDFShader::GetPDFShader/SkPDFMakeShader/g s/SkPDFShader::State/SkPDFImageShaderKey/g s/state/key/g Change-Id: I86dc932c3407c73f387c972fb6674dc09ea0be3c Reviewed-on: https://skia-review.googlesource.com/21661 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkPDF: Refactor PDFShader to use ShTHashMap<>Gravatar Hal Canary2017-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | my tests run ~14% faster. - Split out gradient shaders from image shaders. new compilation unit: SkPDFGradientShader - Common functions InverseTransformBBox and PopulateTilingPatternDict moved to SkPDFUtils - Split SkPDFShader::State into image and gradient structures. - SkPDFCanon is now a simpler structure, with no logic of its own. I am considering just moving all of its fields into SkPDFDocument - SkPDFShader::State (the image/fallback shader) now is POD, making the use of a hashmap for canonicalization straightforward. Formerly, we used a linear search. - Do not bother trying to canonicalize the falback image shader. - SkPDFGradientShader::Key is not POD; comparison of two objects requires looking at the contents of two variable-sized arrays. We now pre-calculate the hash of the arrays using SkOpts::hash and store a hash for the object in the fHash field. Using that hash, we can now canonicalize using a hashmap instead of a linar search! - several static functions renamed to follow style guidelines - stop using codeFunction function pointer; I find that less clear than it could be. - operator==() for SkPDFShader::State and SkPDFGradientShader::Key is now much simpler and can now be inlined. - SkArrayEqual template in SkPDFUtils.h No change to PDF output. BUG=skia:3585 Change-Id: I354ad1b600be6d6749abccb58d13db257370bc0b Reviewed-on: https://skia-review.googlesource.com/21376 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkPDF: clean up fRasterDpiGravatar Hal Canary2017-06-30
| | | | | | | | | | | | - PDFDevice no longer has a fRasterDpi; simply queries document. - #define DPI_FOR_RASTER_SCALE_ONE becomes constexpr float. - PDFShader::GetPDFShader no longer takes rasterScale or dpi - Remove un-needed factory functions. We're all adults here. Change-Id: Id2ce75d4e61af385763ccfb1db210465a1600067 Reviewed-on: https://skia-review.googlesource.com/21348 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
* SkPDF: PDFShader code modernized.Gravatar halcanary2016-08-03
| | | | | | | | | | | | | | | | | | | | | | Motivation: reduce code complexity. SkCanon stores SkPDFShader::State next to SkDFObject, not inside. many places use sk_sp<T> rather than T* to represent ownership. SkPDFShader::State no longer holds bitmap. SkPDFShader::State gets move constructor, no longer heap-allocated. Classes removed: SkPDFFunctionShader SkPDFAlphaFunctionShader SkPDFImageShader BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2193973002 Review-Url: https://codereview.chromium.org/2193973002
* SkPDF: PDFStream has-a not is-a PDFDictGravatar halcanary2016-07-29
| | | | | | | | | | | | | | | Motivation: SkPDFStream and SkPDFSharedStream now work the same. Also: - move SkPDFStream into SkPDFTypes (it's a fundamental PDF type). - minor refactor of SkPDFSharedStream - SkPDFSharedStream takes unique_ptr to represent ownership BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2190883003 Review-Url: https://codereview.chromium.org/2190883003
* 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
* SkPDF s/SkAutoTDelete/std::unique_ptr/Gravatar halcanary2016-03-28
| | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1837553002 Review URL: https://codereview.chromium.org/1837553002
* move setshader to sk_sp, re-using SK_SUPPORT_LEGACY_CREATESHADER_PTRGravatar reed2016-03-25
| | | | | | | BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1829303002 Review URL: https://codereview.chromium.org/1829303002
* SkPDF: SkPDFDevice has ptr to SkPDFDocumentGravatar halcanary2016-03-21
| | | | | | | | | This is necessary for pre-serialization of images. BUG=skia:5087 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1802963002 Review URL: https://codereview.chromium.org/1802963002
* SkPDF: remove all globally references SkPDFObjectsGravatar halcanary2016-03-13
| | | | | | | | | | | | | | | | | Move these singletons into SkPDFCanon (there is still a single object per document; output PDF size will not change). Motivation: After this change, all indirectly-referenced SkPDFObjects are serialized exactly once. The next CL will add a memory saving feature: a method to purge an object's resources immediately after serialization. After that, further changes wil allow some objects to be serialized *before* SkDocument::close(), leading to potentially very large memory savings. BUG=skia:5087 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1788263002 Review URL: https://codereview.chromium.org/1788263002
* SkPDF: use sk_make_sp<T> when it makes sense.Gravatar halcanary2016-03-08
| | | | | | GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1773033002 Review URL: https://codereview.chromium.org/1773033002
* SkPDF: add `final` keyword to leaf classesGravatar halcanary2015-11-22
| | | | Review URL: https://codereview.chromium.org/1461403002
* Style Change: NULL->nullptrGravatar halcanary2015-08-27
| | | | | | DOCS_PREVIEW= https://skia.org/?cl=1316233002 Review URL: https://codereview.chromium.org/1316233002
* 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
* SkPDF: ResourceDict replaced by factory functionGravatar halcanary2015-04-09
| | | | | | | | | Motivation: Having a class here was unnecessary, since the only thing that set this class apart was how it is created, not how it behaves. BUG=skia:3585 Review URL: https://codereview.chromium.org/1068343003
* SkPDF: clean up extra referencesGravatar halcanary2015-03-24
| | | | | | This cleans up code left behind from http://crrev.com/870333002 Review URL: https://codereview.chromium.org/1029263004
* PDF: Canon now owns a reference to all interned objectsGravatar halcanary2015-02-27
| | | | | | | | | | | | | Add SkPDFCanon::reset function to unref all objects. No longer possible to remove object from canon Motivation: this doesn't change these object's lifetime, (they will still be fully unrefed when SkDocument::close() is called, but we no longer have to remove them from the array when their destructor is called. Review URL: https://codereview.chromium.org/966863002
* PDF: Now threadsafe!Gravatar halcanary2015-02-20
| | | | | | | | | | | | | The PDF canvas is now just as threadsafe as any other Skia canvas. DM updated to thread PDF tests. SkDocument_PDF now owns SkPDFCanon, and pointers to that canon are passed around to all classes that need access to the canon. BUG=skia:2683 Review URL: https://codereview.chromium.org/944643002
* Simplify reference management in SkPDFGravatar halcanary2015-02-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Prior to this change, SkPDFObject subclasses were required to track their resources separately from the document structure. (An object has a resource if it depends, via an indirect reference, on another object). This led to a lot of extra code to duplicate effort. I replace the getResources() function with the much simpler addResources() function. I only define a non-trivial addResources() method on arrays, dictionaries, and indirect object references. All other specialized classes simply rely on their parent class's implementation. SkPDFObject::addResources() works by recursively walking the directed graph of object (direct and indirect) references and adding resources to a set. It doesn't matter that there are closed loops in the graph, since we check the set before walking down a branch. - Add SkPDFObject::addResources() virtual function, with four implementations - Remove SkPDFObject::getResources() virtual function and all implementations. - Remove SkPDFObject::GetResourcesHelper() - Remove SkPDFObject::AddResourceHelper() - In SkPDFCatalog::findObjectIndex(), add an object to the catalog if it doesn't exist yet. - SkPDFCatalog::setSubstitute() no longer sets up resources - SkPDFDocument.cpp no longer needs the Streamer object - SkPDFDocument.cpp calls fDocCatalog->addResources to build the resource list. - SkPDFFont::addResource() removed - All SkPDF-::fResource sets removed (they are redundant). - removed SkPDFImage::addSMask() function - SkPDFResourceDict::getReferencedResources() removed. Motivation: this removes quite a bit of code and makes the objects slightly slimmer in memory. Most importantly, this will lead the way towards removing SkPDFObject's inheritance from SkRefCnt, which will greatly simplify everything. Testing: I usually test changes to the PDF backend by comparing checksums of PDF files rendered from GMs and SKPs before and after the change. This change both re-orders and re-numbers the indirect PDF objects. I used the qpdf program to normalize the PDFs and then compared the normalized outputs from before and after the change; they matched. Review URL: https://codereview.chromium.org/870333002
* More changes to SkPDFShader to eliminate multiple inheritance!Gravatar halcanary2015-01-23
| | | | Review URL: https://codereview.chromium.org/873543002
* Simplify SkPDFShader class. Now invalid objects are never created.Gravatar halcanary2015-01-23
| | | | | | | | "Constructors should not do real work" I have verified that all test PDFs render identically. Review URL: https://codereview.chromium.org/862113004
* SkPDFCanonGravatar halcanary2015-01-21
| | | | | | | | | | | | | | | | | SkPDFCanon's fields and methods will eventually become part of SkPDFDocument/SkDocument_PDF. For now, it exists as a singleton to preflight that transition. This replaces three global arrays in SkPDFFont, SkPDFShader, and SkPDFGraphicsContext. This code is still thread-unsafe (http://skbug.com/2683), but moving this functionality into SkPDFDocument will fix that. This CL does not change pdf output from either GMs or SKPs. This change also simplifies some code around the SkPDFCanon methods. BUG=skia:2683 Review URL: https://codereview.chromium.org/842253003
* Generic PDF shader fallbackGravatar fmalita2015-01-13
| | | | | | | | | | | Instead of ignoring unsupported shaders (and essentially filling with solid black), convert them to bitmap shaders using on-the-fly rasterization. BUG=skia:3299 R=reed@google.com,halcanary@google.com Review URL: https://codereview.chromium.org/841763005
* Implemented transparent gradientsGravatar commit-bot@chromium.org2013-07-23
| | | | | | | | | | R=vandebo@chromium.org, edisonn@google.com Author: richardlin@chromium.org Review URL: https://chromiumcodereview.appspot.com/18585002 git-svn-id: http://skia.googlecode.com/svn/trunk@10297 2bbb7eff-a529-9590-31e7-b0007b416f81
* Fixed minor c++ issues found by cppcheckGravatar robertphillips@google.com2012-04-27
| | | | | | | | http://codereview.appspot.com/6127049/ git-svn-id: http://skia.googlecode.com/svn/trunk@3771 2bbb7eff-a529-9590-31e7-b0007b416f81
* [PDF] Handle failures of matrix inversionGravatar vandebo@chromium.org2012-04-17
| | | | | | | | | Previously reviewed in https://codereview.appspot.com/6033047. Rolled back because of unrelated fixed-point bugs. Review URL: https://codereview.appspot.com/6052051 git-svn-id: http://skia.googlecode.com/svn/trunk@3715 2bbb7eff-a529-9590-31e7-b0007b416f81
* Revert "[PDF] Handle failures of matrix inversion" while I investigate fixed ↵Gravatar vandebo@chromium.org2012-04-17
| | | | | | | | | | point failures. This reverts commit r3711 Review URL: https://codereview.appspot.com/6050049 git-svn-id: http://skia.googlecode.com/svn/trunk@3712 2bbb7eff-a529-9590-31e7-b0007b416f81
* [PDF] Handle failures of matrix inversion.Gravatar vandebo@chromium.org2012-04-17
| | | | | | Review URL: https://codereview.appspot.com/6033047 git-svn-id: http://skia.googlecode.com/svn/trunk@3711 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