summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-01 14:45:20 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-03-01 14:45:20 -0500
commit738b08ce6b9f80d93b815411b47c2b11c2f090f6 (patch)
treeec648b9bdf6d9597043bfe657d56f98dc3cdef30 /core
parent50dfc4a7068e8e08105f7b9a3945136e7246e677 (diff)
downloadpdfium-738b08ce6b9f80d93b815411b47c2b11c2f090f6.tar.xz
Fix and enable lint checks.
This CL fixes and enables: * readability/namespace * readability/multiline_string * readability/multiline_comment * readability/inheritance * readability/function * readability/braces R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1747123002 .
Diffstat (limited to 'core')
-rw-r--r--core/include/fpdfapi/fpdf_resource.h2
-rw-r--r--core/include/fxcrt/fx_basic.h11
-rw-r--r--core/include/fxcrt/fx_memory.h2
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_font/font_int.h2
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp25
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp5
-rw-r--r--core/src/fpdfapi/fpdf_page/pageint.h6
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp10
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp21
-rw-r--r--core/src/fpdfapi/fpdf_render/render_int.h2
-rw-r--r--core/src/fxcrt/fx_system_unittest.cpp2
-rw-r--r--core/src/fxge/dib/fx_dib_composite.cpp159
-rw-r--r--core/src/fxge/dib/fx_dib_convert.cpp7
-rw-r--r--core/src/fxge/dib/fx_dib_main.cpp21
-rw-r--r--core/src/fxge/freetype/fx_freetype.cpp3
-rw-r--r--core/src/fxge/ge/fx_ge_device.cpp3
-rw-r--r--core/src/fxge/skia/fx_skia_blitter_new.cpp8
-rw-r--r--core/src/fxge/win32/fx_win32_gdipext.cpp4
19 files changed, 156 insertions, 139 deletions
diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h
index 23e1b55efb..450e878fa1 100644
--- a/core/include/fpdfapi/fpdf_resource.h
+++ b/core/include/fpdfapi/fpdf_resource.h
@@ -166,7 +166,7 @@ class CPDF_Font {
CFX_ByteString*& pCharNames,
FX_BOOL bEmbedded,
FX_BOOL bTrueType);
- void LoadFontDescriptor(CPDF_Dictionary*);
+ void LoadFontDescriptor(CPDF_Dictionary* pDict);
void CheckFontMetrics();
CFX_ByteString m_BaseFont;
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index 6e092dd540..006b2b377d 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -315,13 +315,12 @@ class CFX_ArrayTemplate : public CFX_BasicArray {
TYPE* GetData() { return (TYPE*)m_pData; }
FX_BOOL SetAtGrow(int nIndex, TYPE newElement) {
- if (nIndex < 0) {
+ if (nIndex < 0)
return FALSE;
- }
- if (nIndex >= m_nSize)
- if (!SetSize(nIndex + 1)) {
- return FALSE;
- }
+
+ if (nIndex >= m_nSize && !SetSize(nIndex + 1))
+ return FALSE;
+
((TYPE*)m_pData)[nIndex] = newElement;
return TRUE;
}
diff --git a/core/include/fxcrt/fx_memory.h b/core/include/fxcrt/fx_memory.h
index d64844e743..b9b1888930 100644
--- a/core/include/fxcrt/fx_memory.h
+++ b/core/include/fxcrt/fx_memory.h
@@ -98,7 +98,7 @@ class CFX_GrowOnlyPool {
void* Realloc(void* p, size_t new_size) { return NULL; }
- void Free(void*) {}
+ void Free(void* mem) {}
void FreeAll();
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index bcac9d87d4..bc3de20857 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -472,7 +472,7 @@ static FX_WORD FX_GetCsFromLangCode(uint32_t uCode) {
} else {
iStart = iMid + 1;
}
- };
+ }
return 0;
}
static FX_WORD FX_GetCharsetFromLang(const FX_CHAR* pLang, int32_t iLength) {
diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h
index 1d1f006115..dc28010de3 100644
--- a/core/src/fpdfapi/fpdf_font/font_int.h
+++ b/core/src/fpdfapi/fpdf_font/font_int.h
@@ -89,7 +89,7 @@ class CPDF_CMapParser {
public:
CPDF_CMapParser();
~CPDF_CMapParser() {}
- FX_BOOL Initialize(CPDF_CMap*);
+ FX_BOOL Initialize(CPDF_CMap* pMap);
void ParseWord(const CFX_ByteStringC& str);
CFX_BinaryBuf m_AddMaps;
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index 411f77254b..a9deba665c 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -966,22 +966,21 @@ FX_BOOL CPDF_Type1Font::Load() {
m_Base14Font = PDF_GetStandardFontName(&m_BaseFont);
if (m_Base14Font >= 0) {
CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor");
- if (pFontDesc && pFontDesc->KeyExist("Flags")) {
+ if (pFontDesc && pFontDesc->KeyExist("Flags"))
m_Flags = pFontDesc->GetIntegerBy("Flags");
- } else {
+ else
m_Flags = m_Base14Font >= 12 ? PDFFONT_SYMBOLIC : PDFFONT_NONSYMBOLIC;
- }
- if (m_Base14Font < 4)
- for (int i = 0; i < 256; i++) {
+
+ if (m_Base14Font < 4) {
+ for (int i = 0; i < 256; i++)
m_CharWidth[i] = 600;
- }
- if (m_Base14Font == 12) {
+ }
+ if (m_Base14Font == 12)
m_BaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL;
- } else if (m_Base14Font == 13) {
+ else if (m_Base14Font == 13)
m_BaseEncoding = PDFFONT_ENCODING_ZAPFDINGBATS;
- } else if (m_Flags & PDFFONT_NONSYMBOLIC) {
+ else if (m_Flags & PDFFONT_NONSYMBOLIC)
m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
- }
}
return LoadCommon();
}
@@ -1302,10 +1301,10 @@ CPDF_FontEncoding::CPDF_FontEncoding(int PredefinedEncoding) {
const FX_WORD* pSrc = PDF_UnicodesForPredefinedCharSet(PredefinedEncoding);
if (!pSrc) {
FXSYS_memset(m_Unicodes, 0, sizeof(m_Unicodes));
- } else
- for (int i = 0; i < 256; i++) {
+ } else {
+ for (int i = 0; i < 256; i++)
m_Unicodes[i] = pSrc[i];
- }
+ }
}
FX_BOOL CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const {
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 1a78b1f93c..3cbd67633f 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -1545,12 +1545,11 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
if (m_Charset == CIDSET_JAPAN1) {
if (unicode == '\\') {
unicode = '/';
- }
#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
- else if (unicode == 0xa5) {
+ } else if (unicode == 0xa5) {
unicode = 0x5c;
- }
#endif
+ }
}
if (!face)
return unicode;
diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h
index ec06187b6c..e8d155b656 100644
--- a/core/src/fpdfapi/fpdf_page/pageint.h
+++ b/core/src/fpdfapi/fpdf_page/pageint.h
@@ -138,13 +138,13 @@ class CPDF_StreamContentParser {
CPDF_Image* pImage,
FX_BOOL bInline);
void AddDuplicateImage();
- void AddForm(CPDF_Stream*);
+ void AddForm(CPDF_Stream* pStream);
void SetGraphicStates(CPDF_PageObject* pObj,
FX_BOOL bColor,
FX_BOOL bText,
FX_BOOL bGraph);
- void SaveStates(CPDF_AllStates*);
- void RestoreStates(CPDF_AllStates*);
+ void SaveStates(CPDF_AllStates* pState);
+ void RestoreStates(CPDF_AllStates* pState);
CPDF_Font* FindFont(const CFX_ByteString& name);
CPDF_ColorSpace* FindColorSpace(const CFX_ByteString& name);
CPDF_Pattern* FindPattern(const CFX_ByteString& name, FX_BOOL bShading);
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
index 954d3886b5..b91f258371 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -247,12 +247,11 @@ void CPDF_DIBTransferFunc::TranslateScanline(uint8_t* dest_buf,
*dest_buf++ = m_RampR[*(src_buf++)];
if (!bSkip) {
*dest_buf++ = *src_buf;
- }
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- else {
+ } else {
dest_buf++;
- }
#endif
+ }
src_buf++;
}
break;
@@ -284,7 +283,7 @@ void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf,
dest_buf++;
src_buf++;
}
- } else
+ } else {
#endif
for (int i = 0; i < pixels; i++) {
*dest_buf++ = m_RampB[*(src_buf++)];
@@ -292,6 +291,9 @@ void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf,
*dest_buf++ = m_RampR[*(src_buf++)];
*dest_buf++ = *(src_buf++);
}
+#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
+ }
+#endif
}
}
CPDF_ImageRenderer::CPDF_ImageRenderer() {
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 215b104162..42c378666e 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -74,25 +74,24 @@ void CPDF_Type3Glyphs::AdjustBlue(FX_FLOAT top,
top_line = _AdjustBlue(top, m_TopBlueCount, m_TopBlue);
bottom_line = _AdjustBlue(bottom, m_BottomBlueCount, m_BottomBlue);
}
+
static FX_BOOL _IsScanLine1bpp(uint8_t* pBuf, int width) {
int size = width / 8;
- for (int i = 0; i < size; i++)
- if (pBuf[i]) {
- return TRUE;
- }
- if (width % 8)
- if (pBuf[width / 8] & (0xff << (8 - width % 8))) {
+ for (int i = 0; i < size; i++) {
+ if (pBuf[i])
return TRUE;
- }
- return FALSE;
+ }
+ return (width % 8) && (pBuf[width / 8] & (0xff << (8 - width % 8)));
}
+
static FX_BOOL _IsScanLine8bpp(uint8_t* pBuf, int width) {
- for (int i = 0; i < width; i++)
- if (pBuf[i] > 0x40) {
+ for (int i = 0; i < width; i++) {
+ if (pBuf[i] > 0x40)
return TRUE;
- }
+ }
return FALSE;
}
+
static int _DetectFirstLastScan(const CFX_DIBitmap* pBitmap, FX_BOOL bFirst) {
int height = pBitmap->GetHeight(), pitch = pBitmap->GetPitch(),
width = pBitmap->GetWidth();
diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h
index b7f007dd5d..d691f7dc52 100644
--- a/core/src/fpdfapi/fpdf_render/render_int.h
+++ b/core/src/fpdfapi/fpdf_render/render_int.h
@@ -498,7 +498,7 @@ class CPDF_DIBSource : public CFX_DIBSource {
void SetDownSampleSize(int dest_width, int dest_height) override;
CFX_DIBitmap* GetBitmap() const;
- void ReleaseBitmap(CFX_DIBitmap*) const;
+ void ReleaseBitmap(CFX_DIBitmap* pBitmap) const;
void ClearImageData();
FX_DWORD GetMatteColor() const { return m_MatteColor; }
diff --git a/core/src/fxcrt/fx_system_unittest.cpp b/core/src/fxcrt/fx_system_unittest.cpp
index d9f4cc645e..4a07a77ad2 100644
--- a/core/src/fxcrt/fx_system_unittest.cpp
+++ b/core/src/fxcrt/fx_system_unittest.cpp
@@ -127,7 +127,7 @@ TEST(fxcrt, FXSYS_i64toa_InvalidRadix) {
FXSYS_i64toa(42, buf, -1);
EXPECT_EQ(std::string(""), buf);
-};
+}
TEST(fxcrt, FXSYS_i64toa) {
Check64BitBase16Itoa(std::numeric_limits<int64_t>::min(),
diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp
index 8bf36e523a..e2781d6244 100644
--- a/core/src/fxge/dib/fx_dib_composite.cpp
+++ b/core/src/fxge/dib/fx_dib_composite.cpp
@@ -285,10 +285,10 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
const uint8_t* src_alpha_scan,
uint8_t* dst_alpha_scan,
void* pIccTransform) {
- ICodec_IccModule* pIccModule = NULL;
- if (pIccTransform) {
+ ICodec_IccModule* pIccModule = nullptr;
+ if (pIccTransform)
pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- }
+
if (blend_type) {
FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int blended_color;
@@ -297,9 +297,9 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
uint8_t back_alpha = *dst_alpha_scan;
if (back_alpha == 0) {
int src_alpha = *src_alpha_scan++;
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha) {
if (pIccTransform) {
pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
@@ -315,9 +315,9 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
continue;
}
uint8_t src_alpha = *src_alpha_scan++;
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha == 0) {
dest_scan++;
dst_alpha_scan++;
@@ -343,14 +343,14 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
dst_alpha_scan++;
src_scan += 3;
}
- } else
+ } else {
for (int col = 0; col < pixel_count; col++) {
uint8_t back_alpha = *dst_alpha_scan;
if (back_alpha == 0) {
int src_alpha = src_scan[3];
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha) {
if (pIccTransform) {
pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
@@ -366,9 +366,9 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
continue;
}
uint8_t src_alpha = src_scan[3];
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha == 0) {
dest_scan++;
dst_alpha_scan++;
@@ -378,16 +378,17 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
*dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
uint8_t gray;
- if (pIccTransform) {
+ if (pIccTransform)
pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
+ else
gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
+
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
dest_scan++;
dst_alpha_scan++;
src_scan += 4;
}
+ }
return;
}
if (src_alpha_scan) {
@@ -395,9 +396,9 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
uint8_t back_alpha = *dst_alpha_scan;
if (back_alpha == 0) {
int src_alpha = *src_alpha_scan++;
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha) {
if (pIccTransform) {
pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
@@ -413,9 +414,9 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
continue;
}
uint8_t src_alpha = *src_alpha_scan++;
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha == 0) {
dest_scan++;
dst_alpha_scan++;
@@ -425,24 +426,24 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
*dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
uint8_t gray;
- if (pIccTransform) {
+ if (pIccTransform)
pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
+ else
gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
+
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
dest_scan++;
dst_alpha_scan++;
src_scan += 3;
}
- } else
+ } else {
for (int col = 0; col < pixel_count; col++) {
uint8_t back_alpha = *dst_alpha_scan;
if (back_alpha == 0) {
int src_alpha = src_scan[3];
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha) {
if (pIccTransform) {
pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
@@ -458,9 +459,9 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
continue;
}
uint8_t src_alpha = src_scan[3];
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha == 0) {
dest_scan++;
dst_alpha_scan++;
@@ -470,17 +471,19 @@ void _CompositeRow_Argb2Graya(uint8_t* dest_scan,
*dst_alpha_scan = FXDIB_ALPHA_UNION(back_alpha, src_alpha);
int alpha_ratio = src_alpha * 255 / (*dst_alpha_scan);
uint8_t gray;
- if (pIccTransform) {
+ if (pIccTransform)
pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
+ else
gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
+
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, alpha_ratio);
dest_scan++;
dst_alpha_scan++;
src_scan += 4;
}
+ }
}
+
inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan,
const uint8_t* src_scan,
int pixel_count,
@@ -490,24 +493,24 @@ inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan,
void* pIccTransform) {
ICodec_IccModule* pIccModule = NULL;
uint8_t gray;
- if (pIccTransform) {
+ if (pIccTransform)
pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- }
+
if (blend_type) {
FX_BOOL bNonseparableBlend = blend_type >= FXDIB_BLEND_NONSEPARABLE;
int blended_color;
if (src_alpha_scan) {
for (int col = 0; col < pixel_count; col++) {
int src_alpha = *src_alpha_scan++;
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha) {
- if (pIccTransform) {
+ if (pIccTransform)
pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
+ else
gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
+
if (bNonseparableBlend) {
blended_color =
blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
@@ -519,18 +522,18 @@ inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan,
dest_scan++;
src_scan += 3;
}
- } else
+ } else {
for (int col = 0; col < pixel_count; col++) {
int src_alpha = src_scan[3];
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha) {
- if (pIccTransform) {
+ if (pIccTransform)
pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
+ else
gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
+
if (bNonseparableBlend) {
blended_color =
blend_type == FXDIB_BLEND_LUMINOSITY ? gray : *dest_scan;
@@ -542,43 +545,46 @@ inline void _CompositeRow_Argb2Gray(uint8_t* dest_scan,
dest_scan++;
src_scan += 4;
}
+ }
return;
}
if (src_alpha_scan) {
for (int col = 0; col < pixel_count; col++) {
int src_alpha = *src_alpha_scan++;
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha) {
- if (pIccTransform) {
+ if (pIccTransform)
pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
+ else
gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
+
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
}
dest_scan++;
src_scan += 3;
}
- } else
+ } else {
for (int col = 0; col < pixel_count; col++) {
int src_alpha = src_scan[3];
- if (clip_scan) {
+ if (clip_scan)
src_alpha = clip_scan[col] * src_alpha / 255;
- }
+
if (src_alpha) {
- if (pIccTransform) {
+ if (pIccTransform)
pIccModule->TranslateScanline(pIccTransform, &gray, src_scan, 1);
- } else {
+ else
gray = FXRGB2GRAY(src_scan[2], src_scan[1], *src_scan);
- }
+
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
}
dest_scan++;
src_scan += 4;
}
+ }
}
+
inline void _CompositeRow_Rgb2Gray(uint8_t* dest_scan,
const uint8_t* src_scan,
int src_Bpp,
@@ -2329,7 +2335,7 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan,
dest_scan++;
dest_scan++;
}
- } else
+ } else {
for (int col = 0; col < width; col++) {
FX_ARGB argb = pPalette[*src_scan];
int src_r = FXARGB_R(argb);
@@ -2363,7 +2369,9 @@ inline void _CompositeRow_8bppRgb2Argb_NoBlend(uint8_t* dest_scan,
dest_scan++;
src_scan++;
}
+ }
}
+
void _CompositeRow_8bppRgb2Rgba_NoBlend(uint8_t* dest_scan,
const uint8_t* src_scan,
int width,
@@ -2414,7 +2422,7 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(uint8_t* dest_scan,
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
dest_scan++;
}
- } else
+ } else {
for (int col = 0; col < width; col++) {
FX_ARGB argb = pPalette[*src_scan];
int src_r = FXARGB_R(argb);
@@ -2448,7 +2456,9 @@ void _CompositeRow_8bppRgb2Rgba_NoBlend(uint8_t* dest_scan,
dest_scan++;
src_scan++;
}
+ }
}
+
inline void _CompositeRow_1bppRgb2Argb_NoBlend(uint8_t* dest_scan,
const uint8_t* src_scan,
int src_left,
@@ -4120,12 +4130,13 @@ inline void _ScanlineCompositor_InitSourcePalette(FXDIB_Format src_format,
g, b);
*gray_pal++ = FXRGB2GRAY(r, g, b);
}
- } else
+ } else {
for (int i = 0; i < pal_count; i++) {
FX_ARGB argb = pSrcPalette[i];
*gray_pal++ =
FXRGB2GRAY(FXARGB_R(argb), FXARGB_G(argb), FXARGB_B(argb));
}
+ }
} else {
int palsize = 1 << (src_format & 0xff);
pDestPalette = FX_Alloc(FX_DWORD, palsize);
@@ -4586,27 +4597,29 @@ void CFX_ScanlineCompositor::CompositeByteMaskLine(uint8_t* dest_scan,
width, clip_scan);
}
} else if (m_bRgbByteOrder) {
- if (m_DestFormat == FXDIB_Argb)
+ if (m_DestFormat == FXDIB_Argb) {
_CompositeRow_ByteMask2Argb_RgbByteOrder(
dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
width, m_BlendType, clip_scan);
- else
+ } else {
_CompositeRow_ByteMask2Rgb_RgbByteOrder(
dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
+ }
return;
- } else if (m_DestFormat == FXDIB_Argb)
+ } else if (m_DestFormat == FXDIB_Argb) {
_CompositeRow_ByteMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, width, m_BlendType,
clip_scan);
- else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32)
+ } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) {
_CompositeRow_ByteMask2Rgb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, width, m_BlendType,
(m_DestFormat & 0xff) >> 3, clip_scan);
- else if (m_DestFormat == FXDIB_Rgba)
+ } else if (m_DestFormat == FXDIB_Rgba) {
_CompositeRow_ByteMask2Rgba(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, width, m_BlendType,
clip_scan, dst_extra_alpha);
+ }
}
void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan,
const uint8_t* src_scan,
@@ -4618,32 +4631,35 @@ void CFX_ScanlineCompositor::CompositeBitMaskLine(uint8_t* dest_scan,
_CompositeRow_BitMask2Mask(dest_scan, src_scan, m_MaskAlpha, src_left,
width, clip_scan);
} else if ((m_DestFormat & 0xff) == 8) {
- if (m_DestFormat & 0x0200)
+ if (m_DestFormat & 0x0200) {
_CompositeRow_BitMask2Graya(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
src_left, width, clip_scan, dst_extra_alpha);
- else {
+ } else {
_CompositeRow_BitMask2Gray(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
src_left, width, clip_scan);
}
} else if (m_bRgbByteOrder) {
- if (m_DestFormat == FXDIB_Argb)
+ if (m_DestFormat == FXDIB_Argb) {
_CompositeRow_BitMask2Argb_RgbByteOrder(
dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
src_left, width, m_BlendType, clip_scan);
- else
+ } else {
_CompositeRow_BitMask2Rgb_RgbByteOrder(
dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
+ }
return;
- } else if (m_DestFormat == FXDIB_Argb)
+ } else if (m_DestFormat == FXDIB_Argb) {
_CompositeRow_BitMask2Argb(dest_scan, src_scan, m_MaskAlpha, m_MaskRed,
m_MaskGreen, m_MaskBlue, src_left, width,
m_BlendType, clip_scan);
- else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32)
+ } else if (m_DestFormat == FXDIB_Rgb || m_DestFormat == FXDIB_Rgb32) {
_CompositeRow_BitMask2Rgb(
dest_scan, src_scan, m_MaskAlpha, m_MaskRed, m_MaskGreen, m_MaskBlue,
src_left, width, m_BlendType, (m_DestFormat & 0xff) >> 3, clip_scan);
+ }
}
+
FX_BOOL CFX_DIBitmap::CompositeBitmap(int dest_left,
int dest_top,
int width,
@@ -4838,11 +4854,12 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left,
uint8_t* dest_scan = m_pBuffer + row * m_Pitch + rect.left;
if (src_alpha == 255) {
FXSYS_memset(dest_scan, gray, width);
- } else
+ } else {
for (int col = 0; col < width; col++) {
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, src_alpha);
dest_scan++;
}
+ }
}
return TRUE;
}
@@ -4894,11 +4911,11 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left,
CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1);
} else {
- if (alpha_flag >> 8 && !IsCmykImage())
+ if (alpha_flag >> 8 && !IsCmykImage()) {
AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color),
FXSYS_GetYValue(color), FXSYS_GetKValue(color),
color_p[2], color_p[1], color_p[0]);
- else if (!(alpha_flag >> 8) && IsCmykImage()) {
+ } else if (!(alpha_flag >> 8) && IsCmykImage()) {
return FALSE;
}
}
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp
index 91ccfc109e..a1c18ae121 100644
--- a/core/src/fxge/dib/fx_dib_convert.cpp
+++ b/core/src/fxge/dib/fx_dib_convert.cpp
@@ -389,11 +389,12 @@ FX_BOOL ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf,
FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b);
gray[i] = FXRGB2GRAY(r, g, b);
}
- } else
+ } else {
for (int i = 0; i < 256; i++) {
gray[i] = FXRGB2GRAY(FXARGB_R(src_plt[i]), FXARGB_G(src_plt[i]),
FXARGB_B(src_plt[i]));
}
+ }
}
for (int row = 0; row < height; row++) {
uint8_t* dest_scan = dest_buf + row * dest_pitch;
@@ -1104,10 +1105,10 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format,
}
}
if (dest_format & 0x0200) {
- if (dest_format == FXDIB_Argb)
+ if (dest_format == FXDIB_Argb) {
ret = pSrcAlpha ? pClone->LoadChannel(FXDIB_Alpha, pSrcAlpha, FXDIB_Alpha)
: pClone->LoadChannel(FXDIB_Alpha, 0xff);
- else {
+ } else {
ret = pClone->CopyAlphaMask(pSrcAlpha);
}
}
diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp
index 7c27d5451b..4922373ec0 100644
--- a/core/src/fxge/dib/fx_dib_main.cpp
+++ b/core/src/fxge/dib/fx_dib_main.cpp
@@ -470,11 +470,11 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left,
CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
pIccModule->TranslateScanline(pIccTransform, color_p, color_p, 1);
} else {
- if (alpha_flag >> 8 && !IsCmykImage())
+ if (alpha_flag >> 8 && !IsCmykImage()) {
AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color),
FXSYS_GetYValue(color), FXSYS_GetKValue(color),
color_p[2], color_p[1], color_p[0]);
- else if (!(alpha_flag >> 8) && IsCmykImage()) {
+ } else if (!(alpha_flag >> 8) && IsCmykImage()) {
return FALSE;
}
}
@@ -703,11 +703,10 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel,
}
return FALSE;
}
- } else
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) {
+ } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) {
#else
- if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) {
+ } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) {
#endif
if (pSrcClone != pSrcBitmap) {
delete pSrcClone;
@@ -797,16 +796,13 @@ FX_BOOL CFX_DIBitmap::LoadChannel(FXDIB_Channel destChannel, int value) {
if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyka : FXDIB_Argb)) {
return FALSE;
}
- } else
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) {
- return FALSE;
- }
+ } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb)) {
#else
- if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) {
+ } else if (!ConvertFormat(IsCmykImage() ? FXDIB_Cmyk : FXDIB_Rgb32)) {
+#endif
return FALSE;
}
-#endif
}
destOffset = g_ChannelOffset[destChannel];
}
@@ -1264,7 +1260,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor,
bc + (fc - bc) * gray / 255, bm + (fm - bm) * gray / 255,
by + (fy - by) * gray / 255, bk + (fk - bk) * gray / 255);
}
- } else
+ } else {
for (int i = 0; i < size; i++) {
int gray = FXRGB2GRAY(FXARGB_R(m_pPalette[i]), FXARGB_G(m_pPalette[i]),
FXARGB_B(m_pPalette[i]));
@@ -1272,6 +1268,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(FX_DWORD forecolor,
bg + (fg - bg) * gray / 255,
bb + (fb - bb) * gray / 255);
}
+ }
return TRUE;
}
if (isCmykImage) {
diff --git a/core/src/fxge/freetype/fx_freetype.cpp b/core/src/fxge/freetype/fx_freetype.cpp
index 6cf5aa32ff..2fc60e913e 100644
--- a/core/src/fxge/freetype/fx_freetype.cpp
+++ b/core/src/fxge/freetype/fx_freetype.cpp
@@ -34,8 +34,9 @@ static int xyq_search_node(char* glyph_name,
if (thiscode == (unsigned short)unicode) // found it!
return 1;
table_offset += 3;
- } else
+ } else {
table_offset++;
+ }
// now search in sub-nodes
if (count == 0)
diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp
index c4f7735957..b8ddfec841 100644
--- a/core/src/fxge/ge/fx_ge_device.cpp
+++ b/core/src/fxge/ge/fx_ge_device.cpp
@@ -328,11 +328,12 @@ FX_BOOL CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1,
if (((m_RenderCaps & FXRC_ALPHA_PATH) &&
(FXGETFLAG_COLORTYPE(alpha_flag) &&
FXGETFLAG_ALPHA_FILL(alpha_flag) == 0xff)) ||
- color >= 0xff000000)
+ color >= 0xff000000) {
if (m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, alpha_flag,
pIccTransform, blend_type)) {
return TRUE;
}
+ }
CFX_GraphStateData graph_state;
CFX_PathData path;
path.SetPointCount(2);
diff --git a/core/src/fxge/skia/fx_skia_blitter_new.cpp b/core/src/fxge/skia/fx_skia_blitter_new.cpp
index 4c9c3d0bb9..7a8cb1bfac 100644
--- a/core/src/fxge/skia/fx_skia_blitter_new.cpp
+++ b/core/src/fxge/skia/fx_skia_blitter_new.cpp
@@ -287,9 +287,9 @@ void CFX_SkiaRenderer::CompositeSpanGray_6(uint8_t* dest_scan,
dest_scan++;
continue;
}
- if (src_alpha1 == 255)
+ if (src_alpha1 == 255) {
*dest_scan++ = m_Gray;
- else {
+ } else {
*dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha1);
dest_scan++;
}
@@ -1500,9 +1500,9 @@ FX_BOOL CFX_SkiaRenderer::Init(
m_pOriScan = NULL;
m_pClipScan = NULL;
composite_span = NULL;
- if (m_pClipRgn)
+ if (m_pClipRgn) {
m_ClipBox = m_pClipRgn->GetBox();
- else {
+ } else {
m_ClipBox.left = m_ClipBox.top = 0;
m_ClipBox.right = m_pDevice->GetWidth();
m_ClipBox.bottom = m_pDevice->GetHeight();
diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp
index e71d94d310..629f3235ed 100644
--- a/core/src/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/src/fxge/win32/fx_win32_gdipext.cpp
@@ -1347,7 +1347,9 @@ class GpStream final : public IStream {
DWORD) {
return E_NOTIMPL;
}
- virtual HRESULT STDMETHODCALLTYPE Clone(IStream**) { return E_NOTIMPL; }
+ virtual HRESULT STDMETHODCALLTYPE Clone(IStream** stream) {
+ return E_NOTIMPL;
+ }
virtual HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER liDistanceToMove,
DWORD dwOrigin,
ULARGE_INTEGER* lpNewFilePointer) {