summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-06-13 15:02:05 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-13 15:02:05 -0700
commit2f307669ded2621f87d0b019e508f6663523f1d7 (patch)
tree035cb0ad851aa008a4f3c27c365c40564ef69859
parent868150bd69f0f1f9472affc20deea0a9341bf22b (diff)
downloadpdfium-2f307669ded2621f87d0b019e508f6663523f1d7.tar.xz
Remove default arguments from IFX_RenderDeviceDriver.
Review-Url: https://codereview.chromium.org/2059883004
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp40
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp719
-rw-r--r--core/fxge/agg/fx_agg_driver.h44
-rw-r--r--core/fxge/apple/apple_int.h58
-rw-r--r--core/fxge/apple/fx_apple_platform.cpp125
-rw-r--r--core/fxge/apple/fx_quartz_device.cpp194
-rw-r--r--core/fxge/ge/fx_ge_device.cpp40
-rw-r--r--core/fxge/ge/fx_ge_text.cpp7
-rw-r--r--core/fxge/include/fx_dib.h1
-rw-r--r--core/fxge/include/fx_ge.h57
-rw-r--r--core/fxge/skia/fx_skia_device.cpp61
-rw-r--r--core/fxge/skia/fx_skia_device.h38
-rw-r--r--core/fxge/win32/fx_win32_device.cpp165
-rw-r--r--core/fxge/win32/fx_win32_print.cpp52
-rw-r--r--core/fxge/win32/win32_int.h44
15 files changed, 689 insertions, 956 deletions
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index a675dfe09c..add2a8ae23 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -435,46 +435,34 @@ FX_BOOL CPDF_RenderStatus::ProcessPath(const CPDF_PathObject* pPathObj,
int FillType = pPathObj->m_FillType;
FX_BOOL bStroke = pPathObj->m_bStroke;
ProcessPathPattern(pPathObj, pObj2Device, FillType, bStroke);
- if (FillType == 0 && !bStroke) {
+ if (FillType == 0 && !bStroke)
return TRUE;
- }
- uint32_t fill_argb = 0;
- if (FillType) {
- fill_argb = GetFillArgb(pPathObj);
- }
- uint32_t stroke_argb = 0;
- if (bStroke) {
- stroke_argb = GetStrokeArgb(pPathObj);
- }
+
+ uint32_t fill_argb = FillType ? GetFillArgb(pPathObj) : 0;
+ uint32_t stroke_argb = bStroke ? GetStrokeArgb(pPathObj) : 0;
CFX_Matrix path_matrix = pPathObj->m_Matrix;
path_matrix.Concat(*pObj2Device);
- if (!IsAvailableMatrix(path_matrix)) {
+ if (!IsAvailableMatrix(path_matrix))
return TRUE;
- }
- if (FillType && (m_Options.m_Flags & RENDER_RECT_AA)) {
+
+ if (FillType && (m_Options.m_Flags & RENDER_RECT_AA))
FillType |= FXFILL_RECT_AA;
- }
- if (m_Options.m_Flags & RENDER_FILL_FULLCOVER) {
+ if (m_Options.m_Flags & RENDER_FILL_FULLCOVER)
FillType |= FXFILL_FULLCOVER;
- }
- if (m_Options.m_Flags & RENDER_NOPATHSMOOTH) {
+ if (m_Options.m_Flags & RENDER_NOPATHSMOOTH)
FillType |= FXFILL_NOPATHSMOOTH;
- }
- if (bStroke) {
+ if (bStroke)
FillType |= FX_FILL_STROKE;
- }
const CPDF_GeneralStateData* pGeneralData =
static_cast<const CPDF_PageObject*>(pPathObj)->m_GeneralState.GetObject();
- if (pGeneralData && pGeneralData->m_StrokeAdjust) {
+ if (pGeneralData && pGeneralData->m_StrokeAdjust)
FillType |= FX_STROKE_ADJUST;
- }
- if (m_pType3Char) {
+ if (m_pType3Char)
FillType |= FX_FILL_TEXT_MODE;
- }
+
CFX_GraphStateData graphState(*pPathObj->m_GraphState.GetObject());
- if (m_Options.m_Flags & RENDER_THINLINE) {
+ if (m_Options.m_Flags & RENDER_THINLINE)
graphState.m_LineWidth = 0;
- }
return m_pDevice->DrawPathWithBlend(pPathObj->m_Path.GetObject(),
&path_matrix, &graphState, fill_argb,
stroke_argb, FillType, m_curBlend);
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 7d197f8c21..554c79f349 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -28,6 +28,238 @@ void HardClip(FX_FLOAT& x, FX_FLOAT& y) {
y = std::max(std::min(y, 50000.0f), -50000.0f);
}
+void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, uint32_t argb) {
+ if (x < 0 || x >= pBitmap->GetWidth() || y < 0 || y >= pBitmap->GetHeight())
+ return;
+
+ uint8_t* pos = (uint8_t*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() +
+ x * pBitmap->GetBPP() / 8;
+ if (pBitmap->GetFormat() == FXDIB_Argb) {
+ FXARGB_SETRGBORDERDIB(pos, argb);
+ return;
+ }
+
+ int alpha = FXARGB_A(argb);
+ pos[0] = (FXARGB_R(argb) * alpha + pos[0] * (255 - alpha)) / 255;
+ pos[1] = (FXARGB_G(argb) * alpha + pos[1] * (255 - alpha)) / 255;
+ pos[2] = (FXARGB_B(argb) * alpha + pos[2] * (255 - alpha)) / 255;
+}
+
+void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap,
+ int left,
+ int top,
+ int width,
+ int height,
+ FX_ARGB argb) {
+ int src_alpha = FXARGB_A(argb);
+ if (src_alpha == 0)
+ return;
+
+ FX_RECT rect(left, top, left + width, top + height);
+ rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight());
+ width = rect.Width();
+ int src_r = FXARGB_R(argb);
+ int src_g = FXARGB_G(argb);
+ int src_b = FXARGB_B(argb);
+ int Bpp = pBitmap->GetBPP() / 8;
+ FX_BOOL bAlpha = pBitmap->HasAlpha();
+ int dib_argb = FXARGB_TOBGRORDERDIB(argb);
+ uint8_t* pBuffer = pBitmap->GetBuffer();
+ if (src_alpha == 255) {
+ for (int row = rect.top; row < rect.bottom; row++) {
+ uint8_t* dest_scan =
+ pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp;
+ if (Bpp == 4) {
+ uint32_t* scan = (uint32_t*)dest_scan;
+ for (int col = 0; col < width; col++)
+ *scan++ = dib_argb;
+ } else {
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = src_r;
+ *dest_scan++ = src_g;
+ *dest_scan++ = src_b;
+ }
+ }
+ }
+ return;
+ }
+ for (int row = rect.top; row < rect.bottom; row++) {
+ uint8_t* dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp;
+ if (bAlpha) {
+ for (int col = 0; col < width; col++) {
+ uint8_t back_alpha = dest_scan[3];
+ if (back_alpha == 0) {
+ FXARGB_SETRGBORDERDIB(dest_scan,
+ FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
+ dest_scan += 4;
+ continue;
+ }
+ uint8_t dest_alpha =
+ back_alpha + src_alpha - back_alpha * src_alpha / 255;
+ dest_scan[3] = dest_alpha;
+ int alpha_ratio = src_alpha * 255 / dest_alpha;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
+ dest_scan += 2;
+ }
+ } else {
+ for (int col = 0; col < width; col++) {
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha);
+ dest_scan++;
+ *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha);
+ dest_scan++;
+ if (Bpp == 4)
+ dest_scan++;
+ }
+ }
+ }
+}
+
+void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
+ int dest_left,
+ int dest_top,
+ int width,
+ int height,
+ const CFX_DIBSource* pSrcBitmap,
+ int src_left,
+ int src_top) {
+ if (!pBitmap)
+ return;
+
+ pBitmap->GetOverlapRect(dest_left, dest_top, width, height,
+ pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(),
+ src_left, src_top, nullptr);
+ if (width == 0 || height == 0)
+ return;
+
+ int Bpp = pBitmap->GetBPP() / 8;
+ FXDIB_Format dest_format = pBitmap->GetFormat();
+ FXDIB_Format src_format = pSrcBitmap->GetFormat();
+ int pitch = pBitmap->GetPitch();
+ uint8_t* buffer = pBitmap->GetBuffer();
+ if (dest_format == src_format) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = buffer + (dest_top + row) * pitch + dest_left * Bpp;
+ uint8_t* src_scan =
+ (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
+ if (Bpp == 4) {
+ for (int col = 0; col < width; col++) {
+ FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_scan[3], src_scan[0],
+ src_scan[1], src_scan[2]));
+ dest_scan += 4;
+ src_scan += 4;
+ }
+ } else {
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = src_scan[2];
+ *dest_scan++ = src_scan[1];
+ *dest_scan++ = src_scan[0];
+ src_scan += 3;
+ }
+ }
+ }
+ return;
+ }
+
+ uint8_t* dest_buf = buffer + dest_top * pitch + dest_left * Bpp;
+ if (dest_format == FXDIB_Rgb) {
+ if (src_format == FXDIB_Rgb32) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * pitch;
+ uint8_t* src_scan =
+ (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
+ for (int col = 0; col < width; col++) {
+ *dest_scan++ = src_scan[2];
+ *dest_scan++ = src_scan[1];
+ *dest_scan++ = src_scan[0];
+ src_scan += 4;
+ }
+ }
+ } else {
+ ASSERT(FALSE);
+ }
+ return;
+ }
+
+ if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) {
+ if (src_format == FXDIB_Rgb) {
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch);
+ uint8_t* src_scan =
+ (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
+ for (int col = 0; col < width; col++) {
+ FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1],
+ src_scan[2]));
+ dest_scan += 4;
+ src_scan += 3;
+ }
+ }
+ } else if (src_format == FXDIB_Rgb32) {
+ ASSERT(dest_format == FXDIB_Argb);
+ for (int row = 0; row < height; row++) {
+ uint8_t* dest_scan = dest_buf + row * pitch;
+ uint8_t* src_scan =
+ (uint8_t*)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4);
+ for (int col = 0; col < width; col++) {
+ FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1],
+ src_scan[2]));
+ src_scan += 4;
+ dest_scan += 4;
+ }
+ }
+ }
+ return;
+ }
+
+ ASSERT(FALSE);
+}
+
+FX_ARGB DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) {
+ uint8_t r, g, b;
+ AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk),
+ FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g, b);
+ return ArgbEncode(alpha, r, g, b);
+}
+
+FX_BOOL DibSetPixel(CFX_DIBitmap* pDevice,
+ int x,
+ int y,
+ uint32_t color,
+ int alpha_flag,
+ void* pIccTransform) {
+ FX_BOOL bObjCMYK = FXGETFLAG_COLORTYPE(alpha_flag);
+ int alpha = bObjCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color);
+ if (pIccTransform) {
+ CCodec_IccModule* pIccModule =
+ CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
+ color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
+ pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&color,
+ (uint8_t*)&color, 1);
+ color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
+ if (!pDevice->IsCmykImage()) {
+ color = (color & 0xffffff) | (alpha << 24);
+ }
+ } else {
+ if (pDevice->IsCmykImage()) {
+ if (!bObjCMYK)
+ return FALSE;
+ } else {
+ if (bObjCMYK)
+ color = DefaultCMYK2ARGB(color, alpha);
+ }
+ }
+ pDevice->SetPixel(x, y, color);
+ if (pDevice->m_pAlphaMask) {
+ pDevice->m_pAlphaMask->SetPixel(x, y, alpha << 24);
+ }
+ return TRUE;
+}
+
} // namespace
void CAgg_PathData::BuildPath(const CFX_PathData* pPathData,
@@ -231,12 +463,10 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
CFX_FontCache* pCache,
const CFX_Matrix* pObject2Device,
FX_FLOAT font_size,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) {
+ uint32_t color) {
return FALSE;
-} // _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
-#endif
+}
+#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_
int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) {
switch (caps_id) {
@@ -1230,15 +1460,13 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
uint32_t fill_color,
uint32_t stroke_color,
int fill_mode,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
- if (blend_type != FXDIB_BLEND_NORMAL) {
+ if (blend_type != FXDIB_BLEND_NORMAL)
return FALSE;
- }
- if (!GetBuffer()) {
+
+ if (!GetBuffer())
return TRUE;
- }
+
m_FillFlags = fill_mode;
if ((fill_mode & 3) && fill_color) {
CAgg_PathData path_data;
@@ -1251,358 +1479,106 @@ FX_BOOL CFX_AggDeviceDriver::DrawPath(const CFX_PathData* pPathData,
? agg::fill_non_zero
: agg::fill_even_odd);
if (!RenderRasterizer(rasterizer, fill_color, fill_mode & FXFILL_FULLCOVER,
- FALSE, alpha_flag, pIccTransform)) {
+ FALSE, 0, nullptr)) {
return FALSE;
}
}
- int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag)
- ? FXGETFLAG_ALPHA_STROKE(alpha_flag)
- : FXARGB_A(stroke_color);
- if (pGraphState && stroke_alpha) {
- if (fill_mode & FX_ZEROAREA_FILL) {
- CAgg_PathData path_data;
- path_data.BuildPath(pPathData, pObject2Device);
- agg::rasterizer_scanline_aa rasterizer;
- rasterizer.clip_box(0.0f, 0.0f,
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
- (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
- RasterizeStroke(rasterizer, path_data.m_PathData, nullptr, pGraphState, 1,
- FALSE, fill_mode & FX_STROKE_TEXT_MODE);
- int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag) << 8 |
- FXGETFLAG_ALPHA_STROKE(alpha_flag);
- if (!RenderRasterizer(rasterizer, stroke_color,
- fill_mode & FXFILL_FULLCOVER, m_bGroupKnockout,
- fill_flag, pIccTransform)) {
- return FALSE;
- }
- return TRUE;
- }
- CFX_Matrix matrix1, matrix2;
- if (pObject2Device) {
- matrix1.a = std::max(FXSYS_fabs(pObject2Device->a),
- FXSYS_fabs(pObject2Device->b));
- matrix1.d = matrix1.a;
- matrix2.Set(pObject2Device->a / matrix1.a, pObject2Device->b / matrix1.a,
- pObject2Device->c / matrix1.d, pObject2Device->d / matrix1.d,
- 0, 0);
- CFX_Matrix mtRervese;
- mtRervese.SetReverse(matrix2);
- matrix1 = *pObject2Device;
- matrix1.Concat(mtRervese);
- }
+ int stroke_alpha = FXARGB_A(stroke_color);
+ if (!pGraphState || !stroke_alpha)
+ return TRUE;
+
+ if (fill_mode & FX_ZEROAREA_FILL) {
CAgg_PathData path_data;
- path_data.BuildPath(pPathData, &matrix1);
+ path_data.BuildPath(pPathData, pObject2Device);
agg::rasterizer_scanline_aa rasterizer;
rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
(FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
- RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState,
- matrix1.a, FALSE, fill_mode & FX_STROKE_TEXT_MODE);
- int fill_flag = FXGETFLAG_COLORTYPE(alpha_flag) << 8 |
- FXGETFLAG_ALPHA_STROKE(alpha_flag);
+ RasterizeStroke(rasterizer, path_data.m_PathData, nullptr, pGraphState, 1,
+ FALSE, fill_mode & FX_STROKE_TEXT_MODE);
if (!RenderRasterizer(rasterizer, stroke_color,
- fill_mode & FXFILL_FULLCOVER, m_bGroupKnockout,
- fill_flag, pIccTransform)) {
+ fill_mode & FXFILL_FULLCOVER, m_bGroupKnockout, 0,
+ nullptr)) {
return FALSE;
}
+ return TRUE;
}
- return TRUE;
-}
-
-void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, uint32_t argb) {
- if (x < 0 || x >= pBitmap->GetWidth() || y < 0 || y >= pBitmap->GetHeight()) {
- return;
+ CFX_Matrix matrix1;
+ CFX_Matrix matrix2;
+ if (pObject2Device) {
+ matrix1.a =
+ std::max(FXSYS_fabs(pObject2Device->a), FXSYS_fabs(pObject2Device->b));
+ matrix1.d = matrix1.a;
+ matrix2.Set(pObject2Device->a / matrix1.a, pObject2Device->b / matrix1.a,
+ pObject2Device->c / matrix1.d, pObject2Device->d / matrix1.d, 0,
+ 0);
+ CFX_Matrix mtRervese;
+ mtRervese.SetReverse(matrix2);
+ matrix1 = *pObject2Device;
+ matrix1.Concat(mtRervese);
}
- uint8_t* pos = (uint8_t*)pBitmap->GetBuffer() + y * pBitmap->GetPitch() +
- x * pBitmap->GetBPP() / 8;
- if (pBitmap->GetFormat() == FXDIB_Argb) {
- FXARGB_SETRGBORDERDIB(pos, argb);
- } else {
- int alpha = FXARGB_A(argb);
- pos[0] = (FXARGB_R(argb) * alpha + pos[0] * (255 - alpha)) / 255;
- pos[1] = (FXARGB_G(argb) * alpha + pos[1] * (255 - alpha)) / 255;
- pos[2] = (FXARGB_B(argb) * alpha + pos[2] * (255 - alpha)) / 255;
+ CAgg_PathData path_data;
+ path_data.BuildPath(pPathData, &matrix1);
+ agg::rasterizer_scanline_aa rasterizer;
+ rasterizer.clip_box(0.0f, 0.0f, (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_WIDTH)),
+ (FX_FLOAT)(GetDeviceCaps(FXDC_PIXEL_HEIGHT)));
+ RasterizeStroke(rasterizer, path_data.m_PathData, &matrix2, pGraphState,
+ matrix1.a, FALSE, fill_mode & FX_STROKE_TEXT_MODE);
+ if (!RenderRasterizer(rasterizer, stroke_color, fill_mode & FXFILL_FULLCOVER,
+ m_bGroupKnockout, 0, nullptr)) {
+ return FALSE;
}
+ return TRUE;
}
-void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap,
- int left,
- int top,
- int width,
- int height,
- FX_ARGB argb) {
- int src_alpha = FXARGB_A(argb);
- if (src_alpha == 0) {
- return;
- }
- FX_RECT rect(left, top, left + width, top + height);
- rect.Intersect(0, 0, pBitmap->GetWidth(), pBitmap->GetHeight());
- width = rect.Width();
- int src_r = FXARGB_R(argb), src_g = FXARGB_G(argb), src_b = FXARGB_B(argb);
- int Bpp = pBitmap->GetBPP() / 8;
- FX_BOOL bAlpha = pBitmap->HasAlpha();
- int dib_argb = FXARGB_TOBGRORDERDIB(argb);
- uint8_t* pBuffer = pBitmap->GetBuffer();
- if (src_alpha == 255) {
- for (int row = rect.top; row < rect.bottom; row++) {
- uint8_t* dest_scan =
- pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp;
- if (Bpp == 4) {
- uint32_t* scan = (uint32_t*)dest_scan;
- for (int col = 0; col < width; col++) {
- *scan++ = dib_argb;
- }
- } else {
- for (int col = 0; col < width; col++) {
- *dest_scan++ = src_r;
- *dest_scan++ = src_g;
- *dest_scan++ = src_b;
- }
- }
- }
- return;
- }
- for (int row = rect.top; row < rect.bottom; row++) {
- uint8_t* dest_scan = pBuffer + row * pBitmap->GetPitch() + rect.left * Bpp;
- if (bAlpha) {
- for (int col = 0; col < width; col++) {
- uint8_t back_alpha = dest_scan[3];
- if (back_alpha == 0) {
- FXARGB_SETRGBORDERDIB(dest_scan,
- FXARGB_MAKE(src_alpha, src_r, src_g, src_b));
- dest_scan += 4;
- continue;
- }
- uint8_t dest_alpha =
- back_alpha + src_alpha - back_alpha * src_alpha / 255;
- dest_scan[3] = dest_alpha;
- int alpha_ratio = src_alpha * 255 / dest_alpha;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, alpha_ratio);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, alpha_ratio);
- dest_scan += 2;
- }
- } else {
- for (int col = 0; col < width; col++) {
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_r, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_g, src_alpha);
- dest_scan++;
- *dest_scan = FXDIB_ALPHA_MERGE(*dest_scan, src_b, src_alpha);
- dest_scan++;
- if (Bpp == 4) {
- dest_scan++;
- }
- }
- }
- }
-}
+FX_BOOL CFX_AggDeviceDriver::SetPixel(int x, int y, uint32_t color) {
+ if (!m_pBitmap->GetBuffer())
+ return TRUE;
-void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap,
- int dest_left,
- int dest_top,
- int width,
- int height,
- const CFX_DIBSource* pSrcBitmap,
- int src_left,
- int src_top) {
- if (!pBitmap) {
- return;
- }
- pBitmap->GetOverlapRect(dest_left, dest_top, width, height,
- pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(),
- src_left, src_top, nullptr);
- if (width == 0 || height == 0) {
- return;
- }
- int Bpp = pBitmap->GetBPP() / 8;
- FXDIB_Format dest_format = pBitmap->GetFormat();
- FXDIB_Format src_format = pSrcBitmap->GetFormat();
- int pitch = pBitmap->GetPitch();
- uint8_t* buffer = pBitmap->GetBuffer();
- if (dest_format == src_format) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = buffer + (dest_top + row) * pitch + dest_left * Bpp;
- uint8_t* src_scan =
- (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
- if (Bpp == 4) {
- for (int col = 0; col < width; col++) {
- FXARGB_SETDIB(dest_scan, FXARGB_MAKE(src_scan[3], src_scan[0],
- src_scan[1], src_scan[2]));
- dest_scan += 4;
- src_scan += 4;
- }
- } else {
- for (int col = 0; col < width; col++) {
- *dest_scan++ = src_scan[2];
- *dest_scan++ = src_scan[1];
- *dest_scan++ = src_scan[0];
- src_scan += 3;
- }
- }
- }
- return;
- }
- uint8_t* dest_buf = buffer + dest_top * pitch + dest_left * Bpp;
- if (dest_format == FXDIB_Rgb) {
- if (src_format == FXDIB_Rgb32) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * pitch;
- uint8_t* src_scan =
- (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
- for (int col = 0; col < width; col++) {
- *dest_scan++ = src_scan[2];
- *dest_scan++ = src_scan[1];
- *dest_scan++ = src_scan[0];
- src_scan += 4;
- }
- }
- } else {
- ASSERT(FALSE);
- }
- } else if (dest_format == FXDIB_Argb || dest_format == FXDIB_Rgb32) {
- if (src_format == FXDIB_Rgb) {
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = (uint8_t*)(dest_buf + row * pitch);
- uint8_t* src_scan =
- (uint8_t*)pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
- for (int col = 0; col < width; col++) {
- FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1],
- src_scan[2]));
- dest_scan += 4;
- src_scan += 3;
- }
- }
- } else if (src_format == FXDIB_Rgb32) {
- ASSERT(dest_format == FXDIB_Argb);
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = dest_buf + row * pitch;
- uint8_t* src_scan =
- (uint8_t*)(pSrcBitmap->GetScanline(src_top + row) + src_left * 4);
- for (int col = 0; col < width; col++) {
- FXARGB_SETDIB(dest_scan, FXARGB_MAKE(0xff, src_scan[0], src_scan[1],
- src_scan[2]));
- src_scan += 4;
- dest_scan += 4;
- }
- }
- }
- } else {
- ASSERT(FALSE);
+ if (!m_pClipRgn) {
+ if (!m_bRgbByteOrder)
+ return DibSetPixel(m_pBitmap, x, y, color, 0, nullptr);
+ RgbByteOrderSetPixel(m_pBitmap, x, y, color);
+ return TRUE;
}
-}
-
-FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, uint8_t alpha) {
- uint8_t r, g, b;
- AdobeCMYK_to_sRGB1(FXSYS_GetCValue(cmyk), FXSYS_GetMValue(cmyk),
- FXSYS_GetYValue(cmyk), FXSYS_GetKValue(cmyk), r, g, b);
- return ArgbEncode(alpha, r, g, b);
-}
+ if (!m_pClipRgn->GetBox().Contains(x, y))
+ return TRUE;
-FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice,
- int x,
- int y,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) {
- FX_BOOL bObjCMYK = FXGETFLAG_COLORTYPE(alpha_flag);
- int alpha = bObjCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color);
- if (pIccTransform) {
- CCodec_IccModule* pIccModule =
- CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
- color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
- pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&color,
- (uint8_t*)&color, 1);
- color = bObjCMYK ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
- if (!pDevice->IsCmykImage()) {
- color = (color & 0xffffff) | (alpha << 24);
- }
- } else {
- if (pDevice->IsCmykImage()) {
- if (!bObjCMYK) {
- return FALSE;
- }
- } else {
- if (bObjCMYK) {
- color = _DefaultCMYK2ARGB(color, alpha);
- }
- }
- }
- pDevice->SetPixel(x, y, color);
- if (pDevice->m_pAlphaMask) {
- pDevice->m_pAlphaMask->SetPixel(x, y, alpha << 24);
+ if (m_pClipRgn->GetType() == CFX_ClipRgn::RectI) {
+ if (!m_bRgbByteOrder)
+ return DibSetPixel(m_pBitmap, x, y, color, 0, nullptr);
+ RgbByteOrderSetPixel(m_pBitmap, x, y, color);
+ return TRUE;
}
- return TRUE;
-}
+ if (m_pClipRgn->GetType() != CFX_ClipRgn::MaskF)
+ return TRUE;
-FX_BOOL CFX_AggDeviceDriver::SetPixel(int x,
- int y,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) {
- if (!m_pBitmap->GetBuffer()) {
+ const CFX_DIBitmap* pMask = m_pClipRgn->GetMask().GetObject();
+ int new_alpha = FXARGB_A(color) * pMask->GetScanline(y)[x] / 255;
+ color = (color & 0xffffff) | (new_alpha << 24);
+ if (m_bRgbByteOrder) {
+ RgbByteOrderSetPixel(m_pBitmap, x, y, color);
return TRUE;
}
- if (!CFX_GEModule::Get()->GetCodecModule() ||
- !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
- pIccTransform = nullptr;
- }
- if (!m_pClipRgn) {
- if (m_bRgbByteOrder) {
- RgbByteOrderSetPixel(m_pBitmap, x, y, color);
- } else {
- return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransform);
- }
- } else if (m_pClipRgn->GetBox().Contains(x, y)) {
- if (m_pClipRgn->GetType() == CFX_ClipRgn::RectI) {
- if (m_bRgbByteOrder) {
- RgbByteOrderSetPixel(m_pBitmap, x, y, color);
- } else {
- return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransform);
- }
- } else if (m_pClipRgn->GetType() == CFX_ClipRgn::MaskF) {
- const CFX_DIBitmap* pMask = m_pClipRgn->GetMask().GetObject();
- FX_BOOL bCMYK = FXGETFLAG_COLORTYPE(alpha_flag);
- int new_alpha =
- bCMYK ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(color);
- new_alpha = new_alpha * pMask->GetScanline(y)[x] / 255;
- if (m_bRgbByteOrder) {
- RgbByteOrderSetPixel(m_pBitmap, x, y,
- (color & 0xffffff) | (new_alpha << 24));
- return TRUE;
- }
- if (bCMYK) {
- FXSETFLAG_ALPHA_FILL(alpha_flag, new_alpha);
- } else {
- color = (color & 0xffffff) | (new_alpha << 24);
- }
- return _DibSetPixel(m_pBitmap, x, y, color, alpha_flag, pIccTransform);
- }
- }
- return TRUE;
+ return DibSetPixel(m_pBitmap, x, y, color, 0, nullptr);
}
-FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect,
- uint32_t fill_color,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) {
- if (blend_type != FXDIB_BLEND_NORMAL) {
+FX_BOOL CFX_AggDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) {
+ if (blend_type != FXDIB_BLEND_NORMAL)
return FALSE;
- }
- if (!m_pBitmap->GetBuffer()) {
+
+ if (!m_pBitmap->GetBuffer())
return TRUE;
- }
+
FX_RECT clip_rect;
GetClipBox(&clip_rect);
FX_RECT draw_rect = clip_rect;
- if (pRect) {
+ if (pRect)
draw_rect.Intersect(*pRect);
- }
- if (draw_rect.IsEmpty()) {
+ if (draw_rect.IsEmpty())
return TRUE;
- }
+
if (!m_pClipRgn || m_pClipRgn->GetType() == CFX_ClipRgn::RectI) {
if (m_bRgbByteOrder) {
RgbByteOrderCompositeRect(m_pBitmap, draw_rect.left, draw_rect.top,
@@ -1610,8 +1586,7 @@ FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect,
fill_color);
} else {
m_pBitmap->CompositeRect(draw_rect.left, draw_rect.top, draw_rect.Width(),
- draw_rect.Height(), fill_color, alpha_flag,
- pIccTransform);
+ draw_rect.Height(), fill_color, 0, nullptr);
}
return TRUE;
}
@@ -1619,7 +1594,7 @@ FX_BOOL CFX_AggDeviceDriver::FillRect(const FX_RECT* pRect,
draw_rect.left, draw_rect.top, draw_rect.Width(), draw_rect.Height(),
m_pClipRgn->GetMask().GetObject(), fill_color,
draw_rect.left - clip_rect.left, draw_rect.top - clip_rect.top,
- FXDIB_BLEND_NORMAL, nullptr, m_bRgbByteOrder, alpha_flag, pIccTransform);
+ FXDIB_BLEND_NORMAL, nullptr, m_bRgbByteOrder, 0, nullptr);
return TRUE;
}
@@ -1636,48 +1611,35 @@ FX_BOOL CFX_AggDeviceDriver::GetClipBox(FX_RECT* pRect) {
FX_BOOL CFX_AggDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
int left,
- int top,
- void* pIccTransform,
- FX_BOOL bDEdge) {
- if (!m_pBitmap->GetBuffer()) {
+ int top) {
+ if (!m_pBitmap || !m_pBitmap->GetBuffer())
return TRUE;
- }
- if (bDEdge) {
- if (m_bRgbByteOrder) {
- RgbByteOrderTransferBitmap(pBitmap, 0, 0, pBitmap->GetWidth(),
- pBitmap->GetHeight(), m_pBitmap, left, top);
- } else {
- return pBitmap->TransferBitmap(0, 0, pBitmap->GetWidth(),
- pBitmap->GetHeight(), m_pBitmap, left, top,
- pIccTransform);
- }
- return TRUE;
- }
+
FX_RECT rect(left, top, left + pBitmap->GetWidth(),
top + pBitmap->GetHeight());
CFX_DIBitmap* pBack = nullptr;
if (m_pOriDevice) {
pBack = m_pOriDevice->Clone(&rect);
- if (!pBack) {
+ if (!pBack)
return TRUE;
- }
+
pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(),
m_pBitmap, 0, 0);
} else {
pBack = m_pBitmap->Clone(&rect);
+ if (!pBack)
+ return TRUE;
}
- if (!pBack) {
- return TRUE;
- }
+
FX_BOOL bRet = TRUE;
- left = left >= 0 ? 0 : left;
- top = top >= 0 ? 0 : top;
+ left = std::min(left, 0);
+ top = std::min(top, 0);
if (m_bRgbByteOrder) {
RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(),
pBack, left, top);
} else {
bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack,
- left, top, pIccTransform);
+ left, top, nullptr);
}
delete pBack;
return bRet;
@@ -1688,20 +1650,19 @@ FX_BOOL CFX_AggDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
const FX_RECT* pSrcRect,
int left,
int top,
- int blend_type,
- int alpha_flag,
- void* pIccTransform) {
- if (!m_pBitmap->GetBuffer()) {
+ int blend_type) {
+ if (!m_pBitmap->GetBuffer())
return TRUE;
+
+ if (pBitmap->IsAlphaMask()) {
+ return m_pBitmap->CompositeMask(left, top, pSrcRect->Width(),
+ pSrcRect->Height(), pBitmap, argb,
+ pSrcRect->left, pSrcRect->top, blend_type,
+ m_pClipRgn, m_bRgbByteOrder, 0, nullptr);
}
- if (pBitmap->IsAlphaMask())
- return m_pBitmap->CompositeMask(
- left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, argb,
- pSrcRect->left, pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder,
- alpha_flag, pIccTransform);
return m_pBitmap->CompositeBitmap(
left, top, pSrcRect->Width(), pSrcRect->Height(), pBitmap, pSrcRect->left,
- pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder, pIccTransform);
+ pSrcRect->top, blend_type, m_pClipRgn, m_bRgbByteOrder, nullptr);
}
FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
@@ -1712,17 +1673,14 @@ FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
int dest_height,
const FX_RECT* pClipRect,
uint32_t flags,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
- if (!m_pBitmap->GetBuffer()) {
+ if (!m_pBitmap->GetBuffer())
return TRUE;
- }
+
if (dest_width == pSource->GetWidth() &&
dest_height == pSource->GetHeight()) {
FX_RECT rect(0, 0, dest_width, dest_height);
- return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type,
- alpha_flag, pIccTransform);
+ return SetDIBits(pSource, argb, &rect, dest_left, dest_top, blend_type);
}
FX_RECT dest_rect(dest_left, dest_top, dest_left + dest_width,
dest_top + dest_height);
@@ -1731,8 +1689,7 @@ FX_BOOL CFX_AggDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
dest_clip.Intersect(*pClipRect);
CFX_BitmapComposer composer;
composer.Compose(m_pBitmap, m_pClipRgn, 255, argb, dest_clip, FALSE, FALSE,
- FALSE, m_bRgbByteOrder, alpha_flag, pIccTransform,
- blend_type);
+ FALSE, m_bRgbByteOrder, 0, nullptr, blend_type);
dest_clip.Offset(-dest_rect.left, -dest_rect.top);
CFX_ImageStretcher stretcher(&composer, pSource, dest_width, dest_height,
dest_clip, flags);
@@ -1747,15 +1704,13 @@ FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
const CFX_Matrix* pMatrix,
uint32_t render_flags,
void*& handle,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
- if (!m_pBitmap->GetBuffer()) {
+ if (!m_pBitmap->GetBuffer())
return TRUE;
- }
+
CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer;
pRenderer->Start(m_pBitmap, m_pClipRgn, pSource, bitmap_alpha, argb, pMatrix,
- render_flags, m_bRgbByteOrder, alpha_flag, pIccTransform);
+ render_flags, m_bRgbByteOrder, 0, nullptr);
handle = pRenderer;
return TRUE;
}
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h
index 2c4e292faf..48d6fae87f 100644
--- a/core/fxge/agg/fx_agg_driver.h
+++ b/core/fxge/agg/fx_agg_driver.h
@@ -52,44 +52,20 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
uint32_t fill_color,
uint32_t stroke_color,
int fill_mode,
- int alpha_flag,
- void* pIccTransform,
int blend_type) override;
- FX_BOOL SetPixel(int x,
- int y,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) override;
- FX_BOOL FillRect(const FX_RECT* pRect,
- uint32_t fill_color,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) override;
- FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
- FX_FLOAT y1,
- FX_FLOAT x2,
- FX_FLOAT y2,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) override {
- return FALSE;
- }
+ FX_BOOL SetPixel(int x, int y, uint32_t color) override;
+ FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) override;
FX_BOOL GetClipBox(FX_RECT* pRect) override;
- FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top,
- void* pIccTransform = nullptr,
- FX_BOOL bDEdge = FALSE) override;
+ FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
CFX_DIBitmap* GetBackDrop() override { return m_pOriDevice; }
FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
const FX_RECT* pSrcRect,
int left,
int top,
- int blend_type,
- int alpha_flag,
- void* pIccTransform) override;
+ int blend_type) override;
FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
int dest_left,
@@ -98,8 +74,6 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
int dest_height,
const FX_RECT* pClipRect,
uint32_t flags,
- int alpha_flag,
- void* pIccTransform,
int blend_type) override;
FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
int bitmap_alpha,
@@ -107,8 +81,6 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
const CFX_Matrix* pMatrix,
uint32_t flags,
void*& handle,
- int alpha_flag,
- void* pIccTransform,
int blend_type) override;
FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override;
void CancelDIBits(void* handle) override;
@@ -118,9 +90,7 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
CFX_FontCache* pCache,
const CFX_Matrix* pObject2Device,
FX_FLOAT font_size,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) override;
+ uint32_t color) override;
int GetDriverType() const override { return 1; }
FX_BOOL RenderRasterizer(agg::rasterizer_scanline_aa& rasterizer,
diff --git a/core/fxge/apple/apple_int.h b/core/fxge/apple/apple_int.h
index 6afda63ee0..5a3c0756db 100644
--- a/core/fxge/apple/apple_int.h
+++ b/core/fxge/apple/apple_int.h
@@ -101,36 +101,24 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
uint32_t fill_color,
uint32_t stroke_color,
int fill_mode,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) override;
- FX_BOOL FillRect(const FX_RECT* pRect,
- uint32_t fill_color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) override;
+ int blend_type) override;
+ FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) override;
FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
FX_FLOAT y1,
FX_FLOAT x2,
FX_FLOAT y2,
uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) override;
+ int blend_type) override;
FX_BOOL GetClipBox(FX_RECT* pRect) override;
- FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top,
- void* pIccTransform = nullptr,
- FX_BOOL bDEdge = FALSE) override;
+ FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
const FX_RECT* pSrcRect,
int dest_left,
int dest_top,
- int blend_type,
- int alpha_flag = 0,
- void* pIccTransform = nullptr) override;
+ int blend_type) override;
FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
int dest_left,
@@ -139,18 +127,14 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
int dest_height,
const FX_RECT* pClipRect,
uint32_t flags,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) override;
+ int blend_type) override;
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 = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) override {
+ int blend_type) override {
return FALSE;
}
FX_BOOL DrawDeviceText(int nChars,
@@ -159,9 +143,7 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
CFX_FontCache* pCache,
const CFX_Matrix* pObject2Device,
FX_FLOAT font_size,
- uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr) override;
+ uint32_t color) override;
void ClearDriver() override;
protected:
@@ -172,21 +154,19 @@ class CFX_QuartzDeviceDriver : public IFX_RenderDeviceDriver {
void setPathToContext(const CFX_PathData* pathData);
FX_FLOAT getLineWidth(const CFX_GraphStateData* graphState,
CGAffineTransform ctm);
- FX_BOOL CG_DrawGlypRun(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- CFX_FontCache* pCache,
- const CFX_Matrix* pGlyphMatrix,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t argb,
- int alpha_flag,
- void* pIccTransform);
+ FX_BOOL CG_DrawGlyphRun(int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ CFX_FontCache* pCache,
+ const CFX_Matrix* pGlyphMatrix,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t argb);
void CG_SetImageTransform(int dest_left,
int dest_top,
int dest_width,
int dest_height,
- CGRect* rect = nullptr);
+ CGRect* rect);
CGContextRef m_context;
CGAffineTransform m_foxitDevice2User;
diff --git a/core/fxge/apple/fx_apple_platform.cpp b/core/fxge/apple/fx_apple_platform.cpp
index 4204e7e6a5..3bddf64280 100644
--- a/core/fxge/apple/fx_apple_platform.cpp
+++ b/core/fxge/apple/fx_apple_platform.cpp
@@ -19,54 +19,31 @@
#include "core/fxge/include/fx_freetype.h"
#include "core/fxge/include/fx_ge_apple.h"
-void CFX_AggDeviceDriver::InitPlatform() {
- CQuartz2D& quartz2d =
- static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
- ->m_quartz2d;
- m_pPlatformGraphics = quartz2d.createGraphics(m_pBitmap);
-}
-void CFX_AggDeviceDriver::DestroyPlatform() {
- CQuartz2D& quartz2d =
- static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
- ->m_quartz2d;
- if (m_pPlatformGraphics) {
- quartz2d.destroyGraphics(m_pPlatformGraphics);
- m_pPlatformGraphics = nullptr;
- }
-}
-void CFX_FaceCache::InitPlatform() {}
-void CFX_FaceCache::DestroyPlatform() {}
-CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph_Nativetext(
- CFX_Font* pFont,
- uint32_t glyph_index,
- const CFX_Matrix* pMatrix,
- int dest_width,
- int anti_alias) {
- return nullptr;
-}
-static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext,
- int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- CFX_FontCache* pCache,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t argb,
- int alpha_flag,
- void* pIccTransform) {
- if (nChars == 0) {
+namespace {
+
+void DoNothing(void* info, const void* data, size_t size) {}
+
+FX_BOOL CGDrawGlyphRun(CGContextRef pContext,
+ int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ CFX_FontCache* pCache,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t argb) {
+ if (nChars == 0)
return TRUE;
- }
+
CFX_Matrix new_matrix;
FX_BOOL bNegSize = font_size < 0;
- if (bNegSize) {
+ if (bNegSize)
font_size = -font_size;
- }
+
FX_FLOAT ori_x = pCharPos[0].m_OriginX, ori_y = pCharPos[0].m_OriginY;
new_matrix.Transform(ori_x, ori_y);
- if (pObject2Device) {
+ if (pObject2Device)
new_matrix.Concat(*pObject2Device);
- }
+
CQuartz2D& quartz2d =
static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
->m_quartz2d;
@@ -76,19 +53,17 @@ static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext,
pFont->SetPlatformFont(
quartz2d.CreateFont(pFont->GetFontData(), pFont->GetSize()));
- if (!pFont->GetPlatformFont()) {
+ if (!pFont->GetPlatformFont())
return FALSE;
- }
}
CFX_FixedBufGrow<uint16_t, 32> glyph_indices(nChars);
CFX_FixedBufGrow<CGPoint, 32> glyph_positions(nChars);
for (int i = 0; i < nChars; i++) {
glyph_indices[i] = pCharPos[i].m_ExtGID;
- if (bNegSize) {
+ if (bNegSize)
glyph_positions[i].x = -pCharPos[i].m_OriginX;
- } else {
+ else
glyph_positions[i].x = pCharPos[i].m_OriginX;
- }
glyph_positions[i].y = pCharPos[i].m_OriginY;
}
if (bNegSize) {
@@ -102,19 +77,45 @@ static FX_BOOL _CGDrawGlyphRun(CGContextRef pContext,
font_size, glyph_indices, glyph_positions,
nChars, argb, nullptr);
}
-static void _DoNothing(void* info, const void* data, size_t size) {}
+
+} // namespace
+
+void CFX_AggDeviceDriver::InitPlatform() {
+ CQuartz2D& quartz2d =
+ static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
+ ->m_quartz2d;
+ m_pPlatformGraphics = quartz2d.createGraphics(m_pBitmap);
+}
+void CFX_AggDeviceDriver::DestroyPlatform() {
+ CQuartz2D& quartz2d =
+ static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
+ ->m_quartz2d;
+ if (m_pPlatformGraphics) {
+ quartz2d.destroyGraphics(m_pPlatformGraphics);
+ m_pPlatformGraphics = nullptr;
+ }
+}
+void CFX_FaceCache::InitPlatform() {}
+void CFX_FaceCache::DestroyPlatform() {}
+CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph_Nativetext(
+ CFX_Font* pFont,
+ uint32_t glyph_index,
+ const CFX_Matrix* pMatrix,
+ int dest_width,
+ int anti_alias) {
+ return nullptr;
+}
+
FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
CFX_FontCache* pCache,
const CFX_Matrix* pObject2Device,
FX_FLOAT font_size,
- uint32_t argb,
- int alpha_flag,
- void* pIccTransform) {
- if (!pFont) {
+ uint32_t argb) {
+ if (!pFont)
return FALSE;
- }
+
FX_BOOL bBold = pFont->IsBold();
if (!bBold && pFont->GetSubstFont() &&
pFont->GetSubstFont()->m_Weight >= 500 &&
@@ -122,9 +123,8 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
return FALSE;
}
for (int i = 0; i < nChars; i++) {
- if (pCharPos[i].m_bGlyphAdjust) {
+ if (pCharPos[i].m_bGlyphAdjust)
return FALSE;
- }
}
CGContextRef ctx = CGContextRef(m_pPlatformGraphics);
if (!ctx)
@@ -142,7 +142,7 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
if (pClipMask) {
CGDataProviderRef pClipMaskDataProvider = CGDataProviderCreateWithData(
nullptr, pClipMask->GetBuffer(),
- pClipMask->GetPitch() * pClipMask->GetHeight(), _DoNothing);
+ pClipMask->GetPitch() * pClipMask->GetHeight(), DoNothing);
CGFloat decode_f[2] = {255.f, 0.f};
pImageCG = CGImageMaskCreate(
pClipMask->GetWidth(), pClipMask->GetHeight(), 8, 8,
@@ -153,20 +153,19 @@ FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars,
rect_cg = CGRectMake(0, 0, m_pBitmap->GetWidth(), m_pBitmap->GetHeight());
}
rect_cg = CGContextConvertRectToDeviceSpace(ctx, rect_cg);
- if (pImageCG) {
+ if (pImageCG)
CGContextClipToMask(ctx, rect_cg, pImageCG);
- } else {
+ else
CGContextClipToRect(ctx, rect_cg);
- }
- FX_BOOL ret =
- _CGDrawGlyphRun(ctx, nChars, pCharPos, pFont, pCache, pObject2Device,
- font_size, argb, alpha_flag, pIccTransform);
- if (pImageCG) {
+
+ FX_BOOL ret = CGDrawGlyphRun(ctx, nChars, pCharPos, pFont, pCache,
+ pObject2Device, font_size, argb);
+ if (pImageCG)
CGImageRelease(pImageCG);
- }
CGContextRestoreGState(ctx);
return ret;
}
+
void CFX_Font::ReleasePlatformResource() {
if (m_pPlatformFont) {
CQuartz2D& quartz2d =
diff --git a/core/fxge/apple/fx_quartz_device.cpp b/core/fxge/apple/fx_quartz_device.cpp
index 154910b69f..4e1e62d6eb 100644
--- a/core/fxge/apple/fx_quartz_device.cpp
+++ b/core/fxge/apple/fx_quartz_device.cpp
@@ -340,14 +340,13 @@ static CGBlendMode GetCGBlendMode(int blend_type) {
}
return mode;
}
+
FX_BOOL CFX_QuartzDeviceDriver::DrawPath(const CFX_PathData* pathData,
const CFX_Matrix* matrix,
const CFX_GraphStateData* graphState,
uint32_t fillArgb,
uint32_t strokeArgb,
int fillMode,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
SaveState();
CGBlendMode mode = GetCGBlendMode(blend_type);
@@ -394,11 +393,10 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawPath(const CFX_PathData* pathData,
RestoreState(false);
return TRUE;
}
-FX_BOOL CFX_QuartzDeviceDriver::FillRect(const FX_RECT* rect,
- FX_ARGB fillArgb,
- int alphaFlag,
- void* iccTransform,
- int blend_type) {
+
+FX_BOOL CFX_QuartzDeviceDriver::FillRectWithBlend(const FX_RECT* rect,
+ FX_ARGB fillArgb,
+ int blend_type) {
CGBlendMode mode = GetCGBlendMode(blend_type);
if (mode != kCGBlendModeNormal) {
CGContextSetBlendMode(m_context, mode);
@@ -416,13 +414,12 @@ FX_BOOL CFX_QuartzDeviceDriver::FillRect(const FX_RECT* rect,
}
return TRUE;
}
+
FX_BOOL CFX_QuartzDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
FX_FLOAT y1,
FX_FLOAT x2,
FX_FLOAT y2,
uint32_t argb,
- int alphaFlag,
- void* iccTransform,
int blend_type) {
CGBlendMode mode = GetCGBlendMode(blend_type);
if (mode != kCGBlendModeNormal) {
@@ -447,6 +444,7 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
}
return TRUE;
}
+
FX_BOOL CFX_QuartzDeviceDriver::GetClipBox(FX_RECT* rect) {
CGRect r = CGContextGetClipBoundingBox(m_context);
r = CGRectApplyAffineTransform(r, m_user2FoxitDevice);
@@ -456,20 +454,15 @@ FX_BOOL CFX_QuartzDeviceDriver::GetClipBox(FX_RECT* rect) {
rect->bottom = FXSYS_ceil(r.origin.y + r.size.height);
return TRUE;
}
+
FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap,
int32_t left,
- int32_t top,
- void* pIccTransform,
- FX_BOOL bDEdge) {
- if (FXDC_PRINTER == m_deviceClass) {
- return FALSE;
- }
- if (bitmap->GetBPP() < 32) {
- return FALSE;
- }
- if (!(m_renderCaps | FXRC_GET_BITS)) {
+ int32_t top) {
+ if (FXDC_PRINTER == m_deviceClass || bitmap->GetBPP() < 32 ||
+ !(m_renderCaps | FXRC_GET_BITS)) {
return FALSE;
}
+
CGPoint pt = CGPointMake(left, top);
pt = CGPointApplyAffineTransform(pt, m_foxitDevice2User);
CGAffineTransform ctm = CGContextGetCTM(m_context);
@@ -481,12 +474,11 @@ FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap,
CGFloat width = (CGFloat)bitmap->GetWidth();
CGFloat height = (CGFloat)bitmap->GetHeight();
- if (width + pt.x > m_width) {
+ if (width + pt.x > m_width)
width -= (width + pt.x - m_width);
- }
- if (height + pt.y > m_height) {
+ if (height + pt.y > m_height)
height -= (height + pt.y - m_height);
- }
+
CGImageRef subImage = CGImageCreateWithImageInRect(
image, CGRectMake(pt.x, pt.y, width, height));
CGContextRef context = createContextWithBitmap(bitmap);
@@ -496,29 +488,29 @@ FX_BOOL CFX_QuartzDeviceDriver::GetDIBits(CFX_DIBitmap* bitmap,
CGContextRelease(context);
CGImageRelease(subImage);
CGImageRelease(image);
- if (bitmap->HasAlpha()) {
- for (int row = 0; row < bitmap->GetHeight(); row++) {
- uint8_t* pScanline = (uint8_t*)bitmap->GetScanline(row);
- for (int col = 0; col < bitmap->GetWidth(); col++) {
- if (pScanline[3] > 0) {
- pScanline[0] = (pScanline[0] * 255.f / pScanline[3] + .5f);
- pScanline[1] = (pScanline[1] * 255.f / pScanline[3] + .5f);
- pScanline[2] = (pScanline[2] * 255.f / pScanline[3] + .5f);
- }
- pScanline += 4;
+ if (!bitmap->HasAlpha())
+ return TRUE;
+
+ for (int row = 0; row < bitmap->GetHeight(); row++) {
+ uint8_t* pScanline = (uint8_t*)bitmap->GetScanline(row);
+ for (int col = 0; col < bitmap->GetWidth(); col++) {
+ if (pScanline[3] > 0) {
+ pScanline[0] = (pScanline[0] * 255.f / pScanline[3] + .5f);
+ pScanline[1] = (pScanline[1] * 255.f / pScanline[3] + .5f);
+ pScanline[2] = (pScanline[2] * 255.f / pScanline[3] + .5f);
}
+ pScanline += 4;
}
}
return TRUE;
}
+
FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
FX_ARGB argb,
const FX_RECT* srcRect,
int dest_left,
int dest_top,
- int blendType,
- int alphaFlag,
- void* iccTransform) {
+ int blendType) {
SaveState();
CGFloat src_left, src_top, src_width, src_height;
if (srcRect) {
@@ -635,6 +627,7 @@ FX_BOOL CFX_QuartzDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
RestoreState(false);
return TRUE;
}
+
FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
FX_ARGB argb,
int dest_left,
@@ -643,8 +636,6 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
int dest_height,
const FX_RECT* clipRect,
uint32_t flags,
- int alphaFlag,
- void* iccTransform,
int blend_type) {
SaveState();
if (clipRect) {
@@ -657,21 +648,20 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
}
CGRect rect = CGRectMake(dest_left, dest_top, dest_width, dest_height);
rect = CGRectApplyAffineTransform(rect, m_foxitDevice2User);
- if (FXDIB_BICUBIC_INTERPOL == flags) {
+ if (FXDIB_BICUBIC_INTERPOL == flags)
CGContextSetInterpolationQuality(m_context, kCGInterpolationHigh);
- } else if (FXDIB_DOWNSAMPLE == flags) {
+ else if (FXDIB_DOWNSAMPLE == flags)
CGContextSetInterpolationQuality(m_context, kCGInterpolationNone);
- } else {
+ else
CGContextSetInterpolationQuality(m_context, kCGInterpolationMedium);
- }
- CG_SetImageTransform(dest_left, dest_top, dest_width, dest_height);
+
+ CG_SetImageTransform(dest_left, dest_top, dest_width, dest_height, nullptr);
CFX_DIBitmap* pBitmap1 = nullptr;
if (pBitmap->IsAlphaMask()) {
- if (pBitmap->GetBuffer()) {
+ if (pBitmap->GetBuffer())
pBitmap1 = (CFX_DIBitmap*)pBitmap;
- } else {
+ else
pBitmap1 = pBitmap->Clone();
- }
if (!pBitmap1) {
RestoreState(false);
return FALSE;
@@ -693,20 +683,19 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
CGImageRelease(pImage);
CGColorSpaceRelease(pColorSpace);
CGDataProviderRelease(pBitmapProvider);
- if (pBitmap1 != pBitmap) {
+ if (pBitmap1 != pBitmap)
delete pBitmap1;
- }
+
RestoreState(false);
return TRUE;
}
if (pBitmap->GetBPP() < 32) {
pBitmap1 = pBitmap->CloneConvert(FXDIB_Rgb32);
} else {
- if (pBitmap->GetBuffer()) {
+ if (pBitmap->GetBuffer())
pBitmap1 = (CFX_DIBitmap*)pBitmap;
- } else {
+ else
pBitmap1 = pBitmap->Clone();
- }
}
if (!pBitmap1) {
RestoreState(false);
@@ -735,25 +724,25 @@ FX_BOOL CFX_QuartzDeviceDriver::StretchDIBits(const CFX_DIBSource* pBitmap,
CGContextDrawImage(m_context, rect, image);
CGImageRelease(image);
CGContextRelease(ctx);
- if (pBitmap1 != pBitmap) {
+ if (pBitmap1 != pBitmap)
delete pBitmap1;
- }
+
RestoreState(false);
return TRUE;
}
-FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars,
- const FXTEXT_CHARPOS* pCharPos,
- CFX_Font* pFont,
- CFX_FontCache* pCache,
- const CFX_Matrix* pGlyphMatrix,
- const CFX_Matrix* pObject2Device,
- FX_FLOAT font_size,
- uint32_t argb,
- int alpha_flag,
- void* pIccTransform) {
- if (nChars == 0) {
+
+FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlyphRun(
+ int nChars,
+ const FXTEXT_CHARPOS* pCharPos,
+ CFX_Font* pFont,
+ CFX_FontCache* pCache,
+ const CFX_Matrix* pGlyphMatrix,
+ const CFX_Matrix* pObject2Device,
+ FX_FLOAT font_size,
+ uint32_t argb) {
+ if (nChars == 0)
return TRUE;
- }
+
CQuartz2D& quartz2d =
static_cast<CApplePlatform*>(CFX_GEModule::Get()->GetPlatformData())
->m_quartz2d;
@@ -775,9 +764,9 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars,
glyph_positions[i].y = pCharPos[i].m_OriginY;
}
CFX_Matrix text_matrix;
- if (pObject2Device) {
+ if (pObject2Device)
text_matrix.Concat(*pObject2Device);
- }
+
CGAffineTransform matrix_cg =
CGAffineTransformMake(text_matrix.a, text_matrix.b, text_matrix.c,
text_matrix.d, text_matrix.e, text_matrix.f);
@@ -797,9 +786,9 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars,
CGAffineTransform glyph_matrix = CGAffineTransformMake(
pGlyphMatrix->a, pGlyphMatrix->b, pGlyphMatrix->c, pGlyphMatrix->d,
pGlyphMatrix->e, pGlyphMatrix->f);
- if (m_foxitDevice2User.d < 0) {
+ if (m_foxitDevice2User.d < 0)
glyph_matrix = CGAffineTransformInvert(glyph_matrix);
- }
+
CGContextConcatCTM(m_context, glyph_matrix);
CGContextTranslateCTM(m_context, -origin.x, -origin.y);
}
@@ -808,17 +797,17 @@ FX_BOOL CFX_QuartzDeviceDriver::CG_DrawGlypRun(int nChars,
RestoreState(false);
return TRUE;
}
+
FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
const FXTEXT_CHARPOS* pCharPos,
CFX_Font* pFont,
CFX_FontCache* pCache,
const CFX_Matrix* pObject2Device,
FX_FLOAT font_size,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) {
+ uint32_t color) {
if (!pFont || !m_context)
return FALSE;
+
FX_BOOL bBold = pFont->IsBold();
if (!bBold && pFont->GetSubstFont() &&
pFont->GetSubstFont()->m_Weight >= 500 &&
@@ -832,9 +821,8 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
while (i < nChars) {
if (pCharPos[i].m_bGlyphAdjust || font_size < 0) {
if (i > 0) {
- ret =
- CG_DrawGlypRun(i, pCharPos, pFont, pCache, nullptr, pObject2Device,
- font_size, color, alpha_flag, pIccTransform);
+ ret = CG_DrawGlyphRun(i, pCharPos, pFont, pCache, nullptr,
+ pObject2Device, font_size, color);
if (!ret) {
RestoreState(false);
return ret;
@@ -850,9 +838,8 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
char_pos->m_AdjustMatrix[0], char_pos->m_AdjustMatrix[1],
char_pos->m_AdjustMatrix[2], char_pos->m_AdjustMatrix[3], 0, 0);
}
- ret = CG_DrawGlypRun(1, char_pos, pFont, pCache, &glphy_matrix,
- pObject2Device, font_size, color, alpha_flag,
- pIccTransform);
+ ret = CG_DrawGlyphRun(1, char_pos, pFont, pCache, &glphy_matrix,
+ pObject2Device, font_size, color);
if (!ret) {
RestoreState(false);
return ret;
@@ -866,12 +853,13 @@ FX_BOOL CFX_QuartzDeviceDriver::DrawDeviceText(int nChars,
}
}
if (i > 0) {
- ret = CG_DrawGlypRun(i, pCharPos, pFont, pCache, nullptr, pObject2Device,
- font_size, color, alpha_flag, pIccTransform);
+ ret = CG_DrawGlyphRun(i, pCharPos, pFont, pCache, nullptr, pObject2Device,
+ font_size, color);
}
RestoreState(false);
return ret;
}
+
void CFX_QuartzDeviceDriver::setStrokeInfo(const CFX_GraphStateData* graphState,
FX_ARGB argb,
FX_FLOAT lineWidth) {
@@ -959,6 +947,7 @@ void CFX_QuartzDeviceDriver::setPathToContext(const CFX_PathData* pathData) {
}
}
}
+
void CFX_QuartzDeviceDriver::CG_SetImageTransform(int dest_left,
int dest_top,
int dest_width,
@@ -966,29 +955,30 @@ void CFX_QuartzDeviceDriver::CG_SetImageTransform(int dest_left,
CGRect* rect) {
int flip_y = m_foxitDevice2User.d * dest_height < 0 ? 1 : -1;
int flip_x = m_foxitDevice2User.a * dest_width > 0 ? 1 : -1;
- if (flip_y < 0 || flip_x < 0) {
- if (dest_height < 0) {
- dest_height = -dest_height;
- dest_top -= dest_height;
- }
- CGRect rt = CGRectApplyAffineTransform(
- CGRectMake(dest_left, dest_top, dest_width, dest_height),
- m_foxitDevice2User);
- CGFloat offset_x = (rt.origin.x) + rt.size.width / 2.f,
- offset_y = (rt.origin.y) + rt.size.height / 2.f;
- CGAffineTransform transform = CGAffineTransformIdentity;
- transform = CGAffineTransformConcat(
- transform, CGAffineTransformMake(1, 0, 0, 1, -offset_x, -offset_y));
- transform = CGAffineTransformConcat(
- transform, CGAffineTransformMake(flip_x, 0, 0, flip_y, 0, 0));
- transform = CGAffineTransformConcat(
- transform, CGAffineTransformMake(1, 0, 0, 1, offset_x, offset_y));
- CGContextConcatCTM(m_context, transform);
- if (rect) {
- *rect = CGRectApplyAffineTransform(*rect, transform);
- }
- }
+ if (flip_y >= 0 && flip_x >= 0)
+ return;
+
+ if (dest_height < 0) {
+ dest_height = -dest_height;
+ dest_top -= dest_height;
+ }
+ CGRect rt = CGRectApplyAffineTransform(
+ CGRectMake(dest_left, dest_top, dest_width, dest_height),
+ m_foxitDevice2User);
+ CGFloat offset_x = (rt.origin.x) + rt.size.width / 2.f,
+ offset_y = (rt.origin.y) + rt.size.height / 2.f;
+ CGAffineTransform transform = CGAffineTransformIdentity;
+ transform = CGAffineTransformConcat(
+ transform, CGAffineTransformMake(1, 0, 0, 1, -offset_x, -offset_y));
+ transform = CGAffineTransformConcat(
+ transform, CGAffineTransformMake(flip_x, 0, 0, flip_y, 0, 0));
+ transform = CGAffineTransformConcat(
+ transform, CGAffineTransformMake(1, 0, 0, 1, offset_x, offset_y));
+ CGContextConcatCTM(m_context, transform);
+ if (rect)
+ *rect = CGRectApplyAffineTransform(*rect, transform);
}
+
void CFX_QuartzDeviceDriver::ClearDriver() {
if (!m_context)
return;
diff --git a/core/fxge/ge/fx_ge_device.cpp b/core/fxge/ge/fx_ge_device.cpp
index 7763d91363..f1f7dc021d 100644
--- a/core/fxge/ge/fx_ge_device.cpp
+++ b/core/fxge/ge/fx_ge_device.cpp
@@ -202,22 +202,22 @@ FX_BOOL CFX_RenderDevice::DrawPathWithBlend(
smooth_path |= FXFILL_NOPATHSMOOTH;
}
m_pDeviceDriver->DrawPath(&newPath, pMatrix, &graphState, 0, strokecolor,
- smooth_path, 0, nullptr, blend_type);
+ smooth_path, 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, 0,
- nullptr, blend_type);
+ fill_color, stroke_color, fill_mode,
+ blend_type);
}
return DrawFillStrokePath(pPathData, pObject2Device, pGraphState,
fill_color, stroke_color, fill_mode, blend_type);
}
return m_pDeviceDriver->DrawPath(pPathData, pObject2Device, pGraphState,
- fill_color, stroke_color, fill_mode, 0,
- nullptr, blend_type);
+ fill_color, stroke_color, fill_mode,
+ blend_type);
}
// This can be removed once PDFium entirely relies on Skia
@@ -255,9 +255,8 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
bitmap.Clear(0);
Backdrop.Copy(&bitmap);
} else {
- if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top, nullptr)) {
+ if (!m_pDeviceDriver->GetDIBits(&bitmap, rect.left, rect.top))
return FALSE;
- }
Backdrop.Copy(&bitmap);
}
CFX_FxgeDevice bitmap_device;
@@ -270,7 +269,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, 0, nullptr, blend_type)) {
+ fill_mode, blend_type)) {
return FALSE;
}
FX_RECT src_rect(0, 0, FXSYS_round(rect.Width() * fScaleX),
@@ -280,7 +279,7 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
}
FX_BOOL CFX_RenderDevice::SetPixel(int x, int y, uint32_t color) {
- if (m_pDeviceDriver->SetPixel(x, y, color, 0, nullptr))
+ if (m_pDeviceDriver->SetPixel(x, y, color))
return TRUE;
FX_RECT rect(x, y, x + 1, y + 1);
@@ -290,7 +289,7 @@ FX_BOOL CFX_RenderDevice::SetPixel(int x, int y, uint32_t color) {
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))
+ if (m_pDeviceDriver->FillRectWithBlend(pRect, fill_color, blend_type))
return TRUE;
if (!(m_RenderCaps & FXRC_GET_BITS))
@@ -321,8 +320,7 @@ FX_BOOL CFX_RenderDevice::DrawCosmeticLineWithFillModeAndBlend(FX_FLOAT x1,
int fill_mode,
int blend_type) {
if ((color >= 0xff000000) &&
- m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, 0, nullptr,
- blend_type)) {
+ m_pDeviceDriver->DrawCosmeticLine(x1, y1, x2, y2, color, blend_type)) {
return TRUE;
}
CFX_GraphStateData graph_state;
@@ -331,13 +329,13 @@ FX_BOOL CFX_RenderDevice::DrawCosmeticLineWithFillModeAndBlend(FX_FLOAT x1,
path.SetPoint(0, x1, y1, FXPT_MOVETO);
path.SetPoint(1, x2, y2, FXPT_LINETO);
return m_pDeviceDriver->DrawPath(&path, nullptr, &graph_state, 0, color,
- fill_mode, 0, nullptr, blend_type);
+ fill_mode, blend_type);
}
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, nullptr);
+ return m_pDeviceDriver->GetDIBits(pBitmap, left, top);
}
CFX_DIBitmap* CFX_RenderDevice::GetBackDrop() {
@@ -393,7 +391,7 @@ FX_BOOL CFX_RenderDevice::SetDIBitsWithBlend(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, nullptr);
+ dest_rect.top, blend_mode);
}
FX_BOOL CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
@@ -410,8 +408,8 @@ FX_BOOL CFX_RenderDevice::StretchDIBitsWithFlagsAndBlend(
if (clip_box.IsEmpty())
return TRUE;
return m_pDeviceDriver->StretchDIBits(pBitmap, 0, left, top, dest_width,
- dest_height, &clip_box, flags, 0,
- nullptr, blend_mode);
+ dest_height, &clip_box, flags,
+ blend_mode);
}
FX_BOOL CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap,
@@ -420,7 +418,7 @@ FX_BOOL CFX_RenderDevice::SetBitMask(const CFX_DIBSource* pBitmap,
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, 0, nullptr);
+ FXDIB_BLEND_NORMAL);
}
FX_BOOL CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
@@ -434,8 +432,8 @@ FX_BOOL CFX_RenderDevice::StretchBitMaskWithFlags(const CFX_DIBSource* pBitmap,
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, 0,
- nullptr);
+ dest_height, &clip_box, flags,
+ FXDIB_BLEND_NORMAL);
}
FX_BOOL CFX_RenderDevice::StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
@@ -446,7 +444,7 @@ FX_BOOL CFX_RenderDevice::StartDIBitsWithBlend(const CFX_DIBSource* pBitmap,
void*& handle,
int blend_mode) {
return m_pDeviceDriver->StartDIBits(pBitmap, bitmap_alpha, argb, pMatrix,
- flags, handle, 0, nullptr, blend_mode);
+ flags, handle, blend_mode);
}
FX_BOOL CFX_RenderDevice::ContinueDIBits(void* handle, IFX_Pause* pPause) {
diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp
index 3725f3652b..6b456c2eaa 100644
--- a/core/fxge/ge/fx_ge_text.cpp
+++ b/core/fxge/ge/fx_ge_text.cpp
@@ -448,8 +448,8 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
if (!(text_flags & FXTEXT_PRINTGRAPHICTEXT)) {
if (ShouldDrawDeviceText(pFont, text_flags) &&
m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache,
- pText2Device, font_size, fill_color,
- 0, nullptr)) {
+ pText2Device, font_size,
+ fill_color)) {
return TRUE;
}
}
@@ -458,8 +458,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars,
} else if (!(text_flags & FXTEXT_NO_NATIVETEXT)) {
if (ShouldDrawDeviceText(pFont, text_flags) &&
m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache,
- pText2Device, font_size, fill_color, 0,
- nullptr)) {
+ pText2Device, font_size, fill_color)) {
return TRUE;
}
}
diff --git a/core/fxge/include/fx_dib.h b/core/fxge/include/fx_dib.h
index 4919ba70fe..b1108076a4 100644
--- a/core/fxge/include/fx_dib.h
+++ b/core/fxge/include/fx_dib.h
@@ -154,7 +154,6 @@ 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_ALPHA_FILL(flag, val) flag = ((val) | (flag & 0xffffff00))
class CFX_DIBSource {
public:
diff --git a/core/fxge/include/fx_ge.h b/core/fxge/include/fx_ge.h
index 040c16afa2..b2e2b455e4 100644
--- a/core/fxge/include/fx_ge.h
+++ b/core/fxge/include/fx_ge.h
@@ -421,11 +421,10 @@ class CFX_FxgeDevice : public CFX_RenderDevice {
class IFX_RenderDeviceDriver {
public:
- static IFX_RenderDeviceDriver* CreateFxgeDriver(
- CFX_DIBitmap* pBitmap,
- FX_BOOL bRgbByteOrder = FALSE,
- CFX_DIBitmap* pOriDevice = nullptr,
- FX_BOOL bGroupKnockout = FALSE);
+ static IFX_RenderDeviceDriver* CreateFxgeDriver(CFX_DIBitmap* pBitmap,
+ FX_BOOL bRgbByteOrder,
+ CFX_DIBitmap* pOriDevice,
+ FX_BOOL bGroupKnockout);
virtual ~IFX_RenderDeviceDriver() {}
@@ -457,23 +456,13 @@ class IFX_RenderDeviceDriver {
uint32_t fill_color,
uint32_t stroke_color,
int fill_mode,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) = 0;
-
- virtual FX_BOOL SetPixel(int x,
- int y,
- uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr) {
- return FALSE;
- }
+ int blend_type) = 0;
- virtual FX_BOOL FillRect(const FX_RECT* pRect,
- uint32_t fill_color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) {
+ virtual FX_BOOL SetPixel(int x, int y, uint32_t color) { return FALSE; }
+
+ virtual FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) {
return FALSE;
}
@@ -482,19 +471,13 @@ class IFX_RenderDeviceDriver {
FX_FLOAT x2,
FX_FLOAT y2,
uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) {
+ int blend_type) {
return FALSE;
}
virtual FX_BOOL GetClipBox(FX_RECT* pRect) = 0;
- virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top,
- void* pIccTransform = nullptr,
- FX_BOOL bDEdge = FALSE) {
+ virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
return FALSE;
}
virtual CFX_DIBitmap* GetBackDrop() { return nullptr; }
@@ -504,9 +487,7 @@ class IFX_RenderDeviceDriver {
const FX_RECT* pSrcRect,
int dest_left,
int dest_top,
- int blend_type,
- int alpha_flag = 0,
- void* pIccTransform = nullptr) = 0;
+ int blend_type) = 0;
virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
@@ -516,9 +497,7 @@ class IFX_RenderDeviceDriver {
int dest_height,
const FX_RECT* pClipRect,
uint32_t flags,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) = 0;
+ int blend_type) = 0;
virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
int bitmap_alpha,
@@ -526,9 +505,7 @@ class IFX_RenderDeviceDriver {
const CFX_Matrix* pMatrix,
uint32_t flags,
void*& handle,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) = 0;
+ int blend_type) = 0;
virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) {
return FALSE;
@@ -542,9 +519,7 @@ class IFX_RenderDeviceDriver {
CFX_FontCache* pCache,
const CFX_Matrix* pObject2Device,
FX_FLOAT font_size,
- uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr) {
+ uint32_t color) {
return FALSE;
}
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 6b2e2a2623..c7ed400739 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -5,6 +5,9 @@
#include "core/fxge/include/fx_ge.h"
#if defined(_SKIA_SUPPORT_)
+#include <algorithm>
+#include <vector>
+
#include "core/fxcodec/include/fx_codec.h"
#include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h"
@@ -591,9 +594,7 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars,
CFX_FontCache* pCache,
const CFX_Matrix* pObject2Device,
FX_FLOAT font_size,
- uint32_t color,
- int alpha_flag,
- void* pIccTransform) {
+ uint32_t color) {
sk_sp<SkTypeface> typeface(SkSafeRef(pCache->GetDeviceCache(pFont)));
SkPaint paint;
paint.setAntiAlias(true);
@@ -709,8 +710,6 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath(
uint32_t fill_color, // fill color
uint32_t stroke_color, // stroke color
int fill_mode, // fill mode, WINDING or ALTERNATE. 0 for not filled
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
SkIRect rect;
rect.set(0, 0, GetDeviceCaps(FXDC_PIXEL_WIDTH),
@@ -722,9 +721,7 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath(
skMatrix.setIdentity();
SkPaint skPaint;
skPaint.setAntiAlias(true);
- int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag)
- ? FXGETFLAG_ALPHA_STROKE(alpha_flag)
- : FXARGB_A(stroke_color);
+ int stroke_alpha = FXARGB_A(stroke_color);
if (pGraphState && stroke_alpha)
PaintStroke(&skPaint, pGraphState, skMatrix);
SkPath skPath = BuildPath(pPathData);
@@ -762,11 +759,9 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawPath(
return TRUE;
}
-FX_BOOL CFX_SkiaDeviceDriver::FillRect(const FX_RECT* pRect,
- uint32_t fill_color,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) {
+FX_BOOL CFX_SkiaDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) {
SkPaint spaint;
spaint.setAntiAlias(true);
spaint.setColor(fill_color);
@@ -924,22 +919,10 @@ FX_BOOL CFX_SkiaDeviceDriver::GetClipBox(FX_RECT* pRect) {
FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
int left,
- int top,
- void* pIccTransform,
- FX_BOOL bDEdge) {
+ int top) {
if (!m_pBitmap || !m_pBitmap->GetBuffer())
return TRUE;
- if (bDEdge) {
- if (m_bRgbByteOrder) {
- RgbByteOrderTransferBitmap(pBitmap, 0, 0, pBitmap->GetWidth(),
- pBitmap->GetHeight(), m_pBitmap, left, top);
- } else {
- return pBitmap->TransferBitmap(0, 0, pBitmap->GetWidth(),
- pBitmap->GetHeight(), m_pBitmap, left, top,
- pIccTransform);
- }
- return TRUE;
- }
+
FX_RECT rect(left, top, left + pBitmap->GetWidth(),
top + pBitmap->GetHeight());
CFX_DIBitmap* pBack;
@@ -947,6 +930,7 @@ FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
pBack = m_pOriDevice->Clone(&rect);
if (!pBack)
return TRUE;
+
pBack->CompositeBitmap(0, 0, pBack->GetWidth(), pBack->GetHeight(),
m_pBitmap, 0, 0);
} else {
@@ -954,15 +938,16 @@ FX_BOOL CFX_SkiaDeviceDriver::GetDIBits(CFX_DIBitmap* pBitmap,
if (!pBack)
return TRUE;
}
+
FX_BOOL bRet = TRUE;
- left = left >= 0 ? 0 : left;
- top = top >= 0 ? 0 : top;
+ left = std::min(left, 0);
+ top = std::min(top, 0);
if (m_bRgbByteOrder) {
RgbByteOrderTransferBitmap(pBitmap, 0, 0, rect.Width(), rect.Height(),
pBack, left, top);
} else {
bRet = pBitmap->TransferBitmap(0, 0, rect.Width(), rect.Height(), pBack,
- left, top, pIccTransform);
+ left, top, nullptr);
}
delete pBack;
return bRet;
@@ -973,17 +958,14 @@ FX_BOOL CFX_SkiaDeviceDriver::SetDIBits(const CFX_DIBSource* pBitmap,
const FX_RECT* pSrcRect,
int left,
int top,
- int blend_type,
- int alpha_flag,
- void* pIccTransform) {
+ int blend_type) {
if (!m_pBitmap || !m_pBitmap->GetBuffer())
return TRUE;
CFX_Matrix m(pBitmap->GetWidth(), 0, 0, -pBitmap->GetHeight(), left,
top + pBitmap->GetHeight());
void* dummy;
- return this->StartDIBits(pBitmap, 0xFF, argb, &m, 0, dummy, alpha_flag,
- pIccTransform, blend_type);
+ return StartDIBits(pBitmap, 0xFF, argb, &m, 0, dummy, blend_type);
}
FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
@@ -994,8 +976,6 @@ FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
int dest_height,
const FX_RECT* pClipRect,
uint32_t flags,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
if (!m_pBitmap->GetBuffer())
return TRUE;
@@ -1007,8 +987,7 @@ FX_BOOL CFX_SkiaDeviceDriver::StretchDIBits(const CFX_DIBSource* pSource,
pClipRect->right, pClipRect->top);
m_pCanvas->clipRect(skClipRect);
void* dummy;
- FX_BOOL result = this->StartDIBits(pSource, 0xFF, argb, &m, 0, dummy,
- alpha_flag, pIccTransform, blend_type);
+ FX_BOOL result = StartDIBits(pSource, 0xFF, argb, &m, 0, dummy, blend_type);
m_pCanvas->restore();
return result;
@@ -1020,8 +999,6 @@ FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource,
const CFX_Matrix* pMatrix,
uint32_t render_flags,
void*& handle,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
DebugValidate(m_pBitmap, m_pOriDevice);
SkColorType colorType = pSource->IsAlphaMask()
@@ -1181,7 +1158,7 @@ CFX_FxgeDevice::~CFX_FxgeDevice() {
}
void CFX_FxgeDevice::PreMultiply() {
- (static_cast<CFX_SkiaDeviceDriver*>(this->GetDeviceDriver()))->PreMultiply();
+ (static_cast<CFX_SkiaDeviceDriver*>(GetDeviceDriver()))->PreMultiply();
}
#endif
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index c9ff9f1632..15f6306cb0 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -52,15 +52,11 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
uint32_t fill_color,
uint32_t stroke_color,
int fill_mode,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) override;
+ int blend_type) override;
- FX_BOOL FillRect(const FX_RECT* pRect,
- uint32_t fill_color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) override;
+ FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) override;
/** Draw a single pixel (device dependant) line */
FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
@@ -68,20 +64,14 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
FX_FLOAT x2,
FX_FLOAT y2,
uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) override {
+ int blend_type) override {
return FALSE;
}
FX_BOOL GetClipBox(FX_RECT* pRect) override;
/** Load device buffer into a DIB */
- FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top,
- void* pIccTransform = nullptr,
- FX_BOOL bDEdge = FALSE) override;
+ FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
CFX_DIBitmap* GetBackDrop() override { return m_pOriDevice; }
@@ -90,9 +80,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
const FX_RECT* pSrcRect,
int dest_left,
int dest_top,
- int blend_type,
- int alpha_flag = 0,
- void* pIccTransform = nullptr) override;
+ int blend_type) override;
FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
int dest_left,
@@ -101,9 +89,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
int dest_height,
const FX_RECT* pClipRect,
uint32_t flags,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) override;
+ int blend_type) override;
FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
int bitmap_alpha,
@@ -111,9 +97,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
const CFX_Matrix* pMatrix,
uint32_t flags,
void*& handle,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL) override;
+ int blend_type) override;
FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override {
return FALSE;
@@ -127,9 +111,7 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
CFX_FontCache* pCache,
const CFX_Matrix* pObject2Device,
FX_FLOAT font_size,
- uint32_t color,
- int alpha_flag = 0,
- void* pIccTransform = nullptr) override;
+ uint32_t color) override;
FX_BOOL DrawShading(const CPDF_ShadingPattern* pPattern,
const CFX_Matrix* pMatrix,
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index a8ad1a37cd..c2084f2877 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -753,6 +753,8 @@ CGdiDeviceDriver::CGdiDeviceDriver(HDC hDC, int device_class) {
}
}
+CGdiDeviceDriver::~CGdiDeviceDriver() {}
+
int CGdiDeviceDriver::GetDeviceCaps(int caps_id) {
switch (caps_id) {
case FXDC_DEVICE_CLASS:
@@ -989,14 +991,12 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
uint32_t fill_color,
uint32_t stroke_color,
int fill_mode,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
- if (blend_type != FXDIB_BLEND_NORMAL) {
+ if (blend_type != FXDIB_BLEND_NORMAL)
return FALSE;
- }
- Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform);
- Color2Argb(stroke_color, stroke_color, alpha_flag, pIccTransform);
+
+ Color2Argb(fill_color, fill_color, 1 << 24, nullptr);
+ Color2Argb(stroke_color, stroke_color, 0, nullptr);
CWin32Platform* pPlatform =
(CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
if (!(pGraphState || stroke_color == 0) &&
@@ -1007,24 +1007,23 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
}
FX_RECT bbox = bbox_f.GetInnerRect();
if (bbox.Width() <= 0) {
- return DrawCosmeticLine((FX_FLOAT)(bbox.left), (FX_FLOAT)(bbox.top),
- (FX_FLOAT)(bbox.left),
- (FX_FLOAT)(bbox.bottom + 1), fill_color,
- alpha_flag, pIccTransform, FXDIB_BLEND_NORMAL);
- } else if (bbox.Height() <= 0) {
+ return DrawCosmeticLine(
+ (FX_FLOAT)(bbox.left), (FX_FLOAT)(bbox.top), (FX_FLOAT)(bbox.left),
+ (FX_FLOAT)(bbox.bottom + 1), fill_color, FXDIB_BLEND_NORMAL);
+ }
+ if (bbox.Height() <= 0) {
return DrawCosmeticLine((FX_FLOAT)(bbox.left), (FX_FLOAT)(bbox.top),
(FX_FLOAT)(bbox.right + 1), (FX_FLOAT)(bbox.top),
- fill_color, alpha_flag, pIccTransform,
- FXDIB_BLEND_NORMAL);
+ fill_color, FXDIB_BLEND_NORMAL);
}
}
int fill_alpha = FXARGB_A(fill_color);
int stroke_alpha = FXARGB_A(stroke_color);
FX_BOOL bDrawAlpha = (fill_alpha > 0 && fill_alpha < 255) ||
(stroke_alpha > 0 && stroke_alpha < 255 && pGraphState);
- if (!pPlatform->m_GdiplusExt.IsAvailable() && bDrawAlpha) {
+ if (!pPlatform->m_GdiplusExt.IsAvailable() && bDrawAlpha)
return FALSE;
- }
+
if (pPlatform->m_GdiplusExt.IsAvailable()) {
if (bDrawAlpha ||
((m_DeviceClass != FXDC_PRINTER && !(fill_mode & FXFILL_FULLCOVER)) ||
@@ -1092,24 +1091,22 @@ FX_BOOL CGdiDeviceDriver::DrawPath(const CFX_PathData* pPathData,
return TRUE;
}
-FX_BOOL CGdiDeviceDriver::FillRect(const FX_RECT* pRect,
- uint32_t fill_color,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) {
- if (blend_type != FXDIB_BLEND_NORMAL) {
+FX_BOOL CGdiDeviceDriver::FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) {
+ if (blend_type != FXDIB_BLEND_NORMAL)
return FALSE;
- }
- Color2Argb(fill_color, fill_color, alpha_flag | (1 << 24), pIccTransform);
+
+ Color2Argb(fill_color, fill_color, 1 << 24, nullptr);
int alpha;
FX_COLORREF rgb;
ArgbDecode(fill_color, alpha, rgb);
- if (alpha == 0) {
+ if (alpha == 0)
return TRUE;
- }
- if (alpha < 255) {
+
+ if (alpha < 255)
return FALSE;
- }
+
HBRUSH hBrush = CreateSolidBrush(rgb);
::FillRect(m_hDC, (RECT*)pRect, hBrush);
DeleteObject(hBrush);
@@ -1153,19 +1150,17 @@ FX_BOOL CGdiDeviceDriver::DrawCosmeticLine(FX_FLOAT x1,
FX_FLOAT x2,
FX_FLOAT y2,
uint32_t color,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
- if (blend_type != FXDIB_BLEND_NORMAL) {
+ if (blend_type != FXDIB_BLEND_NORMAL)
return FALSE;
- }
- Color2Argb(color, color, alpha_flag | (1 << 24), pIccTransform);
+
+ Color2Argb(color, color, 1 << 24, nullptr);
int a;
FX_COLORREF rgb;
ArgbDecode(color, a, rgb);
- if (a == 0) {
+ if (a == 0)
return TRUE;
- }
+
HPEN hPen = CreatePen(PS_SOLID, 1, rgb);
hPen = (HPEN)SelectObject(m_hDC, hPen);
MoveToEx(m_hDC, FXSYS_round(x1), FXSYS_round(y1), nullptr);
@@ -1184,11 +1179,9 @@ CGdiDisplayDriver::CGdiDisplayDriver(HDC hDC)
}
}
-FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top,
- void* pIccTransform,
- FX_BOOL bDEdge) {
+CGdiDisplayDriver::~CGdiDisplayDriver() {}
+
+FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) {
FX_BOOL ret = FALSE;
int width = pBitmap->GetWidth();
int height = pBitmap->GetHeight();
@@ -1204,11 +1197,7 @@ FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap,
bmi.bmiHeader.biHeight = -height;
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biWidth = width;
- if (!CFX_GEModule::Get()->GetCodecModule() ||
- !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
- pIccTransform = nullptr;
- }
- if (pBitmap->GetBPP() > 8 && !pBitmap->IsCmykImage() && !pIccTransform) {
+ if (pBitmap->GetBPP() > 8 && !pBitmap->IsCmykImage()) {
ret = ::GetDIBits(hDCMemory, hbmp, 0, height, pBitmap->GetBuffer(), &bmi,
DIB_RGB_COLORS) == height;
} else {
@@ -1217,15 +1206,15 @@ FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap,
bmi.bmiHeader.biBitCount = 24;
::GetDIBits(hDCMemory, hbmp, 0, height, bitmap.GetBuffer(), &bmi,
DIB_RGB_COLORS);
- ret = pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0,
- pIccTransform);
+ ret =
+ pBitmap->TransferBitmap(0, 0, width, height, &bitmap, 0, 0, nullptr);
} else {
ret = FALSE;
}
}
- if (pBitmap->HasAlpha() && ret) {
+ if (pBitmap->HasAlpha() && ret)
pBitmap->LoadChannel(FXDIB_Alpha, 0xff);
- }
+
DeleteObject(hbmp);
DeleteObject(hDCMemory);
return ret;
@@ -1236,54 +1225,48 @@ FX_BOOL CGdiDisplayDriver::SetDIBits(const CFX_DIBSource* pSource,
const FX_RECT* pSrcRect,
int left,
int top,
- int blend_type,
- int alpha_flag,
- void* pIccTransform) {
+ int blend_type) {
ASSERT(blend_type == FXDIB_BLEND_NORMAL);
if (pSource->IsAlphaMask()) {
int width = pSource->GetWidth(), height = pSource->GetHeight();
- int alpha = FXGETFLAG_COLORTYPE(alpha_flag)
- ? FXGETFLAG_ALPHA_FILL(alpha_flag)
- : FXARGB_A(color);
+ int alpha = FXARGB_A(color);
if (pSource->GetBPP() != 1 || alpha != 255) {
CFX_DIBitmap background;
if (!background.Create(width, height, FXDIB_Rgb32) ||
- !GetDIBits(&background, left, top, nullptr) ||
+ !GetDIBits(&background, left, top) ||
!background.CompositeMask(0, 0, width, height, pSource, color, 0, 0,
- FXDIB_BLEND_NORMAL, nullptr, FALSE,
- alpha_flag, pIccTransform)) {
+ FXDIB_BLEND_NORMAL, nullptr, FALSE, 0,
+ nullptr)) {
return FALSE;
}
FX_RECT src_rect(0, 0, width, height);
- return SetDIBits(&background, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL,
- 0, nullptr);
+ return SetDIBits(&background, 0, &src_rect, left, top,
+ FXDIB_BLEND_NORMAL);
}
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);
+ FXDIB_BLEND_NORMAL);
}
int width = pSrcRect->Width(), height = pSrcRect->Height();
if (pSource->HasAlpha()) {
CFX_DIBitmap bitmap;
if (!bitmap.Create(width, height, FXDIB_Rgb) ||
- !GetDIBits(&bitmap, left, top, nullptr) ||
+ !GetDIBits(&bitmap, left, top) ||
!bitmap.CompositeBitmap(0, 0, width, height, pSource, pSrcRect->left,
pSrcRect->top, FXDIB_BLEND_NORMAL, nullptr,
- FALSE, pIccTransform)) {
+ FALSE, nullptr)) {
return FALSE;
}
FX_RECT src_rect(0, 0, width, height);
- return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL, 0,
- nullptr);
+ return SetDIBits(&bitmap, 0, &src_rect, left, top, FXDIB_BLEND_NORMAL);
}
CFX_DIBExtractor temp(pSource);
CFX_DIBitmap* pBitmap = temp;
- if (pBitmap) {
- return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform);
- }
- return FALSE;
+ if (!pBitmap)
+ return FALSE;
+ return GDI_SetDIBits(pBitmap, pSrcRect, left, top, nullptr);
}
FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource,
@@ -1293,17 +1276,14 @@ FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource,
int dest_width,
int dest_height,
const FX_RECT* pClipRect,
- int render_flags,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) {
+ int render_flags) {
FX_RECT bitmap_clip = *pClipRect;
- if (dest_width < 0) {
+ if (dest_width < 0)
dest_left += dest_width;
- }
- if (dest_height < 0) {
+
+ if (dest_height < 0)
dest_top += dest_height;
- }
+
bitmap_clip.Offset(-dest_left, -dest_top);
std::unique_ptr<CFX_DIBitmap> pStretched(
pSource->StretchTo(dest_width, dest_height, render_flags, &bitmap_clip));
@@ -1312,8 +1292,7 @@ FX_BOOL CGdiDisplayDriver::UseFoxitStretchEngine(const CFX_DIBSource* pSource,
FX_RECT src_rect(0, 0, pStretched->GetWidth(), pStretched->GetHeight());
return SetDIBits(pStretched.get(), color, &src_rect, pClipRect->left,
- pClipRect->top, FXDIB_BLEND_NORMAL, alpha_flag,
- pIccTransform);
+ pClipRect->top, FXDIB_BLEND_NORMAL);
}
FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
@@ -1324,15 +1303,12 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
int dest_height,
const FX_RECT* pClipRect,
uint32_t flags,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
ASSERT(pSource && pClipRect);
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);
+ dest_width, dest_height, pClipRect, flags);
}
if (pSource->IsAlphaMask()) {
FX_RECT image_rect;
@@ -1352,23 +1328,22 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
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, nullptr) ||
+ image_rect.top + clip_rect.top) ||
!background.CompositeMask(
0, 0, clip_width, clip_height, pStretched.get(), color, 0, 0,
- FXDIB_BLEND_NORMAL, nullptr, FALSE, alpha_flag, pIccTransform)) {
+ FXDIB_BLEND_NORMAL, nullptr, FALSE, 0, nullptr)) {
return FALSE;
}
FX_RECT src_rect(0, 0, clip_width, clip_height);
- return SetDIBits(
- &background, 0, &src_rect, image_rect.left + clip_rect.left,
- image_rect.top + clip_rect.top, FXDIB_BLEND_NORMAL, 0, nullptr);
+ return SetDIBits(&background, 0, &src_rect,
+ image_rect.left + clip_rect.left,
+ image_rect.top + clip_rect.top, FXDIB_BLEND_NORMAL);
}
if (pSource->HasAlpha()) {
CWin32Platform* pPlatform =
(CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
- if (pPlatform->m_GdiplusExt.IsAvailable() && !pIccTransform &&
- !pSource->IsCmykImage()) {
+ if (pPlatform->m_GdiplusExt.IsAvailable() && !pSource->IsCmykImage()) {
CFX_DIBExtractor temp(pSource);
CFX_DIBitmap* pBitmap = temp;
if (!pBitmap)
@@ -1378,16 +1353,14 @@ FX_BOOL CGdiDisplayDriver::StretchDIBits(const CFX_DIBSource* pSource,
pClipRect, flags);
}
return UseFoxitStretchEngine(pSource, color, dest_left, dest_top,
- dest_width, dest_height, pClipRect, flags,
- alpha_flag, pIccTransform, blend_type);
+ dest_width, dest_height, pClipRect, flags);
}
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;
+ if (!pBitmap)
+ return FALSE;
+ return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width,
+ dest_height, flags, nullptr);
}
CFX_WindowsDevice::CFX_WindowsDevice(HDC hDC) {
diff --git a/core/fxge/win32/fx_win32_print.cpp b/core/fxge/win32/fx_win32_print.cpp
index 08029bc351..b5e36202ba 100644
--- a/core/fxge/win32/fx_win32_print.cpp
+++ b/core/fxge/win32/fx_win32_print.cpp
@@ -125,16 +125,14 @@ FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource,
const FX_RECT* pSrcRect,
int left,
int top,
- int blend_type,
- int alpha_flag,
- void* pIccTransform) {
+ int blend_type) {
if (pSource->IsAlphaMask()) {
FX_RECT clip_rect(left, top, left + pSrcRect->Width(),
top + pSrcRect->Height());
return StretchDIBits(pSource, color, left - pSrcRect->left,
top - pSrcRect->top, pSource->GetWidth(),
- pSource->GetHeight(), &clip_rect, 0, alpha_flag,
- pIccTransform, FXDIB_BLEND_NORMAL);
+ pSource->GetHeight(), &clip_rect, 0,
+ FXDIB_BLEND_NORMAL);
}
ASSERT(pSource && !pSource->IsAlphaMask() && pSrcRect);
ASSERT(blend_type == FXDIB_BLEND_NORMAL);
@@ -146,7 +144,7 @@ FX_BOOL CGdiPrinterDriver::SetDIBits(const CFX_DIBSource* pSource,
if (!pBitmap)
return FALSE;
- return GDI_SetDIBits(pBitmap, pSrcRect, left, top, pIccTransform);
+ return GDI_SetDIBits(pBitmap, pSrcRect, left, top, nullptr);
}
FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
@@ -157,13 +155,9 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
int dest_height,
const FX_RECT* pClipRect,
uint32_t flags,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
if (pSource->IsAlphaMask()) {
- int alpha = FXGETFLAG_COLORTYPE(alpha_flag)
- ? FXGETFLAG_ALPHA_FILL(alpha_flag)
- : FXARGB_A(color);
+ int alpha = FXARGB_A(color);
if (pSource->GetBPP() != 1 || alpha != 255)
return FALSE;
@@ -180,7 +174,7 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
return GDI_StretchBitMask(pFlipped.get(), dest_left, dest_top,
abs(dest_width), abs(dest_height), color, flags,
- alpha_flag, pIccTransform);
+ 0, nullptr);
}
CFX_DIBExtractor temp(pSource);
@@ -188,8 +182,7 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
if (!pBitmap)
return FALSE;
return GDI_StretchBitMask(pBitmap, dest_left, dest_top, dest_width,
- dest_height, color, flags, alpha_flag,
- pIccTransform);
+ dest_height, color, flags, 0, nullptr);
}
if (pSource->HasAlpha())
@@ -207,8 +200,7 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
dest_top += dest_height;
return GDI_StretchDIBits(pFlipped.get(), dest_left, dest_top,
- abs(dest_width), abs(dest_height), flags,
- pIccTransform);
+ abs(dest_width), abs(dest_height), flags, nullptr);
}
CFX_DIBExtractor temp(pSource);
@@ -216,7 +208,7 @@ FX_BOOL CGdiPrinterDriver::StretchDIBits(const CFX_DIBSource* pSource,
if (!pBitmap)
return FALSE;
return GDI_StretchDIBits(pBitmap, dest_left, dest_top, dest_width,
- dest_height, flags, pIccTransform);
+ dest_height, flags, nullptr);
}
FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
@@ -225,8 +217,6 @@ FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
const CFX_Matrix* pMatrix,
uint32_t render_flags,
void*& handle,
- int alpha_flag,
- void* pIccTransform,
int blend_type) {
if (bitmap_alpha < 255 || pSource->HasAlpha() ||
(pSource->IsAlphaMask() && (pSource->GetBPP() != 1))) {
@@ -243,7 +233,7 @@ FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
bFlipY ? full_rect.bottom : full_rect.top,
bFlipX ? -full_rect.Width() : full_rect.Width(),
bFlipY ? -full_rect.Height() : full_rect.Height(),
- nullptr, 0, alpha_flag, pIccTransform, blend_type);
+ nullptr, 0, blend_type);
}
if (FXSYS_fabs(pMatrix->a) < 0.5f && FXSYS_fabs(pMatrix->d) < 0.5f) {
std::unique_ptr<CFX_DIBitmap> pTransformed(
@@ -253,27 +243,9 @@ FX_BOOL CGdiPrinterDriver::StartDIBits(const CFX_DIBSource* pSource,
return StretchDIBits(pTransformed.get(), color, full_rect.left,
full_rect.top, full_rect.Width(), full_rect.Height(),
- nullptr, 0, alpha_flag, pIccTransform, blend_type);
+ nullptr, 0, blend_type);
}
- if (pSource->GetBPP() != 1)
- return FALSE;
-
- std::unique_ptr<CFX_DIBitmap> pTransformed(
- Transform1bppBitmap(pSource, pMatrix));
- if (!pIccTransform)
- return FALSE;
-
- SaveState();
- CFX_PathData path;
- path.AppendRect(0, 0, 1.0f, 1.0f);
- SetClip_PathFill(&path, pMatrix, WINDING);
- FX_BOOL ret =
- StretchDIBits(pTransformed.get(), color, full_rect.left, full_rect.top,
- full_rect.Width(), full_rect.Height(), nullptr, 0,
- alpha_flag, pIccTransform, blend_type);
- RestoreState(false);
- handle = nullptr;
- return ret;
+ return FALSE;
}
#endif
diff --git a/core/fxge/win32/win32_int.h b/core/fxge/win32/win32_int.h
index 8a9c124f00..e0952706fa 100644
--- a/core/fxge/win32/win32_int.h
+++ b/core/fxge/win32/win32_int.h
@@ -108,7 +108,7 @@ class CWin32Platform {
class CGdiDeviceDriver : public IFX_RenderDeviceDriver {
protected:
CGdiDeviceDriver(HDC hDC, int device_class);
- ~CGdiDeviceDriver() override {}
+ ~CGdiDeviceDriver() override;
// IFX_RenderDeviceDriver
int GetDeviceCaps(int caps_id) override;
@@ -126,21 +126,15 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver {
uint32_t fill_color,
uint32_t stroke_color,
int fill_mode,
- int alpha_flag,
- void* pIccTransform,
- int blend_type) override;
- FX_BOOL FillRect(const FX_RECT* pRect,
- uint32_t fill_color,
- int alpha_flag,
- void* pIccTransform,
int blend_type) override;
+ FX_BOOL FillRectWithBlend(const FX_RECT* pRect,
+ uint32_t fill_color,
+ int blend_type) override;
FX_BOOL DrawCosmeticLine(FX_FLOAT x1,
FX_FLOAT y1,
FX_FLOAT x2,
FX_FLOAT y2,
uint32_t color,
- int alpha_flag,
- void* pIccTransform,
int blend_type) override;
FX_BOOL GetClipBox(FX_RECT* pRect) override;
void* GetPlatformSurface() const override { return (void*)m_hDC; }
@@ -183,22 +177,17 @@ class CGdiDeviceDriver : public IFX_RenderDeviceDriver {
class CGdiDisplayDriver : public CGdiDeviceDriver {
public:
- CGdiDisplayDriver(HDC hDC);
+ explicit CGdiDisplayDriver(HDC hDC);
+ ~CGdiDisplayDriver() override;
protected:
- FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap,
- int left,
- int top,
- void* pIccTransform = nullptr,
- FX_BOOL bDEdge = FALSE) override;
+ FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override;
FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
const FX_RECT* pSrcRect,
int left,
int top,
- int blend_type,
- int alpha_flag,
- void* pIccTransform) override;
+ int blend_type) override;
FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
int dest_left,
@@ -207,8 +196,6 @@ class CGdiDisplayDriver : public CGdiDeviceDriver {
int dest_height,
const FX_RECT* pClipRect,
uint32_t flags,
- int alpha_flag,
- void* pIccTransform,
int blend_type) override;
FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
int bitmap_alpha,
@@ -216,8 +203,6 @@ class CGdiDisplayDriver : public CGdiDeviceDriver {
const CFX_Matrix* pMatrix,
uint32_t render_flags,
void*& handle,
- int alpha_flag,
- void* pIccTransform,
int blend_type) override {
return FALSE;
}
@@ -228,10 +213,7 @@ class CGdiDisplayDriver : public CGdiDeviceDriver {
int dest_width,
int dest_height,
const FX_RECT* pClipRect,
- int render_flags,
- int alpha_flag = 0,
- void* pIccTransform = nullptr,
- int blend_type = FXDIB_BLEND_NORMAL);
+ int render_flags);
};
class CGdiPrinterDriver : public CGdiDeviceDriver {
@@ -246,9 +228,7 @@ class CGdiPrinterDriver : public CGdiDeviceDriver {
const FX_RECT* pSrcRect,
int left,
int top,
- int blend_type,
- int alpha_flag,
- void* pIccTransform) override;
+ int blend_type) override;
FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap,
uint32_t color,
int dest_left,
@@ -257,8 +237,6 @@ class CGdiPrinterDriver : public CGdiDeviceDriver {
int dest_height,
const FX_RECT* pClipRect,
uint32_t flags,
- int alpha_flag,
- void* pIccTransform,
int blend_type) override;
FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap,
int bitmap_alpha,
@@ -266,8 +244,6 @@ class CGdiPrinterDriver : public CGdiDeviceDriver {
const CFX_Matrix* pMatrix,
uint32_t render_flags,
void*& handle,
- int alpha_flag,
- void* pIccTransform,
int blend_type) override;
const int m_HorzSize;