WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
47027
refactor the nested large switch statements in GraphicsContext3DCG.cpp:getImageData()
https://bugs.webkit.org/show_bug.cgi?id=47027
Summary
refactor the nested large switch statements in GraphicsContext3DCG.cpp:getIma...
Zhenyao Mo
Reported
2010-10-01 16:14:00 PDT
Currently it's getting out of hand. kbr suggested to use table instead.
Attachments
patch
(12.90 KB, patch)
2010-10-21 10:05 PDT
,
Zhenyao Mo
zmo
: commit-queue-
Details
Formatted Diff
Diff
revised patch: remove an extra whitespace
(12.67 KB, patch)
2010-10-21 10:09 PDT
,
Zhenyao Mo
kbr
: review-
zmo
: commit-queue-
Details
Formatted Diff
Diff
revised patch: responding to kbr's review
(13.05 KB, patch)
2010-10-27 11:27 PDT
,
Zhenyao Mo
kbr
: review+
zmo
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Zhenyao Mo
Comment 1
2010-10-21 10:05:54 PDT
Created
attachment 71449
[details]
patch
Zhenyao Mo
Comment 2
2010-10-21 10:09:59 PDT
Created
attachment 71451
[details]
revised patch: remove an extra whitespace
WebKit Review Bot
Comment 3
2010-10-22 13:56:03 PDT
Attachment 71451
[details]
did not pass style-queue: Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1 WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:65: One space before end of line comments [whitespace/comments] [5] WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:66: One space before end of line comments [whitespace/comments] [5] WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:68: One space before end of line comments [whitespace/comments] [5] Total errors found: 3 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Zhenyao Mo
Comment 4
2010-10-22 14:59:27 PDT
I think I am not going to fix the style complaints because the current arrangement is much better for readability.
Kenneth Russell
Comment 5
2010-10-26 15:36:27 PDT
Comment on
attachment 71451
[details]
revised patch: remove an extra whitespace View in context:
https://bugs.webkit.org/attachment.cgi?id=71451&action=review
This looks really nice overall (thanks for doing this cleanup) but there are a few issues that need to be addressed.
> WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:52 > + kSourceFormatBaseUndefined
It turns out WebKit constant style is not to use the "k" prefix. So, "SourceFormatBaseR", etc. Please add a SourceFormatBaseNumFormats or similar for below.
> WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:58 > + kAlphaFormatLast,
Naming convention. Please also add an AlphaFormatNumFormats (collision with AlphaFormatLast is unfortunate).
> WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:61 > +static GraphicsContext3D::SourceDataFormat getSourceDataFormat(unsigned int componentsPerPixel, AlphaFormat alphaFormat, bool bit16, bool bigEndian)
bit16 -> is16BitFormat
> WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:63 > + const static SourceDataFormatBase tableFormatBase[4][3] = { // componentsPerPixel x AlphaFormat
I think this would read better as "formatTableBase". Please also use AlphaFormatNumFormats as the second array dimension.
> WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:65 > + { kSourceFormatBaseR, kSourceFormatBaseA, kSourceFormatBaseA }, // 1 componentsPerPixel
Please fix the style errors. You can put the extra spaces to the left of the "}".
> WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:70 > + const static GraphicsContext3D::SourceDataFormat tableFormat[7][3] = { // SourceDataFormatBase x bitsPerComponentAndEndian
Instead of [7] use SourceFormatBaseNumFormats. Also, I think this would read better as "formatTable".
Zhenyao Mo
Comment 6
2010-10-27 11:27:19 PDT
Created
attachment 72058
[details]
revised patch: responding to kbr's review
Kenneth Russell
Comment 7
2010-10-27 13:40:42 PDT
Comment on
attachment 72058
[details]
revised patch: responding to kbr's review View in context:
https://bugs.webkit.org/attachment.cgi?id=72058&action=review
Looks good. One comment.
> WebCore/platform/graphics/cg/GraphicsContext3DCG.cpp:62 > +static GraphicsContext3D::SourceDataFormat getSourceDataFormat(unsigned int componentsPerPixel, AlphaFormat alphaFormat, bool is16BitFormat, bool bigEndian)
Please add a comment indicating that this returns kSourceFormatNumFormats if the combination of input parameters is unsupported.
Zhenyao Mo
Comment 8
2010-10-27 14:09:41 PDT
Committed
r70706
: <
http://trac.webkit.org/changeset/70706
>
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