Bug 1066280 - Review fixes. - r=kamidphish,mattwoodrow

This commit is contained in:
jdashg 2014-10-08 13:04:19 -07:00
Родитель fbd3252fc0
Коммит ca85c23987
10 изменённых файлов: 34 добавлений и 117 удалений

Просмотреть файл

@ -1429,11 +1429,10 @@ WebGLContext::PresentScreenBuffer()
gl->MakeCurrent();
auto screen = gl->Screen();
GLScreenBuffer* screen = gl->Screen();
MOZ_ASSERT(screen);
auto size = screen->Size();
if (!screen->PublishFrame(size)) {
if (!screen->PublishFrame(screen->Size())) {
ForceLoseContext();
return false;
}

Просмотреть файл

@ -705,18 +705,18 @@ DrawTargetSkia::CopySurface(SourceSurface *aSurface,
// This is a fast path that is disabled for now to mimimize risk
if (false && !bitmap.mBitmap.getTexture() && mCanvas->imageInfo() == bitmap.mBitmap.info()) {
SkBitmap bm(bitmap.mBitmap);
bm.lockPixels();
if (bm.getPixels()) {
SkImageInfo info = bm.info();
info.fWidth = aSourceRect.width;
info.fHeight = aSourceRect.height;
uint8_t* pixels = static_cast<uint8_t*>(bm.getPixels());
// adjust pixels for the source offset
pixels += aSourceRect.x + aSourceRect.y*bm.rowBytes();
mCanvas->writePixels(info, pixels, bm.rowBytes(), aDestination.x, aDestination.y);
return;
}
SkBitmap bm(bitmap.mBitmap);
bm.lockPixels();
if (bm.getPixels()) {
SkImageInfo info = bm.info();
info.fWidth = aSourceRect.width;
info.fHeight = aSourceRect.height;
uint8_t* pixels = static_cast<uint8_t*>(bm.getPixels());
// adjust pixels for the source offset
pixels += aSourceRect.x + aSourceRect.y*bm.rowBytes();
mCanvas->writePixels(info, pixels, bm.rowBytes(), aDestination.x, aDestination.y);
return;
}
}
mCanvas->save();

Просмотреть файл

@ -43,7 +43,7 @@ GLScreenBuffer::Create(GLContext* gl,
#ifdef MOZ_WIDGET_GONK
/* On B2G, we want a Gralloc factory, and we want one right at the start */
auto allocator = caps.surfaceAllocator;
layers::ISurfaceAllocator* allocator = caps.surfaceAllocator;
if (!factory &&
allocator &&
XRE_GetProcessType() != GeckoProcessType_Default)

Просмотреть файл

@ -460,6 +460,8 @@ UploadImageDataToTexture(GLContext* gl,
break;
case SurfaceFormat::R8G8B8A8:
if (gl->GetPreferredARGB32Format() == LOCAL_GL_BGRA) {
// Upload our RGBA as BGRA, but store that the uploaded format is
// BGRA. (sample from R to get B)
format = LOCAL_GL_BGRA;
type = LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV;
surfaceFormat = SurfaceFormat::B8G8R8A8;

Просмотреть файл

@ -106,8 +106,8 @@ CopyableCanvasLayer::UpdateTarget(DrawTarget* aDestTarget)
if (mGLFrontbuffer) {
frontbuffer = mGLFrontbuffer.get();
} else {
auto screen = mGLContext->Screen();
auto front = screen->Front();
GLScreenBuffer* screen = mGLContext->Screen();
ShSurfHandle* front = screen->Front();
if (front) {
frontbuffer = front->Surf();
}

Просмотреть файл

@ -141,91 +141,6 @@ CanvasClient2D::CreateTextureClientForCanvas(gfx::SurfaceFormat aFormat,
mTextureInfo.mTextureFlags | aFlags);
#endif
}
/*
void
CanvasClientSurfaceStream::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
{
aLayer->mGLContext->MakeCurrent();
SurfaceStream* stream = aLayer->mStream;
MOZ_ASSERT(stream);
// Copy our current surface to the current producer surface in our stream, then
// call SwapProducer to make a new buffer ready.
stream->CopySurfaceToProducer(aLayer->mTextureSurface.get(),
aLayer->mFactory.get());
stream->SwapProducer(aLayer->mFactory.get(),
gfx::IntSize(aSize.width, aSize.height));
#ifdef MOZ_WIDGET_GONK
SharedSurface* surf = stream->SwapConsumer();
if (!surf) {
printf_stderr("surf is null post-SwapConsumer!\n");
return;
}
if (surf->mType != SharedSurfaceType::Gralloc) {
printf_stderr("Unexpected non-Gralloc SharedSurface in IPC path!");
MOZ_ASSERT(false);
return;
}
SharedSurface_Gralloc* grallocSurf = SharedSurface_Gralloc::Cast(surf);
RefPtr<GrallocTextureClientOGL> grallocTextureClient =
static_cast<GrallocTextureClientOGL*>(grallocSurf->GetTextureClient());
// If IPDLActor is null means this TextureClient didn't AddTextureClient yet
if (!grallocTextureClient->GetIPDLActor()) {
grallocTextureClient->SetTextureFlags(mTextureInfo.mTextureFlags);
AddTextureClient(grallocTextureClient);
}
if (grallocTextureClient->GetIPDLActor()) {
UseTexture(grallocTextureClient);
}
if (mBuffer) {
// remove old buffer from CompositableHost
RefPtr<AsyncTransactionTracker> tracker = new RemoveTextureFromCompositableTracker();
// Hold TextureClient until transaction complete.
tracker->SetTextureClient(mBuffer);
mBuffer->SetRemoveFromCompositableTracker(tracker);
// RemoveTextureFromCompositableAsync() expects CompositorChild's presence.
GetForwarder()->RemoveTextureFromCompositableAsync(tracker, this, mBuffer);
}
mBuffer = grallocTextureClient;
#else
bool isCrossProcess = !(XRE_GetProcessType() == GeckoProcessType_Default);
if (isCrossProcess) {
printf_stderr("isCrossProcess, but not MOZ_WIDGET_GONK! Someone needs to write some code!");
MOZ_ASSERT(false);
} else {
bool bufferCreated = false;
if (!mBuffer) {
// We need to dealloc in the client.
TextureFlags flags = GetTextureFlags() |
TextureFlags::DEALLOCATE_CLIENT;
StreamTextureClient* texClient = new StreamTextureClient(flags);
texClient->InitWith(stream);
mBuffer = texClient;
bufferCreated = true;
}
if (bufferCreated && !AddTextureClient(mBuffer)) {
mBuffer = nullptr;
}
if (mBuffer) {
GetForwarder()->UpdatedTexture(this, mBuffer, nullptr);
GetForwarder()->UseTexture(this, mBuffer);
}
}
#endif
aLayer->Painted();
}
*/
////////////////////////////////////////////////////////////////////////
@ -247,7 +162,7 @@ TexClientFromShSurf(SharedSurface* surf, TextureFlags flags)
#ifdef MOZ_WIDGET_GONK
case SharedSurfaceType::Gralloc:
return GrallocTextureClientOGL::FromShSurf(surf, flags);
return GrallocTextureClientOGL::FromSharedSurface(surf, flags);
#endif
default:

Просмотреть файл

@ -797,8 +797,8 @@ TextureParent::ClearTextureHost()
////////////////////////////////////////////////////////////////////////////////
static RefPtr<NewTextureSource>
ShSurfToTexSource(gl::SharedSurface* abstractSurf, Compositor* compositor)
static RefPtr<TextureSource>
SharedSurfaceToTexSource(gl::SharedSurface* abstractSurf, Compositor* compositor)
{
MOZ_ASSERT(abstractSurf);
MOZ_ASSERT(abstractSurf->mType != gl::SharedSurfaceType::Basic);
@ -811,7 +811,7 @@ ShSurfToTexSource(gl::SharedSurface* abstractSurf, Compositor* compositor)
gfx::SurfaceFormat format = abstractSurf->mHasAlpha ? gfx::SurfaceFormat::R8G8B8A8
: gfx::SurfaceFormat::R8G8B8X8;
RefPtr<NewTextureSource> texSource;
RefPtr<TextureSource> texSource;
switch (abstractSurf->mType) {
#ifdef XP_WIN
case gl::SharedSurfaceType::EGLSurfaceANGLE: {
@ -919,7 +919,7 @@ SharedSurfaceTextureHost::EnsureTexSource()
return;
mSurf->WaitSync();
mTexSource = ShSurfToTexSource(mSurf, mCompositor);
mTexSource = SharedSurfaceToTexSource(mSurf, mCompositor);
MOZ_ASSERT(mTexSource);
}

Просмотреть файл

@ -577,7 +577,8 @@ protected:
class SharedSurfaceTextureHost : public TextureHost
{
public:
SharedSurfaceTextureHost(TextureFlags aFlags, const ShSurfDescriptor& aDesc);
SharedSurfaceTextureHost(TextureFlags aFlags,
const SharedSurfaceDescriptor& aDesc);
virtual ~SharedSurfaceTextureHost() {};
@ -610,7 +611,7 @@ public:
mIsLocked = false;
}
virtual NewTextureSource* GetTextureSources() MOZ_OVERRIDE {
virtual TextureSource* GetTextureSources() MOZ_OVERRIDE {
MOZ_ASSERT(mIsLocked);
MOZ_ASSERT(mTexSource);
return mTexSource;
@ -630,7 +631,7 @@ protected:
bool mIsLocked;
gl::SharedSurface* const mSurf;
Compositor* mCompositor;
RefPtr<NewTextureSource> mTexSource;
RefPtr<TextureSource> mTexSource;
};
class MOZ_STACK_CLASS AutoLockTextureHost

Просмотреть файл

@ -112,8 +112,8 @@ GrallocTextureClientOGL::WaitForBufferOwnership()
android::sp<Fence> fence = mReleaseFenceHandle.mFence;
#if ANDROID_VERSION == 17
fence->waitForever(1000, "GrallocTextureClientOGL::Lock");
// 1000 is what Android uses. It is warning timeout ms.
// This timeous is removed since ANDROID_VERSION 18.
// 1000 is what Android uses. It is a warning timeout in ms.
// This timeout was removed in ANDROID_VERSION 18.
#else
fence->waitForever("GrallocTextureClientOGL::Lock");
#endif
@ -348,8 +348,8 @@ GrallocTextureClientOGL::GetBufferSize() const
}
/*static*/ TemporaryRef<TextureClient>
GrallocTextureClientOGL::FromShSurf(gl::SharedSurface* abstractSurf,
TextureFlags flags)
GrallocTextureClientOGL::FromSharedSurface(gl::SharedSurface* abstractSurf,
TextureFlags flags)
{
auto surf = gl::SharedSurface_Gralloc::Cast(abstractSurf);

Просмотреть файл

@ -118,8 +118,8 @@ public:
CreateSimilar(TextureFlags aFlags = TextureFlags::DEFAULT,
TextureAllocationFlags aAllocFlags = ALLOC_DEFAULT) const MOZ_OVERRIDE;
static TemporaryRef<TextureClient> FromShSurf(gl::SharedSurface* surf,
TextureFlags flags);
static TemporaryRef<TextureClient> FromSharedSurface(gl::SharedSurface* surf,
TextureFlags flags);
protected:
/**