summaryrefslogtreecommitdiff
path: root/core/src/fxge
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxge')
-rw-r--r--core/src/fxge/agg/src/fx_agg_driver.cpp9
-rw-r--r--core/src/fxge/dib/fx_dib_composite.cpp12
-rw-r--r--core/src/fxge/dib/fx_dib_convert.cpp24
-rw-r--r--core/src/fxge/dib/fx_dib_engine.cpp9
-rw-r--r--core/src/fxge/dib/fx_dib_main.cpp7
-rw-r--r--core/src/fxge/dib/fx_dib_transform.cpp6
-rw-r--r--core/src/fxge/ge/fx_ge_device.cpp9
-rw-r--r--core/src/fxge/ge/fx_ge_font.cpp27
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp12
-rw-r--r--core/src/fxge/ge/fx_ge_linux.cpp9
-rw-r--r--core/src/fxge/ge/fx_ge_path.cpp6
-rw-r--r--core/src/fxge/ge/fx_ge_text.cpp57
-rw-r--r--core/src/fxge/skia/fx_skia_blitter_new.cpp3061
-rw-r--r--core/src/fxge/win32/fx_win32_device.cpp80
-rw-r--r--core/src/fxge/win32/fx_win32_dib.cpp3
-rw-r--r--core/src/fxge/win32/fx_win32_dwrite.cpp20
-rw-r--r--core/src/fxge/win32/fx_win32_gdipext.cpp8
-rw-r--r--core/src/fxge/win32/fx_win32_print.cpp42
18 files changed, 1702 insertions, 1699 deletions
diff --git a/core/src/fxge/agg/src/fx_agg_driver.cpp b/core/src/fxge/agg/src/fx_agg_driver.cpp
index 475e5f6442..118db7bf1f 100644
--- a/core/src/fxge/agg/src/fx_agg_driver.cpp
+++ b/core/src/fxge/agg/src/fx_agg_driver.cpp
@@ -417,7 +417,8 @@ public:
}
}
return;
- } else if (Bpp == 3 || Bpp == 4) {
+ }
+ if (Bpp == 3 || Bpp == 4) {
for (int col = col_start; col < col_end; col ++) {
int src_alpha;
if (clip_scan) {
@@ -479,7 +480,8 @@ public:
}
}
return;
- } else if (Bpp == 3 || Bpp == 4) {
+ }
+ if (Bpp == 3 || Bpp == 4) {
for (int col = col_start; col < col_end; col ++) {
int src_alpha;
if (clip_scan) {
@@ -508,7 +510,8 @@ public:
continue;
}
return;
- } else if (Bpp == 1) {
+ }
+ if (Bpp == 1) {
for (int col = col_start; col < col_end; col ++) {
int src_alpha;
if (clip_scan) {
diff --git a/core/src/fxge/dib/fx_dib_composite.cpp b/core/src/fxge/dib/fx_dib_composite.cpp
index 19a870ade3..cb99a37ff4 100644
--- a/core/src/fxge/dib/fx_dib_composite.cpp
+++ b/core/src/fxge/dib/fx_dib_composite.cpp
@@ -3938,7 +3938,8 @@ void CFX_ScanlineCompositor::CompositePalBitmapLine(uint8_t* dest_scan, const ui
if (m_SrcFormat == FXDIB_1bppRgb) {
if (m_DestFormat == FXDIB_8bppRgb) {
return;
- } else if(m_DestFormat == FXDIB_Argb) {
+ }
+ if(m_DestFormat == FXDIB_Argb) {
_CompositeRow_1bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_scan, src_left, width, m_pSrcPalette, clip_scan);
} else {
_CompositeRow_1bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_scan, src_left, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan);
@@ -3946,7 +3947,8 @@ void CFX_ScanlineCompositor::CompositePalBitmapLine(uint8_t* dest_scan, const ui
} else {
if (m_DestFormat == FXDIB_8bppRgb) {
return;
- } else if (m_DestFormat == FXDIB_Argb) {
+ }
+ if (m_DestFormat == FXDIB_Argb) {
_CompositeRow_8bppRgb2Argb_NoBlend_RgbByteOrder(dest_scan, src_scan, width, m_pSrcPalette, clip_scan);
} else {
_CompositeRow_8bppRgb2Rgb_NoBlend_RgbByteOrder(dest_scan, src_scan, m_pSrcPalette, width, (m_DestFormat & 0xff) >> 3, clip_scan);
@@ -3957,7 +3959,8 @@ void CFX_ScanlineCompositor::CompositePalBitmapLine(uint8_t* dest_scan, const ui
if (m_DestFormat == FXDIB_8bppMask) {
_CompositeRow_Rgb2Mask(dest_scan, src_scan, width, clip_scan);
return;
- } else if ((m_DestFormat & 0xff) == 8) {
+ }
+ if ((m_DestFormat & 0xff) == 8) {
if (m_Transparency & 8) {
if (m_DestFormat & 0x0200) {
_CompositeRow_1bppPal2Graya(dest_scan, src_scan, src_left, (const uint8_t*)m_pSrcPalette, width, m_BlendType, clip_scan, dst_extra_alpha);
@@ -4208,7 +4211,8 @@ FX_BOOL CFX_DIBitmap::CompositeRect(int left, int top, int width, int height, FX
}
}
return TRUE;
- } else if (m_bpp == 1) {
+ }
+ if (m_bpp == 1) {
ASSERT(!IsCmykImage() && (uint8_t)(alpha_flag >> 8) == 0);
int left_shift = rect.left % 8;
int right_shift = rect.right % 8;
diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp
index 8e96379d37..d7860aee19 100644
--- a/core/src/fxge/dib/fx_dib_convert.cpp
+++ b/core/src/fxge/dib/fx_dib_convert.cpp
@@ -843,12 +843,14 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc
return _ConvertBuffer_1bppPlt2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
}
return _ConvertBuffer_1bppMask2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top);
- } else if ((src_format & 0xff) == 8) {
+ }
+ if ((src_format & 0xff) == 8) {
if (pSrcBitmap->GetPalette()) {
return _ConvertBuffer_8bppPlt2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
}
return _ConvertBuffer_8bppMask2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top);
- } else if ((src_format & 0xff) >= 24) {
+ }
+ if ((src_format & 0xff) >= 24) {
return _ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
}
return FALSE;
@@ -861,7 +863,8 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc
d_pal = FX_Alloc(FX_DWORD, 256);
if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) && pSrcBitmap->GetPalette()) {
return _ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform);
- } else if ((src_format & 0xff) >= 24) {
+ }
+ if ((src_format & 0xff) >= 24) {
return _ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, d_pal, pIccTransform);
}
return FALSE;
@@ -873,14 +876,17 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc
return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
}
return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top);
- } else if ((src_format & 0xff) == 8) {
+ }
+ if ((src_format & 0xff) == 8) {
if (pSrcBitmap->GetPalette()) {
return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
}
return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top);
- } else if ((src_format & 0xff) == 24) {
+ }
+ if ((src_format & 0xff) == 24) {
return _ConvertBuffer_24bppRgb2Rgb24(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
- } else if ((src_format & 0xff) == 32) {
+ }
+ if ((src_format & 0xff) == 32) {
return _ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
}
return FALSE;
@@ -892,12 +898,14 @@ FX_BOOL ConvertBuffer(FXDIB_Format dest_format, uint8_t* dest_buf, int dest_pitc
return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
}
return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top);
- } else if ((src_format & 0xff) == 8) {
+ }
+ if ((src_format & 0xff) == 8) {
if (pSrcBitmap->GetPalette()) {
return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
}
return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top);
- } else if ((src_format & 0xff) >= 24) {
+ }
+ if ((src_format & 0xff) >= 24) {
if (src_format & 0x0400) {
return _ConvertBuffer_32bppCmyk2Rgb32(dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, pIccTransform);
}
diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp
index 11e9a110cb..7390c431d9 100644
--- a/core/src/fxge/dib/fx_dib_engine.cpp
+++ b/core/src/fxge/dib/fx_dib_engine.cpp
@@ -346,9 +346,8 @@ FX_BOOL CStretchEngine::ContinueStretchHorz(IFX_Pause* pPause)
if (rows_to_go == 0) {
if (pPause && pPause->NeedToPauseNow()) {
return TRUE;
- } else {
- rows_to_go = FX_STRECH_PAUSE_ROWS;
}
+ rows_to_go = FX_STRECH_PAUSE_ROWS;
}
const uint8_t* src_scan = m_pSource->GetScanline(m_CurRow);
uint8_t* dest_scan = m_pInterBuf + (m_CurRow - m_SrcClip.top) * m_InterPitch;
@@ -745,17 +744,15 @@ FX_BOOL CFX_ImageStretcher::Start(IFX_ScanlineComposer* pDest,
}
if (flags & FXDIB_DOWNSAMPLE) {
return StartQuickStretch();
- } else {
- return StartStretch();
}
+ return StartStretch();
}
FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause)
{
if (m_Flags & FXDIB_DOWNSAMPLE) {
return ContinueQuickStretch(pPause);
- } else {
- return ContinueStretch(pPause);
}
+ return ContinueStretch(pPause);
}
#define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000
FX_BOOL CFX_ImageStretcher::StartStretch()
diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp
index 82a14974f4..8a864f10a1 100644
--- a/core/src/fxge/dib/fx_dib_main.cpp
+++ b/core/src/fxge/dib/fx_dib_main.cpp
@@ -1033,10 +1033,8 @@ FX_DWORD CFX_DIBitmap::GetPixel(int x, int y) const
case FXDIB_1bppRgb: {
if ((*pos) & (1 << (7 - x % 8))) {
return m_pPalette ? m_pPalette[1] : 0xffffffff;
- } else {
- return m_pPalette ? m_pPalette[0] : 0xff000000;
}
- break;
+ return m_pPalette ? m_pPalette[0] : 0xff000000;
}
case FXDIB_8bppMask:
return (*pos) << 24;
@@ -1588,7 +1586,8 @@ FX_BOOL CFX_ImageRenderer::Continue(IFX_Pause* pPause)
{
if (m_Status == 1) {
return m_Stretcher.Continue(pPause);
- } else if (m_Status == 2) {
+ }
+ if (m_Status == 2) {
if (m_pTransformer->Continue(pPause)) {
return TRUE;
}
diff --git a/core/src/fxge/dib/fx_dib_transform.cpp b/core/src/fxge/dib/fx_dib_transform.cpp
index 423577977c..e34e715bf2 100644
--- a/core/src/fxge/dib/fx_dib_transform.cpp
+++ b/core/src/fxge/dib/fx_dib_transform.cpp
@@ -345,9 +345,11 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause)
m_Storer.Replace(m_Storer.GetBitmap()->SwapXY(m_pMatrix->c > 0, m_pMatrix->b < 0));
}
return FALSE;
- } else if (m_Status == 2) {
+ }
+ if (m_Status == 2) {
return m_Stretcher.Continue(pPause);
- } else if (m_Status != 3) {
+ }
+ if (m_Status != 3) {
return FALSE;
}
if (m_Stretcher.Continue(pPause)) {
diff --git a/core/src/fxge/ge/fx_ge_device.cpp b/core/src/fxge/ge/fx_ge_device.cpp
index 793dfc5ee2..0baa99cdc7 100644
--- a/core/src/fxge/ge/fx_ge_device.cpp
+++ b/core/src/fxge/ge/fx_ge_device.cpp
@@ -64,13 +64,14 @@ FX_BOOL CFX_RenderDevice::CreateCompatibleBitmap(CFX_DIBitmap* pDIB, int width,
{
if (m_RenderCaps & FXRC_CMYK_OUTPUT) {
return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Cmyka : FXDIB_Cmyk);
- } else if (m_RenderCaps & FXRC_BYTEMASK_OUTPUT) {
+ }
+ if (m_RenderCaps & FXRC_BYTEMASK_OUTPUT) {
return pDIB->Create(width, height, FXDIB_8bppMask);
- } else
+ }
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Argb : FXDIB_Rgb32);
+ return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Argb : FXDIB_Rgb32);
#else
- return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Argb : FXDIB_Rgb);
+ return pDIB->Create(width, height, m_RenderCaps & FXRC_ALPHA_OUTPUT ? FXDIB_Argb : FXDIB_Rgb);
#endif
}
FX_BOOL CFX_RenderDevice::SetClip_PathFill(const CFX_PathData* pPathData,
diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp
index f88cbaacde..6a950bf20b 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -309,9 +309,8 @@ CFX_ByteString CFX_Font::GetFamilyName() const
}
if (m_Face) {
return CFX_ByteString(FXFT_Get_Face_Family_Name(m_Face));
- } else {
- return m_pSubstFont->m_Family;
}
+ return m_pSubstFont->m_Family;
}
CFX_ByteString CFX_Font::GetFaceName() const
{
@@ -329,9 +328,8 @@ CFX_ByteString CFX_Font::GetFaceName() const
facename += " " + style;
}
return facename;
- } else {
- return m_pSubstFont->m_Family;
}
+ return m_pSubstFont->m_Family;
}
FX_BOOL CFX_Font::GetBBox(FX_RECT &bbox)
{
@@ -410,21 +408,20 @@ FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCode(FX_DWORD charcode)
}
FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCodeEx(FX_DWORD charcode, int encoding)
{
- FXFT_Face face = m_pFont->GetFace();
+ FXFT_Face face = m_pFont->GetFace();
if (!face) {
return charcode;
}
if (encoding == ENCODING_UNICODE) {
- return GlyphFromCharCode(charcode);
- } else {
- int nmaps = FXFT_Get_Face_CharmapCount(m_pFont->m_Face);
- int i = 0;
- while (i < nmaps) {
- int encoding = FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i++]);
- if (encoding != FXFT_ENCODING_UNICODE) {
- FXFT_Select_Charmap(face, encoding);
- break;
- }
+ return GlyphFromCharCode(charcode);
+ }
+ int nmaps = FXFT_Get_Face_CharmapCount(m_pFont->m_Face);
+ int i = 0;
+ while (i < nmaps) {
+ int encoding = FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i++]);
+ if (encoding != FXFT_ENCODING_UNICODE) {
+ FXFT_Select_Charmap(face, encoding);
+ break;
}
}
return FXFT_Get_Char_Index(face, charcode);
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index 8956cd1c88..4674589911 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -688,7 +688,8 @@ uint8_t _GetCharsetFromCodePage(FX_WORD codepage)
const CHARSET_MAP & cp = g_Codepage2CharsetTable[iMid];
if (codepage == cp.codepage) {
return cp.charset;
- } else if (codepage < cp.codepage) {
+ }
+ if (codepage < cp.codepage) {
iEnd = iMid - 1;
} else {
iStart = iMid + 1;
@@ -1159,14 +1160,10 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru
m_pFontMgr->GetStandardFont(pFontData, size, 12);
m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
return m_FoxitFaces[12];
- } else {
- pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL;
- return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC, weight, italic_angle, 0, pSubstFont);
}
-#else
+#endif
pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL;
return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC, weight, italic_angle, 0, pSubstFont);
-#endif
}
if (Charset == FXFONT_ANSI_CHARSET) {
pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
@@ -1175,9 +1172,8 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, FX_BOOL bTru
int index = m_CharsetArray.Find(Charset);
if (index < 0) {
return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, PitchFamily);
- } else {
- hFont = m_pFontInfo->GetFont(m_FaceArray[index]);
}
+ hFont = m_pFontInfo->GetFont(m_FaceArray[index]);
}
}
pSubstFont->m_ExtHandle = m_pFontInfo->RetainFont(hFont);
diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp
index 631ff8e93f..4e7334596b 100644
--- a/core/src/fxge/ge/fx_ge_linux.cpp
+++ b/core/src/fxge/ge/fx_ge_linux.cpp
@@ -63,15 +63,14 @@ static int32_t GetJapanesePreference(const FX_CHAR* facearr, int weight, int pic
if (face.Find("Gothic") >= 0 || face.Find("\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) {
if (face.Find("PGothic") >= 0 || face.Find("\x82\x6f\x83\x53\x83\x56\x83\x62\x83\x4e") >= 0) {
return 0;
- } else {
- return 1;
}
- } else if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) {
+ return 1;
+ }
+ if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) {
if (face.Find("PMincho") >= 0 || face.Find("\x82\x6f\x96\xbe\x92\xa9") >= 0) {
return 2;
- } else {
- return 3;
}
+ return 3;
}
if (!(picth_family & FXFONT_FF_ROMAN) && weight > 400) {
return 0;
diff --git a/core/src/fxge/ge/fx_ge_path.cpp b/core/src/fxge/ge/fx_ge_path.cpp
index ea1d80390b..b1410b3911 100644
--- a/core/src/fxge/ge/fx_ge_path.cpp
+++ b/core/src/fxge/ge/fx_ge_path.cpp
@@ -55,7 +55,8 @@ void CFX_ClipRgn::IntersectMaskRect(FX_RECT rect, FX_RECT mask_rect, CFX_DIBitma
if (m_Box.IsEmpty()) {
m_Type = RectI;
return;
- } else if (m_Box == mask_rect) {
+ }
+ if (m_Box == mask_rect) {
m_Mask = Mask;
return;
}
@@ -229,7 +230,8 @@ static void _UpdateLineEndPoints(CFX_FloatRect& rect, FX_FLOAT start_x, FX_FLOAT
rect.UpdateRect(end_x + hw, point_y);
rect.UpdateRect(end_x - hw, point_y);
return;
- } else if (start_y == end_y) {
+ }
+ if (start_y == end_y) {
FX_FLOAT point_x;
if (end_x < start_x) {
point_x = end_x - hw;
diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp
index 76c7cf429e..59a4cfb37d 100644
--- a/core/src/fxge/ge/fx_ge_text.cpp
+++ b/core/src/fxge/ge/fx_ge_text.cpp
@@ -1154,38 +1154,37 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD
#else
if (text_flags & FXTEXT_NO_NATIVETEXT) {
return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontStyle, dest_width, anti_alias);
+ }
+ CFX_GlyphBitmap* pGlyphBitmap;
+ CFX_SizeGlyphCache* pSizeCache = NULL;
+ if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) {
+ if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) {
+ return pGlyphBitmap;
+ }
+ pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias);
+ if (pGlyphBitmap) {
+ pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap);
+ return pGlyphBitmap;
+ }
} else {
- CFX_GlyphBitmap* pGlyphBitmap;
- CFX_SizeGlyphCache* pSizeCache = NULL;
- if (m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) {
- if (pSizeCache->m_GlyphMap.Lookup((void*)(uintptr_t)glyph_index, (void*&)pGlyphBitmap)) {
- return pGlyphBitmap;
- }
- pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias);
- if (pGlyphBitmap) {
- pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap);
- return pGlyphBitmap;
- }
- } else {
- pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias);
- if (pGlyphBitmap) {
- pSizeCache = new CFX_SizeGlyphCache;
- m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache);
- pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap);
- return pGlyphBitmap;
- }
+ pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias);
+ if (pGlyphBitmap) {
+ pSizeCache = new CFX_SizeGlyphCache;
+ m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache);
+ pSizeCache->m_GlyphMap.SetAt((void*)(uintptr_t)glyph_index, pGlyphBitmap);
+ return pGlyphBitmap;
}
- if (pFont->GetSubstFont())
- keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000),
- (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), dest_width, anti_alias,
- pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical());
- else
- keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000),
- (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), dest_width, anti_alias);
- CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
- text_flags |= FXTEXT_NO_NATIVETEXT;
- return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontStyle, dest_width, anti_alias);
}
+ if (pFont->GetSubstFont())
+ keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000),
+ (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), dest_width, anti_alias,
+ pFont->GetSubstFont()->m_Weight, pFont->GetSubstFont()->m_ItalicAngle, pFont->IsVertical());
+ else
+ keygen.Generate(6, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000),
+ (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), dest_width, anti_alias);
+ CFX_ByteStringC FaceGlyphsKey2(keygen.m_Key, keygen.m_KeyLen);
+ text_flags |= FXTEXT_NO_NATIVETEXT;
+ return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey2, glyph_index, bFontStyle, dest_width, anti_alias);
#endif
}
CFX_SizeGlyphCache::~CFX_SizeGlyphCache()
diff --git a/core/src/fxge/skia/fx_skia_blitter_new.cpp b/core/src/fxge/skia/fx_skia_blitter_new.cpp
index da9e6f28f1..3437eb497d 100644
--- a/core/src/fxge/skia/fx_skia_blitter_new.cpp
+++ b/core/src/fxge/skia/fx_skia_blitter_new.cpp
@@ -8,1603 +8,1602 @@
#include "../../../include/fxcodec/fx_codec.h"
#include "SkBlitter.h"
#include "fx_skia_blitter_new.h"
- // We use our own renderer here to make it simple
- void CFX_SkiaRenderer::blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[])
- {
- FXSYS_assert(m_Alpha);
- if (m_pOriDevice == NULL && composite_span == NULL) return;
- if (y < m_ClipBox.top || y >= m_ClipBox.bottom) return;
- while (1)
- {
- int width = runs[0];
- SkASSERT(width >= 0);
- if (width <= 0)
- return;
- unsigned aa = antialias[0];
- if (aa)
- (*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, aa, m_ClipBox.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pDestExtraAlphaScan);
- runs += width;
- antialias += width;
- x += width;
- }
- }
+ // We use our own renderer here to make it simple
+ void CFX_SkiaRenderer::blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[])
+ {
+ FXSYS_assert(m_Alpha);
+ if (m_pOriDevice == NULL && composite_span == NULL) return;
+ if (y < m_ClipBox.top || y >= m_ClipBox.bottom) return;
+ while (1)
+ {
+ int width = runs[0];
+ SkASSERT(width >= 0);
+ if (width <= 0)
+ return;
+ unsigned aa = antialias[0];
+ if (aa)
+ (*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, aa, m_ClipBox.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pDestExtraAlphaScan);
+ runs += width;
+ antialias += width;
+ x += width;
+ }
+ }
- void CFX_SkiaRenderer::blitH(int x, int y, int width)
- {
- FXSYS_assert(m_Alpha && width);
- if (y < m_ClipBox.top || y >= m_ClipBox.bottom) return;
- (*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, 255, m_ClipBox.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pDestExtraAlphaScan);
- }
+ void CFX_SkiaRenderer::blitH(int x, int y, int width)
+ {
+ FXSYS_assert(m_Alpha && width);
+ if (y < m_ClipBox.top || y >= m_ClipBox.bottom) return;
+ (*composite_span)(m_pDestScan, m_pOriScan, 0, x, width, y, 255, m_ClipBox.top, m_ClipBox.left, m_ClipBox.right, m_pClipScan, m_pDestExtraAlphaScan);
+ }
- void CFX_SkiaRenderer::blitV(int x, int y, int height, SkAlpha alpha)
- {
- FXSYS_assert(m_Alpha && alpha);
- if (alpha == 255) {
- blitRect(x, y, 1, height);
- } else {
- int16_t runs[2];
- runs[0] = 1;
- runs[1] = 0;
- while (--height >= 0) {
- if (y >= m_ClipBox.bottom)
- return;
- blitAntiH(x, y ++, &alpha, runs);
- }
- }
- }
- void CFX_SkiaRenderer::blitRect(int x, int y, int width, int height)
- {
- FXSYS_assert(m_Alpha && width);
- while (--height >= 0){
- if (y >= m_ClipBox.bottom)
- return;
- blitH(x, y ++, width);
- }
- }
+ void CFX_SkiaRenderer::blitV(int x, int y, int height, SkAlpha alpha)
+ {
+ FXSYS_assert(m_Alpha && alpha);
+ if (alpha == 255) {
+ blitRect(x, y, 1, height);
+ } else {
+ int16_t runs[2];
+ runs[0] = 1;
+ runs[1] = 0;
+ while (--height >= 0) {
+ if (y >= m_ClipBox.bottom)
+ return;
+ blitAntiH(x, y ++, &alpha, runs);
+ }
+ }
+ }
+ void CFX_SkiaRenderer::blitRect(int x, int y, int width, int height)
+ {
+ FXSYS_assert(m_Alpha && width);
+ while (--height >= 0){
+ if (y >= m_ClipBox.bottom)
+ return;
+ blitH(x, y ++, width);
+ }
+ }
- void CFX_SkiaRenderer::blitAntiRect(int x, int y, int width, int height,
+ void CFX_SkiaRenderer::blitAntiRect(int x, int y, int width, int height,
SkAlpha leftAlpha, SkAlpha rightAlpha)
- {
- blitV(x++, y, height, leftAlpha);
- if (width > 0) {
- blitRect(x, y, width, height);
- x += width;
- }
- blitV(x, y, height, rightAlpha);
- }
- /*---------------------------------------------------------------------------------------------------*/
- void CFX_SkiaRenderer::CompositeSpan1bpp_0(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_bRgbByteOrder);
- ASSERT(!m_pDevice->IsCmykImage());
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left/8;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start/8;
+ {
+ blitV(x++, y, height, leftAlpha);
+ if (width > 0) {
+ blitRect(x, y, width, height);
+ x += width;
+ }
+ blitV(x, y, height, rightAlpha);
+ }
+ /*---------------------------------------------------------------------------------------------------*/
+ void CFX_SkiaRenderer::CompositeSpan1bpp_0(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_bRgbByteOrder);
+ ASSERT(!m_pDevice->IsCmykImage());
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left/8;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start/8;
- int index = 0;
- if (m_pDevice->GetPalette() == NULL)
- index = ((uint8_t)m_Color == 0xff) ? 1 : 0;
- else {
- for (int i = 0; i < 2; i ++)
- if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color)
- index = i;
- }
- uint8_t* dest_scan1 = dest_scan;
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- if (src_alpha) {
- if (!index)
- *dest_scan1 &= ~(1 << (7 - (col+span_left)%8));
- else
- *dest_scan1|= 1 << (7 - (col+span_left)%8);
- }
- dest_scan1 = dest_scan+(span_left%8+col-col_start+1)/8;
- }
- }
- void CFX_SkiaRenderer::CompositeSpan1bpp_4(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_bRgbByteOrder);
- ASSERT(!m_pDevice->IsCmykImage());
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left/8;
- clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start/8;
+ int index = 0;
+ if (m_pDevice->GetPalette() == NULL)
+ index = ((uint8_t)m_Color == 0xff) ? 1 : 0;
+ else {
+ for (int i = 0; i < 2; i ++)
+ if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color)
+ index = i;
+ }
+ uint8_t* dest_scan1 = dest_scan;
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ if (src_alpha) {
+ if (!index)
+ *dest_scan1 &= ~(1 << (7 - (col+span_left)%8));
+ else
+ *dest_scan1|= 1 << (7 - (col+span_left)%8);
+ }
+ dest_scan1 = dest_scan+(span_left%8+col-col_start+1)/8;
+ }
+ }
+ void CFX_SkiaRenderer::CompositeSpan1bpp_4(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_bRgbByteOrder);
+ ASSERT(!m_pDevice->IsCmykImage());
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left/8;
+ clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start/8;
- int index = 0;
- if (m_pDevice->GetPalette() == NULL)
- index = ((uint8_t)m_Color == 0xff) ? 1 : 0;
- else {
- for (int i = 0; i < 2; i ++)
- if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color)
- index = i;
- }
- uint8_t* dest_scan1 = dest_scan;
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha1 = src_alpha * clip_scan[col] / 255;
- if (src_alpha1) {
- if (!index)
- *dest_scan1 &= ~(1 << (7 - (col+span_left)%8));
- else
- *dest_scan1|= 1 << (7 - (col+span_left)%8);
- }
- dest_scan1 = dest_scan+(span_left%8+col-col_start+1)/8;
- }
- }
- /*-----------------------------------------------------------------------------------------------------*/
- void CFX_SkiaRenderer::CompositeSpanGray_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_pDevice->IsCmykImage());
- ASSERT(!m_bRgbByteOrder);
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start;
- if (cover_scan == 255 && m_Alpha == 255) {
- FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gray, m_Gray, m_Gray, m_Gray), col_end - col_start);
- return;
- }
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha);
- dest_scan++;
- }
- }
- void CFX_SkiaRenderer::CompositeSpanGray_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_pDevice->IsCmykImage());
- ASSERT(!m_bRgbByteOrder);
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
- ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start;
- ori_scan += col_start;
- if (m_Alpha == 255 && cover_scan == 255) {
- FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gray, m_Gray, m_Gray, m_Gray), col_end - col_start);
- } else {
- int src_alpha = m_Alpha;
+ int index = 0;
+ if (m_pDevice->GetPalette() == NULL)
+ index = ((uint8_t)m_Color == 0xff) ? 1 : 0;
+ else {
+ for (int i = 0; i < 2; i ++)
+ if (FXARGB_TODIB(m_pDevice->GetPalette()[i]) == m_Color)
+ index = i;
+ }
+ uint8_t* dest_scan1 = dest_scan;
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha1 = src_alpha * clip_scan[col] / 255;
+ if (src_alpha1) {
+ if (!index)
+ *dest_scan1 &= ~(1 << (7 - (col+span_left)%8));
+ else
+ *dest_scan1|= 1 << (7 - (col+span_left)%8);
+ }
+ dest_scan1 = dest_scan+(span_left%8+col-col_start+1)/8;
+ }
+ }
+ /*-----------------------------------------------------------------------------------------------------*/
+ void CFX_SkiaRenderer::CompositeSpanGray_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_pDevice->IsCmykImage());
+ ASSERT(!m_bRgbByteOrder);
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start;
+ if (cover_scan == 255 && m_Alpha == 255) {
+ FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gray, m_Gray, m_Gray, m_Gray), col_end - col_start);
+ return;
+ }
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha);
+ dest_scan++;
+ }
+ }
+ void CFX_SkiaRenderer::CompositeSpanGray_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_pDevice->IsCmykImage());
+ ASSERT(!m_bRgbByteOrder);
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
+ ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start;
+ ori_scan += col_start;
+ if (m_Alpha == 255 && cover_scan == 255) {
+ FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gray, m_Gray, m_Gray, m_Gray), col_end - col_start);
+ } else {
+ int src_alpha = m_Alpha;
#if 1
- for (int col = col_start; col < col_end; col ++) {
- int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan);
- dest_scan ++;
- }
+ for (int col = col_start; col < col_end; col ++) {
+ int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan);
+ dest_scan ++;
+ }
#else
- if (m_bFullCover) {
- if (src_alpha == 255) {
- FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gray, m_Gray, m_Gray, m_Gray), col_end - col_start);
- return;
- }
- for (int col = col_start; col < col_end; col ++)
- *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
- } else {
- for (int col = col_start; col < col_end; col ++) {
- int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan);
- dest_scan++;
- }
- }
+ if (m_bFullCover) {
+ if (src_alpha == 255) {
+ FXSYS_memset(dest_scan, FXARGB_MAKE(m_Gray, m_Gray, m_Gray, m_Gray), col_end - col_start);
+ return;
+ }
+ for (int col = col_start; col < col_end; col ++)
+ *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
+ } else {
+ for (int col = col_start; col < col_end; col ++) {
+ int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan);
+ dest_scan++;
+ }
+ }
#endif
- }
- }
+ }
+ }
- void CFX_SkiaRenderer::CompositeSpanGray_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_bRgbByteOrder);
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
- clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start;
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha1 = src_alpha * clip_scan[col] / 255;
- if (!src_alpha1) {
- dest_scan ++;
- continue;
- }
- if (src_alpha1 == 255)
- *dest_scan++ = m_Gray;
- else {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha1);
- dest_scan ++;
- }
- }
- }
+ void CFX_SkiaRenderer::CompositeSpanGray_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_bRgbByteOrder);
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
+ clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start;
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha1 = src_alpha * clip_scan[col] / 255;
+ if (!src_alpha1) {
+ dest_scan ++;
+ continue;
+ }
+ if (src_alpha1 == 255)
+ *dest_scan++ = m_Gray;
+ else {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha1);
+ dest_scan ++;
+ }
+ }
+ }
- void CFX_SkiaRenderer::CompositeSpanGray_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_pDevice->IsCmykImage());
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
- ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left;
- clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start;
- ori_scan += col_start;
+ void CFX_SkiaRenderer::CompositeSpanGray_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_pDevice->IsCmykImage());
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left;
+ ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left;
+ clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start;
+ ori_scan += col_start;
#if 1
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (src_alpha == 255 && cover_scan == 255) {
- *dest_scan++ = m_Gray;
- ori_scan++;
- continue;
- }
- int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan);
- dest_scan++;
- }
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (src_alpha == 255 && cover_scan == 255) {
+ *dest_scan++ = m_Gray;
+ ori_scan++;
+ continue;
+ }
+ int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan);
+ dest_scan++;
+ }
#else
- if (m_bFullCover) {
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (!src_alpha) {
- dest_scan++;
- ori_scan++;
- continue;
- }
- if (src_alpha == 255){
- *dest_scan++ = m_Gray;
- ori_scan++;
- continue;
- }
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
- }
- } else {
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (src_alpha == 255 && cover_scan == 255) {
- *dest_scan++ = m_Gray;
- ori_scan++;
- continue;
- }
- int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan);
- dest_scan++;
- }
- }
+ if (m_bFullCover) {
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (!src_alpha) {
+ dest_scan++;
+ ori_scan++;
+ continue;
+ }
+ if (src_alpha == 255){
+ *dest_scan++ = m_Gray;
+ ori_scan++;
+ continue;
+ }
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
+ }
+ } else {
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (src_alpha == 255 && cover_scan == 255) {
+ *dest_scan++ = m_Gray;
+ ori_scan++;
+ continue;
+ }
+ int gray = FXDIB_ALPHA_MERGE(*ori_scan++, m_Gray, src_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, gray, cover_scan);
+ dest_scan++;
+ }
+ }
#endif
- }
- /*--------------------------------------------------------------------------------------------------*/
+ }
+ /*--------------------------------------------------------------------------------------------------*/
- void CFX_SkiaRenderer::CompositeSpanARGB_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start<<2;
- if (m_Alpha == 255 && cover_scan == 255) {
- FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
- return;
- }
- int src_alpha;
+ void CFX_SkiaRenderer::CompositeSpanARGB_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start<<2;
+ if (m_Alpha == 255 && cover_scan == 255) {
+ FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
+ return;
+ }
+ int src_alpha;
#if 0
- if (m_bFullCover) {
- if (m_Alpha == 255) {
- FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
- return;
- }
- }
- else
+ if (m_bFullCover) {
+ if (m_Alpha == 255) {
+ FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
+ return;
+ }
+ }
+ else
#endif
- src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- // Dest format: Argb
- // calculate destination alpha (it's union of source and dest alpha)
- if (dest_scan[3] == 0) {
- dest_scan[3] = src_alpha;
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan = m_Red;
- dest_scan += 2;
- continue;
- }
- uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha*255/dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan += 2;
- }
- }
+ src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ // Dest format: Argb
+ // calculate destination alpha (it's union of source and dest alpha)
+ if (dest_scan[3] == 0) {
+ dest_scan[3] = src_alpha;
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan = m_Red;
+ dest_scan += 2;
+ continue;
+ }
+ uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha*255/dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan += 2;
+ }
+ }
- void CFX_SkiaRenderer::CompositeSpanARGB_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_pDevice->IsCmykImage());
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
- //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2);
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start << 2;
- //ori_scan += col_start << 2;
+ void CFX_SkiaRenderer::CompositeSpanARGB_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_pDevice->IsCmykImage());
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
+ //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2);
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start << 2;
+ //ori_scan += col_start << 2;
- if (m_Alpha == 255 && cover_scan == 255){
- FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
- return;
- }
- if (cover_scan == 255) {
- int dst_color = (0x00ffffff&m_Color)|(m_Alpha<<24);
- FXSYS_memset(dest_scan, dst_color, (col_end - col_start)<<2);
- return;
- }
- // Do not need origin bitmap, because of merge in pure transparent background
- int src_alpha_covered = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++)
- {
- // shortcut
- if (dest_scan[3] == 0) {
- dest_scan[3] = src_alpha_covered;
- *dest_scan ++ = m_Blue;
- *dest_scan ++ = m_Green;
- *dest_scan = m_Red;
- dest_scan += 2;
- continue;
- }
- // We should do alpha transition and color transition
- // alpha fg color fg
- // alpha bg color bg
- // alpha cover color cover
- dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], m_Alpha, cover_scan);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, cover_scan);
- dest_scan += 2;
- }
- }
- void CFX_SkiaRenderer::CompositeSpanARGB_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
- clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start << 2;
+ if (m_Alpha == 255 && cover_scan == 255){
+ FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
+ return;
+ }
+ if (cover_scan == 255) {
+ int dst_color = (0x00ffffff&m_Color)|(m_Alpha<<24);
+ FXSYS_memset(dest_scan, dst_color, (col_end - col_start)<<2);
+ return;
+ }
+ // Do not need origin bitmap, because of merge in pure transparent background
+ int src_alpha_covered = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++)
+ {
+ // shortcut
+ if (dest_scan[3] == 0) {
+ dest_scan[3] = src_alpha_covered;
+ *dest_scan ++ = m_Blue;
+ *dest_scan ++ = m_Green;
+ *dest_scan = m_Red;
+ dest_scan += 2;
+ continue;
+ }
+ // We should do alpha transition and color transition
+ // alpha fg color fg
+ // alpha bg color bg
+ // alpha cover color cover
+ dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], m_Alpha, cover_scan);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, cover_scan);
+ dest_scan += 2;
+ }
+ }
+ void CFX_SkiaRenderer::CompositeSpanARGB_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
+ clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start << 2;
#if 1
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha1 = src_alpha* clip_scan[col] / 255;
- if (!src_alpha1) {
- dest_scan += 4;
- continue;
- }
- if (src_alpha1 == 255) {
- *(FX_DWORD*)dest_scan = m_Color;
- dest_scan += 4;
- } else {
- // Dest format: Argb
- // calculate destination alpha (it's union of source and dest alpha)
- if (dest_scan[3] == 0) {
- dest_scan[3] = src_alpha1;
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan = m_Red;
- dest_scan += 2;
- continue;
- }
- uint8_t dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha1*255/dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan += 2;
- }
- }
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha1 = src_alpha* clip_scan[col] / 255;
+ if (!src_alpha1) {
+ dest_scan += 4;
+ continue;
+ }
+ if (src_alpha1 == 255) {
+ *(FX_DWORD*)dest_scan = m_Color;
+ dest_scan += 4;
+ } else {
+ // Dest format: Argb
+ // calculate destination alpha (it's union of source and dest alpha)
+ if (dest_scan[3] == 0) {
+ dest_scan[3] = src_alpha1;
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan = m_Red;
+ dest_scan += 2;
+ continue;
+ }
+ uint8_t dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha1*255/dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan += 2;
+ }
+ }
#else
- if (m_bFullCover) {
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (!src_alpha) {
- dest_scan += 4;
- continue;
- }
- if (src_alpha == 255){
- *(FX_DWORD*)dest_scan = m_Color;
- dest_scan += 4;
- continue;
- } else {
- // Dest format: Argb
- // calculate destination alpha (it's union of source and dest alpha)
- if (dest_scan[3] == 0) {
- dest_scan[3] = src_alpha;
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan = m_Red;
- dest_scan += 2;
- continue;
- }
- uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha*255/dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan += 2;
- }
- }
- } else {
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha1 = src_alpha* clip_scan[col] / 255;
- if (!src_alpha1) {
- dest_scan += 4;
- continue;
- }
- if (src_alpha1 == 255) {
- *(FX_DWORD*)dest_scan = m_Color;
- dest_scan += 4;
- } else {
- // Dest format: Argb
- // calculate destination alpha (it's union of source and dest alpha)
- if (dest_scan[3] == 0) {
- dest_scan[3] = src_alpha1;
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan = m_Red;
- dest_scan += 2;
- continue;
- }
- uint8_t dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha1*255/dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan += 2;
- }
- }
- }
+ if (m_bFullCover) {
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (!src_alpha) {
+ dest_scan += 4;
+ continue;
+ }
+ if (src_alpha == 255){
+ *(FX_DWORD*)dest_scan = m_Color;
+ dest_scan += 4;
+ continue;
+ } else {
+ // Dest format: Argb
+ // calculate destination alpha (it's union of source and dest alpha)
+ if (dest_scan[3] == 0) {
+ dest_scan[3] = src_alpha;
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan = m_Red;
+ dest_scan += 2;
+ continue;
+ }
+ uint8_t dest_alpha = dest_scan[3] + src_alpha - dest_scan[3] * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha*255/dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan += 2;
+ }
+ }
+ } else {
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha1 = src_alpha* clip_scan[col] / 255;
+ if (!src_alpha1) {
+ dest_scan += 4;
+ continue;
+ }
+ if (src_alpha1 == 255) {
+ *(FX_DWORD*)dest_scan = m_Color;
+ dest_scan += 4;
+ } else {
+ // Dest format: Argb
+ // calculate destination alpha (it's union of source and dest alpha)
+ if (dest_scan[3] == 0) {
+ dest_scan[3] = src_alpha1;
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan = m_Red;
+ dest_scan += 2;
+ continue;
+ }
+ uint8_t dest_alpha = dest_scan[3] + src_alpha1 - dest_scan[3] * src_alpha1 / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha1*255/dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan += 2;
+ }
+ }
+ }
#endif
- }
+ }
- void CFX_SkiaRenderer::CompositeSpanARGB_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_pDevice->IsCmykImage());
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
- //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2);
- clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start << 2;
- //ori_scan += col_start << 2;
- // Do not need origin bitmap, because of merge in pure transparent background
- for (int col = col_start; col < col_end; col ++)
- {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- int src_alpha_covered = src_alpha * cover_scan / 255;
- // shortcut
- if (src_alpha_covered == 0){
- dest_scan += 4;
- continue;
- }
- // shortcut
- if (cover_scan == 255 || dest_scan[3] == 0)
- {
- // origin alpha always zero, just get src alpha
- dest_scan[3] = src_alpha_covered;
- *dest_scan ++ = m_Blue;
- *dest_scan ++ = m_Green;
- *dest_scan = m_Red;
- dest_scan += 2;
- continue;
- }
- // We should do alpha transition and color transition
- // alpha fg color fg
- // alpha bg color bg
- // alpha cover color cover
- dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], src_alpha, cover_scan);
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, cover_scan);
- dest_scan += 2;
- }
- }
+ void CFX_SkiaRenderer::CompositeSpanARGB_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_pDevice->IsCmykImage());
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
+ //ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2);
+ clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start << 2;
+ //ori_scan += col_start << 2;
+ // Do not need origin bitmap, because of merge in pure transparent background
+ for (int col = col_start; col < col_end; col ++)
+ {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ int src_alpha_covered = src_alpha * cover_scan / 255;
+ // shortcut
+ if (src_alpha_covered == 0){
+ dest_scan += 4;
+ continue;
+ }
+ // shortcut
+ if (cover_scan == 255 || dest_scan[3] == 0)
+ {
+ // origin alpha always zero, just get src alpha
+ dest_scan[3] = src_alpha_covered;
+ *dest_scan ++ = m_Blue;
+ *dest_scan ++ = m_Green;
+ *dest_scan = m_Red;
+ dest_scan += 2;
+ continue;
+ }
+ // We should do alpha transition and color transition
+ // alpha fg color fg
+ // alpha bg color bg
+ // alpha cover color cover
+ dest_scan[3] = FXDIB_ALPHA_MERGE(dest_scan[3], src_alpha, cover_scan);
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, cover_scan);
+ dest_scan += 2;
+ }
+ }
- /*-----------------------------------------------------------------------------------------------------------*/
- void CFX_SkiaRenderer::CompositeSpanRGB32_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += (col_start << 2);
- if (m_Alpha == 255 && cover_scan == 255) {
- FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
- return;
- }
- int src_alpha;
+ /*-----------------------------------------------------------------------------------------------------------*/
+ void CFX_SkiaRenderer::CompositeSpanRGB32_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += (col_start << 2);
+ if (m_Alpha == 255 && cover_scan == 255) {
+ FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
+ return;
+ }
+ int src_alpha;
#if 0
- if (m_bFullCover)
- src_alpha = m_Alpha;
- else
+ if (m_bFullCover)
+ src_alpha = m_Alpha;
+ else
#endif
- src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- // Dest format: Rgb32
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
- dest_scan += 2;
- }
- }
- void CFX_SkiaRenderer::CompositeSpanRGB32_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
- ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2);
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start << 2;
- ori_scan += col_start << 2;
- if (m_Alpha == 255 && cover_scan == 255) {
- FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
- return;
- }
- int src_alpha = m_Alpha;
- for (int col = col_start; col < col_end; col ++) {
+ src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ // Dest format: Rgb32
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
+ dest_scan += 2;
+ }
+ }
+ void CFX_SkiaRenderer::CompositeSpanRGB32_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
+ ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2);
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start << 2;
+ ori_scan += col_start << 2;
+ if (m_Alpha == 255 && cover_scan == 255) {
+ FXSYS_memset(dest_scan, m_Color, (col_end - col_start)<<2);
+ return;
+ }
+ int src_alpha = m_Alpha;
+ for (int col = col_start; col < col_end; col ++) {
#if 0
- if (m_bFullCover) {
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
- dest_scan += 2; ori_scan += 2;
- continue;
- }
+ if (m_bFullCover) {
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
+ dest_scan += 2; ori_scan += 2;
+ continue;
+ }
#endif
- int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
- int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
- int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
- ori_scan += 2;
- *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
- dest_scan += 2;
- }
- }
- void CFX_SkiaRenderer::CompositeSpanRGB32_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
- clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start << 2;
+ int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
+ int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
+ int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
+ ori_scan += 2;
+ *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
+ dest_scan += 2;
+ }
+ }
+ void CFX_SkiaRenderer::CompositeSpanRGB32_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
+ clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start << 2;
#if 1
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha1 = src_alpha * clip_scan[col] / 255;
- if (!src_alpha1) {
- dest_scan += 4;
- continue;
- }
- if (src_alpha1 == 255) {
- *(FX_DWORD*)dest_scan = m_Color;
- dest_scan += 4;
- } else {
- // Dest format: Rgb or Rgb32
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha1);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha1);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1);
- dest_scan += 2;
- }
- }
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha1 = src_alpha * clip_scan[col] / 255;
+ if (!src_alpha1) {
+ dest_scan += 4;
+ continue;
+ }
+ if (src_alpha1 == 255) {
+ *(FX_DWORD*)dest_scan = m_Color;
+ dest_scan += 4;
+ } else {
+ // Dest format: Rgb or Rgb32
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha1);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha1);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1);
+ dest_scan += 2;
+ }
+ }
#else
- if (m_bFullCover) {
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (!src_alpha) {
- dest_scan += 4;
- continue;
- }
- if (src_alpha == 255) {
- *(FX_DWORD*)dest_scan = m_Color;
- dest_scan += 4;
- } else {
- // Dest format: Rgb or Rgb32
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
- dest_scan += 2;
- }
- }
- } else {
- // Rgb32
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha1 = src_alpha * clip_scan[col] / 255;
- if (!src_alpha1) {
- dest_scan += 4;
- continue;
- }
- if (src_alpha1 == 255) {
- *(FX_DWORD*)dest_scan = m_Color;
- dest_scan += 4;
- } else {
- // Dest format: Rgb or Rgb32
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha1);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha1);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1);
- dest_scan += 2;
- }
- }
- }
+ if (m_bFullCover) {
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (!src_alpha) {
+ dest_scan += 4;
+ continue;
+ }
+ if (src_alpha == 255) {
+ *(FX_DWORD*)dest_scan = m_Color;
+ dest_scan += 4;
+ } else {
+ // Dest format: Rgb or Rgb32
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
+ dest_scan += 2;
+ }
+ }
+ } else {
+ // Rgb32
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha1 = src_alpha * clip_scan[col] / 255;
+ if (!src_alpha1) {
+ dest_scan += 4;
+ continue;
+ }
+ if (src_alpha1 == 255) {
+ *(FX_DWORD*)dest_scan = m_Color;
+ dest_scan += 4;
+ } else {
+ // Dest format: Rgb or Rgb32
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha1);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha1);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1);
+ dest_scan += 2;
+ }
+ }
+ }
#endif
- }
- void CFX_SkiaRenderer::CompositeSpanRGB32_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_pDevice->IsCmykImage());
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
- ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2);
- clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start << 2;
- ori_scan += col_start << 2;
+ }
+ void CFX_SkiaRenderer::CompositeSpanRGB32_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_pDevice->IsCmykImage());
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + (span_left<<2);
+ ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + (span_left<<2);
+ clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start << 2;
+ ori_scan += col_start << 2;
#if 1
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (src_alpha == 255 && cover_scan == 255) {
- *(FX_DWORD*)dest_scan = m_Color;
- dest_scan += 4;
- ori_scan += 4;
- continue;
- }
- int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
- int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
- int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
- ori_scan += 2;
- *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
- dest_scan += 2;
- }
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (src_alpha == 255 && cover_scan == 255) {
+ *(FX_DWORD*)dest_scan = m_Color;
+ dest_scan += 4;
+ ori_scan += 4;
+ continue;
+ }
+ int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
+ int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
+ int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
+ ori_scan += 2;
+ *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
+ dest_scan += 2;
+ }
#else
- if (m_bFullCover) {
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (!src_alpha) {
- *(FX_DWORD*)dest_scan = *(FX_DWORD*)ori_scan;
- dest_scan += 4;
- ori_scan += 4;
- continue;
- }
- if (src_alpha == 255) {
- *(FX_DWORD*)dest_scan = m_Color;
- dest_scan += 4;
- ori_scan += 4;
- continue;
- }
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
- dest_scan += 2; ori_scan += 2;
- }
- } else {
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (src_alpha == 255 && cover_scan == 255) {
- *(FX_DWORD*)dest_scan = m_Color;
- dest_scan += 4;
- ori_scan += 4;
- continue;
- }
- int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
- int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
- int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
- ori_scan += 2;
- *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
- dest_scan += 2;
- }
- }
+ if (m_bFullCover) {
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (!src_alpha) {
+ *(FX_DWORD*)dest_scan = *(FX_DWORD*)ori_scan;
+ dest_scan += 4;
+ ori_scan += 4;
+ continue;
+ }
+ if (src_alpha == 255) {
+ *(FX_DWORD*)dest_scan = m_Color;
+ dest_scan += 4;
+ ori_scan += 4;
+ continue;
+ }
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
+ dest_scan += 2; ori_scan += 2;
+ }
+ } else {
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (src_alpha == 255 && cover_scan == 255) {
+ *(FX_DWORD*)dest_scan = m_Color;
+ dest_scan += 4;
+ ori_scan += 4;
+ continue;
+ }
+ int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
+ int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
+ int r = FXDIB_ALPHA_MERGE(*ori_scan, m_Red, src_alpha);
+ ori_scan += 2;
+ *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
+ dest_scan += 2;
+ }
+ }
#endif
- }
- /*-----------------------------------------------------------------------------------------------------*/
- void CFX_SkiaRenderer::CompositeSpanRGB24_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1);
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += (col_start<<1)+col_start;
- int src_alpha;
+ }
+ /*-----------------------------------------------------------------------------------------------------*/
+ void CFX_SkiaRenderer::CompositeSpanRGB24_2(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1);
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += (col_start<<1)+col_start;
+ int src_alpha;
#if 0
- if (m_bFullCover)
- src_alpha = m_Alpha;
- else
+ if (m_bFullCover)
+ src_alpha = m_Alpha;
+ else
#endif
- src_alpha = m_Alpha * cover_scan / 255;
- if (src_alpha == 255) {
- for (int col = col_start; col < col_end; col ++) {
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan++ = m_Red;
- }
- return;
- }
- for (int col = col_start; col < col_end; col ++) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
- dest_scan ++;
- }
- }
- void CFX_SkiaRenderer::CompositeSpanRGB24_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_pDevice->IsCmykImage());
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1);
- ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left + (span_left<<1);
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += (col_start<<1) + col_start;
- ori_scan += (col_start<<1) + col_start;
- if (m_Alpha == 255&&cover_scan == 255) {
- for (int col = col_start; col < col_end; col ++) {
- *dest_scan ++ = m_Blue;
- *dest_scan ++ = m_Green;
- *dest_scan ++ = m_Red;
- }
- return;
- }
- for (int col = col_start; col < col_end; col ++) {
+ src_alpha = m_Alpha * cover_scan / 255;
+ if (src_alpha == 255) {
+ for (int col = col_start; col < col_end; col ++) {
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan++ = m_Red;
+ }
+ return;
+ }
+ for (int col = col_start; col < col_end; col ++) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
+ dest_scan ++;
+ }
+ }
+ void CFX_SkiaRenderer::CompositeSpanRGB24_3(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_pDevice->IsCmykImage());
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left + (span_left<<1);
+ ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left + (span_left<<1);
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += (col_start<<1) + col_start;
+ ori_scan += (col_start<<1) + col_start;
+ if (m_Alpha == 255&&cover_scan == 255) {
+ for (int col = col_start; col < col_end; col ++) {
+ *dest_scan ++ = m_Blue;
+ *dest_scan ++ = m_Green;
+ *dest_scan ++ = m_Red;
+ }
+ return;
+ }
+ for (int col = col_start; col < col_end; col ++) {
#if 0
- if (m_bFullCover) {
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, m_Alpha);
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, m_Alpha);
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, m_Alpha);
- continue;
- }
+ if (m_bFullCover) {
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, m_Alpha);
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, m_Alpha);
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, m_Alpha);
+ continue;
+ }
#endif
- int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, m_Alpha);
- int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, m_Alpha);
- int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, m_Alpha);
- *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
- dest_scan ++;
- }
- }
- void CFX_SkiaRenderer::CompositeSpanRGB24_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1);
- clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start + (col_start << 1);
+ int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, m_Alpha);
+ int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, m_Alpha);
+ int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, m_Alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
+ dest_scan ++;
+ }
+ }
+ void CFX_SkiaRenderer::CompositeSpanRGB24_6(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1);
+ clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start + (col_start << 1);
#if 1
- int src_alpha = m_Alpha * cover_scan /255;
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha1 = src_alpha * clip_scan[col] / 255;
- if (!src_alpha1) {
- dest_scan += 3;
- continue;
- }
- if (src_alpha1 == 255) {
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan++ = m_Red;
- } else {
- // Dest format: Rgb
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha1);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha1);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1);
- dest_scan ++;
- }
- }
+ int src_alpha = m_Alpha * cover_scan /255;
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha1 = src_alpha * clip_scan[col] / 255;
+ if (!src_alpha1) {
+ dest_scan += 3;
+ continue;
+ }
+ if (src_alpha1 == 255) {
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan++ = m_Red;
+ } else {
+ // Dest format: Rgb
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha1);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha1);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1);
+ dest_scan ++;
+ }
+ }
#else
- if (m_bFullCover) {
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (!src_alpha) {
- dest_scan += 3;
- continue;
- }
- if (src_alpha == 255) {
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan++ = m_Red;
- } else {
- // Dest format: Rgb
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
- dest_scan ++;
- }
- }
- } else {
- int src_alpha = m_Alpha * cover_scan /255;
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha1 = src_alpha * clip_scan[col] / 255;
- if (!src_alpha1) {
- dest_scan += 3;
- continue;
- }
- if (src_alpha1 == 255) {
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan++ = m_Red;
- } else {
- // Dest format: Rgb
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha1);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha1);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1);
- dest_scan ++;
- }
- }
- }
+ if (m_bFullCover) {
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (!src_alpha) {
+ dest_scan += 3;
+ continue;
+ }
+ if (src_alpha == 255) {
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan++ = m_Red;
+ } else {
+ // Dest format: Rgb
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
+ dest_scan ++;
+ }
+ }
+ } else {
+ int src_alpha = m_Alpha * cover_scan /255;
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha1 = src_alpha * clip_scan[col] / 255;
+ if (!src_alpha1) {
+ dest_scan += 3;
+ continue;
+ }
+ if (src_alpha1 == 255) {
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan++ = m_Red;
+ } else {
+ // Dest format: Rgb
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha1);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha1);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha1);
+ dest_scan ++;
+ }
+ }
+ }
#endif
- }
- void CFX_SkiaRenderer::CompositeSpanRGB24_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_pDevice->IsCmykImage());
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1);
- ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left+(span_left<<1);
- clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start + (col_start<<1);
- ori_scan += col_start + (col_start<<1);
+ }
+ void CFX_SkiaRenderer::CompositeSpanRGB24_7(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_pDevice->IsCmykImage());
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1);
+ ori_scan = (uint8_t*)m_pOriDevice->GetScanline(span_top) + span_left+(span_left<<1);
+ clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start + (col_start<<1);
+ ori_scan += col_start + (col_start<<1);
#if 1
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (src_alpha == 255 && cover_scan == 255) {
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan++ = m_Red;
- ori_scan += 3;
- continue;
- }
- int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
- int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
- int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
- dest_scan ++;
- }
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (src_alpha == 255 && cover_scan == 255) {
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan++ = m_Red;
+ ori_scan += 3;
+ continue;
+ }
+ int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
+ int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
+ int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
+ dest_scan ++;
+ }
#else
- if (m_bFullCover) {
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (!src_alpha){
- *dest_scan++ = *ori_scan++;
- *dest_scan++ = *ori_scan++;
- *dest_scan++ = *ori_scan++;
- continue;
- }
- if (src_alpha == 255){
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan++ = m_Red;
- ori_scan += 3;
- continue;
- }
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
- *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha);
- }
- } else {
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (src_alpha == 255 && cover_scan == 255) {
- *dest_scan++ = m_Blue;
- *dest_scan++ = m_Green;
- *dest_scan++ = m_Red;
- ori_scan += 3;
- continue;
- }
- int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
- int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
- int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha);
- *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
- dest_scan ++;
- }
- }
+ if (m_bFullCover) {
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (!src_alpha){
+ *dest_scan++ = *ori_scan++;
+ *dest_scan++ = *ori_scan++;
+ *dest_scan++ = *ori_scan++;
+ continue;
+ }
+ if (src_alpha == 255){
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan++ = m_Red;
+ ori_scan += 3;
+ continue;
+ }
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
+ *dest_scan++ = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha);
+ }
+ } else {
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (src_alpha == 255 && cover_scan == 255) {
+ *dest_scan++ = m_Blue;
+ *dest_scan++ = m_Green;
+ *dest_scan++ = m_Red;
+ ori_scan += 3;
+ continue;
+ }
+ int b = FXDIB_ALPHA_MERGE(*ori_scan++, m_Blue, src_alpha);
+ int g = FXDIB_ALPHA_MERGE(*ori_scan++, m_Green, src_alpha);
+ int r = FXDIB_ALPHA_MERGE(*ori_scan++, m_Red, src_alpha);
+ *dest_scan = FXDIB_ALPHA_MERGE( *dest_scan, b, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, g, cover_scan);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, r, cover_scan);
+ dest_scan ++;
+ }
+ }
#endif
- }
- void CFX_SkiaRenderer::CompositeSpanRGB24_10(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1);
- dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start+(col_start<<1);
+ }
+ void CFX_SkiaRenderer::CompositeSpanRGB24_10(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1);
+ dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start+(col_start<<1);
#if 1
- if (m_Alpha == 255 && cover_scan == 255) {
- for (int col = col_start; col < col_end; col ++) {
- *dest_scan++ = (uint8_t)m_Blue;
- *dest_scan++ = (uint8_t)m_Green;
- *dest_scan++ = (uint8_t)m_Red;
- *dest_extra_alpha_scan++ = 255;
- }
- return;
- }
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- // Dest format: Rgba
- // calculate destination alpha (it's union of source and dest alpha)
- uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
- (*dest_extra_alpha_scan) * src_alpha / 255;
- *dest_extra_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha*255/dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan ++;
- }
+ if (m_Alpha == 255 && cover_scan == 255) {
+ for (int col = col_start; col < col_end; col ++) {
+ *dest_scan++ = (uint8_t)m_Blue;
+ *dest_scan++ = (uint8_t)m_Green;
+ *dest_scan++ = (uint8_t)m_Red;
+ *dest_extra_alpha_scan++ = 255;
+ }
+ return;
+ }
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ // Dest format: Rgba
+ // calculate destination alpha (it's union of source and dest alpha)
+ uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
+ (*dest_extra_alpha_scan) * src_alpha / 255;
+ *dest_extra_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha*255/dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan ++;
+ }
#else
- if (m_bFullCover) {
- if (m_Alpha == 255) {
- for (int col = col_start; col < col_end; col ++) {
- *dest_scan++ = (uint8_t)m_Blue;
- *dest_scan++ = (uint8_t)m_Green;
- *dest_scan++ = (uint8_t)m_Red;
- *dest_extra_alpha_scan++ = 255;
- }
- return;
- }
- for (int col = col_start; col < col_end; col ++) {
- // Dest format: Rgba
- // calculate destination alpha (it's union of source and dest alpha)
- uint8_t dest_alpha = (*dest_extra_alpha_scan) + m_Alpha -
- (*dest_extra_alpha_scan) * m_Alpha / 255;
- *dest_extra_alpha_scan++ = dest_alpha;
- int alpha_ratio = m_Alpha*255/dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan ++;
- }
- } else {
- if (m_Alpha == 255 && cover_scan == 255) {
- for (int col = col_start; col < col_end; col ++) {
- *dest_scan++ = (uint8_t)m_Blue;
- *dest_scan++ = (uint8_t)m_Green;
- *dest_scan++ = (uint8_t)m_Red;
- *dest_extra_alpha_scan++ = 255;
- }
- return;
- }
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- // Dest format: Rgba
- // calculate destination alpha (it's union of source and dest alpha)
- uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
- (*dest_extra_alpha_scan) * src_alpha / 255;
- *dest_extra_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha*255/dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan ++;
- }
- }
+ if (m_bFullCover) {
+ if (m_Alpha == 255) {
+ for (int col = col_start; col < col_end; col ++) {
+ *dest_scan++ = (uint8_t)m_Blue;
+ *dest_scan++ = (uint8_t)m_Green;
+ *dest_scan++ = (uint8_t)m_Red;
+ *dest_extra_alpha_scan++ = 255;
+ }
+ return;
+ }
+ for (int col = col_start; col < col_end; col ++) {
+ // Dest format: Rgba
+ // calculate destination alpha (it's union of source and dest alpha)
+ uint8_t dest_alpha = (*dest_extra_alpha_scan) + m_Alpha -
+ (*dest_extra_alpha_scan) * m_Alpha / 255;
+ *dest_extra_alpha_scan++ = dest_alpha;
+ int alpha_ratio = m_Alpha*255/dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan ++;
+ }
+ } else {
+ if (m_Alpha == 255 && cover_scan == 255) {
+ for (int col = col_start; col < col_end; col ++) {
+ *dest_scan++ = (uint8_t)m_Blue;
+ *dest_scan++ = (uint8_t)m_Green;
+ *dest_scan++ = (uint8_t)m_Red;
+ *dest_extra_alpha_scan++ = 255;
+ }
+ return;
+ }
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ // Dest format: Rgba
+ // calculate destination alpha (it's union of source and dest alpha)
+ uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
+ (*dest_extra_alpha_scan) * src_alpha / 255;
+ *dest_extra_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha*255/dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan ++;
+ }
+ }
#endif
- }
- void CFX_SkiaRenderer::CompositeSpanRGB24_14(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1);
- dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left;
- clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start + (col_start << 1);
+ }
+ void CFX_SkiaRenderer::CompositeSpanRGB24_14(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ dest_scan = (uint8_t*)m_pDevice->GetScanline(span_top) + span_left+(span_left<<1);
+ dest_extra_alpha_scan = (uint8_t*)m_pDevice->m_pAlphaMask->GetScanline(span_top)+span_left;
+ clip_scan = (uint8_t*)m_pClipMask->GetScanline(span_top-clip_top) - clip_left + span_left;
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start + (col_start << 1);
#if 1
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha1 = src_alpha * clip_scan[col] / 255;
- if (!src_alpha1) {
- dest_extra_alpha_scan++;
- dest_scan += 3;
- continue;
- }
- if (src_alpha1 == 255) {
- *dest_scan++ = (uint8_t)m_Blue;
- *dest_scan++ = (uint8_t)m_Green;
- *dest_scan++ = (uint8_t)m_Red;
- *dest_extra_alpha_scan++ = (uint8_t)m_Alpha;
- } else {
- // Dest format: Rgba
- // calculate destination alpha (it's union of source and dest alpha)
- uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 -
- (*dest_extra_alpha_scan) * src_alpha1 / 255;
- *dest_extra_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha1*255/dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan ++;
- }
- }
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha1 = src_alpha * clip_scan[col] / 255;
+ if (!src_alpha1) {
+ dest_extra_alpha_scan++;
+ dest_scan += 3;
+ continue;
+ }
+ if (src_alpha1 == 255) {
+ *dest_scan++ = (uint8_t)m_Blue;
+ *dest_scan++ = (uint8_t)m_Green;
+ *dest_scan++ = (uint8_t)m_Red;
+ *dest_extra_alpha_scan++ = (uint8_t)m_Alpha;
+ } else {
+ // Dest format: Rgba
+ // calculate destination alpha (it's union of source and dest alpha)
+ uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 -
+ (*dest_extra_alpha_scan) * src_alpha1 / 255;
+ *dest_extra_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha1*255/dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan ++;
+ }
+ }
#else
- if (m_bFullCover) {
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha = m_Alpha * clip_scan[col] / 255;
- if (!src_alpha) {
- dest_extra_alpha_scan++;
- dest_scan += 3;
- continue;
- }
- if (src_alpha == 255) {
- *dest_scan++ = (uint8_t)m_Blue;
- *dest_scan++ = (uint8_t)m_Green;
- *dest_scan++ = (uint8_t)m_Red;
- *dest_extra_alpha_scan++ = (uint8_t)m_Alpha;
- } else {
- // Dest format: Rgba
- // calculate destination alpha (it's union of source and dest alpha)
- uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
- (*dest_extra_alpha_scan) * src_alpha / 255;
- *dest_extra_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha*255/dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan ++;
- }
- }
- } else {
- int src_alpha = m_Alpha * cover_scan / 255;
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha1 = m_Alpha * cover_scan * clip_scan[col] / 255;
- if (!src_alpha1) {
- dest_extra_alpha_scan++;
- dest_scan += 3;
- continue;
- }
- if (src_alpha1 == 255) {
- *dest_scan++ = (uint8_t)m_Blue;
- *dest_scan++ = (uint8_t)m_Green;
- *dest_scan++ = (uint8_t)m_Red;
- *dest_extra_alpha_scan++ = (uint8_t)m_Alpha;
- } else {
- // Dest format: Rgba
- // calculate destination alpha (it's union of source and dest alpha)
- uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 -
- (*dest_extra_alpha_scan) * src_alpha1 / 255;
- *dest_extra_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha1*255/dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan ++;
- }
- }
- }
+ if (m_bFullCover) {
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha = m_Alpha * clip_scan[col] / 255;
+ if (!src_alpha) {
+ dest_extra_alpha_scan++;
+ dest_scan += 3;
+ continue;
+ }
+ if (src_alpha == 255) {
+ *dest_scan++ = (uint8_t)m_Blue;
+ *dest_scan++ = (uint8_t)m_Green;
+ *dest_scan++ = (uint8_t)m_Red;
+ *dest_extra_alpha_scan++ = (uint8_t)m_Alpha;
+ } else {
+ // Dest format: Rgba
+ // calculate destination alpha (it's union of source and dest alpha)
+ uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
+ (*dest_extra_alpha_scan) * src_alpha / 255;
+ *dest_extra_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha*255/dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan ++;
+ }
+ }
+ } else {
+ int src_alpha = m_Alpha * cover_scan / 255;
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha1 = m_Alpha * cover_scan * clip_scan[col] / 255;
+ if (!src_alpha1) {
+ dest_extra_alpha_scan++;
+ dest_scan += 3;
+ continue;
+ }
+ if (src_alpha1 == 255) {
+ *dest_scan++ = (uint8_t)m_Blue;
+ *dest_scan++ = (uint8_t)m_Green;
+ *dest_scan++ = (uint8_t)m_Red;
+ *dest_extra_alpha_scan++ = (uint8_t)m_Alpha;
+ } else {
+ // Dest format: Rgba
+ // calculate destination alpha (it's union of source and dest alpha)
+ uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha1 -
+ (*dest_extra_alpha_scan) * src_alpha1 / 255;
+ *dest_extra_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha1*255/dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan ++;
+ }
+ }
+ }
#endif
- }
- /*-----------------------------------------------------------------------------------------------------*/
+ }
+ /*-----------------------------------------------------------------------------------------------------*/
- // A general alpha merge function (with clipping mask). Cmyka/Cmyk device.
- void CFX_SkiaRenderer::CompositeSpanCMYK(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
- int span_left, int span_len, int span_top, uint8_t cover_scan,
- int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
- uint8_t* dest_extra_alpha_scan)
- {
- ASSERT(!m_bRgbByteOrder);
- // Cmyk(a)
- int col_start = span_left < clip_left ? clip_left - span_left : 0;
- int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
- if (col_end < col_start) return; // do nothing.
- dest_scan += col_start * 4;
- Bpp; // for avoid compile warning.
+ // A general alpha merge function (with clipping mask). Cmyka/Cmyk device.
+ void CFX_SkiaRenderer::CompositeSpanCMYK(uint8_t* dest_scan, uint8_t* ori_scan,int Bpp,
+ int span_left, int span_len, int span_top, uint8_t cover_scan,
+ int clip_top, int clip_left, int clip_right, uint8_t* clip_scan,
+ uint8_t* dest_extra_alpha_scan)
+ {
+ ASSERT(!m_bRgbByteOrder);
+ // Cmyk(a)
+ int col_start = span_left < clip_left ? clip_left - span_left : 0;
+ int col_end = (span_left + span_len) < clip_right ? span_len : (clip_right - span_left);
+ if (col_end < col_start) return; // do nothing.
+ dest_scan += col_start * 4;
+ Bpp; // for avoid compile warning.
- if (dest_extra_alpha_scan) {
- // CMYKa
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha;
- if (m_bFullCover) {
- if (clip_scan)
- src_alpha = m_Alpha * clip_scan[col] / 255;
- else
- src_alpha = m_Alpha;
- } else {
- if (clip_scan)
- src_alpha = m_Alpha * cover_scan * clip_scan[col] / 255 / 255;
- else
- src_alpha = m_Alpha * cover_scan / 255;
- }
+ if (dest_extra_alpha_scan) {
+ // CMYKa
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha;
+ if (m_bFullCover) {
+ if (clip_scan)
+ src_alpha = m_Alpha * clip_scan[col] / 255;
+ else
+ src_alpha = m_Alpha;
+ } else {
+ if (clip_scan)
+ src_alpha = m_Alpha * cover_scan * clip_scan[col] / 255 / 255;
+ else
+ src_alpha = m_Alpha * cover_scan / 255;
+ }
- if (src_alpha) {
- if (src_alpha == 255) {
- *(FX_CMYK*)dest_scan = m_Color;
- *dest_extra_alpha_scan = (uint8_t)m_Alpha;
- } else {
- // Dest format: Cmyka
- // calculate destination alpha (it's union of source and dest alpha)
- uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
- (*dest_extra_alpha_scan) * src_alpha / 255;
- *dest_extra_alpha_scan++ = dest_alpha;
- int alpha_ratio = src_alpha*255/dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, alpha_ratio);
- dest_scan ++;
- continue;
- }
- }
- dest_extra_alpha_scan++;
- dest_scan += 4;
- }
- } else {
- // CMYK
- for (int col = col_start; col < col_end; col ++) {
- int src_alpha;
- if (clip_scan)
- src_alpha = m_Alpha * cover_scan * clip_scan[col] / 255 / 255;
- else
- src_alpha = m_Alpha * cover_scan / 255;
+ if (src_alpha) {
+ if (src_alpha == 255) {
+ *(FX_CMYK*)dest_scan = m_Color;
+ *dest_extra_alpha_scan = (uint8_t)m_Alpha;
+ } else {
+ // Dest format: Cmyka
+ // calculate destination alpha (it's union of source and dest alpha)
+ uint8_t dest_alpha = (*dest_extra_alpha_scan) + src_alpha -
+ (*dest_extra_alpha_scan) * src_alpha / 255;
+ *dest_extra_alpha_scan++ = dest_alpha;
+ int alpha_ratio = src_alpha*255/dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, alpha_ratio);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, alpha_ratio);
+ dest_scan ++;
+ continue;
+ }
+ }
+ dest_extra_alpha_scan++;
+ dest_scan += 4;
+ }
+ } else {
+ // CMYK
+ for (int col = col_start; col < col_end; col ++) {
+ int src_alpha;
+ if (clip_scan)
+ src_alpha = m_Alpha * cover_scan * clip_scan[col] / 255 / 255;
+ else
+ src_alpha = m_Alpha * cover_scan / 255;
- if (src_alpha) {
- if (src_alpha == 255) {
- *(FX_CMYK*)dest_scan = m_Color;
- } else {
- // Dest format: cmyk
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
- dest_scan ++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha);
- dest_scan ++;
- continue;
- }
- }
- dest_scan += 4;
- }
- }
- }
+ if (src_alpha) {
+ if (src_alpha == 255) {
+ *(FX_CMYK*)dest_scan = m_Color;
+ } else {
+ // Dest format: cmyk
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Red, src_alpha);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Green, src_alpha);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Blue, src_alpha);
+ dest_scan ++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, m_Gray, src_alpha);
+ dest_scan ++;
+ continue;
+ }
+ }
+ dest_scan += 4;
+ }
+ }
+ }
- //--------------------------------------------------------------------
- FX_BOOL CFX_SkiaRenderer::Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn* pClipRgn, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bRgbByteOrder,
- int alpha_flag, void* pIccTransform) //The alpha flag must be fill_flag if exist.
- {
- m_pDevice = pDevice;
- m_pClipRgn = pClipRgn;
- m_bRgbByteOrder = bRgbByteOrder;
- m_pOriDevice = pOriDevice;
- m_pDestScan = NULL;
- m_pDestExtraAlphaScan = NULL;
- m_pOriScan = NULL;
- m_pClipScan = NULL;
- composite_span = NULL;
- if (m_pClipRgn)
- m_ClipBox = m_pClipRgn->GetBox();
- else {
- m_ClipBox.left = m_ClipBox.top = 0;
- m_ClipBox.right = m_pDevice->GetWidth();
- m_ClipBox.bottom = m_pDevice->GetHeight();
- }
- m_pClipMask = NULL;
- if (m_pClipRgn && m_pClipRgn->GetType() == CFX_ClipRgn::MaskF)
- {
- m_pClipMask = m_pClipRgn->GetMask();
- m_pClipScan = m_pClipMask->GetBuffer();
- }
- if (m_pDevice->m_pAlphaMask)
- m_pDestExtraAlphaScan = m_pDevice->m_pAlphaMask->GetBuffer();
- if (m_pOriDevice)
- m_pOriScan = m_pOriDevice->GetBuffer();
- m_pDestScan = m_pDevice->GetBuffer();
+ //--------------------------------------------------------------------
+ FX_BOOL CFX_SkiaRenderer::Init(CFX_DIBitmap* pDevice, CFX_DIBitmap* pOriDevice, const CFX_ClipRgn* pClipRgn, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bRgbByteOrder,
+ int alpha_flag, void* pIccTransform) //The alpha flag must be fill_flag if exist.
+ {
+ m_pDevice = pDevice;
+ m_pClipRgn = pClipRgn;
+ m_bRgbByteOrder = bRgbByteOrder;
+ m_pOriDevice = pOriDevice;
+ m_pDestScan = NULL;
+ m_pDestExtraAlphaScan = NULL;
+ m_pOriScan = NULL;
+ m_pClipScan = NULL;
+ composite_span = NULL;
+ if (m_pClipRgn)
+ m_ClipBox = m_pClipRgn->GetBox();
+ else {
+ m_ClipBox.left = m_ClipBox.top = 0;
+ m_ClipBox.right = m_pDevice->GetWidth();
+ m_ClipBox.bottom = m_pDevice->GetHeight();
+ }
+ m_pClipMask = NULL;
+ if (m_pClipRgn && m_pClipRgn->GetType() == CFX_ClipRgn::MaskF)
+ {
+ m_pClipMask = m_pClipRgn->GetMask();
+ m_pClipScan = m_pClipMask->GetBuffer();
+ }
+ if (m_pDevice->m_pAlphaMask)
+ m_pDestExtraAlphaScan = m_pDevice->m_pAlphaMask->GetBuffer();
+ if (m_pOriDevice)
+ m_pOriScan = m_pOriDevice->GetBuffer();
+ m_pDestScan = m_pDevice->GetBuffer();
- m_bFullCover = bFullCover;
+ m_bFullCover = bFullCover;
- FX_BOOL bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag);
- FX_BOOL bDeviceCMYK = pDevice->IsCmykImage();
+ FX_BOOL bObjectCMYK = FXGETFLAG_COLORTYPE(alpha_flag);
+ FX_BOOL bDeviceCMYK = pDevice->IsCmykImage();
- m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color);
+ m_Alpha = bObjectCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color);
- ICodec_IccModule* pIccModule = NULL;
- // No lcms engine, we skip the transform
- if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule())
- pIccTransform = NULL;
- else
- pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
+ ICodec_IccModule* pIccModule = NULL;
+ // No lcms engine, we skip the transform
+ if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule())
+ pIccTransform = NULL;
+ else
+ pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- if (m_pDevice->GetBPP() == 8) { // Gray(a) device
- ASSERT(!m_bRgbByteOrder);
- if (m_pDevice->IsAlphaMask()) {
- //Alpha Mask
- m_Gray = 255;
- } else {
- //Gray(a) device
- if (pIccTransform) {
- uint8_t gray;
- color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
- pIccModule->TranslateScanline(pIccTransform, &gray, (const uint8_t*)&color, 1);
- m_Gray = gray;
- } else {
- if (bObjectCMYK) {
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color),
- r, g, b);
- m_Gray = FXRGB2GRAY(r, g, b);
- } else {
- m_Gray = FXRGB2GRAY(FXARGB_R(color), FXARGB_G(color), FXARGB_B(color));
- }
- }
- }
- } else {
- if (bDeviceCMYK) { // Cmyk(a) Device
- ASSERT(!m_bRgbByteOrder);
- //TODO... opt for cmyk
- composite_span = &CFX_SkiaRenderer::CompositeSpanCMYK;
- if (bObjectCMYK) {
- m_Color = FXCMYK_TODIB(color);
- if (pIccTransform)
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&m_Color, 1);
- } else { // Object RGB
- if (!pIccTransform)
- return FALSE;
- color = FXARGB_TODIB(color);
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1);
- }
- m_Red = ((uint8_t*)&m_Color)[0];
- m_Green = ((uint8_t*)&m_Color)[1];
- m_Blue = ((uint8_t*)&m_Color)[2];
- m_Gray = ((uint8_t*)&m_Color)[3];
- return TRUE;
- } else {
- if (pIccTransform) {
- color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1);
- ((uint8_t*)&m_Color)[3] = m_Alpha;
- m_Red = ((uint8_t*)&m_Color)[2];
- m_Green = ((uint8_t*)&m_Color)[1];
- m_Blue = ((uint8_t*)&m_Color)[0];
- // Need Johnson to improvement it.
- if (m_bRgbByteOrder) {
- // swap
- m_Red = ((uint8_t*)&m_Color)[0];
- m_Blue = ((uint8_t*)&m_Color)[2];
- m_Color = FXARGB_TODIB(m_Color);
- m_Color = FXARGB_TOBGRORDERDIB(m_Color);
- }
- } else {
- if (bObjectCMYK) {
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color),
- r, g, b);
- m_Color = FXARGB_MAKE(m_Alpha, r, g, b);
- if (m_bRgbByteOrder){
- m_Color = FXARGB_TOBGRORDERDIB(m_Color);
- m_Red = b; m_Green = g; m_Blue = r;//
- }else {
- m_Color = FXARGB_TODIB(m_Color);
- m_Red = r; m_Green = g; m_Blue = b;//
- }
- } else {
- if (m_bRgbByteOrder){
- m_Color = FXARGB_TOBGRORDERDIB(color);
- ArgbDecode(color, m_Alpha, m_Blue, m_Green, m_Red); //
- }else {
- m_Color = FXARGB_TODIB(color);
- ArgbDecode(color, m_Alpha, m_Red, m_Green, m_Blue);
- }
- }
- }
- }
- }
- // Get palette transparency selector
- m_ProcessFilter = (m_pOriDevice? 1 : 0) /* has Ori Device flag */
- + (m_pDevice->GetBPP() >= 8 ? 2 : 0) /* bpp flag */
- + (m_pClipMask? 4 : 0) /* has clip region flag */
- + (m_pDevice->m_pAlphaMask? 8 : 0); /* has Alpha Mask chanel flag */
- switch(m_ProcessFilter) {
- case 0:
- composite_span = &CFX_SkiaRenderer::CompositeSpan1bpp_0;
- break;
- case 2:
- {
- if (m_pDevice->GetBPP() == 8)
- composite_span = &CFX_SkiaRenderer::CompositeSpanGray_2;
- else if (m_pDevice->GetBPP() == 24)
- composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_2;
- else
- composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer::CompositeSpanARGB_2 : &CFX_SkiaRenderer::CompositeSpanRGB32_2;
- }
- break;
- case 3:
- {
- if (m_pDevice->GetBPP() == 8)
- composite_span = &CFX_SkiaRenderer::CompositeSpanGray_3;
- else if (m_pDevice->GetBPP() == 24)
- composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_3;
- else
- composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer::CompositeSpanARGB_3 : &CFX_SkiaRenderer::CompositeSpanRGB32_3;
- }
- break;
- case 4:
- composite_span = &CFX_SkiaRenderer::CompositeSpan1bpp_4;
- break;
- case 6:
- {
- if (m_pDevice->GetBPP() == 8)
- composite_span = &CFX_SkiaRenderer::CompositeSpanGray_6;
- else if (m_pDevice->GetBPP() == 24)
- composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_6;
- else
- composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer::CompositeSpanARGB_6 : &CFX_SkiaRenderer::CompositeSpanRGB32_6;
- }
- break;
- case 7:
- {
- if (m_pDevice->GetBPP() == 8)
- composite_span = &CFX_SkiaRenderer::CompositeSpanGray_7;
- else if (m_pDevice->GetBPP() == 24)
- composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_7;
- else
- composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer::CompositeSpanARGB_7 : &CFX_SkiaRenderer::CompositeSpanRGB32_7;
- }
- break;
- case 1:
- case 5:
- case 8:
- case 9:
- case 11:
- case 12:
- case 13:
- case 15:
- //TODO...
- break;
- case 10:
- composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_10;
- break;
- case 14:
- composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_14;
- break;
- }
- if (composite_span == NULL)
- return FALSE;
- return TRUE;
- }
+ if (m_pDevice->GetBPP() == 8) { // Gray(a) device
+ ASSERT(!m_bRgbByteOrder);
+ if (m_pDevice->IsAlphaMask()) {
+ //Alpha Mask
+ m_Gray = 255;
+ } else {
+ //Gray(a) device
+ if (pIccTransform) {
+ uint8_t gray;
+ color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
+ pIccModule->TranslateScanline(pIccTransform, &gray, (const uint8_t*)&color, 1);
+ m_Gray = gray;
+ } else {
+ if (bObjectCMYK) {
+ uint8_t r, g, b;
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color),
+ r, g, b);
+ m_Gray = FXRGB2GRAY(r, g, b);
+ } else {
+ m_Gray = FXRGB2GRAY(FXARGB_R(color), FXARGB_G(color), FXARGB_B(color));
+ }
+ }
+ }
+ } else {
+ if (bDeviceCMYK) { // Cmyk(a) Device
+ ASSERT(!m_bRgbByteOrder);
+ //TODO... opt for cmyk
+ composite_span = &CFX_SkiaRenderer::CompositeSpanCMYK;
+ if (bObjectCMYK) {
+ m_Color = FXCMYK_TODIB(color);
+ if (pIccTransform)
+ pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&m_Color, 1);
+ } else { // Object RGB
+ if (!pIccTransform)
+ return FALSE;
+ color = FXARGB_TODIB(color);
+ pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1);
+ }
+ m_Red = ((uint8_t*)&m_Color)[0];
+ m_Green = ((uint8_t*)&m_Color)[1];
+ m_Blue = ((uint8_t*)&m_Color)[2];
+ m_Gray = ((uint8_t*)&m_Color)[3];
+ return TRUE;
+ }
+ if (pIccTransform) {
+ color = bObjectCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
+ pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&m_Color, (const uint8_t*)&color, 1);
+ ((uint8_t*)&m_Color)[3] = m_Alpha;
+ m_Red = ((uint8_t*)&m_Color)[2];
+ m_Green = ((uint8_t*)&m_Color)[1];
+ m_Blue = ((uint8_t*)&m_Color)[0];
+ // Need Johnson to improvement it.
+ if (m_bRgbByteOrder) {
+ // swap
+ m_Red = ((uint8_t*)&m_Color)[0];
+ m_Blue = ((uint8_t*)&m_Color)[2];
+ m_Color = FXARGB_TODIB(m_Color);
+ m_Color = FXARGB_TOBGRORDERDIB(m_Color);
+ }
+ } else {
+ if (bObjectCMYK) {
+ uint8_t r, g, b;
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(color), FXSYS_GetMValue(color), FXSYS_GetYValue(color), FXSYS_GetKValue(color),
+ r, g, b);
+ m_Color = FXARGB_MAKE(m_Alpha, r, g, b);
+ if (m_bRgbByteOrder){
+ m_Color = FXARGB_TOBGRORDERDIB(m_Color);
+ m_Red = b; m_Green = g; m_Blue = r;//
+ }else {
+ m_Color = FXARGB_TODIB(m_Color);
+ m_Red = r; m_Green = g; m_Blue = b;//
+ }
+ } else {
+ if (m_bRgbByteOrder){
+ m_Color = FXARGB_TOBGRORDERDIB(color);
+ ArgbDecode(color, m_Alpha, m_Blue, m_Green, m_Red); //
+ }else {
+ m_Color = FXARGB_TODIB(color);
+ ArgbDecode(color, m_Alpha, m_Red, m_Green, m_Blue);
+ }
+ }
+ }
+ }
+ // Get palette transparency selector
+ m_ProcessFilter = (m_pOriDevice? 1 : 0) /* has Ori Device flag */
+ + (m_pDevice->GetBPP() >= 8 ? 2 : 0) /* bpp flag */
+ + (m_pClipMask? 4 : 0) /* has clip region flag */
+ + (m_pDevice->m_pAlphaMask? 8 : 0); /* has Alpha Mask chanel flag */
+ switch(m_ProcessFilter) {
+ case 0:
+ composite_span = &CFX_SkiaRenderer::CompositeSpan1bpp_0;
+ break;
+ case 2:
+ {
+ if (m_pDevice->GetBPP() == 8)
+ composite_span = &CFX_SkiaRenderer::CompositeSpanGray_2;
+ else if (m_pDevice->GetBPP() == 24)
+ composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_2;
+ else
+ composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer::CompositeSpanARGB_2 : &CFX_SkiaRenderer::CompositeSpanRGB32_2;
+ }
+ break;
+ case 3:
+ {
+ if (m_pDevice->GetBPP() == 8)
+ composite_span = &CFX_SkiaRenderer::CompositeSpanGray_3;
+ else if (m_pDevice->GetBPP() == 24)
+ composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_3;
+ else
+ composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer::CompositeSpanARGB_3 : &CFX_SkiaRenderer::CompositeSpanRGB32_3;
+ }
+ break;
+ case 4:
+ composite_span = &CFX_SkiaRenderer::CompositeSpan1bpp_4;
+ break;
+ case 6:
+ {
+ if (m_pDevice->GetBPP() == 8)
+ composite_span = &CFX_SkiaRenderer::CompositeSpanGray_6;
+ else if (m_pDevice->GetBPP() == 24)
+ composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_6;
+ else
+ composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer::CompositeSpanARGB_6 : &CFX_SkiaRenderer::CompositeSpanRGB32_6;
+ }
+ break;
+ case 7:
+ {
+ if (m_pDevice->GetBPP() == 8)
+ composite_span = &CFX_SkiaRenderer::CompositeSpanGray_7;
+ else if (m_pDevice->GetBPP() == 24)
+ composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_7;
+ else
+ composite_span = m_pDevice->HasAlpha()?&CFX_SkiaRenderer::CompositeSpanARGB_7 : &CFX_SkiaRenderer::CompositeSpanRGB32_7;
+ }
+ break;
+ case 1:
+ case 5:
+ case 8:
+ case 9:
+ case 11:
+ case 12:
+ case 13:
+ case 15:
+ //TODO...
+ break;
+ case 10:
+ composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_10;
+ break;
+ case 14:
+ composite_span = &CFX_SkiaRenderer::CompositeSpanRGB24_14;
+ break;
+ }
+ if (composite_span == NULL)
+ return FALSE;
+ return TRUE;
+ }
- /*----------------------------------------------------------------------------------------------------*/
- void CFX_SkiaA8Renderer::blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[])
- {
- FXSYS_assert(m_pDevice);
- int dst_y = y - m_Top;
- if (dst_y < 0 || dst_y >= m_pDevice->GetHeight())
- return;
+ /*----------------------------------------------------------------------------------------------------*/
+ void CFX_SkiaA8Renderer::blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[])
+ {
+ FXSYS_assert(m_pDevice);
+ int dst_y = y - m_Top;
+ if (dst_y < 0 || dst_y >= m_pDevice->GetHeight())
+ return;
- uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y;
- uint8_t* dest_pos = dest_scan;
- while (1)
- {
- if (x >= m_dstWidth)
- return;
- int width = runs[0];
- SkASSERT(width >= 0);
- if (width <= 0)
- return;
- unsigned aa = antialias[0];
- if (aa) {
- int col_start = x < m_Left ? 0 : x - m_Left;
- int col_end = x + width;
- col_end = col_end < m_dstWidth ? col_end - m_Left: m_pDevice->GetWidth();
- int result = col_end - col_start;
- if (result > 0) {
- dest_pos = dest_scan + col_start;
- if (result >= 4)
- FXSYS_memset(dest_pos, FXARGB_MAKE(aa, aa, aa, aa),result);
- else
- FXSYS_memset(dest_pos,aa,result);
- }
- }
- runs += width;
- antialias += width;
- x += width;
- }
- }
- void CFX_SkiaA8Renderer::blitH(int x, int y, int width)
- {
- FXSYS_assert(m_pDevice);
- int dst_y = y - m_Top;
- if (dst_y < 0 || dst_y >= m_pDevice->GetHeight())
- return;
- if (x >= m_dstWidth)
- return;
- uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y;
- int col_start = x < m_Left ? 0 : x - m_Left;
- int col_end = x + width;
- col_end = col_end < m_dstWidth ? col_end - m_Left: m_pDevice->GetWidth();
- int result = col_end - col_start;
- if (result > 0) {
- uint8_t* dest_pos = dest_scan + col_start;
- if (result >= 4)
- FXSYS_memset(dest_pos, 0xffffffff,result);
- else
- FXSYS_memset(dest_pos,255,result);
- }
- }
- void CFX_SkiaA8Renderer::blitV(int x, int y, int height, SkAlpha alpha)
- {
- FXSYS_assert(alpha);
- if (alpha == 255) {
- blitRect(x, y, 1, height);
- } else {
- int16_t runs[2];
- runs[0] = 1;
- runs[1] = 0;
- while (--height >= 0) {
- if (y >= m_dstHeight)
- return;
- blitAntiH(x, y ++, &alpha, runs);
- }
- }
- }
- void CFX_SkiaA8Renderer::blitRect(int x, int y, int width, int height)
- {
- FXSYS_assert(m_pDevice);
- while (--height >= 0) {
- if (y >= m_dstHeight)
- return;
- blitH(x , y ++, width);
- }
- }
+ uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y;
+ uint8_t* dest_pos = dest_scan;
+ while (1)
+ {
+ if (x >= m_dstWidth)
+ return;
+ int width = runs[0];
+ SkASSERT(width >= 0);
+ if (width <= 0)
+ return;
+ unsigned aa = antialias[0];
+ if (aa) {
+ int col_start = x < m_Left ? 0 : x - m_Left;
+ int col_end = x + width;
+ col_end = col_end < m_dstWidth ? col_end - m_Left: m_pDevice->GetWidth();
+ int result = col_end - col_start;
+ if (result > 0) {
+ dest_pos = dest_scan + col_start;
+ if (result >= 4)
+ FXSYS_memset(dest_pos, FXARGB_MAKE(aa, aa, aa, aa),result);
+ else
+ FXSYS_memset(dest_pos,aa,result);
+ }
+ }
+ runs += width;
+ antialias += width;
+ x += width;
+ }
+ }
+ void CFX_SkiaA8Renderer::blitH(int x, int y, int width)
+ {
+ FXSYS_assert(m_pDevice);
+ int dst_y = y - m_Top;
+ if (dst_y < 0 || dst_y >= m_pDevice->GetHeight())
+ return;
+ if (x >= m_dstWidth)
+ return;
+ uint8_t* dest_scan = m_pDevice->GetBuffer() + m_pDevice->GetPitch() * dst_y;
+ int col_start = x < m_Left ? 0 : x - m_Left;
+ int col_end = x + width;
+ col_end = col_end < m_dstWidth ? col_end - m_Left: m_pDevice->GetWidth();
+ int result = col_end - col_start;
+ if (result > 0) {
+ uint8_t* dest_pos = dest_scan + col_start;
+ if (result >= 4)
+ FXSYS_memset(dest_pos, 0xffffffff,result);
+ else
+ FXSYS_memset(dest_pos,255,result);
+ }
+ }
+ void CFX_SkiaA8Renderer::blitV(int x, int y, int height, SkAlpha alpha)
+ {
+ FXSYS_assert(alpha);
+ if (alpha == 255) {
+ blitRect(x, y, 1, height);
+ } else {
+ int16_t runs[2];
+ runs[0] = 1;
+ runs[1] = 0;
+ while (--height >= 0) {
+ if (y >= m_dstHeight)
+ return;
+ blitAntiH(x, y ++, &alpha, runs);
+ }
+ }
+ }
+ void CFX_SkiaA8Renderer::blitRect(int x, int y, int width, int height)
+ {
+ FXSYS_assert(m_pDevice);
+ while (--height >= 0) {
+ if (y >= m_dstHeight)
+ return;
+ blitH(x , y ++, width);
+ }
+ }
- void CFX_SkiaA8Renderer::blitAntiRect(int x, int y, int width, int height,
+ void CFX_SkiaA8Renderer::blitAntiRect(int x, int y, int width, int height,
SkAlpha leftAlpha, SkAlpha rightAlpha)
- {
- blitV(x++, y, height, leftAlpha);
- if (width > 0) {
- blitRect(x, y, width, height);
- x += width;
- }
- blitV(x, y, height, rightAlpha);
- }
+ {
+ blitV(x++, y, height, leftAlpha);
+ if (width > 0) {
+ blitRect(x, y, width, height);
+ x += width;
+ }
+ blitV(x, y, height, rightAlpha);
+ }
- FX_BOOL CFX_SkiaA8Renderer::Init(CFX_DIBitmap* pDevice, int Left, int Top)
- {
- m_pDevice = pDevice;
- m_Left = Left;
- m_Top = Top;
- if (pDevice){
- m_dstWidth = m_Left + pDevice->GetWidth();
- m_dstHeight = m_Top + pDevice->GetHeight();
- }
- return TRUE;
- }
+ FX_BOOL CFX_SkiaA8Renderer::Init(CFX_DIBitmap* pDevice, int Left, int Top)
+ {
+ m_pDevice = pDevice;
+ m_Left = Left;
+ m_Top = Top;
+ if (pDevice){
+ m_dstWidth = m_Left + pDevice->GetWidth();
+ m_dstHeight = m_Top + pDevice->GetHeight();
+ }
+ return TRUE;
+ }
#endif
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index b0dbc14ebc..18bcc595a4 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -267,7 +267,8 @@ void CWin32FontInfo::GetJapanesePreference(CFX_ByteString& face, int weight, int
}
}
return;
- } else if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) {
+ }
+ if (face.Find("Mincho") >= 0 || face.Find("\x96\xbe\x92\xa9") >= 0) {
if (face.Find("PMincho") >= 0 || face.Find("\x82\x6f\x96\xbe\x92\xa9") >= 0) {
face = "MS PMincho";
} else {
@@ -989,8 +990,10 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD colo
if (!bGDI) {
CFX_DIBitmap background;
if (!background.Create(width, height, FXDIB_Rgb32) ||
- !GetDIBits(&background, left, top, NULL) ||
- !background.CompositeMask(0, 0, width, height, pSource, color, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, alpha_flag, pIccTransform)) {
+ !GetDIBits(&background, left, top, NULL) ||
+ !background.CompositeMask(0, 0, width, height, pSource, color,
+ 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE,
+ alpha_flag, pIccTransform)) {
return FALSE;
}
FX_RECT src_rect(0, 0, width, height);
@@ -999,23 +1002,22 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource, FX_DWORD colo
FX_RECT clip_rect(left, top, left + pSrcRect->Width(), top + pSrcRect->Height());
return StretchDIBits(pSource, color, left - pSrcRect->left, top - pSrcRect->top, width, height,
&clip_rect, 0, alpha_flag, pIccTransform, FXDIB_BLEND_NORMAL);
- } else {
- int width = pSrcRect->Width(), height = pSrcRect->Height();
- if (pSource->HasAlpha()) {
- CFX_DIBitmap bitmap;
- if (!bitmap.Create(width, height, FXDIB_Rgb) ||
- !GetDIBits(&bitmap, left, top, NULL) ||
- !bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left, pSrcRect->top, FXDIB_BLEND_NORMAL, NULL, FALSE, pIccTransform)) {
- return FALSE;
- }
- FX_RECT src_rect(0, 0, width, height);
- return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL, 0, NULL);
- }
- CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp;
- if (pBitmap) {
- return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform);
+ }
+ int width = pSrcRect->Width(), height = pSrcRect->Height();
+ if (pSource->HasAlpha()) {
+ CFX_DIBitmap bitmap;
+ if (!bitmap.Create(width, height, FXDIB_Rgb) ||
+ !GetDIBits(&bitmap, left, top, NULL) ||
+ !bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left, pSrcRect->top, FXDIB_BLEND_NORMAL, NULL, FALSE, pIccTransform)) {
+ return FALSE;
}
+ FX_RECT src_rect(0, 0, width, height);
+ return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL, 0, NULL);
+ }
+ CFX_DIBExtractor temp(pSource);
+ CFX_DIBitmap* pBitmap = temp;
+ if (pBitmap) {
+ return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform);
}
return FALSE;
}
@@ -1045,9 +1047,10 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD
int alpha_flag, void* pIccTransform, int blend_type)
{
ASSERT(pSource != NULL && pClipRect != NULL);
- if (flags || dest_width > 10000 || dest_width < -10000 || dest_height > 10000 || dest_height < -10000)
+ if (flags || dest_width > 10000 || dest_width < -10000 || dest_height > 10000 || dest_height < -10000) {
return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, dest_width, dest_height,
pClipRect, flags, alpha_flag, pIccTransform, blend_type);
+ }
if (pSource->IsAlphaMask()) {
FX_RECT image_rect;
image_rect.left = dest_width > 0 ? dest_left : dest_left + dest_width;
@@ -1064,8 +1067,8 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD
}
CFX_DIBitmap background;
if (!background.Create(clip_width, clip_height, FXDIB_Rgb32) ||
- !GetDIBits(&background, image_rect.left + clip_rect.left, image_rect.top + clip_rect.top, NULL) ||
- !background.CompositeMask(0, 0, clip_width, clip_height, pStretched, color, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, alpha_flag, pIccTransform)) {
+ !GetDIBits(&background, image_rect.left + clip_rect.left, image_rect.top + clip_rect.top, NULL) ||
+ !background.CompositeMask(0, 0, clip_width, clip_height, pStretched, color, 0, 0, FXDIB_BLEND_NORMAL, NULL, FALSE, alpha_flag, pIccTransform)) {
delete pStretched;
return FALSE;
}
@@ -1073,25 +1076,24 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD
FX_BOOL ret = SetDIBits(&background, 0, &src_rect, image_rect.left + clip_rect.left, image_rect.top + clip_rect.top, FXDIB_BLEND_NORMAL, 0, NULL);
delete pStretched;
return ret;
- } else {
- if (pSource->HasAlpha()) {
- CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
- if (pPlatform->m_GdiplusExt.IsAvailable() && pIccTransform == NULL && !pSource->IsCmykImage()) {
- CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp;
- if (pBitmap == NULL) {
- return FALSE;
- }
- return pPlatform->m_GdiplusExt.StretchDIBits(m_hDC, pBitmap, dest_left, dest_top, dest_width, dest_height, pClipRect, flags);
+ }
+ if (pSource->HasAlpha()) {
+ CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
+ if (pPlatform->m_GdiplusExt.IsAvailable() && pIccTransform == NULL && !pSource->IsCmykImage()) {
+ CFX_DIBExtractor temp(pSource);
+ CFX_DIBitmap* pBitmap = temp;
+ if (pBitmap == NULL) {
+ return FALSE;
}
- return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, dest_width, dest_height,
- pClipRect, flags, alpha_flag, pIccTransform, blend_type);
- }
- CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp;
- if (pBitmap) {
- return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags, pIccTransform);
+ return pPlatform->m_GdiplusExt.StretchDIBits(m_hDC, pBitmap, dest_left, dest_top, dest_width, dest_height, pClipRect, flags);
}
+ return UseFoxitStretchEngine(pSource, color, dest_left, dest_top, dest_width, dest_height,
+ pClipRect, flags, alpha_flag, pIccTransform, blend_type);
+ }
+ CFX_DIBExtractor temp(pSource);
+ CFX_DIBitmap* pBitmap = temp;
+ if (pBitmap) {
+ return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags, pIccTransform);
}
return FALSE;
}
diff --git a/core/src/fxge/win32/fx_win32_dib.cpp b/core/src/fxge/win32/fx_win32_dib.cpp
index 191c2dc9cd..3dcfce4802 100644
--- a/core/src/fxge/win32/fx_win32_dib.cpp
+++ b/core/src/fxge/win32/fx_win32_dib.cpp
@@ -146,7 +146,8 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args)
CWin32Platform* pPlatform = (CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
if (pPlatform->m_GdiplusExt.IsAvailable()) {
return pPlatform->m_GdiplusExt.LoadDIBitmap(args);
- } else if (args.flags == WINDIB_OPEN_MEMORY) {
+ }
+ if (args.flags == WINDIB_OPEN_MEMORY) {
return NULL;
}
HBITMAP hBitmap = (HBITMAP)LoadImageW(NULL, (wchar_t*)args.path_name, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp
index 889a5684b7..65a35d86a1 100644
--- a/core/src/fxge/win32/fx_win32_dwrite.cpp
+++ b/core/src/fxge/win32/fx_win32_dwrite.cpp
@@ -282,10 +282,9 @@ HRESULT STDMETHODCALLTYPE CDwFontFileStream::QueryInterface(REFIID iid, void** p
*ppvObject = this;
AddRef();
return S_OK;
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
}
+ *ppvObject = NULL;
+ return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE CDwFontFileStream::AddRef()
{
@@ -306,16 +305,14 @@ HRESULT STDMETHODCALLTYPE CDwFontFileStream::ReadFileFragment(
OUT void** fragmentContext
)
{
- if (fileOffset <= resourceSize_ &&
- fragmentSize <= resourceSize_ - fileOffset) {
+ if (fileOffset <= resourceSize_ && fragmentSize <= resourceSize_ - fileOffset) {
*fragmentStart = static_cast<uint8_t const*>(resourcePtr_) + static_cast<size_t>(fileOffset);
*fragmentContext = NULL;
return S_OK;
- } else {
- *fragmentStart = NULL;
- *fragmentContext = NULL;
- return E_FAIL;
}
+ *fragmentStart = NULL;
+ *fragmentContext = NULL;
+ return E_FAIL;
}
void STDMETHODCALLTYPE CDwFontFileStream::ReleaseFileFragment(void* fragmentContext)
{
@@ -341,10 +338,9 @@ HRESULT STDMETHODCALLTYPE CDwFontFileLoader::QueryInterface(REFIID iid, void** p
*ppvObject = this;
AddRef();
return S_OK;
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
}
+ *ppvObject = NULL;
+ return E_NOINTERFACE;
}
ULONG STDMETHODCALLTYPE CDwFontFileLoader::AddRef()
{
diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp
index 8fef914cd8..d76d52e50b 100644
--- a/core/src/fxge/win32/fx_win32_gdipext.cpp
+++ b/core/src/fxge/win32/fx_win32_gdipext.cpp
@@ -1010,14 +1010,14 @@ public:
virtual HRESULT STDMETHODCALLTYPE
QueryInterface(REFIID iid, void ** ppvObject)
{
- if (iid == __uuidof(IUnknown) || iid == __uuidof(IStream) ||
- iid == __uuidof(ISequentialStream)) {
+ if (iid == __uuidof(IUnknown) ||
+ iid == __uuidof(IStream) ||
+ iid == __uuidof(ISequentialStream)) {
*ppvObject = static_cast<IStream*>(this);
AddRef();
return S_OK;
- } else {
- return E_NOINTERFACE;
}
+ return E_NOINTERFACE;
}
virtual ULONG STDMETHODCALLTYPE AddRef(void)
{
diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp
index 199ab78d9f..86dbf9bb0a 100644
--- a/core/src/fxge/win32/fx_win32_print.cpp
+++ b/core/src/fxge/win32/fx_win32_print.cpp
@@ -80,33 +80,31 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource, FX_DWORD
return FALSE;
}
return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width, dest_height, color, flags, alpha_flag, pIccTransform);
- } else {
- ASSERT(pSource != NULL);
- if (pSource->HasAlpha()) {
+ }
+ if (pSource->HasAlpha()) {
+ return FALSE;
+ }
+ if (dest_width < 0 || dest_height < 0) {
+ CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_height < 0);
+ if (pFlipped == NULL) {
return FALSE;
}
- if (dest_width < 0 || dest_height < 0) {
- CFX_DIBitmap* pFlipped = pSource->FlipImage(dest_width < 0, dest_height < 0);
- if (pFlipped == NULL) {
- return FALSE;
- }
- if (dest_width < 0) {
- dest_left += dest_width;
- }
- if (dest_height < 0) {
- dest_top += dest_height;
- }
- FX_BOOL ret = GDI_StretchDIBits(pFlipped, dest_left, dest_top, abs(dest_width), abs(dest_height), flags, pIccTransform);
- delete pFlipped;
- return ret;
+ if (dest_width < 0) {
+ dest_left += dest_width;
}
- CFX_DIBExtractor temp(pSource);
- CFX_DIBitmap* pBitmap = temp;
- if (pBitmap == NULL) {
- return FALSE;
+ if (dest_height < 0) {
+ dest_top += dest_height;
}
- return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags, pIccTransform);
+ FX_BOOL ret = GDI_StretchDIBits(pFlipped, dest_left, dest_top, abs(dest_width), abs(dest_height), flags, pIccTransform);
+ delete pFlipped;
+ return ret;
+ }
+ CFX_DIBExtractor temp(pSource);
+ CFX_DIBitmap* pBitmap = temp;
+ if (pBitmap == NULL) {
+ return FALSE;
}
+ return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width, dest_height, flags, pIccTransform);
}
static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pDestMatrix)
{