Bug 1319374. Fix --disable-skia builds. r=lsalzman

This commit is contained in:
Mason Chang 2016-11-30 10:13:54 -08:00
parent 3c8e37927c
commit 0337770c6a
4 changed files with 45 additions and 12 deletions

View File

@ -195,8 +195,18 @@ public:
CGContextRef cg;
private:
#ifdef USE_SKIA
static CGContextRef BorrowCGContextFromDrawTarget(DrawTarget *aDT);
static void ReturnCGContextToDrawTarget(DrawTarget *aDT, CGContextRef cg);
#else
static CGContextRef BorrowCGContextFromDrawTarget(DrawTarget *aDT) {
MOZ_CRASH("Not supported without Skia");
}
static void ReturnCGContextToDrawTarget(DrawTarget *aDT, CGContextRef cg) {
MOZ_CRASH("not supported without Skia");
}
#endif
DrawTarget *mDT;
};
#endif

View File

@ -11,7 +11,6 @@
#include "CompositableHost.h" // for CompositableHost
#include "ContainerLayerComposite.h" // for ContainerLayerComposite, etc
#include "FPSCounter.h" // for FPSState, FPSCounter
#include "PaintCounter.h" // For PaintCounter
#include "FrameMetrics.h" // for FrameMetrics
#include "GeckoProfiler.h" // for profiler_set_frame_number, etc
#include "ImageLayerComposite.h" // for ImageLayerComposite
@ -69,6 +68,10 @@
#include "mozilla/layers/CompositorBridgeParent.h"
#include "TreeTraversal.h" // for ForEachNode
#ifdef USE_SKIA
#include "PaintCounter.h" // For PaintCounter
#endif
class gfxContext;
namespace mozilla {
@ -134,6 +137,10 @@ LayerManagerComposite::LayerManagerComposite(Compositor* aCompositor)
{
mTextRenderer = new TextRenderer(aCompositor);
MOZ_ASSERT(aCompositor);
#ifdef USE_SKIA
mPaintCounter = nullptr;
#endif
}
LayerManagerComposite::~LayerManagerComposite()
@ -153,8 +160,11 @@ LayerManagerComposite::Destroy()
mCompositor->CancelFrame();
mRoot = nullptr;
mClonedLayerTreeProperties = nullptr;
mPaintCounter = nullptr;
mDestroyed = true;
#ifdef USE_SKIA
mPaintCounter = nullptr;
#endif
}
}
@ -527,7 +537,6 @@ LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion, const
bool drawFps = gfxPrefs::LayersDrawFPS();
bool drawFrameCounter = gfxPrefs::DrawFrameCounter();
bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
bool drawPaintTimes = gfxPrefs::AlwaysPaint();
if (drawFps || drawFrameCounter) {
aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 256, 256));
@ -535,11 +544,16 @@ LayerManagerComposite::InvalidateDebugOverlay(nsIntRegion& aInvalidRegion, const
if (drawFrameColorBars) {
aInvalidRegion.Or(aInvalidRegion, nsIntRect(0, 0, 10, aBounds.height));
}
#ifdef USE_SKIA
bool drawPaintTimes = gfxPrefs::AlwaysPaint();
if (drawPaintTimes) {
aInvalidRegion.Or(aInvalidRegion, nsIntRect(PaintCounter::GetPaintRect()));
}
#endif
}
#ifdef USE_SKIA
void
LayerManagerComposite::DrawPaintTimes(Compositor* aCompositor)
{
@ -550,6 +564,7 @@ LayerManagerComposite::DrawPaintTimes(Compositor* aCompositor)
TimeDuration compositeTime = TimeStamp::Now() - mRenderStartTime;
mPaintCounter->Draw(aCompositor, mLastPaintTime, compositeTime);
}
#endif
static uint16_t sFrameCount = 0;
void
@ -558,8 +573,7 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds)
bool drawFps = gfxPrefs::LayersDrawFPS();
bool drawFrameCounter = gfxPrefs::DrawFrameCounter();
bool drawFrameColorBars = gfxPrefs::CompositorDrawColorBars();
bool drawPaintTimes = gfxPrefs::AlwaysPaint();
TimeStamp now = TimeStamp::Now();
if (drawFps) {
@ -699,9 +713,12 @@ LayerManagerComposite::RenderDebugOverlay(const IntRect& aBounds)
sFrameCount++;
}
#ifdef USE_SKIA
bool drawPaintTimes = gfxPrefs::AlwaysPaint();
if (drawPaintTimes) {
DrawPaintTimes(mCompositor);
}
#endif
}
RefPtr<CompositingRenderTarget>

View File

@ -172,7 +172,6 @@ protected:
mozilla::TimeStamp mWarnTime;
bool mWindowOverlayChanged;
RefPtr<PaintCounter> mPaintCounter;
TimeDuration mLastPaintTime;
TimeStamp mRenderStartTime;
};
@ -386,11 +385,6 @@ private:
void RenderToPresentationSurface();
#endif
/**
* Render paint and composite times above the frame.
*/
void DrawPaintTimes(Compositor* aCompositor);
/**
* We need to know our invalid region before we're ready to render.
*/
@ -436,6 +430,14 @@ private:
RefPtr<CompositingRenderTarget> mTwoPassTmpTarget;
RefPtr<TextRenderer> mTextRenderer;
bool mGeometryChanged;
#ifdef USE_SKIA
/**
* Render paint and composite times above the frame.
*/
void DrawPaintTimes(Compositor* aCompositor);
RefPtr<PaintCounter> mPaintCounter;
#endif
};
/**

View File

@ -321,7 +321,6 @@ UNIFIED_SOURCES += [
'composite/ImageHost.cpp',
'composite/ImageLayerComposite.cpp',
'composite/LayerManagerComposite.cpp',
'composite/PaintCounter.cpp',
'composite/PaintedLayerComposite.cpp',
'composite/TextRenderer.cpp',
'composite/TextureHost.cpp',
@ -450,3 +449,8 @@ LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-error=shadow']
if CONFIG['MOZ_ENABLE_SKIA']:
UNIFIED_SOURCES += [
'composite/PaintCounter.cpp',
]