summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/agg/fx_agg_driver.cpp16
-rw-r--r--core/fxge/agg/fx_agg_driver.h2
-rw-r--r--core/fxge/dib/fx_dib_main.cpp85
-rw-r--r--core/fxge/ge/fx_ge_device.cpp2
-rw-r--r--core/fxge/include/fx_dib.h11
-rw-r--r--core/fxge/include/fx_ge.h12
-rw-r--r--core/fxge/skia/fx_skia_device.cpp14
-rw-r--r--core/fxge/skia/fx_skia_device.h4
8 files changed, 19 insertions, 127 deletions
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 86326f6caf..d7a9ddb530 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -189,17 +189,15 @@ IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver(
FX_BOOL bRgbByteOrder,
CFX_DIBitmap* pOriDevice,
FX_BOOL bGroupKnockout) {
- return new CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice,
+ return new CFX_AggDeviceDriver(pBitmap, bRgbByteOrder, pOriDevice,
bGroupKnockout);
}
CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap,
- int dither_bits,
FX_BOOL bRgbByteOrder,
CFX_DIBitmap* pOriDevice,
FX_BOOL bGroupKnockout) {
m_pBitmap = pBitmap;
- m_DitherBits = dither_bits;
m_pClipRgn = nullptr;
m_pPlatformBitmap = nullptr;
m_pPlatformGraphics = nullptr;
@@ -270,8 +268,6 @@ int CFX_AggDeviceDriver::GetDeviceCaps(int caps_id) {
}
return flags;
}
- case FXDC_DITHER_BITS:
- return m_DitherBits;
}
return 0;
}
@@ -1784,16 +1780,15 @@ CFX_FxgeDevice::CFX_FxgeDevice() {
}
bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
- int dither_bits,
bool bRgbByteOrder,
CFX_DIBitmap* pOriDevice,
bool bGroupKnockout) {
- if (!pBitmap) {
+ if (!pBitmap)
return false;
- }
+
SetBitmap(pBitmap);
IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(
- pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout);
+ pBitmap, bRgbByteOrder, pOriDevice, bGroupKnockout);
SetDeviceDriver(pDriver);
return true;
}
@@ -1801,7 +1796,6 @@ bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
bool CFX_FxgeDevice::Create(int width,
int height,
FXDIB_Format format,
- int dither_bits,
CFX_DIBitmap* pOriDevice) {
m_bOwnedBitmap = true;
CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
@@ -1811,7 +1805,7 @@ bool CFX_FxgeDevice::Create(int width,
}
SetBitmap(pBitmap);
IFX_RenderDeviceDriver* pDriver =
- new CFX_AggDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE);
+ new CFX_AggDeviceDriver(pBitmap, FALSE, pOriDevice, FALSE);
SetDeviceDriver(pDriver);
return true;
}
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h
index a33bc09937..3462b61bb2 100644
--- a/core/fxge/agg/fx_agg_driver.h
+++ b/core/fxge/agg/fx_agg_driver.h
@@ -28,7 +28,6 @@ class CAgg_PathData {
class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
public:
CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap,
- int dither_bits,
FX_BOOL bRgbByteOrder,
CFX_DIBitmap* pOriDevice,
FX_BOOL bGroupKnockout);
@@ -144,7 +143,6 @@ class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver {
void* m_pPlatformBitmap;
void* m_pDwRenderTartget;
int m_FillFlags;
- int m_DitherBits;
FX_BOOL m_bRgbByteOrder;
CFX_DIBitmap* m_pOriDevice;
FX_BOOL m_bGroupKnockout;
diff --git a/core/fxge/dib/fx_dib_main.cpp b/core/fxge/dib/fx_dib_main.cpp
index ad6ee0c4e7..85df71e11d 100644
--- a/core/fxge/dib/fx_dib_main.cpp
+++ b/core/fxge/dib/fx_dib_main.cpp
@@ -1371,90 +1371,7 @@ FX_BOOL CFX_DIBitmap::ConvertColorScale(uint32_t forecolor,
}
return TRUE;
}
-FX_BOOL CFX_DIBitmap::DitherFS(const uint32_t* pPalette,
- int pal_size,
- const FX_RECT* pRect) {
- if (!m_pBuffer) {
- return FALSE;
- }
- if (m_bpp != 8 && m_pPalette && m_AlphaFlag != 0) {
- return FALSE;
- }
- if (m_Width < 4 && m_Height < 4) {
- return FALSE;
- }
- FX_RECT rect(0, 0, m_Width, m_Height);
- if (pRect) {
- rect.Intersect(*pRect);
- }
- uint8_t translate[256];
- for (int i = 0; i < 256; i++) {
- int err2 = 65536;
- for (int j = 0; j < pal_size; j++) {
- uint8_t entry = (uint8_t)pPalette[j];
- int err = (int)entry - i;
- if (err * err < err2) {
- err2 = err * err;
- translate[i] = entry;
- }
- }
- }
- for (int row = rect.top; row < rect.bottom; row++) {
- uint8_t* scan = m_pBuffer + row * m_Pitch;
- uint8_t* next_scan = m_pBuffer + (row + 1) * m_Pitch;
- for (int col = rect.left; col < rect.right; col++) {
- int src_pixel = scan[col];
- int dest_pixel = translate[src_pixel];
- scan[col] = (uint8_t)dest_pixel;
- int error = -dest_pixel + src_pixel;
- if (col < rect.right - 1) {
- int src = scan[col + 1];
- src += error * 7 / 16;
- if (src > 255) {
- scan[col + 1] = 255;
- } else if (src < 0) {
- scan[col + 1] = 0;
- } else {
- scan[col + 1] = src;
- }
- }
- if (col < rect.right - 1 && row < rect.bottom - 1) {
- int src = next_scan[col + 1];
- src += error * 1 / 16;
- if (src > 255) {
- next_scan[col + 1] = 255;
- } else if (src < 0) {
- next_scan[col + 1] = 0;
- } else {
- next_scan[col + 1] = src;
- }
- }
- if (row < rect.bottom - 1) {
- int src = next_scan[col];
- src += error * 5 / 16;
- if (src > 255) {
- next_scan[col] = 255;
- } else if (src < 0) {
- next_scan[col] = 0;
- } else {
- next_scan[col] = src;
- }
- }
- if (col > rect.left && row < rect.bottom - 1) {
- int src = next_scan[col - 1];
- src += error * 3 / 16;
- if (src > 255) {
- next_scan[col - 1] = 255;
- } else if (src < 0) {
- next_scan[col - 1] = 0;
- } else {
- next_scan[col - 1] = src;
- }
- }
- }
- }
- return TRUE;
-}
+
CFX_DIBitmap* CFX_DIBSource::FlipImage(FX_BOOL bXFlip, FX_BOOL bYFlip) const {
CFX_DIBitmap* pFlipped = new CFX_DIBitmap;
if (!pFlipped->Create(m_Width, m_Height, GetFormat())) {
diff --git a/core/fxge/ge/fx_ge_device.cpp b/core/fxge/ge/fx_ge_device.cpp
index d6c7b18b47..b9bd133e57 100644
--- a/core/fxge/ge/fx_ge_device.cpp
+++ b/core/fxge/ge/fx_ge_device.cpp
@@ -261,7 +261,7 @@ FX_BOOL CFX_RenderDevice::DrawFillStrokePath(
Backdrop.Copy(&bitmap);
}
CFX_FxgeDevice bitmap_device;
- bitmap_device.Attach(&bitmap, 0, FALSE, &Backdrop, TRUE);
+ bitmap_device.Attach(&bitmap, false, &Backdrop, true);
CFX_Matrix matrix;
if (pObject2Device) {
matrix = *pObject2Device;
diff --git a/core/fxge/include/fx_dib.h b/core/fxge/include/fx_dib.h
index 6504e5fd8f..12ed03c1d3 100644
--- a/core/fxge/include/fx_dib.h
+++ b/core/fxge/include/fx_dib.h
@@ -256,6 +256,7 @@ class CFX_DIBSource {
int FindPalette(uint32_t color) const;
void GetPalette(uint32_t* pal, int alpha) const;
};
+
class CFX_DIBitmap : public CFX_DIBSource {
public:
CFX_DIBitmap();
@@ -357,17 +358,13 @@ class CFX_DIBitmap : public CFX_DIBSource {
FX_BOOL ConvertColorScale(uint32_t forecolor, uint32_t backcolor);
- FX_BOOL DitherFS(const uint32_t* pPalette,
- int pal_size,
- const FX_RECT* pRect = NULL);
-
protected:
- uint8_t* m_pBuffer;
+ FX_BOOL GetGrayData(void* pIccTransform = NULL);
+ uint8_t* m_pBuffer;
FX_BOOL m_bExtBuf;
-
- FX_BOOL GetGrayData(void* pIccTransform = NULL);
};
+
class CFX_DIBExtractor {
public:
CFX_DIBExtractor(const CFX_DIBSource* pSrc);
diff --git a/core/fxge/include/fx_ge.h b/core/fxge/include/fx_ge.h
index c025c1251e..6a3113d070 100644
--- a/core/fxge/include/fx_ge.h
+++ b/core/fxge/include/fx_ge.h
@@ -161,7 +161,6 @@ class CFX_GraphStateData {
#define FXDC_HORZ_SIZE 5
#define FXDC_VERT_SIZE 6
#define FXDC_RENDER_CAPS 7
-#define FXDC_DITHER_BITS 8
#define FXDC_DISPLAY 1
#define FXDC_PRINTER 2
#define FXRC_GET_BITS 0x01
@@ -402,16 +401,13 @@ class CFX_FxgeDevice : public CFX_RenderDevice {
~CFX_FxgeDevice() override;
bool Attach(CFX_DIBitmap* pBitmap,
- int dither_bits = 0,
- bool bRgbByteOrder = false,
- CFX_DIBitmap* pOriDevice = NULL,
- bool bGroupKnockout = false);
-
+ bool bRgbByteOrder,
+ CFX_DIBitmap* pOriDevice,
+ bool bGroupKnockout);
bool Create(int width,
int height,
FXDIB_Format format,
- int dither_bits = 0,
- CFX_DIBitmap* pOriDevice = NULL);
+ CFX_DIBitmap* pOriDevice);
#ifdef _SKIA_SUPPORT_
bool AttachRecorder(SkPictureRecorder* recorder);
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index e64dfd0a73..452472e40c 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -500,14 +500,12 @@ void CFX_SkiaDeviceDriver::PaintStroke(SkPaint* spaint,
}
CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap,
- int dither_bits,
FX_BOOL bRgbByteOrder,
CFX_DIBitmap* pOriDevice,
FX_BOOL bGroupKnockout)
: m_pBitmap(pBitmap),
m_pOriDevice(pOriDevice),
m_pRecorder(nullptr),
- m_ditherBits(dither_bits),
m_bRgbByteOrder(bRgbByteOrder),
m_bGroupKnockout(bGroupKnockout) {
SkBitmap skBitmap;
@@ -526,7 +524,6 @@ CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(int size_x, int size_y)
: m_pBitmap(nullptr),
m_pOriDevice(nullptr),
m_pRecorder(new SkPictureRecorder),
- m_ditherBits(0),
m_bRgbByteOrder(FALSE),
m_bGroupKnockout(FALSE) {
m_pRecorder->beginRecording(SkIntToScalar(size_x), SkIntToScalar(size_y));
@@ -537,7 +534,6 @@ CFX_SkiaDeviceDriver::CFX_SkiaDeviceDriver(SkPictureRecorder* recorder)
: m_pBitmap(nullptr),
m_pOriDevice(nullptr),
m_pRecorder(recorder),
- m_ditherBits(0),
m_bRgbByteOrder(FALSE),
m_bGroupKnockout(FALSE) {
m_pCanvas = m_pRecorder->getRecordingCanvas();
@@ -594,8 +590,6 @@ int CFX_SkiaDeviceDriver::GetDeviceCaps(int caps_id) {
return FXRC_GET_BITS | FXRC_ALPHA_PATH | FXRC_ALPHA_IMAGE |
FXRC_BLEND_MODE | FXRC_SOFT_CLIP | FXRC_ALPHA_OUTPUT |
FXRC_FILLSTROKE_PATH | FXRC_SHADING;
- case FXDC_DITHER_BITS:
- return m_ditherBits;
}
return 0;
}
@@ -1095,15 +1089,14 @@ SkPictureRecorder* CFX_FxgeDevice::CreateRecorder(int size_x, int size_y) {
}
bool CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap,
- int dither_bits,
bool bRgbByteOrder,
CFX_DIBitmap* pOriDevice,
bool bGroupKnockout) {
if (!pBitmap)
return false;
SetBitmap(pBitmap);
- SetDeviceDriver(new CFX_SkiaDeviceDriver(pBitmap, dither_bits, bRgbByteOrder,
- pOriDevice, bGroupKnockout));
+ SetDeviceDriver(new CFX_SkiaDeviceDriver(pBitmap, bRgbByteOrder, pOriDevice,
+ bGroupKnockout));
return true;
}
@@ -1117,7 +1110,6 @@ bool CFX_FxgeDevice::AttachRecorder(SkPictureRecorder* recorder) {
bool CFX_FxgeDevice::Create(int width,
int height,
FXDIB_Format format,
- int dither_bits,
CFX_DIBitmap* pOriDevice) {
m_bOwnedBitmap = TRUE;
CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
@@ -1127,7 +1119,7 @@ bool CFX_FxgeDevice::Create(int width,
}
SetBitmap(pBitmap);
CFX_SkiaDeviceDriver* pDriver =
- new CFX_SkiaDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE);
+ new CFX_SkiaDeviceDriver(pBitmap, FALSE, pOriDevice, FALSE);
SetDeviceDriver(pDriver);
return true;
}
diff --git a/core/fxge/skia/fx_skia_device.h b/core/fxge/skia/fx_skia_device.h
index 79097ade18..dd3ba420e8 100644
--- a/core/fxge/skia/fx_skia_device.h
+++ b/core/fxge/skia/fx_skia_device.h
@@ -17,11 +17,10 @@ struct SkIRect;
class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
public:
CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap,
- int dither_bits,
FX_BOOL bRgbByteOrder,
CFX_DIBitmap* pOriDevice,
FX_BOOL bGroupKnockout);
- CFX_SkiaDeviceDriver(SkPictureRecorder* recorder);
+ explicit CFX_SkiaDeviceDriver(SkPictureRecorder* recorder);
CFX_SkiaDeviceDriver(int size_x, int size_y);
~CFX_SkiaDeviceDriver() override;
@@ -145,7 +144,6 @@ class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver {
CFX_DIBitmap* m_pOriDevice;
SkCanvas* m_pCanvas;
SkPictureRecorder* const m_pRecorder;
- int m_ditherBits;
FX_BOOL m_bRgbByteOrder;
FX_BOOL m_bGroupKnockout;
};