Adds an interface for the document creator to pass in a tree
of tags indicating the structure of the document, each with a type
(from a predetermined enum of possible types) and a node ID.
It also adds a setNodeId function to SkCanvas so that page content
can be associated with a particular tag. If both the tag tree and
marked content are present, Skia can now output a properly tagged
PDF.
An example program is included. When used properly, the PDF generated
by this patch is valid and the tags are parsed properly by Adobe
Acrobat. It handles many corner cases like content that spans more
than one page, or tags that don't correspond to any marked content, or
marked content that doesn't correspond to any tags.
However, it doesn't implement all of the features of PDF accessibility
yet, there are some additional attributes that can be associated with
some tags that need to be supported, too, in order to properly tag
things like figures and tables.
Bug: skia:8148
Change-Id: I2e448eca8ded8e1b29ba685663b557ae7ad7e23e
Reviewed-on: https://skia-review.googlesource.com/141138
Reviewed-by: Hal Canary <halcanary@google.com>
This reverts commit 1e09e461d2.
Change-Id: I95d5544a7baaa078536790493ce4119816a77e94
Reviewed-on: https://skia-review.googlesource.com/72903
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This reverts commit 5627d65146.
Reason for revert: Google3
Original change's description:
> Add method to sk_gpu_test::TestContext to automatically restore the previous context.
>
> The motivation for this is to allow a GM to create a GL context, do some some work in it, and then return to the context that was set when it was invoked.
>
> Change-Id: Ie8496072a10f8f3ff36a08889e593a6ca961b61a
> Reviewed-on: https://skia-review.googlesource.com/70720
> Commit-Queue: Brian Salomon <bsalomon@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
TBR=bsalomon@google.com,brianosman@google.com
Change-Id: Ifb79638c9d4500ca3be9a5be39a5ad78b20247c1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/72981
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
The motivation for this is to allow a GM to create a GL context, do some some work in it, and then return to the context that was set when it was invoked.
Change-Id: Ie8496072a10f8f3ff36a08889e593a6ca961b61a
Reviewed-on: https://skia-review.googlesource.com/70720
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
- SkImageSubset becomes SkKeyedImage
- SkPDFCanvas::onDraw{Bitmap, Image} go away
- Remove SkPDFCanvas: base classes now do the right thing.
- SkPDFDevice::draw{Bitmap,Image}{Rect,}() simplified
- 244 fewer SLOC.
All but a few PDFs are identical, those rasterize almost the same.
Change-Id: I3ceb3b8935c689719cedf1ad544b0407b5c1733e
Reviewed-on: https://skia-review.googlesource.com/22218
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
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>
This canaries the idea by converting gyp/pdf.gypi to gn/pdf.gni.
If this lands and rolls quietly, I'll flesh out the rest.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=3972
Change-Id: Iecaf1ccce7891679904c585946272bfb25eea299
Reviewed-on: https://skia-review.googlesource.com/3972
Reviewed-by: Hal Canary <halcanary@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>