gfx/ipc/SharedDIBWin.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/ipc/SharedDIBWin.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef gfx_SharedDIBWin_h__
    1.10 +#define gfx_SharedDIBWin_h__
    1.11 +
    1.12 +#include <windows.h>
    1.13 +
    1.14 +#include "SharedDIB.h"
    1.15 +
    1.16 +namespace mozilla {
    1.17 +namespace gfx {
    1.18 +
    1.19 +class SharedDIBWin : public SharedDIB
    1.20 +{
    1.21 +public:
    1.22 +  SharedDIBWin();
    1.23 +  ~SharedDIBWin();
    1.24 +
    1.25 +  // Allocate a new win32 dib section compatible with an hdc. The dib will
    1.26 +  // be selected into the hdc on return.
    1.27 +  nsresult Create(HDC aHdc, uint32_t aWidth, uint32_t aHeight,
    1.28 +                  bool aTransparent);
    1.29 +
    1.30 +  // Wrap a dib section around an existing shared memory object. aHandle should
    1.31 +  // point to a section large enough for the dib's memory, otherwise this call
    1.32 +  // will fail.
    1.33 +  nsresult Attach(Handle aHandle, uint32_t aWidth, uint32_t aHeight,
    1.34 +                  bool aTransparent);
    1.35 +
    1.36 +  // Destroy or release resources associated with this dib.
    1.37 +  nsresult Close();
    1.38 +
    1.39 +  // Return the HDC of the shared dib.
    1.40 +  HDC GetHDC() { return mSharedHdc; }
    1.41 +
    1.42 +  // Return the bitmap bits.
    1.43 +  void* GetBits() { return mBitmapBits; }
    1.44 +
    1.45 +private:
    1.46 +  HDC                 mSharedHdc;
    1.47 +  HBITMAP             mSharedBmp;
    1.48 +  HGDIOBJ             mOldObj;
    1.49 +  void*               mBitmapBits;
    1.50 +
    1.51 +  uint32_t SetupBitmapHeader(uint32_t aWidth, uint32_t aHeight,
    1.52 +                             bool aTransparent, BITMAPV4HEADER *aHeader);
    1.53 +  nsresult SetupSurface(HDC aHdc, BITMAPV4HEADER *aHdr);
    1.54 +};
    1.55 +
    1.56 +} // gfx
    1.57 +} // mozilla
    1.58 +
    1.59 +#endif

mercurial