Bug 724666 - Part 1: Refactor nsCoreAnimation support into azure QuartzSupport. r=jmuizelaar

--HG--
rename : gfx/thebes/nsIOSurface.h => gfx/2d/MacIOSurface.h
rename : gfx/thebes/nsCoreAnimationSupport.mm => gfx/2d/QuartzSupport.mm
This commit is contained in:
Benoit Girard 2012-07-31 11:11:57 -04:00
parent 8046ad34ee
commit d38270d473
16 changed files with 301 additions and 159 deletions

View File

@ -1495,18 +1495,22 @@ void nsPluginInstanceOwner::RenderCoreAnimation(CGContextRef aCGContext,
if (aWidth == 0 || aHeight == 0)
return;
if (!mCARenderer) {
mCARenderer = new nsCARenderer();
}
if (!mIOSurface ||
(mIOSurface->GetWidth() != (size_t)aWidth ||
mIOSurface->GetHeight() != (size_t)aHeight)) {
mIOSurface = nullptr;
// If the renderer is backed by an IOSurface, resize it as required.
mIOSurface = nsIOSurface::CreateIOSurface(aWidth, aHeight);
mIOSurface = MacIOSurface::CreateIOSurface(aWidth, aHeight);
if (mIOSurface) {
nsRefPtr<nsIOSurface> attachSurface = nsIOSurface::LookupSurface(
RefPtr<MacIOSurface> attachSurface = MacIOSurface::LookupSurface(
mIOSurface->GetIOSurfaceID());
if (attachSurface) {
mCARenderer.AttachIOSurface(attachSurface);
mCARenderer->AttachIOSurface(attachSurface);
} else {
NS_ERROR("IOSurface attachment failed");
mIOSurface = nullptr;
@ -1518,7 +1522,7 @@ void nsPluginInstanceOwner::RenderCoreAnimation(CGContextRef aCGContext,
mColorProfile = CreateSystemColorSpace();
}
if (mCARenderer.isInit() == false) {
if (mCARenderer->isInit() == false) {
void *caLayer = NULL;
nsresult rv = mInstance->GetValueFromPlugin(NPPVpluginCoreAnimationLayer, &caLayer);
if (NS_FAILED(rv) || !caLayer) {
@ -1527,7 +1531,7 @@ void nsPluginInstanceOwner::RenderCoreAnimation(CGContextRef aCGContext,
// We don't run Flash in-process so we can unconditionally disallow
// the offliner renderer.
mCARenderer.SetupRenderer(caLayer, aWidth, aHeight, DISALLOW_OFFLINE_RENDERER);
mCARenderer->SetupRenderer(caLayer, aWidth, aHeight, DISALLOW_OFFLINE_RENDERER);
// Setting up the CALayer requires resetting the painting otherwise we
// get garbage for the first few frames.
@ -1536,7 +1540,7 @@ void nsPluginInstanceOwner::RenderCoreAnimation(CGContextRef aCGContext,
}
CGImageRef caImage = NULL;
nsresult rt = mCARenderer.Render(aWidth, aHeight, &caImage);
nsresult rt = mCARenderer->Render(aWidth, aHeight, &caImage);
if (rt == NS_OK && mIOSurface && mColorProfile) {
nsCARenderer::DrawSurfaceToCGContext(aCGContext, mIOSurface, mColorProfile,
0, 0, aWidth, aHeight);

View File

@ -26,7 +26,7 @@
#endif
#ifdef XP_MACOSX
#include "nsCoreAnimationSupport.h"
#include "mozilla/gfx/QuartzSupport.h"
#include <ApplicationServices/ApplicationServices.h>
#endif
@ -305,8 +305,8 @@ private:
NP_Port mQDPluginPortCopy;
#endif
PRInt32 mInCGPaintLevel;
nsRefPtr<nsIOSurface> mIOSurface;
nsCARenderer mCARenderer;
mozilla::RefPtr<MacIOSurface> mIOSurface;
mozilla::RefPtr<nsCARenderer> mCARenderer;
CGColorSpaceRef mColorProfile;
static nsCOMPtr<nsITimer> *sCATimer;
static nsTArray<nsPluginInstanceOwner*> *sCARefreshListeners;

View File

@ -906,16 +906,20 @@ PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
PaintTracker pt;
NPCocoaEvent evcopy = event.event;
nsRefPtr<nsIOSurface> surf = nsIOSurface::LookupSurface(surfaceid);
RefPtr<MacIOSurface> surf = MacIOSurface::LookupSurface(surfaceid);
if (!surf) {
NS_ERROR("Invalid IOSurface.");
*handled = false;
return false;
}
if (!mCARenderer) {
mCARenderer = new nsCARenderer();
}
if (evcopy.type == NPCocoaEventDrawRect) {
mCARenderer.AttachIOSurface(surf);
if (!mCARenderer.isInit()) {
mCARenderer->AttachIOSurface(surf);
if (!mCARenderer->isInit()) {
void *caLayer = nullptr;
NPError result = mPluginIface->getvalue(GetNPP(),
NPPVpluginCoreAnimationLayer,
@ -928,7 +932,7 @@ PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
return false;
}
mCARenderer.SetupRenderer(caLayer, mWindow.width, mWindow.height,
mCARenderer->SetupRenderer(caLayer, mWindow.width, mWindow.height,
GetQuirks() & PluginModuleChild::QUIRK_ALLOW_OFFLINE_RENDERER ?
ALLOW_OFFLINE_RENDERER : DISALLOW_OFFLINE_RENDERER);
@ -943,7 +947,7 @@ PluginInstanceChild::AnswerNPP_HandleEvent_IOSurface(const NPRemoteEvent& event,
return false;
}
mCARenderer.Render(mWindow.width, mWindow.height, nullptr);
mCARenderer->Render(mWindow.width, mWindow.height, nullptr);
return true;

View File

@ -17,7 +17,7 @@
#include "mozilla/gfx/SharedDIBWin.h"
#elif defined(MOZ_WIDGET_COCOA)
#include "PluginUtilsOSX.h"
#include "nsCoreAnimationSupport.h"
#include "mozilla/gfx/QuartzSupport.h"
#include "base/timer.h"
using namespace mozilla::plugins::PluginUtilsOSX;
@ -420,15 +420,15 @@ private:
#if defined(MOZ_WIDGET_COCOA)
private:
#if defined(__i386__)
NPEventModel mEventModel;
NPEventModel mEventModel;
#endif
CGColorSpaceRef mShColorSpace;
CGContextRef mShContext;
nsCARenderer mCARenderer;
void *mCGLayer;
CGColorSpaceRef mShColorSpace;
CGContextRef mShContext;
mozilla::RefPtr<nsCARenderer> mCARenderer;
void *mCGLayer;
// Core Animation drawing model requires a refresh timer.
uint32_t mCARefreshTimer;
uint32_t mCARefreshTimer;
public:
const NPCocoaEvent* getCurrentEvent() {

View File

@ -591,7 +591,7 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect,
else if (newSurface.type() == SurfaceDescriptor::TIOSurfaceDescriptor) {
IOSurfaceDescriptor iodesc = newSurface.get_IOSurfaceDescriptor();
nsRefPtr<nsIOSurface> newIOSurface = nsIOSurface::LookupSurface(iodesc.surfaceId());
RefPtr<MacIOSurface> newIOSurface = MacIOSurface::LookupSurface(iodesc.surfaceId());
if (!newIOSurface) {
NS_WARNING("Got bad IOSurfaceDescriptor in RecvShow");
@ -709,7 +709,7 @@ nsresult
PluginInstanceParent::GetImageContainer(ImageContainer** aContainer)
{
#ifdef XP_MACOSX
nsIOSurface* ioSurface = NULL;
MacIOSurface* ioSurface = NULL;
if (mFrontIOSurface) {
ioSurface = mFrontIOSurface;
@ -1019,7 +1019,7 @@ PluginInstanceParent::NPP_SetWindow(const NPWindow* aWindow)
if (mShWidth != window.width || mShHeight != window.height) {
if (mDrawingModel == NPDrawingModelCoreAnimation ||
mDrawingModel == NPDrawingModelInvalidatingCoreAnimation) {
mIOSurface = nsIOSurface::CreateIOSurface(window.width, window.height);
mIOSurface = MacIOSurface::CreateIOSurface(window.width, window.height);
} else if (mShWidth * mShHeight != window.width * window.height) {
if (mShWidth != 0 && mShHeight != 0) {
DeallocShmem(mShSurface);

View File

@ -14,7 +14,7 @@
#include <d3d10_1.h>
#include "nsRefPtrHashtable.h"
#elif defined(MOZ_WIDGET_COCOA)
#include "nsCoreAnimationSupport.h"
#include "mozilla/gfx/QuartzSupport.h"
#endif
#include "npfunctions.h"
@ -346,8 +346,8 @@ private:
uint16_t mShWidth;
uint16_t mShHeight;
CGColorSpaceRef mShColorSpace;
nsRefPtr<nsIOSurface> mIOSurface;
nsRefPtr<nsIOSurface> mFrontIOSurface;
RefPtr<MacIOSurface> mIOSurface;
RefPtr<MacIOSurface> mFrontIOSurface;
#endif // definied(MOZ_WIDGET_COCOA)
// ObjectFrame layer wrapper

View File

@ -9,7 +9,7 @@
#include "npapi.h"
#include "nsRect.h"
#include "nsCoreAnimationSupport.h"
#include "mozilla/gfx/QuartzSupport.h"
namespace mozilla {
namespace plugins {
@ -61,9 +61,9 @@ public:
private:
void *mCALayer;
nsRefPtr<nsCARenderer> mCARenderer;
nsRefPtr<nsIOSurface> mFrontSurface;
nsRefPtr<nsIOSurface> mBackSurface;
RefPtr<nsCARenderer> mCARenderer;
RefPtr<MacIOSurface> mFrontSurface;
RefPtr<MacIOSurface> mBackSurface;
};
} // namespace PluginUtilsOSX

View File

@ -310,7 +310,7 @@ bool nsDoubleBufferCARenderer::InitFrontSurface(size_t aWidth, size_t aHeight,
return false;
}
mFrontSurface = nsIOSurface::CreateIOSurface(aWidth, aHeight);
mFrontSurface = MacIOSurface::CreateIOSurface(aWidth, aHeight);
if (!mFrontSurface) {
mCARenderer = nullptr;
return false;
@ -351,7 +351,7 @@ void nsDoubleBufferCARenderer::Render() {
}
void nsDoubleBufferCARenderer::SwapSurfaces() {
nsRefPtr<nsIOSurface> prevFrontSurface = mFrontSurface;
RefPtr<MacIOSurface> prevFrontSurface = mFrontSurface;
mFrontSurface = mBackSurface;
mBackSurface = prevFrontSurface;

View File

@ -4,27 +4,32 @@
* 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/. */
#ifndef nsIOSurface_h__
#define nsIOSurface_h__
#ifndef MacIOSurface_h__
#define MacIOSurface_h__
#ifdef XP_MACOSX
#import <OpenGL/OpenGL.h>
#include "2D.h"
#include "mozilla/RefPtr.h"
class gfxASurface;
struct _CGLContextObject;
typedef _CGLContextObject* CGLContextObj;
typedef struct CGContext* CGContextRef;
typedef struct CGImage* CGImageRef;
typedef uint32_t IOSurfaceID;
class THEBES_API nsIOSurface {
NS_INLINE_DECL_REFCOUNTING(nsIOSurface)
class MacIOSurface : public mozilla::RefCounted<MacIOSurface> {
public:
static already_AddRefed<nsIOSurface> CreateIOSurface(int aWidth, int aHeight);
static void ReleaseIOSurface(nsIOSurface *aIOSurface);
static already_AddRefed<nsIOSurface> LookupSurface(IOSurfaceID aSurfaceID);
typedef mozilla::gfx::SourceSurface SourceSurface;
nsIOSurface(const void *aIOSurfacePtr) : mIOSurfacePtr(aIOSurfacePtr) {}
~nsIOSurface();
static mozilla::TemporaryRef<MacIOSurface> CreateIOSurface(int aWidth, int aHeight);
static void ReleaseIOSurface(MacIOSurface *aIOSurface);
static mozilla::TemporaryRef<MacIOSurface> LookupSurface(IOSurfaceID aSurfaceID);
MacIOSurface(const void *aIOSurfacePtr) : mIOSurfacePtr(aIOSurfacePtr) {}
~MacIOSurface();
IOSurfaceID GetIOSurfaceID();
void *GetBaseAddress();
size_t GetWidth();
@ -37,7 +42,13 @@ public:
CGLError CGLTexImageIOSurface2D(void *ctxt,
GLenum internalFormat, GLenum format,
GLenum type, GLuint plane);
already_AddRefed<gfxASurface> GetAsSurface();
mozilla::TemporaryRef<SourceSurface> GetAsSurface();
CGContextRef CreateIOSurfaceContext();
// FIXME This doesn't really belong here
static CGImageRef CreateImageFromIOSurfaceContext(CGContextRef aContext);
static mozilla::TemporaryRef<MacIOSurface> IOSurfaceContextGetSurface(CGContextRef aContext);
private:
friend class nsCARenderer;
const void* mIOSurfacePtr;

View File

@ -10,10 +10,9 @@
#import <OpenGL/OpenGL.h>
#import "ApplicationServices/ApplicationServices.h"
#include "nscore.h"
#include "gfxTypes.h"
#include "nsAutoPtr.h"
#include "nsIOSurface.h"
#include "mozilla/RefPtr.h"
#include "mozilla/gfx/MacIOSurface.h"
// Get the system color space.
CGColorSpaceRef THEBES_API CreateSystemColorSpace();
@ -24,11 +23,10 @@ struct _CGLContextObject;
enum AllowOfflineRendererEnum { ALLOW_OFFLINE_RENDERER, DISALLOW_OFFLINE_RENDERER };
class THEBES_API nsCARenderer {
NS_INLINE_DECL_REFCOUNTING(nsCARenderer)
class nsCARenderer : public mozilla::RefCounted<nsCARenderer> {
public:
nsCARenderer() : mCARenderer(nullptr), mFBOTexture(0), mOpenGLContext(nullptr),
mCGImage(nullptr), mCGData(nullptr), mIOSurface(nullptr), mFBO(0),
nsCARenderer() : mCARenderer(nsnull), mFBOTexture(0), mOpenGLContext(nsnull),
mCGImage(nsnull), mCGData(nsnull), mIOSurface(nsnull), mFBO(0),
mIOTexture(0),
mUnsupportedWidth(UINT32_MAX), mUnsupportedHeight(UINT32_MAX),
mAllowOfflineRenderer(DISALLOW_OFFLINE_RENDERER) {}
@ -36,16 +34,16 @@ public:
nsresult SetupRenderer(void* aCALayer, int aWidth, int aHeight,
AllowOfflineRendererEnum aAllowOfflineRenderer);
nsresult Render(int aWidth, int aHeight, CGImageRef *aOutCAImage);
bool isInit() { return mCARenderer != nullptr; }
bool isInit() { return mCARenderer != nsnull; }
/*
* Render the CALayer to an IOSurface. If no IOSurface
* is attached then an internal pixel buffer will be
* used.
*/
void AttachIOSurface(nsRefPtr<nsIOSurface> aSurface);
void AttachIOSurface(mozilla::RefPtr<MacIOSurface> aSurface);
IOSurfaceID GetIOSurfaceID();
static nsresult DrawSurfaceToCGContext(CGContextRef aContext,
nsIOSurface *surf,
MacIOSurface *surf,
CGColorSpaceRef aColorSpace,
int aX, int aY,
size_t aWidth, size_t aHeight);
@ -55,7 +53,7 @@ public:
void DettachCALayer();
void AttachCALayer(void *aCALayer);
#ifdef DEBUG
static void SaveToDisk(nsIOSurface *surf);
static void SaveToDisk(MacIOSurface *surf);
#endif
private:
void SetBounds(int aWidth, int aHeight);
@ -67,7 +65,7 @@ private:
_CGLContextObject *mOpenGLContext;
CGImageRef mCGImage;
void *mCGData;
nsRefPtr<nsIOSurface> mIOSurface;
mozilla::RefPtr<MacIOSurface> mIOSurface;
uint32_t mFBO;
uint32_t mIOTexture;
uint32_t mUnsupportedWidth;
@ -75,6 +73,15 @@ private:
AllowOfflineRendererEnum mAllowOfflineRenderer;
};
enum CGContextType {
CG_CONTEXT_TYPE_UNKNOWN = 0,
// These are found by inspection, it's possible they could be changed
CG_CONTEXT_TYPE_BITMAP = 4,
CG_CONTEXT_TYPE_IOSURFACE = 8
};
CGContextType GetContextType(CGContextRef ref);
#endif // XP_MACOSX
#endif // nsCoreAnimationSupport_h__

View File

@ -4,7 +4,7 @@
* 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/. */
#include "nsCoreAnimationSupport.h"
#include "QuartzSupport.h"
#include "nsDebug.h"
#import <QuartzCore/QuartzCore.h>
@ -15,7 +15,11 @@
"/System/Library/Frameworks/IOSurface.framework/IOSurface"
#define OPENGL_FRAMEWORK_PATH \
"/System/Library/Frameworks/OpenGL.framework/OpenGL"
#define COREGRAPHICS_FRAMEWORK_PATH \
"/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/CoreGraphics"
using mozilla::RefPtr;
using mozilla::TemporaryRef;
// IOSurface signatures
typedef CFTypeRef IOSurfacePtr;
@ -37,6 +41,12 @@ typedef CGLError (*CGLTexImageIOSurface2DFunc) (CGLContextObj ctxt,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
IOSurfacePtr ioSurface, GLuint plane);
typedef CGContextRef (*IOSurfaceContextCreateFunc)(CFTypeRef io_surface,
unsigned width, unsigned height,
unsigned bitsPerComponent, unsigned bytes,
CGColorSpaceRef colorSpace, CGBitmapInfo bitmapInfo);
typedef CGImageRef (*IOSurfaceContextCreateImageFunc)(CGContextRef ref);
typedef IOSurfacePtr (*IOSurfaceContextGetSurfaceFunc)(CGContextRef ref);
#define GET_CONST(const_name) \
((CFStringRef*) dlsym(sIOSurfaceFramework, const_name))
@ -44,11 +54,14 @@ typedef CGLError (*CGLTexImageIOSurface2DFunc) (CGLContextObj ctxt,
(typeof(dest)) dlsym(sIOSurfaceFramework, sym_name)
#define GET_CGLSYM(dest,sym_name) \
(typeof(dest)) dlsym(sOpenGLFramework, sym_name)
#define GET_CGSYM(dest,sym_name) \
(typeof(dest)) dlsym(sCoreGraphicsFramework, sym_name)
class nsIOSurfaceLib: public nsIOSurface {
class MacIOSurfaceLib: public MacIOSurface {
public:
static void *sIOSurfaceFramework;
static void *sOpenGLFramework;
static void *sCoreGraphicsFramework;
static bool isLoaded;
static IOSurfaceCreateFunc sCreate;
static IOSurfaceGetIDFunc sGetID;
@ -60,6 +73,9 @@ public:
static IOSurfaceGetHeightFunc sHeight;
static IOSurfaceGetBytesPerRowFunc sBytesPerRow;
static CGLTexImageIOSurface2DFunc sTexImage;
static IOSurfaceContextCreateFunc sIOSurfaceContextCreate;
static IOSurfaceContextCreateImageFunc sIOSurfaceContextCreateImage;
static IOSurfaceContextGetSurfaceFunc sIOSurfaceContextGetSurface;
static CFStringRef kPropWidth;
static CFStringRef kPropHeight;
static CFStringRef kPropBytesPerElem;
@ -84,6 +100,13 @@ public:
GLsizei width, GLsizei height,
GLenum format, GLenum type,
IOSurfacePtr ioSurface, GLuint plane);
static CGContextRef IOSurfaceContextCreate(IOSurfacePtr aIOSurfacePtr,
unsigned aWidth, unsigned aHeight,
unsigned aBitsPerCompoent, unsigned aBytes,
CGColorSpaceRef aColorSpace, CGBitmapInfo bitmapInfo);
static CGImageRef IOSurfaceContextCreateImage(CGContextRef ref);
static IOSurfacePtr IOSurfaceContextGetSurface(CGContextRef ref);
static unsigned int (*sCGContextGetTypePtr) (CGContextRef);
static void LoadLibrary();
static void CloseLibrary();
@ -96,76 +119,82 @@ public:
} sLibraryUnloader;
};
nsIOSurfaceLib::LibraryUnloader nsIOSurfaceLib::sLibraryUnloader;
bool nsIOSurfaceLib::isLoaded = false;
void* nsIOSurfaceLib::sIOSurfaceFramework;
void* nsIOSurfaceLib::sOpenGLFramework;
IOSurfaceCreateFunc nsIOSurfaceLib::sCreate;
IOSurfaceGetIDFunc nsIOSurfaceLib::sGetID;
IOSurfaceLookupFunc nsIOSurfaceLib::sLookup;
IOSurfaceGetBaseAddressFunc nsIOSurfaceLib::sGetBaseAddress;
IOSurfaceGetHeightFunc nsIOSurfaceLib::sWidth;
IOSurfaceGetWidthFunc nsIOSurfaceLib::sHeight;
IOSurfaceGetBytesPerRowFunc nsIOSurfaceLib::sBytesPerRow;
IOSurfaceLockFunc nsIOSurfaceLib::sLock;
IOSurfaceUnlockFunc nsIOSurfaceLib::sUnlock;
CGLTexImageIOSurface2DFunc nsIOSurfaceLib::sTexImage;
CFStringRef nsIOSurfaceLib::kPropWidth;
CFStringRef nsIOSurfaceLib::kPropHeight;
CFStringRef nsIOSurfaceLib::kPropBytesPerElem;
CFStringRef nsIOSurfaceLib::kPropBytesPerRow;
CFStringRef nsIOSurfaceLib::kPropIsGlobal;
MacIOSurfaceLib::LibraryUnloader MacIOSurfaceLib::sLibraryUnloader;
bool MacIOSurfaceLib::isLoaded = false;
void* MacIOSurfaceLib::sIOSurfaceFramework;
void* MacIOSurfaceLib::sOpenGLFramework;
void* MacIOSurfaceLib::sCoreGraphicsFramework;
IOSurfaceCreateFunc MacIOSurfaceLib::sCreate;
IOSurfaceGetIDFunc MacIOSurfaceLib::sGetID;
IOSurfaceLookupFunc MacIOSurfaceLib::sLookup;
IOSurfaceGetBaseAddressFunc MacIOSurfaceLib::sGetBaseAddress;
IOSurfaceGetHeightFunc MacIOSurfaceLib::sWidth;
IOSurfaceGetWidthFunc MacIOSurfaceLib::sHeight;
IOSurfaceGetBytesPerRowFunc MacIOSurfaceLib::sBytesPerRow;
IOSurfaceLockFunc MacIOSurfaceLib::sLock;
IOSurfaceUnlockFunc MacIOSurfaceLib::sUnlock;
CGLTexImageIOSurface2DFunc MacIOSurfaceLib::sTexImage;
IOSurfaceContextCreateFunc MacIOSurfaceLib::sIOSurfaceContextCreate;
IOSurfaceContextCreateImageFunc MacIOSurfaceLib::sIOSurfaceContextCreateImage;
IOSurfaceContextGetSurfaceFunc MacIOSurfaceLib::sIOSurfaceContextGetSurface;
unsigned int (*MacIOSurfaceLib::sCGContextGetTypePtr) (CGContextRef) = NULL;
bool nsIOSurfaceLib::isInit() {
CFStringRef MacIOSurfaceLib::kPropWidth;
CFStringRef MacIOSurfaceLib::kPropHeight;
CFStringRef MacIOSurfaceLib::kPropBytesPerElem;
CFStringRef MacIOSurfaceLib::kPropBytesPerRow;
CFStringRef MacIOSurfaceLib::kPropIsGlobal;
bool MacIOSurfaceLib::isInit() {
// Guard against trying to reload the library
// if it is not available.
if (!isLoaded)
LoadLibrary();
if (!sIOSurfaceFramework) {
NS_ERROR("nsIOSurfaceLib failed to initialize");
NS_ERROR("MacIOSurfaceLib failed to initialize");
}
return sIOSurfaceFramework;
}
IOSurfacePtr nsIOSurfaceLib::IOSurfaceCreate(CFDictionaryRef properties) {
IOSurfacePtr MacIOSurfaceLib::IOSurfaceCreate(CFDictionaryRef properties) {
return sCreate(properties);
}
IOSurfacePtr nsIOSurfaceLib::IOSurfaceLookup(IOSurfaceID aIOSurfaceID) {
IOSurfacePtr MacIOSurfaceLib::IOSurfaceLookup(IOSurfaceID aIOSurfaceID) {
return sLookup(aIOSurfaceID);
}
IOSurfaceID nsIOSurfaceLib::IOSurfaceGetID(IOSurfacePtr aIOSurfacePtr) {
IOSurfaceID MacIOSurfaceLib::IOSurfaceGetID(IOSurfacePtr aIOSurfacePtr) {
return sGetID(aIOSurfacePtr);
}
void* nsIOSurfaceLib::IOSurfaceGetBaseAddress(IOSurfacePtr aIOSurfacePtr) {
void* MacIOSurfaceLib::IOSurfaceGetBaseAddress(IOSurfacePtr aIOSurfacePtr) {
return sGetBaseAddress(aIOSurfacePtr);
}
size_t nsIOSurfaceLib::IOSurfaceGetWidth(IOSurfacePtr aIOSurfacePtr) {
size_t MacIOSurfaceLib::IOSurfaceGetWidth(IOSurfacePtr aIOSurfacePtr) {
return sWidth(aIOSurfacePtr);
}
size_t nsIOSurfaceLib::IOSurfaceGetHeight(IOSurfacePtr aIOSurfacePtr) {
size_t MacIOSurfaceLib::IOSurfaceGetHeight(IOSurfacePtr aIOSurfacePtr) {
return sHeight(aIOSurfacePtr);
}
size_t nsIOSurfaceLib::IOSurfaceGetBytesPerRow(IOSurfacePtr aIOSurfacePtr) {
size_t MacIOSurfaceLib::IOSurfaceGetBytesPerRow(IOSurfacePtr aIOSurfacePtr) {
return sBytesPerRow(aIOSurfacePtr);
}
IOReturn nsIOSurfaceLib::IOSurfaceLock(IOSurfacePtr aIOSurfacePtr,
IOReturn MacIOSurfaceLib::IOSurfaceLock(IOSurfacePtr aIOSurfacePtr,
uint32_t options, uint32_t *seed) {
return sLock(aIOSurfacePtr, options, seed);
}
IOReturn nsIOSurfaceLib::IOSurfaceUnlock(IOSurfacePtr aIOSurfacePtr,
IOReturn MacIOSurfaceLib::IOSurfaceUnlock(IOSurfacePtr aIOSurfacePtr,
uint32_t options, uint32_t *seed) {
return sUnlock(aIOSurfacePtr, options, seed);
}
CGLError nsIOSurfaceLib::CGLTexImageIOSurface2D(CGLContextObj ctxt,
CGLError MacIOSurfaceLib::CGLTexImageIOSurface2D(CGLContextObj ctxt,
GLenum target, GLenum internalFormat,
GLsizei width, GLsizei height,
GLenum format, GLenum type,
@ -174,7 +203,28 @@ CGLError nsIOSurfaceLib::CGLTexImageIOSurface2D(CGLContextObj ctxt,
format, type, ioSurface, plane);
}
CFStringRef nsIOSurfaceLib::GetIOConst(const char* symbole) {
CGContextRef MacIOSurfaceLib::IOSurfaceContextCreate(IOSurfacePtr aIOSurfacePtr,
unsigned aWidth, unsigned aHeight,
unsigned aBitsPerComponent, unsigned aBytes,
CGColorSpaceRef aColorSpace, CGBitmapInfo bitmapInfo) {
if (!sIOSurfaceContextCreate)
return NULL;
return sIOSurfaceContextCreate(aIOSurfacePtr, aWidth, aHeight, aBitsPerComponent, aBytes, aColorSpace, bitmapInfo);
}
CGImageRef MacIOSurfaceLib::IOSurfaceContextCreateImage(CGContextRef aContext) {
if (!sIOSurfaceContextCreateImage)
return NULL;
return sIOSurfaceContextCreateImage(aContext);
}
IOSurfacePtr MacIOSurfaceLib::IOSurfaceContextGetSurface(CGContextRef aContext) {
if (!sIOSurfaceContextGetSurface)
return NULL;
return sIOSurfaceContextGetSurface(aContext);
}
CFStringRef MacIOSurfaceLib::GetIOConst(const char* symbole) {
CFStringRef *address = (CFStringRef*)dlsym(sIOSurfaceFramework, symbole);
if (!address)
return nullptr;
@ -182,21 +232,28 @@ CFStringRef nsIOSurfaceLib::GetIOConst(const char* symbole) {
return *address;
}
void nsIOSurfaceLib::LoadLibrary() {
void MacIOSurfaceLib::LoadLibrary() {
if (isLoaded) {
return;
}
isLoaded = true;
sIOSurfaceFramework = dlopen(IOSURFACE_FRAMEWORK_PATH,
sIOSurfaceFramework = dlopen(IOSURFACE_FRAMEWORK_PATH,
RTLD_LAZY | RTLD_LOCAL);
sOpenGLFramework = dlopen(OPENGL_FRAMEWORK_PATH,
sOpenGLFramework = dlopen(OPENGL_FRAMEWORK_PATH,
RTLD_LAZY | RTLD_LOCAL);
if (!sIOSurfaceFramework) {
return;
}
if (!sOpenGLFramework) {
dlclose(sIOSurfaceFramework);
sIOSurfaceFramework = nullptr;
sCoreGraphicsFramework = dlopen(COREGRAPHICS_FRAMEWORK_PATH,
RTLD_LAZY | RTLD_LOCAL);
if (!sIOSurfaceFramework || !sOpenGLFramework || !sCoreGraphicsFramework) {
if (sIOSurfaceFramework)
dlclose(sIOSurfaceFramework);
if (sOpenGLFramework)
dlclose(sOpenGLFramework);
if (sCoreGraphicsFramework)
dlclose(sCoreGraphicsFramework);
sIOSurfaceFramework = nsnull;
sOpenGLFramework = nsnull;
sCoreGraphicsFramework = nsnull;
return;
}
@ -215,6 +272,12 @@ void nsIOSurfaceLib::LoadLibrary() {
sUnlock = GET_IOSYM(sUnlock, "IOSurfaceUnlock");
sGetBaseAddress = GET_IOSYM(sGetBaseAddress, "IOSurfaceGetBaseAddress");
sTexImage = GET_CGLSYM(sTexImage, "CGLTexImageIOSurface2D");
sCGContextGetTypePtr = (unsigned int (*)(CGContext*))dlsym(RTLD_DEFAULT, "CGContextGetType");
// Optional symbols
sIOSurfaceContextCreate = GET_CGSYM(sIOSurfaceContextCreate, "CGIOSurfaceContextCreate");
sIOSurfaceContextCreateImage = GET_CGSYM(sIOSurfaceContextCreateImage, "CGIOSurfaceContextCreateImage");
sIOSurfaceContextGetSurface = GET_CGSYM(sIOSurfaceContextGetSurface, "CGIOSurfaceContextGetSurface");
if (!sCreate || !sGetID || !sLookup || !sTexImage || !sGetBaseAddress ||
!kPropWidth || !kPropHeight || !kPropBytesPerElem || !kPropIsGlobal ||
@ -224,7 +287,7 @@ void nsIOSurfaceLib::LoadLibrary() {
}
}
void nsIOSurfaceLib::CloseLibrary() {
void MacIOSurfaceLib::CloseLibrary() {
if (sIOSurfaceFramework) {
dlclose(sIOSurfaceFramework);
}
@ -235,12 +298,12 @@ void nsIOSurfaceLib::CloseLibrary() {
sOpenGLFramework = nullptr;
}
nsIOSurface::~nsIOSurface() {
MacIOSurface::~MacIOSurface() {
CFRelease(mIOSurfacePtr);
}
already_AddRefed<nsIOSurface> nsIOSurface::CreateIOSurface(int aWidth, int aHeight) {
if (!nsIOSurfaceLib::isInit())
TemporaryRef<MacIOSurface> MacIOSurface::CreateIOSurface(int aWidth, int aHeight) {
if (!MacIOSurfaceLib::isInit())
return nullptr;
CFMutableDictionaryRef props = ::CFDictionaryCreateMutable(
@ -254,25 +317,25 @@ already_AddRefed<nsIOSurface> nsIOSurface::CreateIOSurface(int aWidth, int aHeig
CFNumberRef cfWidth = ::CFNumberCreate(NULL, kCFNumberSInt32Type, &aWidth);
CFNumberRef cfHeight = ::CFNumberCreate(NULL, kCFNumberSInt32Type, &aHeight);
CFNumberRef cfBytesPerElem = ::CFNumberCreate(NULL, kCFNumberSInt32Type, &bytesPerElem);
::CFDictionaryAddValue(props, nsIOSurfaceLib::kPropWidth,
::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropWidth,
cfWidth);
::CFRelease(cfWidth);
::CFDictionaryAddValue(props, nsIOSurfaceLib::kPropHeight,
::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropHeight,
cfHeight);
::CFRelease(cfHeight);
::CFDictionaryAddValue(props, nsIOSurfaceLib::kPropBytesPerElem,
::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropBytesPerElem,
cfBytesPerElem);
::CFRelease(cfBytesPerElem);
::CFDictionaryAddValue(props, nsIOSurfaceLib::kPropIsGlobal,
::CFDictionaryAddValue(props, MacIOSurfaceLib::kPropIsGlobal,
kCFBooleanTrue);
IOSurfacePtr surfaceRef = nsIOSurfaceLib::IOSurfaceCreate(props);
IOSurfacePtr surfaceRef = MacIOSurfaceLib::IOSurfaceCreate(props);
::CFRelease(props);
if (!surfaceRef)
return nullptr;
nsRefPtr<nsIOSurface> ioSurface = new nsIOSurface(surfaceRef);
RefPtr<MacIOSurface> ioSurface = new MacIOSurface(surfaceRef);
if (!ioSurface) {
::CFRelease(surfaceRef);
return nullptr;
@ -281,15 +344,15 @@ already_AddRefed<nsIOSurface> nsIOSurface::CreateIOSurface(int aWidth, int aHeig
return ioSurface.forget();
}
already_AddRefed<nsIOSurface> nsIOSurface::LookupSurface(IOSurfaceID aIOSurfaceID) {
if (!nsIOSurfaceLib::isInit())
TemporaryRef<MacIOSurface> MacIOSurface::LookupSurface(IOSurfaceID aIOSurfaceID) {
if (!MacIOSurfaceLib::isInit())
return nullptr;
IOSurfacePtr surfaceRef = nsIOSurfaceLib::IOSurfaceLookup(aIOSurfaceID);
IOSurfacePtr surfaceRef = MacIOSurfaceLib::IOSurfaceLookup(aIOSurfaceID);
if (!surfaceRef)
return nullptr;
nsRefPtr<nsIOSurface> ioSurface = new nsIOSurface(surfaceRef);
RefPtr<MacIOSurface> ioSurface = new MacIOSurface(surfaceRef);
if (!ioSurface) {
::CFRelease(surfaceRef);
return nullptr;
@ -297,66 +360,69 @@ already_AddRefed<nsIOSurface> nsIOSurface::LookupSurface(IOSurfaceID aIOSurfaceI
return ioSurface.forget();
}
IOSurfaceID nsIOSurface::GetIOSurfaceID() {
return nsIOSurfaceLib::IOSurfaceGetID(mIOSurfacePtr);
IOSurfaceID MacIOSurface::GetIOSurfaceID() {
return MacIOSurfaceLib::IOSurfaceGetID(mIOSurfacePtr);
}
void* nsIOSurface::GetBaseAddress() {
return nsIOSurfaceLib::IOSurfaceGetBaseAddress(mIOSurfacePtr);
void* MacIOSurface::GetBaseAddress() {
return MacIOSurfaceLib::IOSurfaceGetBaseAddress(mIOSurfacePtr);
}
size_t nsIOSurface::GetWidth() {
return nsIOSurfaceLib::IOSurfaceGetWidth(mIOSurfacePtr);
size_t MacIOSurface::GetWidth() {
return MacIOSurfaceLib::IOSurfaceGetWidth(mIOSurfacePtr);
}
size_t nsIOSurface::GetHeight() {
return nsIOSurfaceLib::IOSurfaceGetHeight(mIOSurfacePtr);
size_t MacIOSurface::GetHeight() {
return MacIOSurfaceLib::IOSurfaceGetHeight(mIOSurfacePtr);
}
size_t nsIOSurface::GetBytesPerRow() {
return nsIOSurfaceLib::IOSurfaceGetBytesPerRow(mIOSurfacePtr);
size_t MacIOSurface::GetBytesPerRow() {
return MacIOSurfaceLib::IOSurfaceGetBytesPerRow(mIOSurfacePtr);
}
#define READ_ONLY 0x1
void nsIOSurface::Lock() {
nsIOSurfaceLib::IOSurfaceLock(mIOSurfacePtr, READ_ONLY, NULL);
void MacIOSurface::Lock() {
MacIOSurfaceLib::IOSurfaceLock(mIOSurfacePtr, READ_ONLY, NULL);
}
void nsIOSurface::Unlock() {
nsIOSurfaceLib::IOSurfaceUnlock(mIOSurfacePtr, READ_ONLY, NULL);
void MacIOSurface::Unlock() {
MacIOSurfaceLib::IOSurfaceUnlock(mIOSurfacePtr, READ_ONLY, NULL);
}
#include "gfxImageSurface.h"
#include "SourceSurfaceRawData.h"
using mozilla::gfx::SourceSurface;
using mozilla::gfx::SourceSurfaceRawData;
using mozilla::gfx::IntSize;
already_AddRefed<gfxASurface>
nsIOSurface::GetAsSurface() {
TemporaryRef<SourceSurface>
MacIOSurface::GetAsSurface() {
Lock();
size_t bytesPerRow = GetBytesPerRow();
size_t ioWidth = GetWidth();
size_t ioHeight = GetHeight();
unsigned char* ioData = (unsigned char*)GetBaseAddress();
nsRefPtr<gfxImageSurface> imgSurface =
new gfxImageSurface(gfxIntSize(ioWidth, ioHeight), gfxASurface::ImageFormatARGB32);
for (int i = 0; i < ioHeight; i++) {
memcpy(imgSurface->Data() + i * imgSurface->Stride(),
unsigned char* dataCpy = (unsigned char*)malloc(bytesPerRow*ioHeight);
for (size_t i = 0; i < ioHeight; i++) {
memcpy(dataCpy + i * bytesPerRow,
ioData + i * bytesPerRow, ioWidth * 4);
}
Unlock();
return imgSurface.forget();
RefPtr<SourceSurfaceRawData> surf = new SourceSurfaceRawData();
surf->InitWrappingData(dataCpy, IntSize(ioWidth, ioHeight), bytesPerRow, mozilla::gfx::FORMAT_B8G8R8A8, true);
return surf.forget();
}
CGLError
nsIOSurface::CGLTexImageIOSurface2D(void *c,
MacIOSurface::CGLTexImageIOSurface2D(void *c,
GLenum internalFormat, GLenum format,
GLenum type, GLuint plane)
{
NSOpenGLContext *ctxt = static_cast<NSOpenGLContext*>(c);
return nsIOSurfaceLib::CGLTexImageIOSurface2D((CGLContextObj)[ctxt CGLContextObj],
return MacIOSurfaceLib::CGLTexImageIOSurface2D((CGLContextObj)[ctxt CGLContextObj],
GL_TEXTURE_RECTANGLE_ARB,
internalFormat,
GetWidth(), GetHeight(),
@ -364,10 +430,6 @@ nsIOSurface::CGLTexImageIOSurface2D(void *c,
mIOSurfacePtr, plane);
}
nsCARenderer::~nsCARenderer() {
Destroy();
}
CGColorSpaceRef CreateSystemColorSpace() {
CMProfileRef system_profile = nullptr;
CGColorSpaceRef cspace = nullptr;
@ -384,6 +446,16 @@ CGColorSpaceRef CreateSystemColorSpace() {
return cspace;
}
CGContextRef MacIOSurface::CreateIOSurfaceContext() {
CGContextRef ref = MacIOSurfaceLib::IOSurfaceContextCreate(mIOSurfacePtr, GetWidth(), GetHeight(),
8, 32, CreateSystemColorSpace(), 0x2002);
return ref;
}
nsCARenderer::~nsCARenderer() {
Destroy();
}
void cgdata_release_callback(void *aCGData, const void *data, size_t size) {
if (aCGData) {
free(aCGData);
@ -391,6 +463,7 @@ void cgdata_release_callback(void *aCGData, const void *data, size_t size) {
}
void nsCARenderer::Destroy() {
printf("Destroy\n");
if (mCARenderer) {
CARenderer* caRenderer = (CARenderer*)mCARenderer;
// Bug 556453:
@ -430,9 +503,11 @@ void nsCARenderer::Destroy() {
mFBOTexture = 0;
mOpenGLContext = nullptr;
mCGImage = nullptr;
printf("Destroy: set null\n");
mIOSurface = nullptr;
mFBO = 0;
mIOTexture = 0;
printf("Destroy: cleanup\n");
}
nsresult nsCARenderer::SetupRenderer(void *aCALayer, int aWidth, int aHeight,
@ -541,7 +616,7 @@ nsresult nsCARenderer::SetupRenderer(void *aCALayer, int aWidth, int aHeight,
::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mIOTexture);
::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
::glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
nsIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB,
MacIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB,
GL_RGBA, aWidth, aHeight,
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
mIOSurface->mIOSurfacePtr, 0);
@ -635,7 +710,8 @@ void nsCARenderer::SetViewport(int aWidth, int aHeight) {
::glScalef(1.0, -1.0, 1.0);
}
void nsCARenderer::AttachIOSurface(nsRefPtr<nsIOSurface> aSurface) {
void nsCARenderer::AttachIOSurface(RefPtr<MacIOSurface> aSurface) {
printf("*****Attach*****\n\n\n\n\n");
if (mIOSurface &&
aSurface->GetIOSurfaceID() == mIOSurface->GetIOSurfaceID()) {
// This object isn't needed since we already have a
@ -655,7 +731,7 @@ void nsCARenderer::AttachIOSurface(nsRefPtr<nsIOSurface> aSurface) {
CGLContextObj oldContext = ::CGLGetCurrentContext();
::CGLSetCurrentContext(mOpenGLContext);
::glBindTexture(GL_TEXTURE_RECTANGLE_ARB, mIOTexture);
nsIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB,
MacIOSurfaceLib::CGLTexImageIOSurface2D(mOpenGLContext, GL_TEXTURE_RECTANGLE_ARB,
GL_RGBA, mIOSurface->GetWidth(), mIOSurface->GetHeight(),
GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
mIOSurface->mIOSurfacePtr, 0);
@ -770,7 +846,7 @@ nsresult nsCARenderer::Render(int aWidth, int aHeight,
}
nsresult nsCARenderer::DrawSurfaceToCGContext(CGContextRef aContext,
nsIOSurface *surf,
MacIOSurface *surf,
CGColorSpaceRef aColorSpace,
int aX, int aY,
size_t aWidth, size_t aHeight) {
@ -845,7 +921,7 @@ void nsCARenderer::AttachCALayer(void *aCALayer) {
#ifdef DEBUG
int sSaveToDiskSequence = 0;
void nsCARenderer::SaveToDisk(nsIOSurface *surf) {
void nsCARenderer::SaveToDisk(MacIOSurface *surf) {
surf->Lock();
size_t bytesPerRow = surf->GetBytesPerRow();
size_t ioWidth = surf->GetWidth();
@ -900,3 +976,46 @@ void nsCARenderer::SaveToDisk(nsIOSurface *surf) {
#endif
CGImageRef MacIOSurface::CreateImageFromIOSurfaceContext(CGContextRef aContext) {
if (!MacIOSurfaceLib::isInit())
return nsnull;
return MacIOSurfaceLib::IOSurfaceContextCreateImage(aContext);
}
TemporaryRef<MacIOSurface> MacIOSurface::IOSurfaceContextGetSurface(CGContextRef aContext) {
if (!MacIOSurfaceLib::isInit())
return nsnull;
IOSurfacePtr surfaceRef = MacIOSurfaceLib::IOSurfaceContextGetSurface(aContext);
if (!surfaceRef)
return nsnull;
// Retain the IOSurface because MacIOSurface will release it
CFRetain(surfaceRef);
RefPtr<MacIOSurface> ioSurface = new MacIOSurface(surfaceRef);
if (!ioSurface) {
::CFRelease(surfaceRef);
return nsnull;
}
return ioSurface.forget();
}
CGContextType GetContextType(CGContextRef ref)
{
if (!MacIOSurfaceLib::isInit() || !MacIOSurfaceLib::sCGContextGetTypePtr)
return CG_CONTEXT_TYPE_UNKNOWN;
unsigned int type = MacIOSurfaceLib::sCGContextGetTypePtr(ref);
if (type == CG_CONTEXT_TYPE_BITMAP) {
return CG_CONTEXT_TYPE_BITMAP;
} else if (type == CG_CONTEXT_TYPE_IOSURFACE) {
return CG_CONTEXT_TYPE_IOSURFACE;
} else {
return CG_CONTEXT_TYPE_UNKNOWN;
}
}

View File

@ -18,7 +18,7 @@
#include "gfxPlatform.h"
#ifdef XP_MACOSX
#include "nsIOSurface.h"
#include "mozilla/gfx/MacIOSurface.h"
#endif
#ifdef XP_WIN
struct ID3D10Texture2D;
@ -222,7 +222,7 @@ public:
* image container. This is usually done by the layer system internally and
* not explicitly by users. For PlanarYCbCr or Cairo images the default
* implementation will creates images whose data lives in system memory, for
* MacIOSurfaces the default implementation will be a simple nsIOSurface
* MacIOSurfaces the default implementation will be a simple MacIOSurface
* wrapper.
*/
@ -873,7 +873,7 @@ public:
class THEBES_API MacIOSurfaceImage : public Image {
public:
struct Data {
nsIOSurface* mIOSurface;
MacIOSurface* mIOSurface;
};
MacIOSurfaceImage()
@ -921,7 +921,7 @@ public:
return mSize;
}
nsIOSurface* GetIOSurface()
MacIOSurface* GetIOSurface()
{
return mIOSurface;
}
@ -932,7 +932,7 @@ public:
private:
gfxIntSize mSize;
nsRefPtr<nsIOSurface> mIOSurface;
RefPtr<MacIOSurface> mIOSurface;
void* mPluginInstanceOwner;
UpdateSurfaceCallback mUpdateCallback;
DestroyCallback mDestroyCallback;

View File

@ -746,8 +746,8 @@ BasicLayerManager::PaintLayer(gfxContext* aTarget,
(aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE) &&
!transform.HasNonAxisAlignedTransform()) {
Rect opaqueRect = dt->GetTransform().TransformBounds(
Rect(bounds.x, bounds.y, bounds.width, bounds.height));
gfx::Rect opaqueRect = dt->GetTransform().TransformBounds(
gfx::Rect(bounds.x, bounds.y, bounds.width, bounds.height));
opaqueRect.RoundIn();
IntRect intOpaqueRect;
if (opaqueRect.ToIntRect(&intOpaqueRect)) {

View File

@ -60,7 +60,7 @@ SetAntialiasingFlags(Layer* aLayer, gfxContext* aTarget)
}
const nsIntRect& bounds = aLayer->GetVisibleRegion().GetBounds();
Rect transformedBounds = dt->GetTransform().TransformBounds(Rect(Float(bounds.x), Float(bounds.y),
gfx::Rect transformedBounds = dt->GetTransform().TransformBounds(gfx::Rect(Float(bounds.x), Float(bounds.y),
Float(bounds.width), Float(bounds.height)));
transformedBounds.RoundOut();
IntRect intTransformedBounds;

View File

@ -47,8 +47,6 @@ EXPORTS = \
gfxTypes.h \
gfxUtils.h \
gfxUserFontSet.h \
nsCoreAnimationSupport.h \
nsIOSurface.h \
nsSurfaceTexture.h \
gfxSharedImageSurface.h \
gfxReusableSurfaceWrapper.h \
@ -331,7 +329,6 @@ CPPSRCS += gfxQuartzNativeDrawing.cpp
CMMSRCS = \
gfxMacPlatformFontList.mm \
nsCoreAnimationSupport.mm \
$(NULL)
endif

View File

@ -118,7 +118,7 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
#ifdef XP_MACOSX
#include "gfxQuartzNativeDrawing.h"
#include "nsPluginUtilsOSX.h"
#include "nsCoreAnimationSupport.h"
#include "mozilla/gfx/QuartzSupport.h"
#endif
#ifdef MOZ_WIDGET_GTK2