зеркало из https://github.com/mozilla/gecko-dev.git
Bug 517834 - Use gfxQuartzImageSurface to paint video frames for an 8-23% perf win on Mac. r=roc
--HG-- extra : rebase_source : de46fdadcefed1fd203a824ed4b078c7ba0b6779
This commit is contained in:
Родитель
7518dee43b
Коммит
30ee7451cb
|
@ -53,6 +53,10 @@
|
|||
#include "nsMediaDecoder.h"
|
||||
#include "nsDOMError.h"
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
#include "gfxQuartzImageSurface.h"
|
||||
#endif
|
||||
|
||||
// Number of milliseconds between progress events as defined by spec
|
||||
#define PROGRESS_MS 350
|
||||
|
||||
|
@ -246,16 +250,25 @@ void nsMediaDecoder::Paint(gfxContext* aContext,
|
|||
if (!mRGB)
|
||||
return;
|
||||
|
||||
/* Create a surface backed by the RGB */
|
||||
nsRefPtr<gfxASurface> surface =
|
||||
new gfxImageSurface(mRGB,
|
||||
gfxIntSize(mRGBWidth, mRGBHeight),
|
||||
mRGBWidth * 4,
|
||||
gfxASurface::ImageFormatRGB24);
|
||||
|
||||
if (!surface)
|
||||
nsRefPtr<gfxImageSurface> imgSurface =
|
||||
new gfxImageSurface(mRGB,
|
||||
gfxIntSize(mRGBWidth, mRGBHeight),
|
||||
mRGBWidth * 4,
|
||||
gfxASurface::ImageFormatRGB24);
|
||||
if (!imgSurface)
|
||||
return;
|
||||
|
||||
nsRefPtr<gfxASurface> surface(imgSurface);
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
nsRefPtr<gfxQuartzImageSurface> quartzSurface =
|
||||
new gfxQuartzImageSurface(imgSurface);
|
||||
if (!quartzSurface)
|
||||
return;
|
||||
|
||||
surface = quartzSurface;
|
||||
#endif
|
||||
|
||||
nsRefPtr<gfxPattern> pat = new gfxPattern(surface);
|
||||
if (!pat)
|
||||
return;
|
||||
|
@ -285,20 +298,5 @@ void nsMediaDecoder::Paint(gfxContext* aContext,
|
|||
aContext->NewPath();
|
||||
aContext->PixelSnappedRectangleAndSetPattern(aRect, pat);
|
||||
aContext->Fill();
|
||||
|
||||
#ifdef DEBUG_FRAME_RATE
|
||||
{
|
||||
// Output frame rate
|
||||
static float last = double(PR_IntervalToMilliseconds(PR_IntervalNow()))/1000.0;
|
||||
float now = double(PR_IntervalToMilliseconds(PR_IntervalNow()))/1000.0;
|
||||
static int count = 0;
|
||||
count++;
|
||||
if (now-last > 10.0) {
|
||||
LOG(PR_LOG_DEBUG, ("Paint Frame Rate = %f (should be %f)\n", (float)count / (float)(now-last), mFramerate));
|
||||
count = 0;
|
||||
last = double(PR_IntervalToMilliseconds(PR_IntervalNow()))/1000.0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче