WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
159721
Get rid of the m_premultiplyAlpha flag of the ImageFrame class
https://bugs.webkit.org/show_bug.cgi?id=159721
Summary
Get rid of the m_premultiplyAlpha flag of the ImageFrame class
Said Abou-Hallawa
Reported
2016-07-13 09:22:05 PDT
This flag was only needed when calling BitmapPixels::setSize(). Instead we can pass the ImageDecoder::m_premultiplyAlpha to ImageFrame::setSize() which will pass it to BitmapPixels::setSize().
Attachments
Patch
(166.18 KB, patch)
2016-07-13 09:30 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(166.59 KB, patch)
2016-07-13 12:19 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(171.63 KB, patch)
2016-07-13 14:32 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(171.09 KB, patch)
2016-07-13 14:50 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(170.55 KB, patch)
2016-07-13 14:55 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(171.74 KB, patch)
2016-07-13 15:04 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(171.90 KB, patch)
2016-07-13 15:20 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(171.75 KB, patch)
2016-07-13 15:31 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch for review
(25.45 KB, patch)
2016-07-13 17:04 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(13.53 KB, patch)
2016-09-12 17:11 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(19.82 KB, patch)
2016-09-13 10:32 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(20.46 KB, patch)
2016-09-13 10:43 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(20.46 KB, patch)
2016-09-13 10:51 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(20.58 KB, patch)
2016-09-13 10:55 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(20.82 KB, patch)
2016-09-13 12:41 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Patch
(21.04 KB, patch)
2016-09-13 12:54 PDT
,
Said Abou-Hallawa
no flags
Details
Formatted Diff
Diff
Show Obsolete
(15)
View All
Add attachment
proposed patch, testcase, etc.
Said Abou-Hallawa
Comment 1
2016-07-13 09:30:56 PDT
Created
attachment 283537
[details]
Patch
Said Abou-Hallawa
Comment 2
2016-07-13 12:19:10 PDT
Created
attachment 283557
[details]
Patch
Said Abou-Hallawa
Comment 3
2016-07-13 14:32:10 PDT
Created
attachment 283565
[details]
Patch
Said Abou-Hallawa
Comment 4
2016-07-13 14:50:18 PDT
Created
attachment 283569
[details]
Patch
Said Abou-Hallawa
Comment 5
2016-07-13 14:55:08 PDT
Created
attachment 283571
[details]
Patch
Said Abou-Hallawa
Comment 6
2016-07-13 15:04:53 PDT
Created
attachment 283577
[details]
Patch
Said Abou-Hallawa
Comment 7
2016-07-13 15:20:04 PDT
Created
attachment 283578
[details]
Patch
Said Abou-Hallawa
Comment 8
2016-07-13 15:31:08 PDT
Created
attachment 283580
[details]
Patch
Said Abou-Hallawa
Comment 9
2016-07-13 17:04:58 PDT
Created
attachment 283589
[details]
Patch for review
Said Abou-Hallawa
Comment 10
2016-09-12 17:11:25 PDT
Created
attachment 288644
[details]
Patch
Simon Fraser (smfr)
Comment 11
2016-09-12 17:13:46 PDT
Comment on
attachment 288644
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=288644&action=review
> Source/WebCore/ChangeLog:10 > + This flag was only needed when calling ImageBackingStore::setSize(). Instead > + we can pass the ImageDecoder::m_premultiplyAlpha to ImageFrame::setSize() > + which will pass it to ImageBackingStore::setSize().
Why does setting the size care about premultiplied alpha?
Carlos Garcia Campos
Comment 12
2016-09-12 23:27:14 PDT
(In reply to
comment #11
)
> Comment on
attachment 288644
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=288644&action=review
> > > Source/WebCore/ChangeLog:10 > > + This flag was only needed when calling ImageBackingStore::setSize(). Instead > > + we can pass the ImageDecoder::m_premultiplyAlpha to ImageFrame::setSize() > > + which will pass it to ImageBackingStore::setSize(). > > Why does setting the size care about premultiplied alpha?
It doesn't, I think it's because we only want the m_premultiplyAlpha to be passed to the ImageBackingStore constructor and ImageBackingStore is created in setSize().
Carlos Garcia Campos
Comment 13
2016-09-12 23:42:46 PDT
I agree that passing premultiplyAlpha to setSize() is weird from the API point of view. But also because setSize() is weird as it is implemented. It can't be called if the ImageFrame already has a backing store, and it always creates a new ImageBackingStore. So, maybe if we rename the method as initializeBackingStore or simply initialize() it makes more sense to pass a size and premultiplyalpha as initialization parameters. We could probably rename copyBitmapData() also as initialize(). Another possibility (in addition to the rename that I think we should do anyway, because setSize and copyBitmapData are confusing), would be to let the decoder pass premultiplyAlpha to setPixel and blendPixel methods, that would just pass it to the backing store, since those are the only methods needing it.
Said Abou-Hallawa
Comment 14
2016-09-13 10:32:44 PDT
Created
attachment 288695
[details]
Patch
Said Abou-Hallawa
Comment 15
2016-09-13 10:43:39 PDT
Created
attachment 288696
[details]
Patch
Said Abou-Hallawa
Comment 16
2016-09-13 10:51:19 PDT
Created
attachment 288697
[details]
Patch
Said Abou-Hallawa
Comment 17
2016-09-13 10:55:11 PDT
Created
attachment 288698
[details]
Patch
Said Abou-Hallawa
Comment 18
2016-09-13 11:43:01 PDT
(In reply to
comment #13
)
> I agree that passing premultiplyAlpha to setSize() is weird from the API > point of view. But also because setSize() is weird as it is implemented. It > can't be called if the ImageFrame already has a backing store, and it always > creates a new ImageBackingStore. So, maybe if we rename the method as > initializeBackingStore or simply initialize() it makes more sense to pass a > size and premultiplyalpha as initialization parameters. We could probably > rename copyBitmapData() also as initialize().
I like this suggestion. I renamed setSize() and copyBitmapData() to initializeBackingStore(). I preferred it over initialize() because ImageFrame will be shared between CG and non-CG code and initialize() is very generic name. Calling initializeBackingStore() makes it clearer that we want to initialize the backing store only which is only needed by non CG ports.
> Another possibility (in > addition to the rename that I think we should do anyway, because setSize and > copyBitmapData are confusing), would be to let the decoder pass > premultiplyAlpha to setPixel and blendPixel methods, that would just pass it > to the backing store, since those are the only methods needing it.
I am not sure about this suggestion. It can actually make creating the backing store simpler and can make setPixel() and blendPixel() static or even global functions. But having the backing store not aware whether its pixels are premultiplied or not, seems weird to me. Anyway this seems a big change and I can do it in a separate patch if we need it.
Simon Fraser (smfr)
Comment 19
2016-09-13 11:52:57 PDT
Comment on
attachment 288698
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=288698&action=review
> Source/WebCore/ChangeLog:10 > + to ImageFrame::setSize(), which should be renamed ImageFrame::initializeBackingStore().
s/should be/is/
> Source/WebCore/platform/image-decoders/ImageDecoder.cpp:179 > + if (!backingStore) > + return false;
Should backingStore just be a reference instead?
> Source/WebCore/platform/image-decoders/ImageDecoder.h:174 > + bool premultiplyAlpha() const { return m_premultiplyAlpha; }
premultipiesAlpha()?
Said Abou-Hallawa
Comment 20
2016-09-13 12:41:41 PDT
Created
attachment 288717
[details]
Patch
Said Abou-Hallawa
Comment 21
2016-09-13 12:54:23 PDT
Created
attachment 288719
[details]
Patch
WebKit Commit Bot
Comment 22
2016-09-13 13:58:28 PDT
Comment on
attachment 288719
[details]
Patch Clearing flags on attachment: 288719 Committed
r205877
: <
http://trac.webkit.org/changeset/205877
>
WebKit Commit Bot
Comment 23
2016-09-13 13:58:34 PDT
All reviewed patches have been landed. Closing bug.
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