Bug 888530 - Simplify the code for updating a TextureClientShmem from an Image. r=jrmuizel

This commit is contained in:
Matt Woodrow 2013-07-09 17:52:30 -04:00
Родитель ac99fe266c
Коммит 4cfda893e7
4 изменённых файлов: 5 добавлений и 18 удалений

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

@ -51,7 +51,6 @@ ImageClient::CreateImageClient(CompositableType aCompositableHostType,
ImageClient::ImageClient(CompositableForwarder* aFwd, CompositableType aType)
: CompositableClient(aFwd)
, mFilter(gfxPattern::FILTER_GOOD)
, mType(aType)
, mLastPaintedImageSerial(0)
{}
@ -190,11 +189,8 @@ ImageClientSingle::UpdateImage(ImageContainer* aContainer,
EnsureDeprecatedTextureClient(TEXTURE_SHMEM);
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
nsRefPtr<gfxPattern> pattern = new gfxPattern(surface);
pattern->SetFilter(mFilter);
AutoLockShmemClient clientLock(mDeprecatedTextureClient);
if (!clientLock.Update(image, aContentFlags, pattern)) {
if (!clientLock.Update(image, aContentFlags, surface)) {
NS_WARNING("failed to update DeprecatedTextureClient");
return false;
}

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

@ -61,7 +61,6 @@ public:
protected:
ImageClient(CompositableForwarder* aFwd, CompositableType aType);
gfxPattern::GraphicsFilter mFilter;
CompositableType mType;
int32_t mLastPaintedImageSerial;
nsIntRect mPictureRect;

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

@ -220,22 +220,16 @@ DeprecatedTextureClientTile::LockImageSurface()
bool AutoLockShmemClient::Update(Image* aImage,
uint32_t aContentFlags,
gfxPattern* pat)
gfxASurface *aSurface)
{
nsRefPtr<gfxASurface> surface = pat->GetSurface();
if (!aImage) {
return false;
}
nsRefPtr<gfxPattern> pattern = pat ? pat : new gfxPattern(surface);
gfxIntSize size = aImage->GetSize();
gfxASurface::gfxContentType contentType = gfxASurface::CONTENT_COLOR_ALPHA;
gfxASurface::gfxContentType contentType = aSurface->GetContentType();
bool isOpaque = (aContentFlags & Layer::CONTENT_OPAQUE);
if (surface) {
contentType = surface->GetContentType();
}
if (contentType != gfxASurface::CONTENT_ALPHA &&
isOpaque) {
contentType = gfxASurface::CONTENT_COLOR;
@ -253,9 +247,7 @@ bool AutoLockShmemClient::Update(Image* aImage,
}
nsRefPtr<gfxContext> tmpCtx = new gfxContext(tmpASurface.get());
tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
PaintContext(pat,
nsIntRegion(nsIntRect(0, 0, size.width, size.height)),
1.0, tmpCtx, nullptr);
tmpCtx->DrawSurface(aSurface, gfxSize(size.width, size.height));
return true;
}

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

@ -278,7 +278,7 @@ class AutoLockShmemClient : public AutoLockDeprecatedTextureClient
{
public:
AutoLockShmemClient(DeprecatedTextureClient* aTexture) : AutoLockDeprecatedTextureClient(aTexture) {}
bool Update(Image* aImage, uint32_t aContentFlags, gfxPattern* pat);
bool Update(Image* aImage, uint32_t aContentFlags, gfxASurface *aSurface);
};
}