WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
179952
FEComponentTransfer cleanup and optimization
https://bugs.webkit.org/show_bug.cgi?id=179952
Summary
FEComponentTransfer cleanup and optimization
Simon Fraser (smfr)
Reported
2017-11-22 11:06:18 PST
FEComponentTransfer cleanup and optimization
Attachments
Patch
(11.98 KB, patch)
2017-11-22 11:11 PST
,
Simon Fraser (smfr)
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Simon Fraser (smfr)
Comment 1
2017-11-22 11:11:04 PST
Created
attachment 327462
[details]
Patch
EWS Watchlist
Comment 2
2017-11-22 11:13:43 PST
Attachment 327462
[details]
did not pass style-queue: ERROR: Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:173: One space before end of line comments [whitespace/comments] [5] ERROR: Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:174: One space before end of line comments [whitespace/comments] [5] ERROR: Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:175: One space before end of line comments [whitespace/comments] [5] ERROR: Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:176: One space before end of line comments [whitespace/comments] [5] ERROR: Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:177: One space before end of line comments [whitespace/comments] [5] ERROR: Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:178: One space before end of line comments [whitespace/comments] [5] ERROR: Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:181: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:182: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:183: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] ERROR: Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:184: Please replace ASSERT_WITH_SECURITY_IMPLICATION() with RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(). [security/assertion] [5] Total errors found: 10 in 3 files If any of these errors are false positives, please file a bug against check-webkit-style.
Darin Adler
Comment 3
2017-11-22 11:23:56 PST
Comment on
attachment 327462
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=327462&action=review
Not a huge fan of all the abbreviations here. I would say m_redFunction instead m_redFunc, and redTable instead of rTable, etc.
> Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:73 > +void FEComponentTransfer::computeIdentityTable(FEComponentTransfer::LookupTable, const ComponentTransferFunction&)
Can just call it LookupTable because this is inside the declaration of a FEComponentTransfer member function.
> Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:150 > + unsigned char c = data[pixelOffset]; > + data[pixelOffset] = rTable[c];
auto or uint8_t or do it in single lines without local variables so we don’t need all the comments: data[pixelOffset] = rTable[data[pixelOffset]]; data[pixelOffset + 1] = gTable[data[pixelOffset + 1]]; data[pixelOffset + 2] = bTable[data[pixelOffset + 2]]; data[pixelOffset + 3] = aTable[data[pixelOffset + 3]];
> Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:171 > + typedef void (*TransferType)(LookupTable, const ComponentTransferFunction&);
We are using "using" these days: using TransferType = void (*)(LookupTable, const ComponentTransferFunction&);
> Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:186 > + (*callEffect[m_redFunc.type])(rValues, m_redFunc);
I don’t think the (*x) is needed. Should just be able to call: callEffect[m_redFunc.type](rValues, m_redFunc);
> Source/WebCore/platform/graphics/filters/FEComponentTransfer.h:76 > + typedef uint8_t LookupTable[lookupTableSize];
Better to use using. But even better to use std::array so the strangeness of C arrays doesn’t affect us so much. Then when you want to modify the table you have to pass LookupTable& instead. And you can call size() instead of having a separate constant. using LookupTable = std::array<uint8_t, 256>;
> Source/WebCore/platform/graphics/filters/FEComponentTransfer.h:78 > + static void computeIdentityTable(FEComponentTransfer::LookupTable, const ComponentTransferFunction&);
Same here, no need to write FEComponentTransfer:: prefix.
Simon Fraser (smfr)
Comment 4
2017-11-22 22:48:25 PST
https://trac.webkit.org/changeset/225107/webkit
Radar WebKit Bug Importer
Comment 5
2017-11-22 22:49:23 PST
<
rdar://problem/35672813
>
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