WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
83132
[Qt] Separate image encoding from dataURL construction
https://bugs.webkit.org/show_bug.cgi?id=83132
Summary
[Qt] Separate image encoding from dataURL construction
noel gordon
Reported
2012-04-04 02:24:22 PDT
[Qt] Separate image encoding from dataURL construction
Attachments
Patch
(3.54 KB, patch)
2012-04-04 02:25 PDT
,
noel gordon
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
noel gordon
Comment 1
2012-04-04 02:25:33 PDT
Created
attachment 135534
[details]
Patch
Simon Hausmann
Comment 2
2012-04-10 03:28:42 PDT
Comment on
attachment 135534
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=135534&action=review
> Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp:383 > + compressionQuality = static_cast<int>(*quality * 100 + 0.5);
Why not use ceil or round here?
noel gordon
Comment 3
2012-04-10 04:04:51 PDT
> Why not use ceil or round here?
Left it as it was before, and also matches the other webkit ports.
Noam Rosenthal
Comment 4
2012-04-10 07:12:02 PDT
Comment on
attachment 135534
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=135534&action=review
> Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp:382 > + if (quality && *quality >= 0.0 && *quality <= 1.0)
Use 0 and 1, not 0.0 and 1.0
> Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp:406 > + if (!encodeImage(m_data.m_pixmap, mimeType.substring(sizeof "image"), quality, data)) > + return "data:,";
Any reason why not to use QMimeDatabase and QMimeType::suffixes()?
noel gordon
Comment 5
2012-04-10 17:06:05 PDT
(In reply to
comment #4
)
> (From update of
attachment 135534
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=135534&action=review
> > > Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp:382 > > + if (quality && *quality >= 0.0 && *quality <= 1.0) > > Use 0 and 1, not 0.0 and 1.0
Possible but again, just re-factoring change here, and it matches the other webkit ports, so I'd prefer to leave it as is.
> > Source/WebCore/platform/graphics/qt/ImageBufferQt.cpp:406 > > + if (!encodeImage(m_data.m_pixmap, mimeType.substring(sizeof "image"), quality, data)) > > + return "data:,"; > > Any reason why not to use QMimeDatabase and QMimeType::suffixes()?
Interesting, though not sure how they'd help. At routine entry we have: ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType)); so the mimeType is already canonical.
noel gordon
Comment 6
2012-04-10 17:31:13 PDT
Thanks for the r+ Noam. I have some questions. I believe that QPixmap.save() is not safe to use off the main thread. Is that correct? Since the mimeType is known canonical via the ASSERT, why are the following lines needed? if (!mimeType.startsWith("image/")) return "data:,"; Is there a reason to prefer the QT toBase64 encoder over the base64 encoder provided by WebCore? return "data:" + mimeType + ";base64," + data.toBase64().data();
WebKit Review Bot
Comment 7
2012-04-10 18:47:08 PDT
Comment on
attachment 135534
[details]
Patch Clearing flags on attachment: 135534 Committed
r113805
: <
http://trac.webkit.org/changeset/113805
>
WebKit Review Bot
Comment 8
2012-04-10 18:47:18 PDT
All reviewed patches have been landed. Closing bug.
noel gordon
Comment 9
2012-04-11 22:17:58 PDT
(In reply to
comment #6
)
> Thanks for the r+ Noam. I have some questions.
>
> Since the mimeType is known canonical via the ASSERT, why are the following lines needed? > > if (!mimeType.startsWith("image/")) > return "data:,";
Filed
bug 83746
about that if you'd like to review.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug