Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef gfx_SharedDIBWin_h__
7 #define gfx_SharedDIBWin_h__
9 #include <windows.h>
11 #include "SharedDIB.h"
13 namespace mozilla {
14 namespace gfx {
16 class SharedDIBWin : public SharedDIB
17 {
18 public:
19 SharedDIBWin();
20 ~SharedDIBWin();
22 // Allocate a new win32 dib section compatible with an hdc. The dib will
23 // be selected into the hdc on return.
24 nsresult Create(HDC aHdc, uint32_t aWidth, uint32_t aHeight,
25 bool aTransparent);
27 // Wrap a dib section around an existing shared memory object. aHandle should
28 // point to a section large enough for the dib's memory, otherwise this call
29 // will fail.
30 nsresult Attach(Handle aHandle, uint32_t aWidth, uint32_t aHeight,
31 bool aTransparent);
33 // Destroy or release resources associated with this dib.
34 nsresult Close();
36 // Return the HDC of the shared dib.
37 HDC GetHDC() { return mSharedHdc; }
39 // Return the bitmap bits.
40 void* GetBits() { return mBitmapBits; }
42 private:
43 HDC mSharedHdc;
44 HBITMAP mSharedBmp;
45 HGDIOBJ mOldObj;
46 void* mBitmapBits;
48 uint32_t SetupBitmapHeader(uint32_t aWidth, uint32_t aHeight,
49 bool aTransparent, BITMAPV4HEADER *aHeader);
50 nsresult SetupSurface(HDC aHdc, BITMAPV4HEADER *aHdr);
51 };
53 } // gfx
54 } // mozilla
56 #endif