summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/ge/fx_ge_device.cpp239
-rw-r--r--core/fxge/ge/fx_ge_text.cpp99
-rw-r--r--core/fxge/include/fx_dib.h4
-rw-r--r--core/fxge/include/fx_ge.h167
4 files changed, 227 insertions, 282 deletions
diff --git a/core/fxge/ge/fx_ge_device.cpp b/core/fxge/ge/fx_ge_device.cpp
index 2d3ba566be..d6c7b18b47 100644
--- a/core/fxge/ge/fx_ge_device.cpp
+++ b/core/fxge/ge/fx_ge_device.cpp
@@ -112,29 +112,16 @@ void CFX_RenderDevice::UpdateClipBox() {
m_ClipBox.bottom = m_Height;
}
-FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData,
- const CFX_Matrix* pObject2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- uint32_t stroke_color,
- int fill_mode,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) {
- uint8_t fill_alpha, stroke_alpha;
- if (FXGETFLAG_COLORTYPE(alpha_flag)) {
- fill_alpha = FXGETFLAG_ALPHA_FILL(alpha_flag);
- stroke_alpha = FXGETFLAG_ALPHA_STROKE(alpha_flag);
- } else {
- fill_alpha = FXARGB_A(fill_color);
- stroke_alpha = FXARGB_A(stroke_color);
- }
- if ((fill_mode & 3) == 0) {
- fill_alpha = 0;
- }
- if (!pGraphState) {
- stroke_alpha = 0;
- }
+FX_BOOL CFX_RenderDevice::DrawPathWithBlend(
+ const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type) {
+ uint8_t stroke_alpha = pGraphState ? FXARGB_A(stroke_color) : 0;
+ uint8_t fill_alpha = (fill_mode & 3) ? FXARGB_A(fill_color) : 0;
if (stroke_alpha == 0 && pPathData->GetPointCount() == 2) {
FX_PATHPOINT* pPoints = pPathData->GetPoints();
FX_FLOAT x1, x2, y1, y2;
@@ -149,8 +136,8 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData,
x2 = pPoints[1].m_PointX;
y2 = pPoints[1].m_PointY;
}
- DrawCosmeticLine(x1, y1, x2, y2, fill_color, fill_mode, alpha_flag,
- pIccTransform, blend_type);
+ DrawCosmeticLineWithFillModeAndBlend(x1, y1, x2, y2, fill_color, fill_mode,
+ blend_type);
return TRUE;
}
if ((pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) &&
@@ -189,8 +176,7 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData,
rect_i.bottom--;
}
}
- if (FillRect(&rect_i, fill_color, alpha_flag, pIccTransform,
- blend_type)) {
+ if (FillRectWithBlend(&rect_i, fill_color, blend_type)) {
return TRUE;
}
}
@@ -205,12 +191,7 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData,
graphState.m_LineWidth = 0.0f;
uint32_t strokecolor = fill_color;
if (bThin) {
- if (FXGETFLAG_COLORTYPE(alpha_flag)) {
- FXSETFLAG_ALPHA_STROKE(alpha_flag, fill_alpha >> 2);
- } else {
- strokecolor =
- (((fill_alpha >> 2) << 24) | (strokecolor & 0x00ffffff));
- }
+ strokecolor = (((fill_alpha >> 2) << 24) | (strokecolor & 0x00ffffff));
}
CFX_Matrix* pMatrix = NULL;
if (pObject2Device && !pObject2Device->IsIdentity()) {
@@ -221,24 +202,22 @@ FX_BOOL CFX_RenderDevice::DrawPath(const CFX_PathData* pPathData,
smooth_path |= FXFILL_NOPATHSMOOTH;
}
m_pDeviceDriver->DrawPath(&newPath, pMatrix, &graphState, 0, strokecolor,
- smooth_path, alpha_flag, pIccTransform,
- blend_type);
+ smooth_path, 0, nullptr, blend_type);
}
}
if ((fill_mode & 3) && fill_alpha && stroke_alpha < 0xff &&
(fill_mode & FX_FILL_STROKE)) {
if (m_RenderCaps & FXRC_FILLSTROKE_PATH) {
return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState,
- fill_color, stroke_color, fill_mode,
- alpha_flag, pIccTransform, blend_type);
+ fill_color, stroke_color, fill_mode, 0,
+ nullptr, blend_type);
}
return DrawFillStrokePath(pPathData, pObject2Device, pGraphState,
- fill_color, stroke_color, fill_mode, alpha_flag,
- pIccTransform, blend_type);
+ fill_color, stroke_color, fill_mode, blend_type);
}
return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState,
- fill_color, stroke_color, fill_mode,
- alpha_flag, pIccTransform, blend_type);
+ fill_color, stroke_color, fill_mode, 0,
+ nullptr, blend_type);
}
// This can be removed once PDFium entirely relies on Skia
@@ -249,8 +228,6 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
uint32_t fill_color,
uint32_t stroke_color,
int fill_mode,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
if (!(m_RenderCaps & FXRC_GET_BITS)) {
return FALSE;
@@ -293,7 +270,7 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
matrix.Concat(fScaleX, 0, 0, fScaleY, 0, 0);
if (!bitmap_device.GetDeviceDriver()->DrawPath(
pPathData, &matrix, pGraphState, fill_color, stroke_color,
- fill_mode, alpha_flag, pIccTransform, blend_type)) {
+ fill_mode, 0, nullptr, blend_type)) {
return FALSE;
}
FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX),
@@ -302,38 +279,32 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
rect.top, FXDIB_BLEND_NORMAL);
}
-FX_BOOL CFX_RenderDevice::SetPixel(int x,
- int y,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) {
- if (m_pDeviceDriver->SetPixel(x, y, color, alpha_flag, pIccTransform)) {
+FX_BOOL CFX_RenderDevice::SetPixel(int x, int y, uint32_t color) {
+ if (m_pDeviceDriver->SetPixel(x, y, color, 0, nullptr))
return TRUE;
- }
+
FX_RECT rect(x, y, x + 1, y + 1);
- return FillRect(&rect, color, alpha_flag, pIccTransform);
+ return FillRectWithBlend(&rect, color, FXDIB_BLEND_NORMAL);
}
-FX_BOOL CFX_RenderDevice::FillRect(const FX_RECT* pRect,
- uint32_t fill_color,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) {
- if (m_pDeviceDriver->FillRect(pRect, fill_color, alpha_flag, pIccTransform,
- blend_type)) {
+
+FX_BOOL CFX_RenderDevice::FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) {
+ if (m_pDeviceDriver->FillRect(pRect, fill_color, 0, nullptr, blend_type))
return TRUE;
- }
- if (!(m_RenderCaps & FXRC_GET_BITS)) {
+
+ if (!(m_RenderCaps & FXRC_GET_BITS))
return FALSE;
- }
+
CFX_DIBitmap bitmap;
- if (!CreateCompatibleBitmap(&bitmap, pRect->Width(), pRect->Height())) {
+ if (!CreateCompatibleBitmap(&bitmap, pRect->Width(), pRect->Height()))
return FALSE;
- }
- if (!m_pDeviceDriver->GetDIBits(&bitmap, pRect->left, pRect->top)) {
+
+ if (!m_pDeviceDriver->GetDIBits(&bitmap, pRect->left, pRect->top))
return FALSE;
- }
+
if (!bitmap.CompositeRect(0, 0, pRect->Width(), pRect->Height(), fill_color,
- alpha_flag, pIccTransform)) {
+ 0, nullptr)) {
return FALSE;
}
FX_RECT src_rect(0, 0, pRect->Width(), pRect->Height());
@@ -341,50 +312,42 @@ FX_BOOL CFX_RenderDevice::FillRect(const FX_RECT* pRect,
FXDIB_BLEND_NORMAL);
return TRUE;
}
-FX_BOOL CFX_RenderDevice::DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t color,
- int fill_mode,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) {
- if (((m_RenderCaps & FXRC_ALPHA_PATH) &&
- (FXGETFLAG_COLORTYPE(alpha_flag) &&
- FXGETFLAG_ALPHA_FILL(alpha_flag) == 0xff)) ||
- color >= 0xff000000) {
- if (m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, alpha_flag,
- pIccTransform, blend_type)) {
- return TRUE;
- }
+
+FX_BOOL CFX_RenderDevice::DrawCosmeticLineWithFillModeAndBlend(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ uint32_t color,
+ int fill_mode,
+ int blend_type) {
+ if ((color >= 0xff000000) &&
+ m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, 0, nullptr,
+ blend_type)) {
+ return TRUE;
}
CFX_GraphStateData graph_state;
CFX_PathData path;
path.SetPointCount(2);
path.SetPoint(0, x1, y1, FXPT_MOVETO);
path.SetPoint(1, x2, y2, FXPT_LINETO);
- return m_pDeviceDriver->DrawPath(&path, NULL, &graph_state, 0, color,
- fill_mode, alpha_flag, pIccTransform,
- blend_type);
+ return m_pDeviceDriver->DrawPath(&path, nullptr, &graph_state, 0, color,
+ fill_mode, 0, nullptr, blend_type);
}
-FX_BOOL CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top,
- void* pIccTransform) {
- if (!(m_RenderCaps & FXRC_GET_BITS)) {
+
+FX_BOOL CFX_RenderDevice::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
+ if (!(m_RenderCaps & FXRC_GET_BITS))
return FALSE;
- }
- return m_pDeviceDriver->GetDIBits(pBitmap, left, top, pIccTransform);
+ return m_pDeviceDriver->GetDIBits(pBitmap, left, top, nullptr);
}
+
CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() {
return m_pDeviceDriver->GetBackDrop();
}
-FX_BOOL CFX_RenderDevice::SetDIBits(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int blend_mode,
- void* pIccTransform) {
+
+FX_BOOL CFX_RenderDevice::SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int blend_mode) {
ASSERT(!pBitmap->IsAlphaMask());
CFX_Matrix ctm = GetCTM();
FX_FLOAT fScaleX = FXSYS_fabs(ctm.a);
@@ -422,7 +385,7 @@ FX_BOOL CFX_RenderDevice::SetDIBits(const CFX_DIBSource* pBitmap,
}
if (!background.CompositeBitmap(0, 0, bg_pixel_width, bg_pixel_height,
pBitmap, src_rect.left, src_rect.top,
- blend_mode, NULL, FALSE, pIccTransform)) {
+ blend_mode, nullptr, FALSE, nullptr)) {
return FALSE;
}
FX_RECT src_rect(0, 0, bg_pixel_width, bg_pixel_height);
@@ -430,70 +393,66 @@ FX_BOOL CFX_RenderDevice::SetDIBits(const CFX_DIBSource* pBitmap,
dest_rect.top, FXDIB_BLEND_NORMAL);
}
return m_pDeviceDriver->SetDIBits(pBitmap, 0, &src_rect, dest_rect.left,
- dest_rect.top, blend_mode, 0,
- pIccTransform);
+ dest_rect.top, blend_mode, 0, nullptr);
}
-FX_BOOL CFX_RenderDevice::StretchDIBits(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t flags,
- void* pIccTransform,
- int blend_mode) {
+
+FX_BOOL CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
+ const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t flags,
+ int blend_mode) {
FX_RECT dest_rect(left, top, left + dest_width, top + dest_height);
FX_RECT clip_box = m_ClipBox;
clip_box.Intersect(dest_rect);
- if (clip_box.IsEmpty()) {
+ if (clip_box.IsEmpty())
return TRUE;
- }
return m_pDeviceDriver->StretchDIBits(pBitmap, 0, left, top, dest_width,
dest_height, &clip_box, flags, 0,
- pIccTransform, blend_mode);
+ nullptr, blend_mode);
}
+
FX_BOOL CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap,
int left,
int top,
- uint32_t argb,
- int alpha_flag,
- void* pIccTransform) {
+ uint32_t argb) {
FX_RECT src_rect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight());
return m_pDeviceDriver->SetDIBits(pBitmap, argb, &src_rect, left, top,
- FXDIB_BLEND_NORMAL, alpha_flag,
- pIccTransform);
+ FXDIB_BLEND_NORMAL, 0, nullptr);
}
-FX_BOOL CFX_RenderDevice::StretchBitMask(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int dest_width,
- int dest_height,
- uint32_t argb,
- uint32_t flags,
- int alpha_flag,
- void* pIccTransform) {
+
+FX_BOOL CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t argb,
+ uint32_t flags) {
FX_RECT dest_rect(left, top, left + dest_width, top + dest_height);
FX_RECT clip_box = m_ClipBox;
clip_box.Intersect(dest_rect);
return m_pDeviceDriver->StretchDIBits(pBitmap, argb, left, top, dest_width,
- dest_height, &clip_box, flags,
- alpha_flag, pIccTransform);
+ dest_height, &clip_box, flags, 0,
+ nullptr);
}
-FX_BOOL CFX_RenderDevice::StartDIBits(const CFX_DIBSource* pBitmap,
- int bitmap_alpha,
- uint32_t argb,
- const CFX_Matrix* pMatrix,
- uint32_t flags,
- void*& handle,
- int alpha_flag,
- void* pIccTransform,
- int blend_mode) {
+
+FX_BOOL CFX_RenderDevice::StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t argb,
+ const CFX_Matrix* pMatrix,
+ uint32_t flags,
+ void*& handle,
+ int blend_mode) {
return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix,
- flags, handle, alpha_flag, pIccTransform,
- blend_mode);
+ flags, handle, 0, nullptr, blend_mode);
}
+
FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) {
return m_pDeviceDriver->ContinueDIBits(handle, pPause);
}
+
void CFX_RenderDevice::CancelDIBits(void* handle) {
m_pDeviceDriver->CancelDIBits(handle);
}
diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp
index f2867aaf11..aeac66b4b0 100644
--- a/core/fxge/ge/fx_ge_text.cpp
+++ b/core/fxge/ge/fx_ge_text.cpp
@@ -427,9 +427,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
FX_FLOAT font_size,
const CFX_Matrix* pText2Device,
uint32_t fill_color,
- uint32_t text_flags,
- int alpha_flag,
- void* pIccTransform) {
+ uint32_t text_flags) {
int nativetext_flags = text_flags;
if (m_DeviceClass != FXDC_DISPLAY) {
if (!(text_flags & FXTEXT_PRINTGRAPHICTEXT)) {
@@ -445,16 +443,12 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
if (should_call_draw_device_text &&
m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache,
pText2Device, font_size, fill_color,
- alpha_flag, pIccTransform)) {
+ 0, nullptr)) {
return TRUE;
}
}
- int alpha = FXGETFLAG_COLORTYPE(alpha_flag)
- ? FXGETFLAG_ALPHA_FILL(alpha_flag)
- : FXARGB_A(fill_color);
- if (alpha < 255) {
+ if (FXARGB_A(fill_color) < 255)
return FALSE;
- }
} else if (!(text_flags & FXTEXT_NO_NATIVETEXT)) {
bool should_call_draw_device_text = true;
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -465,8 +459,8 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
#endif
if (should_call_draw_device_text &&
m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache,
- pText2Device, font_size, fill_color,
- alpha_flag, pIccTransform)) {
+ pText2Device, font_size, fill_color, 0,
+ nullptr)) {
return TRUE;
}
}
@@ -484,9 +478,9 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
(pFont->GetSubstFont()->m_SubstFlags & FXFONT_SUBST_GLYPHPATH)) {
int nPathFlags =
(text_flags & FXTEXT_NOSMOOTH) == 0 ? 0 : FXFILL_NOPATHSMOOTH;
- return DrawTextPath(nChars, pCharPos, pFont, pCache, font_size,
- pText2Device, NULL, NULL, fill_color, 0, NULL,
- nPathFlags, alpha_flag, pIccTransform);
+ return DrawTextPathWithFlags(nChars, pCharPos, pFont, pCache, font_size,
+ pText2Device, nullptr, nullptr, fill_color,
+ 0, nullptr, nPathFlags);
}
}
int anti_alias = FXFT_RENDER_MODE_MONO;
@@ -621,7 +615,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
int g = 0;
int b = 0;
if (anti_alias == FXFT_RENDER_MODE_LCD) {
- Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform);
+ Color2Argb(fill_color, fill_color, (1 << 24), nullptr);
ArgbDecode(fill_color, a, r, g, b);
}
for (const FXTEXT_GLYPHPOS& glyph : glyphs) {
@@ -635,8 +629,8 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
int nrows = pGlyph->GetHeight();
if (anti_alias == FXFT_RENDER_MODE_NORMAL) {
if (!bitmap.CompositeMask(left, top, ncols, nrows, pGlyph, fill_color, 0,
- 0, FXDIB_BLEND_NORMAL, nullptr, FALSE,
- alpha_flag, pIccTransform)) {
+ 0, FXDIB_BLEND_NORMAL, nullptr, FALSE, 0,
+ nullptr)) {
return FALSE;
}
continue;
@@ -653,34 +647,29 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
DrawNormalTextHelper(&bitmap, pGlyph, nrows, left, top, start_col, end_col,
bNormal, bBGRStripe, x_subpixel, a, r, g, b);
}
- if (bitmap.IsAlphaMask()) {
- SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color, alpha_flag,
- pIccTransform);
- } else {
+ if (bitmap.IsAlphaMask())
+ SetBitMask(&bitmap, bmp_rect.left, bmp_rect.top, fill_color);
+ else
SetDIBits(&bitmap, bmp_rect.left, bmp_rect.top);
- }
-
return TRUE;
}
-FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- CFX_FontCache* pCache,
- FX_FLOAT font_size,
- const CFX_Matrix* pText2User,
- const CFX_Matrix* pUser2Device,
- const CFX_GraphStateData* pGraphState,
- uint32_t fill_color,
- FX_ARGB stroke_color,
- CFX_PathData* pClippingPath,
- int nFlag,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) {
- if (!pCache) {
+FX_BOOL CFX_RenderDevice::DrawTextPathWithFlags(
+ int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ CFX_FontCache* pCache,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2User,
+ const CFX_Matrix* pUser2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ FX_ARGB stroke_color,
+ CFX_PathData* pClippingPath,
+ int nFlag) {
+ if (!pCache)
pCache = CFX_GEModule::Get()->GetFontCache();
- }
+
CFX_FaceCache* pFaceCache = pCache->GetCachedFace(pFont);
FX_FONTCACHE_DEFINE(pCache, pFont);
for (int iChar = 0; iChar < nChars; iChar++) {
@@ -693,37 +682,25 @@ FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars,
charpos.m_OriginY);
const CFX_PathData* pPath = pFaceCache->LoadGlyphPath(
pFont, charpos.m_GlyphIndex, charpos.m_FontCharWidth);
- if (!pPath) {
+ if (!pPath)
continue;
- }
+
matrix.Concat(*pText2User);
CFX_PathData TransformedPath(*pPath);
TransformedPath.Transform(&matrix);
- FX_BOOL bHasAlpha = FXGETFLAG_COLORTYPE(alpha_flag)
- ? (FXGETFLAG_ALPHA_FILL(alpha_flag) ||
- FXGETFLAG_ALPHA_STROKE(alpha_flag))
- : (fill_color || stroke_color);
- if (bHasAlpha) {
+ if (fill_color || stroke_color) {
int fill_mode = nFlag;
- if (FXGETFLAG_COLORTYPE(alpha_flag)) {
- if (FXGETFLAG_ALPHA_FILL(alpha_flag)) {
- fill_mode |= FXFILL_WINDING;
- }
- } else {
- if (fill_color) {
- fill_mode |= FXFILL_WINDING;
- }
- }
+ if (fill_color)
+ fill_mode |= FXFILL_WINDING;
fill_mode |= FX_FILL_TEXT_MODE;
- if (!DrawPath(&TransformedPath, pUser2Device, pGraphState, fill_color,
- stroke_color, fill_mode, alpha_flag, pIccTransform,
- blend_type)) {
+ if (!DrawPathWithBlend(&TransformedPath, pUser2Device, pGraphState,
+ fill_color, stroke_color, fill_mode,
+ FXDIB_BLEND_NORMAL)) {
return FALSE;
}
}
- if (pClippingPath) {
+ if (pClippingPath)
pClippingPath->Append(&TransformedPath, pUser2Device);
- }
}
return TRUE;
}
diff --git a/core/fxge/include/fx_dib.h b/core/fxge/include/fx_dib.h
index a09f88453f..6504e5fd8f 100644
--- a/core/fxge/include/fx_dib.h
+++ b/core/fxge/include/fx_dib.h
@@ -154,11 +154,7 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb);
#define FXGETFLAG_COLORTYPE(flag) (uint8_t)((flag) >> 8)
#define FXGETFLAG_ALPHA_FILL(flag) (uint8_t)(flag)
#define FXGETFLAG_ALPHA_STROKE(flag) (uint8_t)((flag) >> 16)
-#define FXSETFLAG_COLORTYPE(flag, val) \
- flag = (((val) << 8) | (flag & 0xffff00ff))
#define FXSETFLAG_ALPHA_FILL(flag, val) flag = ((val) | (flag & 0xffffff00))
-#define FXSETFLAG_ALPHA_STROKE(flag, val) \
- flag = (((val) << 16) | (flag & 0xff00ffff))
class CFX_DIBSource {
public:
diff --git a/core/fxge/include/fx_ge.h b/core/fxge/include/fx_ge.h
index 6efd5177bc..c025c1251e 100644
--- a/core/fxge/include/fx_ge.h
+++ b/core/fxge/include/fx_ge.h
@@ -217,7 +217,6 @@ class CFX_RenderDevice {
void EndRendering();
void SaveState();
void RestoreState(bool bKeepSaved);
-
int GetWidth() const { return m_Width; }
int GetHeight() const { return m_Height; }
int GetDeviceClass() const { return m_DeviceClass; }
@@ -225,108 +224,119 @@ class CFX_RenderDevice {
int GetRenderCaps() const { return m_RenderCaps; }
int GetDeviceCaps(int id) const;
CFX_Matrix GetCTM() const;
-
CFX_DIBitmap* GetBitmap() const { return m_pBitmap; }
void SetBitmap(CFX_DIBitmap* pBitmap) { m_pBitmap = pBitmap; }
-
FX_BOOL CreateCompatibleBitmap(CFX_DIBitmap* pDIB,
int width,
int height) const;
-
const FX_RECT& GetClipBox() const { return m_ClipBox; }
-
FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
int fill_mode);
-
FX_BOOL SetClip_Rect(const FX_RECT& pRect);
FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
const CFX_GraphStateData* pGraphState);
-
FX_BOOL DrawPath(const CFX_PathData* pPathData,
const CFX_Matrix* pObject2Device,
const CFX_GraphStateData* pGraphState,
uint32_t fill_color,
uint32_t stroke_color,
- int fill_mode,
- int alpha_flag = 0,
- void* pIccTransform = NULL,
- int blend_type = FXDIB_BLEND_NORMAL);
-
- FX_BOOL SetPixel(int x,
- int y,
- uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = NULL);
-
- FX_BOOL FillRect(const FX_RECT* pRect,
- uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = NULL,
- int blend_type = FXDIB_BLEND_NORMAL);
-
+ int fill_mode) {
+ return DrawPathWithBlend(pPathData, pObject2Device, pGraphState, fill_color,
+ stroke_color, fill_mode, FXDIB_BLEND_NORMAL);
+ }
+ FX_BOOL DrawPathWithBlend(const CFX_PathData* pPathData,
+ const CFX_Matrix* pObject2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ int fill_mode,
+ int blend_type);
+ FX_BOOL SetPixel(int x, int y, uint32_t color);
+ FX_BOOL FillRect(const FX_RECT* pRect, uint32_t color) {
+ return FillRectWithBlend(pRect, color, FXDIB_BLEND_NORMAL);
+ }
+ FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t color,
+ int blend_type);
FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
FX_FLOAT y1,
FX_FLOAT x2,
FX_FLOAT y2,
- uint32_t color,
- int fill_mode = 0,
- int alpha_flag = 0,
- void* pIccTransform = NULL,
- int blend_type = FXDIB_BLEND_NORMAL);
-
- FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top,
- void* pIccTransform = NULL);
-
+ uint32_t color) {
+ return DrawCosmeticLineWithFillModeAndBlend(x1, y1, x2, y2, color, 0,
+ FXDIB_BLEND_NORMAL);
+ }
+ FX_BOOL DrawCosmeticLineWithFillModeAndBlend(FX_FLOAT x1,
+ FX_FLOAT y1,
+ FX_FLOAT x2,
+ FX_FLOAT y2,
+ uint32_t color,
+ int fill_mode,
+ int blend_type);
+
+ FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top);
CFX_DIBitmap* GetBackDrop();
-
- FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
- int left,
- int top,
- int blend_type = FXDIB_BLEND_NORMAL,
- void* pIccTransform = NULL);
-
+ FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, int left, int top) {
+ return SetDIBitsWithBlend(pBitmap, left, top, FXDIB_BLEND_NORMAL);
+ }
+ FX_BOOL SetDIBitsWithBlend(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int blend_type);
FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
int left,
int top,
int dest_width,
- int dest_height,
- uint32_t flags = 0,
- void* pIccTransform = NULL,
- int blend_type = FXDIB_BLEND_NORMAL);
-
+ int dest_height) {
+ return StretchDIBitsWithFlagsAndBlend(pBitmap, left, top, dest_width,
+ dest_height, 0, FXDIB_BLEND_NORMAL);
+ }
+ FX_BOOL StretchDIBitsWithFlagsAndBlend(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t flags,
+ int blend_type);
FX_BOOL SetBitMask(const CFX_DIBSource* pBitmap,
int left,
int top,
- uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = NULL);
-
+ uint32_t color);
FX_BOOL StretchBitMask(const CFX_DIBSource* pBitmap,
int left,
int top,
int dest_width,
int dest_height,
- uint32_t color,
- uint32_t flags = 0,
- int alpha_flag = 0,
- void* pIccTransform = NULL);
-
+ uint32_t color) {
+ return StretchBitMaskWithFlags(pBitmap, left, top, dest_width, dest_height,
+ color, 0);
+ }
+ FX_BOOL StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
+ int left,
+ int top,
+ int dest_width,
+ int dest_height,
+ uint32_t color,
+ uint32_t flags);
FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
int bitmap_alpha,
uint32_t color,
const CFX_Matrix* pMatrix,
uint32_t flags,
- void*& handle,
- int alpha_flag = 0,
- void* pIccTransform = NULL,
- int blend_type = FXDIB_BLEND_NORMAL);
-
+ void*& handle) {
+ return StartDIBitsWithBlend(pBitmap, bitmap_alpha, color, pMatrix, flags,
+ handle, FXDIB_BLEND_NORMAL);
+ }
+ FX_BOOL StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
+ int bitmap_alpha,
+ uint32_t color,
+ const CFX_Matrix* pMatrix,
+ uint32_t flags,
+ void*& handle,
+ int blend_type);
FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause);
-
void CancelDIBits(void* handle);
FX_BOOL DrawNormalText(int nChars,
@@ -336,10 +346,7 @@ class CFX_RenderDevice {
FX_FLOAT font_size,
const CFX_Matrix* pText2Device,
uint32_t fill_color,
- uint32_t text_flags,
- int alpha_flag = 0,
- void* pIccTransform = NULL);
-
+ uint32_t text_flags);
FX_BOOL DrawTextPath(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
@@ -350,13 +357,23 @@ class CFX_RenderDevice {
const CFX_GraphStateData* pGraphState,
uint32_t fill_color,
uint32_t stroke_color,
- CFX_PathData* pClippingPath,
- int nFlag = 0,
- int alpha_flag = 0,
- void* pIccTransform = NULL,
- int blend_type = FXDIB_BLEND_NORMAL);
- virtual void Begin() {}
- virtual void End() {}
+ CFX_PathData* pClippingPath) {
+ return DrawTextPathWithFlags(nChars, pCharPos, pFont, pCache, font_size,
+ pText2User, pUser2Device, pGraphState,
+ fill_color, stroke_color, pClippingPath, 0);
+ }
+ FX_BOOL DrawTextPathWithFlags(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ CFX_FontCache* pCache,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2User,
+ const CFX_Matrix* pUser2Device,
+ const CFX_GraphStateData* pGraphState,
+ uint32_t fill_color,
+ uint32_t stroke_color,
+ CFX_PathData* pClippingPath,
+ int nFlag);
private:
void InitDeviceInfo();
@@ -367,8 +384,6 @@ class CFX_RenderDevice {
uint32_t fill_color,
uint32_t stroke_color,
int fill_mode,
- int alpha_flag,
- void* pIccTransform,
int blend_type);
CFX_DIBitmap* m_pBitmap;
@@ -416,8 +431,6 @@ class IFX_RenderDeviceDriver {
FX_BOOL bGroupKnockout = FALSE);
virtual ~IFX_RenderDeviceDriver() {}
- virtual void Begin() {}
- virtual void End() {}
virtual int GetDeviceCaps(int caps_id) = 0;