Merge b2g-inbound to m-c

This commit is contained in:
Wes Kocher 2013-12-16 21:08:22 -08:00
commit a846798a5c
4 changed files with 39 additions and 23 deletions

View File

@ -153,17 +153,18 @@ YCbCrImageDataSerializer::ComputeMinBufferSize(uint32_t aSize)
}
void
YCbCrImageDataSerializer::InitializeBufferInfo(const gfx::IntSize& aYSize,
YCbCrImageDataSerializer::InitializeBufferInfo(uint32_t aYOffset,
uint32_t aCbOffset,
uint32_t aCrOffset,
const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize,
StereoMode aStereoMode)
{
YCbCrBufferInfo* info = GetYCbCrBufferInfo(mData);
info->mYOffset = MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
info->mCbOffset = info->mYOffset
+ MOZ_ALIGN_WORD(aYSize.width * aYSize.height);
info->mCrOffset = info->mCbOffset
+ MOZ_ALIGN_WORD(aCbCrSize.width * aCbCrSize.height);
uint32_t info_size = MOZ_ALIGN_WORD(sizeof(YCbCrBufferInfo));
info->mYOffset = info_size + aYOffset;
info->mCbOffset = info_size + aCbOffset;
info->mCrOffset = info_size + aCrOffset;
info->mYWidth = aYSize.width;
info->mYHeight = aYSize.height;
info->mCbCrWidth = aCbCrSize.width;
@ -171,6 +172,17 @@ YCbCrImageDataSerializer::InitializeBufferInfo(const gfx::IntSize& aYSize,
info->mStereoMode = aStereoMode;
}
void
YCbCrImageDataSerializer::InitializeBufferInfo(const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize,
StereoMode aStereoMode)
{
uint32_t yOffset = 0;
uint32_t cbOffset = yOffset + MOZ_ALIGN_WORD(aYSize.width * aYSize.height);
uint32_t crOffset = cbOffset + MOZ_ALIGN_WORD(aCbCrSize.width * aCbCrSize.height);
return InitializeBufferInfo(yOffset, cbOffset, crOffset, aYSize, aCbCrSize, aStereoMode);
}
void
YCbCrImageDataSerializer::InitializeBufferInfo(const gfxIntSize& aYSize,
const gfxIntSize& aCbCrSize,

View File

@ -114,6 +114,12 @@ public:
* The provided pointer should point to the beginning of the (chunk of)
* buffer on which we want to store the image.
*/
void InitializeBufferInfo(uint32_t aYOffset,
uint32_t aCbOffset,
uint32_t aCrOffset,
const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize,
StereoMode aStereoMode);
void InitializeBufferInfo(const gfx::IntSize& aYSize,
const gfx::IntSize& aCbCrSize,
StereoMode aStereoMode);

View File

@ -1213,21 +1213,6 @@ const CSSRect AsyncPanZoomController::CalculatePendingDisplayPort(
scrollOffset.y = scrollableRect.y;
}
// FIXME/bug 936500: Make sure the displayport contains the composition
// bounds. This is to work around a layout bug that means if a display item's
// corresponding displayport doesn't contain its frame's bounds, it may get
// optimised out and the layer won't get created.
if (displayPort.x + displayPort.width < compositionBounds.width) {
displayPort.x = -(displayPort.width - compositionBounds.width);
} else if (displayPort.x > 0) {
displayPort.x = 0;
}
if (displayPort.y + displayPort.height < compositionBounds.height) {
displayPort.y = -(displayPort.height - compositionBounds.height);
} else if (displayPort.y > 0) {
displayPort.y = 0;
}
CSSRect shiftedDisplayPort = displayPort + scrollOffset;
return scrollableRect.ClampRect(shiftedDisplayPort) - scrollOffset;
}

View File

@ -143,8 +143,21 @@ SharedPlanarYCbCrImage::SetDataNoCopy(const Data &aData)
{
mData = aData;
mSize = aData.mPicSize;
/* SetDataNoCopy is used to update YUV plane offsets without (re)allocating
* memory previously allocated with AllocateAndGetNewBuffer().
* serializer.GetData() returns the address of the memory previously allocated
* with AllocateAndGetNewBuffer(), that we subtract from the Y, Cb, Cr
* channels to compute 0-based offsets to pass to InitializeBufferInfo.
*/
YCbCrImageDataSerializer serializer(mTextureClient->GetBuffer());
serializer.InitializeBufferInfo(aData.mYSize,
uint8_t *base = serializer.GetData();
uint32_t yOffset = aData.mYChannel - base;
uint32_t cbOffset = aData.mCbChannel - base;
uint32_t crOffset = aData.mCrChannel - base;
serializer.InitializeBufferInfo(yOffset,
cbOffset,
crOffset,
aData.mYSize,
aData.mCbCrSize,
aData.mStereoMode);
}