summaryrefslogtreecommitdiff
path: root/core/fxge/win32
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-07-19 16:06:10 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-19 16:06:10 -0700
commit8ca60b2cda3efc112c987c1d57d1eb8568667da9 (patch)
treeb9170a729249b4f4aa8751e2f713afed77fca15b /core/fxge/win32
parent5b36f0a0eff7f3666a0e642640db3c89e4bb6748 (diff)
downloadpdfium-8ca60b2cda3efc112c987c1d57d1eb8568667da9.tar.xz
Use smart pointers for various Jbig2 decoding contexts
Use unique_ptr for class owned member variables, and remove unnecessary or unused functions and member variable. BUG=pdfium:518 Review-Url: https://codereview.chromium.org/2149903002
Diffstat (limited to 'core/fxge/win32')
-rw-r--r--core/fxge/win32/fx_win32_dib.cpp82
1 files changed, 0 insertions, 82 deletions
diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp
index 0e79399357..ae28a3498f 100644
--- a/core/fxge/win32/fx_win32_dib.cpp
+++ b/core/fxge/win32/fx_win32_dib.cpp
@@ -189,88 +189,6 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) {
return pDIBitmap;
}
-CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC,
- HBITMAP hBitmap,
- uint32_t* pPalette,
- uint32_t palsize) {
- FX_BOOL bCreatedDC = !hDC;
- if (bCreatedDC) {
- hDC = CreateCompatibleDC(nullptr);
- }
- BITMAPINFOHEADER bmih;
- FXSYS_memset(&bmih, 0, sizeof bmih);
- bmih.biSize = sizeof bmih;
- GetDIBits(hDC, hBitmap, 0, 0, nullptr, (BITMAPINFO*)&bmih, DIB_RGB_COLORS);
- int width = bmih.biWidth;
- int height = abs(bmih.biHeight);
- bmih.biHeight = -height;
- bmih.biCompression = BI_RGB;
- CFX_DIBitmap* pDIBitmap = new CFX_DIBitmap;
- int ret = 0;
- if (bmih.biBitCount == 1 || bmih.biBitCount == 8) {
- int size = sizeof(BITMAPINFOHEADER) + 8;
- if (bmih.biBitCount == 8) {
- size += sizeof(uint32_t) * 254;
- }
- BITMAPINFO* pbmih = (BITMAPINFO*)FX_Alloc(uint8_t, size);
- pbmih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- pbmih->bmiHeader.biBitCount = bmih.biBitCount;
- pbmih->bmiHeader.biCompression = BI_RGB;
- pbmih->bmiHeader.biHeight = -height;
- pbmih->bmiHeader.biPlanes = 1;
- pbmih->bmiHeader.biWidth = bmih.biWidth;
- if (!pDIBitmap->Create(bmih.biWidth, height, bmih.biBitCount == 1
- ? FXDIB_1bppRgb
- : FXDIB_8bppRgb)) {
- delete pDIBitmap;
- FX_Free(pbmih);
- if (bCreatedDC) {
- DeleteDC(hDC);
- }
- return nullptr;
- }
- ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
- (BITMAPINFO*)pbmih, DIB_RGB_COLORS);
- FX_Free(pbmih);
- pbmih = nullptr;
- pDIBitmap->CopyPalette(pPalette, palsize);
- } else {
- if (bmih.biBitCount <= 24) {
- bmih.biBitCount = 24;
- } else {
- bmih.biBitCount = 32;
- }
- if (!pDIBitmap->Create(bmih.biWidth, height,
- bmih.biBitCount == 24 ? FXDIB_Rgb : FXDIB_Rgb32)) {
- delete pDIBitmap;
- if (bCreatedDC) {
- DeleteDC(hDC);
- }
- return nullptr;
- }
- ret = GetDIBits(hDC, hBitmap, 0, height, pDIBitmap->GetBuffer(),
- (BITMAPINFO*)&bmih, DIB_RGB_COLORS);
- if (ret != 0 && bmih.biBitCount == 32) {
- int pitch = pDIBitmap->GetPitch();
- for (int row = 0; row < height; row++) {
- uint8_t* dest_scan = (uint8_t*)(pDIBitmap->GetBuffer() + row * pitch);
- for (int col = 0; col < width; col++) {
- dest_scan[3] = 255;
- dest_scan += 4;
- }
- }
- }
- }
- if (ret == 0) {
- delete pDIBitmap;
- pDIBitmap = nullptr;
- }
- if (bCreatedDC) {
- DeleteDC(hDC);
- }
- return pDIBitmap;
-}
-
CFX_WindowsDIB::CFX_WindowsDIB(HDC hDC, int width, int height) {
Create(width, height, FXDIB_Rgb, (uint8_t*)1);
BITMAPINFOHEADER bmih;