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.
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 mozilla_gfx_SharedDIBSurface_h |
michael@0 | 7 | #define mozilla_gfx_SharedDIBSurface_h |
michael@0 | 8 | |
michael@0 | 9 | #include "gfxImageSurface.h" |
michael@0 | 10 | #include "SharedDIBWin.h" |
michael@0 | 11 | |
michael@0 | 12 | #include <windows.h> |
michael@0 | 13 | |
michael@0 | 14 | namespace mozilla { |
michael@0 | 15 | namespace gfx { |
michael@0 | 16 | |
michael@0 | 17 | /** |
michael@0 | 18 | * A SharedDIBSurface owns an underlying SharedDIBWin. |
michael@0 | 19 | */ |
michael@0 | 20 | class SharedDIBSurface : public gfxImageSurface |
michael@0 | 21 | { |
michael@0 | 22 | public: |
michael@0 | 23 | typedef base::SharedMemoryHandle Handle; |
michael@0 | 24 | |
michael@0 | 25 | SharedDIBSurface() { } |
michael@0 | 26 | ~SharedDIBSurface() { } |
michael@0 | 27 | |
michael@0 | 28 | /** |
michael@0 | 29 | * Create this image surface backed by shared memory. |
michael@0 | 30 | */ |
michael@0 | 31 | bool Create(HDC adc, uint32_t aWidth, uint32_t aHeight, bool aTransparent); |
michael@0 | 32 | |
michael@0 | 33 | /** |
michael@0 | 34 | * Attach this surface to shared memory from another process. |
michael@0 | 35 | */ |
michael@0 | 36 | bool Attach(Handle aHandle, uint32_t aWidth, uint32_t aHeight, |
michael@0 | 37 | bool aTransparent); |
michael@0 | 38 | |
michael@0 | 39 | /** |
michael@0 | 40 | * After drawing to a surface via GDI, GDI must be flushed before the bitmap |
michael@0 | 41 | * is valid. |
michael@0 | 42 | */ |
michael@0 | 43 | void Flush() { ::GdiFlush(); } |
michael@0 | 44 | |
michael@0 | 45 | HDC GetHDC() { return mSharedDIB.GetHDC(); } |
michael@0 | 46 | |
michael@0 | 47 | nsresult ShareToProcess(base::ProcessHandle aChildProcess, Handle* aChildHandle) { |
michael@0 | 48 | return mSharedDIB.ShareToProcess(aChildProcess, aChildHandle); |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | static bool IsSharedDIBSurface(gfxASurface* aSurface); |
michael@0 | 52 | |
michael@0 | 53 | private: |
michael@0 | 54 | SharedDIBWin mSharedDIB; |
michael@0 | 55 | |
michael@0 | 56 | void InitSurface(uint32_t aWidth, uint32_t aHeight, bool aTransparent); |
michael@0 | 57 | }; |
michael@0 | 58 | |
michael@0 | 59 | } // namespace gfx |
michael@0 | 60 | } // namespace mozilla |
michael@0 | 61 | |
michael@0 | 62 | #endif // mozilla_gfx_SharedDIBSurface_h |