2010-07-29 15:38:32 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
// vim:set ts=2 sts=2 sw=2 et cin:
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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 http://mozilla.org/MPL/2.0/. */
|
2010-07-29 15:38:32 -07:00
|
|
|
|
2011-07-12 07:31:18 -07:00
|
|
|
#ifndef dom_plugins_PluginUtilsOSX_h
|
|
|
|
#define dom_plugins_PluginUtilsOSX_h 1
|
|
|
|
|
2010-07-29 15:38:32 -07:00
|
|
|
#include "npapi.h"
|
2011-05-19 14:08:14 -07:00
|
|
|
#include "nsRect.h"
|
2011-07-12 07:31:18 -07:00
|
|
|
#include "nsCoreAnimationSupport.h"
|
2010-07-29 15:38:32 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace plugins {
|
|
|
|
namespace PluginUtilsOSX {
|
|
|
|
|
2011-05-19 14:08:14 -07:00
|
|
|
// Need to call back into the browser's message loop to process event.
|
2010-07-29 15:38:32 -07:00
|
|
|
typedef void (*RemoteProcessEvents) (void*);
|
|
|
|
|
|
|
|
NPError ShowCocoaContextMenu(void* aMenu, int aX, int aY, void* pluginModule, RemoteProcessEvents remoteEvent);
|
|
|
|
|
|
|
|
void InvokeNativeEventLoop();
|
|
|
|
|
2011-05-19 14:08:14 -07:00
|
|
|
// Need to call back and send a cocoa draw event to the plugin.
|
|
|
|
typedef void (*DrawPluginFunc) (CGContextRef, void*, nsIntRect aUpdateRect);
|
|
|
|
|
|
|
|
void* GetCGLayer(DrawPluginFunc aFunc, void* aPluginInstance);
|
|
|
|
void ReleaseCGLayer(void* cgLayer);
|
|
|
|
void Repaint(void* cgLayer, nsIntRect aRect);
|
|
|
|
|
2010-08-15 20:02:38 -07:00
|
|
|
bool SetProcessName(const char* aProcessName);
|
2011-05-19 14:08:14 -07:00
|
|
|
|
2011-07-12 07:31:18 -07:00
|
|
|
/*
|
|
|
|
* Provides a wrapper around nsCARenderer to manage double buffering
|
|
|
|
* without having to unbind nsCARenderer on every surface swaps.
|
|
|
|
*
|
|
|
|
* The double buffer renderer begins with no initialize surfaces.
|
|
|
|
* The buffers can be initialized and cleared individually.
|
|
|
|
* Swapping still occurs regardless if the buffers are initialized.
|
|
|
|
*/
|
|
|
|
class THEBES_API nsDoubleBufferCARenderer {
|
|
|
|
public:
|
|
|
|
nsDoubleBufferCARenderer() : mCALayer(nsnull) {}
|
|
|
|
size_t GetFrontSurfaceWidth();
|
|
|
|
size_t GetFrontSurfaceHeight();
|
|
|
|
size_t GetBackSurfaceWidth();
|
|
|
|
size_t GetBackSurfaceHeight();
|
|
|
|
IOSurfaceID GetFrontSurfaceID();
|
|
|
|
|
|
|
|
bool HasBackSurface();
|
|
|
|
bool HasFrontSurface();
|
|
|
|
bool HasCALayer();
|
|
|
|
|
|
|
|
void SetCALayer(void *aCALayer);
|
2011-10-20 13:32:38 -07:00
|
|
|
bool InitFrontSurface(size_t aWidth, size_t aHeight, AllowOfflineRendererEnum aAllowOfflineRenderer);
|
2011-07-12 07:31:18 -07:00
|
|
|
void Render();
|
|
|
|
void SwapSurfaces();
|
|
|
|
void ClearFrontSurface();
|
|
|
|
void ClearBackSurface();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void *mCALayer;
|
2011-11-15 14:38:50 -08:00
|
|
|
nsRefPtr<nsCARenderer> mCARenderer;
|
2011-07-12 07:31:18 -07:00
|
|
|
nsRefPtr<nsIOSurface> mFrontSurface;
|
|
|
|
nsRefPtr<nsIOSurface> mBackSurface;
|
|
|
|
};
|
|
|
|
|
2010-07-29 15:38:32 -07:00
|
|
|
} // namespace PluginUtilsOSX
|
|
|
|
} // namespace plugins
|
|
|
|
} // namespace mozilla
|
2011-07-12 07:31:18 -07:00
|
|
|
|
|
|
|
#endif //dom_plugins_PluginUtilsOSX_h
|