author Ted Mielczarek <>
Mon, 23 Feb 2015 11:27:50 -0500
changeset 249276 6512200e17e21633a00ee5b27c66eb1ed2236c92
parent 106112 a16372ce30b5f6b747246b01fcd215a4bf3b6342
permissions -rw-r--r--
bug 1135700 - Import the Python requests module. r=gps

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#ifndef gfx_SharedDIBWin_h__
#define gfx_SharedDIBWin_h__

#include <windows.h>

#include "SharedDIB.h"

namespace mozilla {
namespace gfx {

class SharedDIBWin : public SharedDIB

  // Allocate a new win32 dib section compatible with an hdc. The dib will
  // be selected into the hdc on return.
  nsresult Create(HDC aHdc, uint32_t aWidth, uint32_t aHeight,
                  bool aTransparent);

  // Wrap a dib section around an existing shared memory object. aHandle should
  // point to a section large enough for the dib's memory, otherwise this call
  // will fail.
  nsresult Attach(Handle aHandle, uint32_t aWidth, uint32_t aHeight,
                  bool aTransparent);

  // Destroy or release resources associated with this dib.
  nsresult Close();

  // Return the HDC of the shared dib.
  HDC GetHDC() { return mSharedHdc; }

  // Return the bitmap bits.
  void* GetBits() { return mBitmapBits; }

  HDC                 mSharedHdc;
  HBITMAP             mSharedBmp;
  HGDIOBJ             mOldObj;
  void*               mBitmapBits;

  uint32_t SetupBitmapHeader(uint32_t aWidth, uint32_t aHeight,
                             bool aTransparent, BITMAPV4HEADER *aHeader);
  nsresult SetupSurface(HDC aHdc, BITMAPV4HEADER *aHdr);

} // gfx
} // mozilla