Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Issue 493163003: Use number of components from ICC profile and alternateCS (Closed)

Created:
6 years, 4 months ago by Bo Xu
Modified:
5 years, 9 months ago
Reviewers:
Tom Sepez, jun_fang
Base URL:
https://pdfium.googlesource.com/pdfium.git@master
Visibility:
Public.

Description

Use number of components from ICC profile and alternate color space BUG=406806 Committed: https://pdfium.googlesource.com/pdfium/+/be83103

Patch Set 1 : #

Total comments: 23
Unified diffs Side-by-side diffs Delta from patch set Stats (+110 lines, -61 lines) Patch
M core/include/fpdfapi/fpdf_parser.h View 1 chunk +1 line, -1 line 0 comments Download
M core/include/fxcodec/fx_codec.h View 1 chunk +3 lines, -3 lines 0 comments Download
M core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp View 2 chunks +55 lines, -31 lines 11 comments Download
M core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp View 3 chunks +4 lines, -4 lines 0 comments Download
M core/src/fpdfapi/fpdf_page/pageint.h View 2 chunks +4 lines, -2 lines 4 comments Download
M core/src/fxcodec/codec/codec_int.h View 1 chunk +3 lines, -3 lines 0 comments Download
M core/src/fxcodec/codec/fx_codec_icc.cpp View 9 chunks +40 lines, -17 lines 8 comments Download

Messages

Total messages: 7 (0 generated)
Bo Xu
Hi Tom, Please review this one. For this bug and some previous bugs, the number ...
6 years, 4 months ago (2014-08-24 21:56:22 UTC) #1
Bo Xu
Committed patchset #1 manually as be83103 (presubmit successful).
6 years, 4 months ago (2014-08-25 17:01:27 UTC) #2
Bo Xu
On 2014/08/25 17:01:27, Bo Xu wrote: > Committed patchset #1 manually as be83103 (presubmit successful). ...
6 years, 4 months ago (2014-08-25 17:03:09 UTC) #3
Tom Sepez
I pinged nico about the best way to revert. In the mean time, here are ...
6 years, 4 months ago (2014-08-25 18:18:52 UTC) #4
Bo Xu
A revert of this CL (patchset #1) has been created in https://codereview.chromium.org/504883003/ by bo_xu@foxitsoftware.com. The ...
6 years, 4 months ago (2014-08-25 18:37:02 UTC) #5
jun_fang
https://codereview.chromium.org/493163003/diff/80001/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp File core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp (right): https://codereview.chromium.org/493163003/diff/80001/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp#newcode525 core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp:525: m_srcnComponents = 3; In some cases, m_nSrcComponents may not ...
6 years, 4 months ago (2014-08-25 18:56:51 UTC) #6
Bo Xu
6 years, 4 months ago (2014-08-25 20:28:18 UTC) #7
Message was sent while issue was closed.
New patch set in https://codereview.chromium.org/503883002/

https://codereview.chromium.org/493163003/diff/80001/core/src/fpdfapi/fpdf_pa...
File core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp (right):

https://codereview.chromium.org/493163003/diff/80001/core/src/fpdfapi/fpdf_pa...
core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp:525: m_srcnComponents = 3;
On 2014/08/25 18:56:51, jun_fang wrote:
> In some cases, m_nSrcComponents may not initialized. It shall be initialized
to
> be a default value out of this condition.

Done.

https://codereview.chromium.org/493163003/diff/80001/core/src/fpdfapi/fpdf_pa...
core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp:529: m_pTransform =
CPDF_ModuleMgr::Get()->GetIccModule()->CreateTransform_sRGB(pData, dwSize,
&m_srcnComponents);
On 2014/08/25 18:18:51, Tom Sepez wrote:
> If neither expression in this if-statement is true, we run the risk of leaving
> m_bsRGB, m_pTransform, and m_srcnComponent unitialized.  One common pattern
for
> these kinds of constructors is to do something like
> 
> CPDF_IccProfile::CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize) :
>     m_bsRGB(FALSE),
>     m_pTransform(NULL),
>     m_srcnComponents(0) {
>   if ( ... ) {
>     m_bsRGB = TRUE;
>     m_srcnComponents = 3;
>   } else if ( ... ) {
>     m_pTransform = ... ( ..., &m_nsrcnComponents)
>   }
> }

That's right. Done.

https://codereview.chromium.org/493163003/diff/80001/core/src/fpdfapi/fpdf_pa...
core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp:596: FX_INT32 Dict_nComponents =
pDict ? pDict->GetInteger(FX_BSTRC("N")) : 0;
On 2014/08/25 18:18:51, Tom Sepez wrote:
> nit: nDictComponents for consistency perhaps.

Done.

https://codereview.chromium.org/493163003/diff/80001/core/src/fpdfapi/fpdf_pa...
core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp:600: CPDF_ColorSpace* alter_cs =
CPDF_ColorSpace::Load(pDoc, pAlterCSObj);
On 2014/08/25 18:18:51, Tom Sepez wrote:
> nit: If you wanted to do some cleanup along the way, this probably should be
> pAlterCS (or pAlternateCS) to keep with the style of the file.  In chromium,
> you're right that we vastly prefer the _ style identifiers, but for now, I've
> been suggesting that we keep to whatever dominant style convention is already
at
> play in the file. 

Done.

https://codereview.chromium.org/493163003/diff/80001/core/src/fpdfapi/fpdf_pa...
core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp:610: if (Dict_nComponents == 1
|| Dict_nComponents == 3 || Dict_nComponents == 4 ) {
On 2014/08/25 18:18:51, Tom Sepez wrote:
> nit: prefer early return as in
> if (Dict_nComponents != 1 && Dict_nComponents != 3 && Dict_nComponents != 4 )
{
>     return FALSE;
> }
> m_nComponents = ... 

Done.

https://codereview.chromium.org/493163003/diff/80001/core/src/fpdfapi/fpdf_pa...
File core/src/fpdfapi/fpdf_page/pageint.h (right):

https://codereview.chromium.org/493163003/diff/80001/core/src/fpdfapi/fpdf_pa...
core/src/fpdfapi/fpdf_page/pageint.h:473: FX_INT32 GetComponents() { return
m_srcnComponents; }
On 2014/08/25 18:18:51, Tom Sepez wrote:
> nit: const method.

Done.

https://codereview.chromium.org/493163003/diff/80001/core/src/fpdfapi/fpdf_pa...
core/src/fpdfapi/fpdf_page/pageint.h:475: FX_INT32               
m_srcnComponents;
On 2014/08/25 18:56:51, jun_fang wrote:
> should be m_nSrcComponents?

Done.

https://codereview.chromium.org/493163003/diff/80001/core/src/fxcodec/codec/f...
File core/src/fxcodec/codec/fx_codec_icc.cpp (right):

https://codereview.chromium.org/493163003/diff/80001/core/src/fxcodec/codec/f...
core/src/fxcodec/codec/fx_codec_icc.cpp:10: #define N_COMPONENT_LAB 3
On 2014/08/25 18:56:51, jun_fang wrote:
> It's better to use const variables rather than macro like:
> const FX_DWORD N_COMPONENT_LAB = 3;

Done.

https://codereview.chromium.org/493163003/diff/80001/core/src/fxcodec/codec/f...
core/src/fxcodec/codec/fx_codec_icc.cpp:69: {
On 2014/08/25 18:56:51, jun_fang wrote:
> FX_DWORD components = N_COMPONENT_DEFAULT;

Done.

https://codereview.chromium.org/493163003/diff/80001/core/src/fxcodec/codec/f...
core/src/fxcodec/codec/fx_codec_icc.cpp:96: *nSrcComponents = 0;
On 2014/08/25 18:56:51, jun_fang wrote:
> Need to check whether nSrcComponents is NULL.

I have changed nSrcComponents from pointer to reference.

Powered by Google App Engine
This is Rietveld 408576698