Skip to content

M135 public#311

Merged
HinTak merged 8 commits into
skia-python:mainfrom
HinTak:m135-public
Apr 6, 2025
Merged

M135 public#311
HinTak merged 8 commits into
skia-python:mainfrom
HinTak:m135-public

Conversation

@HinTak
Copy link
Copy Markdown
Collaborator

@HinTak HinTak commented Mar 6, 2025

The main breakage is #310 - and this includes a fix. I have replaced the "bare" constructors with the more useful one, but now we need to think about what to do with the bare one, and whether to provide them somehow. Have two months to think about this until m136.

HinTak added 8 commits March 5, 2025 22:43
…rewritten to give old behavior.

m135: Use the new built-in callback SkPDF::JPEG::MetadataWithCallbacks as default constructor for SkPDF::Metadata;
2nd part of SkPDF::MakeDocument() breakage.

m135: Fixes the 3rd SkPDF::MakeDocument(SkWStream*) constructor which uses DictToMetadata.

Fixes skia-python#310

The m135 release note is misleading. `SkPDF::MakeDocument(SkWStream*)` is not deprecated (works with warning
or works but not recommended for new code), but it now throws an error:

Python 3.13.2 (main, Feb  4 2025, 00:00:00) [GCC 14.2.1 20250110 (Red Hat 14.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import skia
... import pytest
...
>>> stream = skia.DynamicMemoryWStream()
>>> document = skia.PDF.MakeDocument(stream)
../../src/pdf/SkPDFDocument.cpp:713: fatal error: "Must set both a jpegDecoder and jpegEncoder to create PDFs"

Milestone 135
-------------
  * `SkPDF::MakeDocument(SkWStream*)` [one argument] has been deprecated and will be removed. This is because SkPDFMetdata has added 2 required fields `jpegDecoder` and `jpegEncoder`. In order to make a reasonable PDF, those must be supplied (using the two argument factory). To make these easier to supply `include/docs/SkPDFJpegHelpers.h` has been added, which will use Skia's built-in jpeg encoder and decoder.
…ates warning). Mistakenly added a while ago
@HinTak HinTak mentioned this pull request Apr 1, 2025
@HinTak HinTak merged commit 0ea6ca8 into skia-python:main Apr 6, 2025
@HinTak HinTak deleted the m135-public branch April 6, 2025 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant