summaryrefslogtreecommitdiff
path: root/core/fxge/win32/fx_win32_dib.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-06-14 17:21:14 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-14 17:21:14 -0700
commitf4bb580add3824196dc49cd7de2f7d051019ede8 (patch)
tree15c1db6fb7000330d48c105c66acf1d468ba56bd /core/fxge/win32/fx_win32_dib.cpp
parentee2abec93f22bd10522181dc0362f24d389fc66b (diff)
downloadpdfium-f4bb580add3824196dc49cd7de2f7d051019ede8.tar.xz
Make code compile with clang_use_chrome_plugin (part II)
This change contains files in core directory which were not covered in part I. This is part of the efforts to make PDFium code compilable by Clang chromium style plugins. The changes are mainly the following: -- move inline constructor/destructor of complex class/struct out-of-line; -- add constructor/destructor of complex class/struct if not explicitly defined; -- add explicit out-of-line copy constructor when needed; -- move inline virtual functions out-of-line; -- Properly mark virtual functions with 'override'; -- some minor cleanups; BUG=pdfium:469 Review-Url: https://codereview.chromium.org/2060913003
Diffstat (limited to 'core/fxge/win32/fx_win32_dib.cpp')
-rw-r--r--core/fxge/win32/fx_win32_dib.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/fxge/win32/fx_win32_dib.cpp b/core/fxge/win32/fx_win32_dib.cpp
index 7221d10536..0e79399357 100644
--- a/core/fxge/win32/fx_win32_dib.cpp
+++ b/core/fxge/win32/fx_win32_dib.cpp
@@ -51,6 +51,7 @@ CFX_ByteString CFX_WindowsDIB::GetBitmapInfo(const CFX_DIBitmap* pBitmap) {
result.ReleaseBuffer(len);
return result;
}
+
CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
LPVOID pData,
FX_BOOL bAlpha) {
@@ -97,21 +98,25 @@ CFX_DIBitmap* _FX_WindowsDIB_LoadFromBuf(BITMAPINFO* pbmi,
}
return pBitmap;
}
+
CFX_DIBitmap* CFX_WindowsDIB::LoadFromBuf(BITMAPINFO* pbmi, LPVOID pData) {
return _FX_WindowsDIB_LoadFromBuf(pbmi, pData, FALSE);
}
+
HBITMAP CFX_WindowsDIB::GetDDBitmap(const CFX_DIBitmap* pBitmap, HDC hDC) {
CFX_ByteString info = GetBitmapInfo(pBitmap);
return CreateDIBitmap(hDC, (BITMAPINFOHEADER*)info.c_str(), CBM_INIT,
pBitmap->GetBuffer(), (BITMAPINFO*)info.c_str(),
DIB_RGB_COLORS);
}
+
void GetBitmapSize(HBITMAP hBitmap, int& w, int& h) {
BITMAP bmp;
GetObject(hBitmap, sizeof bmp, &bmp);
w = bmp.bmWidth;
h = bmp.bmHeight;
}
+
CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename) {
CWin32Platform* pPlatform =
(CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
@@ -145,6 +150,11 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_WCHAR* filename) {
DeleteDC(hDC);
return pDIBitmap;
}
+
+CFX_DIBitmap* CFX_WindowsDIB::LoadFromFile(const FX_CHAR* filename) {
+ return LoadFromFile(CFX_WideString::FromLocal(filename).c_str());
+}
+
CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) {
CWin32Platform* pPlatform =
(CWin32Platform*)CFX_GEModule::Get()->GetPlatformData();
@@ -178,6 +188,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadDIBitmap(WINDIB_Open_Args_ args) {
DeleteDC(hDC);
return pDIBitmap;
}
+
CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC,
HBITMAP hBitmap,
uint32_t* pPalette,
@@ -259,6 +270,7 @@ CFX_DIBitmap* CFX_WindowsDIB::LoadFromDDB(HDC hDC,
}
return pDIBitmap;
}
+
CFX_WindowsDIB::CFX_WindowsDIB(HDC hDC, int width, int height) {
Create(width, height, FXDIB_Rgb, (uint8_t*)1);
BITMAPINFOHEADER bmih;
@@ -273,14 +285,17 @@ CFX_WindowsDIB::CFX_WindowsDIB(HDC hDC, int width, int height) {
m_hMemDC = CreateCompatibleDC(hDC);
m_hOldBitmap = (HBITMAP)SelectObject(m_hMemDC, m_hBitmap);
}
+
CFX_WindowsDIB::~CFX_WindowsDIB() {
SelectObject(m_hMemDC, m_hOldBitmap);
DeleteDC(m_hMemDC);
DeleteObject(m_hBitmap);
}
+
void CFX_WindowsDIB::LoadFromDevice(HDC hDC, int left, int top) {
::BitBlt(m_hMemDC, 0, 0, m_Width, m_Height, hDC, left, top, SRCCOPY);
}
+
void CFX_WindowsDIB::SetToDevice(HDC hDC, int left, int top) {
::BitBlt(hDC, left, top, m_Width, m_Height, m_hMemDC, 0, 0, SRCCOPY);
}