Bug 938970 - 5/5. Switch gfx/layers to UNIFIED_SOURCES - r=ehsan,mattwoodrow

This commit is contained in:
Benoit Jacob 2013-11-17 21:07:08 -05:00
parent fbd864db98
commit 012417f2af
16 changed files with 79 additions and 114 deletions

View File

@ -137,7 +137,7 @@ ImageDataSerializerBase::GetAsDrawTarget()
GetFormat());
}
TemporaryRef<DataSourceSurface>
TemporaryRef<gfx::DataSourceSurface>
ImageDataSerializerBase::GetAsSurface()
{
MOZ_ASSERT(IsValid());

View File

@ -1506,6 +1506,39 @@ PrintInfo(nsACString& aTo, LayerComposite* aLayerComposite)
return aTo;
}
void
SetAntialiasingFlags(Layer* aLayer, gfxContext* aTarget)
{
if (!aTarget->IsCairo()) {
RefPtr<DrawTarget> dt = aTarget->GetDrawTarget();
if (dt->GetFormat() != FORMAT_B8G8R8A8) {
return;
}
const nsIntRect& bounds = aLayer->GetVisibleRegion().GetBounds();
gfx::Rect transformedBounds = dt->GetTransform().TransformBounds(gfx::Rect(Float(bounds.x), Float(bounds.y),
Float(bounds.width), Float(bounds.height)));
transformedBounds.RoundOut();
IntRect intTransformedBounds;
transformedBounds.ToIntRect(&intTransformedBounds);
dt->SetPermitSubpixelAA(!(aLayer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA) ||
dt->GetOpaqueRect().Contains(intTransformedBounds));
} else {
nsRefPtr<gfxASurface> surface = aTarget->CurrentSurface();
if (surface->GetContentType() != GFX_CONTENT_COLOR_ALPHA) {
// Destination doesn't have alpha channel; no need to set any special flags
return;
}
const nsIntRect& bounds = aLayer->GetVisibleRegion().GetBounds();
surface->SetSubpixelAntialiasingEnabled(
!(aLayer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA) ||
surface->GetOpaqueRect().Contains(
aTarget->UserToDevice(gfxRect(bounds.x, bounds.y, bounds.width, bounds.height))));
}
}
PRLogModuleInfo* LayerManager::sLog;
} // namespace layers

View File

@ -1954,6 +1954,9 @@ protected:
uint64_t mId;
};
void
SetAntialiasingFlags(Layer* aLayer, gfxContext* aTarget);
#ifdef MOZ_DUMP_PAINTING
void WriteSnapshotToDumpFile(Layer* aLayer, gfxASurface* aSurf);
void WriteSnapshotToDumpFile(LayerManager* aManager, gfxASurface* aSurf);

View File

@ -212,7 +212,7 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget,
}
}
RefPtr<SourceSurface> snapshot;
RefPtr<gfx::SourceSurface> snapshot;
if (aSource == BUFFER_BLACK) {
snapshot = mDTBuffer->Snapshot();
} else {
@ -353,7 +353,7 @@ ThebesLayerBuffer::DrawTo(ThebesLayer* aLayer,
clipped = true;
}
RefPtr<SourceSurface> mask;
RefPtr<gfx::SourceSurface> mask;
if (aMask) {
mask = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, aMask);
}

View File

@ -693,7 +693,7 @@ BasicLayerManager::SetRoot(Layer* aLayer)
}
static pixman_transform
Matrix3DToPixman(const gfx3DMatrix& aMatrix)
BasicLayerManager_Matrix3DToPixman(const gfx3DMatrix& aMatrix)
{
pixman_f_transform transform;
@ -735,7 +735,7 @@ PixmanTransform(const gfxImageSurface *aDest,
NS_ABORT_IF_FALSE(src && dest, "Failed to create pixman images?");
pixman_transform pixTransform = Matrix3DToPixman(aTransform);
pixman_transform pixTransform = BasicLayerManager_Matrix3DToPixman(aTransform);
pixman_transform pixTransformInverted;
// If the transform is singular then nothing would be drawn anyway, return here

View File

@ -46,39 +46,6 @@ IntersectWithClip(const nsIntRegion& aRegion, gfxContext* aContext)
return result;
}
static void
SetAntialiasingFlags(Layer* aLayer, gfxContext* aTarget)
{
if (!aTarget->IsCairo()) {
RefPtr<DrawTarget> dt = aTarget->GetDrawTarget();
if (dt->GetFormat() != FORMAT_B8G8R8A8) {
return;
}
const nsIntRect& bounds = aLayer->GetVisibleRegion().GetBounds();
gfx::Rect transformedBounds = dt->GetTransform().TransformBounds(gfx::Rect(Float(bounds.x), Float(bounds.y),
Float(bounds.width), Float(bounds.height)));
transformedBounds.RoundOut();
IntRect intTransformedBounds;
transformedBounds.ToIntRect(&intTransformedBounds);
dt->SetPermitSubpixelAA(!(aLayer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA) ||
dt->GetOpaqueRect().Contains(intTransformedBounds));
} else {
nsRefPtr<gfxASurface> surface = aTarget->CurrentSurface();
if (surface->GetContentType() != GFX_CONTENT_COLOR_ALPHA) {
// Destination doesn't have alpha channel; no need to set any special flags
return;
}
const nsIntRect& bounds = aLayer->GetVisibleRegion().GetBounds();
surface->SetSubpixelAntialiasingEnabled(
!(aLayer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA) ||
surface->GetOpaqueRect().Contains(
aTarget->UserToDevice(gfxRect(bounds.x, bounds.y, bounds.width, bounds.height))));
}
}
void
BasicThebesLayer::PaintThebes(gfxContext* aContext,
Layer* aMaskLayer,

View File

@ -28,39 +28,6 @@ using namespace mozilla::gfx;
namespace mozilla {
namespace layers {
static void
SetAntialiasingFlags(Layer* aLayer, gfxContext* aTarget)
{
if (!aTarget->IsCairo()) {
RefPtr<DrawTarget> dt = aTarget->GetDrawTarget();
if (dt->GetFormat() != FORMAT_B8G8R8A8) {
return;
}
const nsIntRect& bounds = aLayer->GetVisibleRegion().GetBounds();
gfx::Rect transformedBounds = dt->GetTransform().TransformBounds(gfx::Rect(Float(bounds.x), Float(bounds.y),
Float(bounds.width), Float(bounds.height)));
transformedBounds.RoundOut();
IntRect intTransformedBounds;
transformedBounds.ToIntRect(&intTransformedBounds);
dt->SetPermitSubpixelAA(!(aLayer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA) ||
dt->GetOpaqueRect().Contains(intTransformedBounds));
} else {
nsRefPtr<gfxASurface> surface = aTarget->CurrentSurface();
if (surface->GetContentType() != GFX_CONTENT_COLOR_ALPHA) {
// Destination doesn't have alpha channel; no need to set any special flags
return;
}
const nsIntRect& bounds = aLayer->GetVisibleRegion().GetBounds();
surface->SetSubpixelAntialiasingEnabled(
!(aLayer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA) ||
surface->GetOpaqueRect().Contains(
aTarget->UserToDevice(gfxRect(bounds.x, bounds.y, bounds.width, bounds.height))));
}
}
void
ClientThebesLayer::PaintThebes()
{

View File

@ -82,8 +82,6 @@ namespace layers {
*/
static float gTouchStartTolerance = 1.0f/16.0f;
static const float EPSILON = 0.0001f;
/**
* Angle from axis within which we stay axis-locked
*/

View File

@ -20,8 +20,6 @@
namespace mozilla {
namespace layers {
static const float EPSILON = 0.0001f;
/**
* Maximum acceleration that can happen between two frames. Velocity is
* throttled if it's above this. This may happen if a time delta is very low,

View File

@ -15,6 +15,8 @@
namespace mozilla {
namespace layers {
const float EPSILON = 0.0001f;
class AsyncPanZoomController;
/**

View File

@ -3,6 +3,9 @@
* 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 gfx_layers_ipc_ImageBridgeParent_h_
#define gfx_layers_ipc_ImageBridgeParent_h_
#include <stddef.h> // for size_t
#include <stdint.h> // for uint32_t, uint64_t
#include "CompositableTransactionParent.h"
@ -107,3 +110,4 @@ private:
} // layers
} // mozilla
#endif // gfx_layers_ipc_ImageBridgeParent_h_

View File

@ -18,6 +18,7 @@
#include "mozilla/layers/ImageBridgeChild.h" // for ImageBridgeChild
#include "mozilla/mozalloc.h" // for operator delete
#include "nsISupportsImpl.h" // for Image::AddRef
#include "mozilla/ipc/Shmem.h"
class gfxASurface;
@ -339,7 +340,7 @@ DeprecatedSharedPlanarYCbCrImage::DropToSurfaceDescriptor(SurfaceDescriptor& aDe
return false;
}
aDesc = YCbCrImage(mShmem, 0);
mShmem = Shmem();
mShmem = mozilla::ipc::Shmem();
mAllocated = false;
return true;
}

View File

@ -44,7 +44,7 @@ EXPORTS += [
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
SOURCES += [
UNIFIED_SOURCES += [
'D3D9SurfaceImage.cpp',
]
if CONFIG['MOZ_ENABLE_D3D9_LAYER']:
@ -56,18 +56,20 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'd3d9/CompositorD3D9.h',
'd3d9/TextureD3D9.h',
]
SOURCES += [
UNIFIED_SOURCES += [
'd3d9/CanvasLayerD3D9.cpp',
'd3d9/ColorLayerD3D9.cpp',
'd3d9/CompositorD3D9.cpp',
'd3d9/ContainerLayerD3D9.cpp',
'd3d9/DeviceManagerD3D9.cpp',
'd3d9/ImageLayerD3D9.cpp',
'd3d9/LayerManagerD3D9.cpp',
'd3d9/Nv3DVUtils.cpp',
'd3d9/TextureD3D9.cpp',
'd3d9/ThebesLayerD3D9.cpp',
]
SOURCES += [
'd3d9/CompositorD3D9.cpp',
'd3d9/DeviceManagerD3D9.cpp',
]
if CONFIG['MOZ_ENABLE_D3D10_LAYER']:
EXPORTS += [
'd3d10/LayerManagerD3D10.h',
@ -78,7 +80,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'd3d11/TextureD3D11.h',
'ipc/ShadowLayerUtilsD3D10.h',
]
SOURCES += [
UNIFIED_SOURCES += [
'd3d10/CanvasLayerD3D10.cpp',
'd3d10/ColorLayerD3D10.cpp',
'd3d10/ContainerLayerD3D10.cpp',
@ -86,10 +88,12 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'd3d10/LayerManagerD3D10.cpp',
'd3d10/ReadbackManagerD3D10.cpp',
'd3d10/ThebesLayerD3D10.cpp',
'd3d11/CompositorD3D11.cpp',
'd3d11/TextureD3D11.cpp',
'ipc/ShadowLayerUtilsD3D10.cpp',
]
SOURCES += [
'd3d11/CompositorD3D11.cpp',
]
EXPORTS.gfxipc += [
'ipc/ShadowLayerUtils.h',
@ -166,10 +170,12 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
EXPORTS += [
'MacIOSurfaceImage.h',
]
UNIFIED_SOURCES += [
'opengl/GLManager.cpp',
]
SOURCES += [
'ipc/ShadowLayerUtilsMac.cpp',
'MacIOSurfaceImage.cpp',
'opengl/GLManager.cpp',
]
# NB: Gralloc is available on other platforms that use the android GL
@ -179,19 +185,20 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
EXPORTS.mozilla.layers += [
'ipc/ShadowLayerUtilsGralloc.h',
]
SOURCES += [
UNIFIED_SOURCES += [
'GrallocImages.cpp',
'ipc/ShadowLayerUtilsGralloc.cpp',
'opengl/GrallocTextureClient.cpp',
'opengl/GrallocTextureHost.cpp',
]
SOURCES += [
'ipc/ShadowLayerUtilsGralloc.cpp',
]
SOURCES += [
UNIFIED_SOURCES += [
'basic/BasicCanvasLayer.cpp',
'basic/BasicColorLayer.cpp',
'basic/BasicCompositor.cpp',
'basic/BasicContainerLayer.cpp',
'basic/BasicImageLayer.cpp',
'basic/BasicImages.cpp',
'basic/BasicLayerManager.cpp',
'basic/BasicLayersImpl.cpp',
@ -226,7 +233,6 @@ SOURCES += [
'Compositor.cpp',
'CopyableCanvasLayer.cpp',
'Effects.cpp',
'ImageContainer.cpp',
'ImageDataSerializer.cpp',
'ImageLayers.cpp',
'ipc/AsyncPanZoomController.cpp',
@ -269,6 +275,11 @@ SOURCES += [
'YCbCrImageDataSerializer.cpp',
]
SOURCES += [
'basic/BasicImageLayer.cpp',
'ImageContainer.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
SOURCES += [
'opengl/MacIOSurfaceTextureClientOGL.cpp',

View File

@ -3,6 +3,9 @@
* 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 mozilla_layers_opengl_FPSCounter_h_
#define mozilla_layers_opengl_FPSCounter_h_
#include <stddef.h> // for size_t
#include <algorithm> // for min
#include "GLDefs.h" // for GLuint
@ -84,3 +87,5 @@ struct FPSState {
}
}
#endif // mozilla_layers_opengl_FPSCounter_h_

View File

@ -1171,7 +1171,7 @@ LayerManagerOGL::SetLayerProgramProjectionMatrix(const gfx3DMatrix& aMatrix)
}
static GLenum
GetFrameBufferInternalFormat(GLContext* gl,
LayerManagerOGL_GetFrameBufferInternalFormat(GLContext* gl,
GLuint aCurrentFrameBuffer,
nsIWidget* aWidget)
{
@ -1199,7 +1199,7 @@ LayerManagerOGL::CreateFBOWithTexture(const nsIntRect& aRect, InitMode aInit,
// check the format of the framebuffer here and take a slow path
// if it's incompatible.
GLenum format =
GetFrameBufferInternalFormat(gl(), aCurrentFrameBuffer, mWidget);
LayerManagerOGL_GetFrameBufferInternalFormat(gl(), aCurrentFrameBuffer, mWidget);
bool isFormatCompatibleWithRGBA
= gl()->IsGLES2() ? (format == LOCAL_GL_RGBA)

View File

@ -74,30 +74,6 @@ CreateClampOrRepeatTextureImage(GLContext *aGl,
return aGl->CreateTextureImage(aSize, aContentType, WrapMode(aGl, aFlags));
}
static void
SetAntialiasingFlags(Layer* aLayer, gfxContext* aTarget)
{
if (aTarget->IsCairo()) {
nsRefPtr<gfxASurface> surface = aTarget->CurrentSurface();
if (surface->GetContentType() != GFX_CONTENT_COLOR_ALPHA) {
// Destination doesn't have alpha channel; no need to set any special flags
return;
}
surface->SetSubpixelAntialiasingEnabled(
!(aLayer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA));
} else {
RefPtr<DrawTarget> dt = aTarget->GetDrawTarget();
if (dt->GetFormat() != FORMAT_B8G8R8A8) {
return;
}
dt->SetPermitSubpixelAA(
!(aLayer->GetContentFlags() & Layer::CONTENT_COMPONENT_ALPHA));
}
}
class ThebesLayerBufferOGL
{
NS_INLINE_DECL_REFCOUNTING(ThebesLayerBufferOGL)