зеркало из https://github.com/mozilla/gecko-dev.git
Bug 888530 - Simplify the code for updating a TextureClientShmem from an Image. r=jrmuizel
This commit is contained in:
Родитель
ac99fe266c
Коммит
4cfda893e7
|
@ -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);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче