gfx/ipc/SharedDIBWin.h

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial