Skip to content

Commit

Permalink
Even more bug fixes
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: 9CP2TS966zt
  • Loading branch information
jrmuizel committed Jan 27, 2018
1 parent ebb0f15 commit f45e10c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions gfx/2d/DrawEventRecorder.cpp
Expand Up @@ -126,6 +126,9 @@ DrawEventRecorderMemory::Finish()
printf("FINISH\n");
// this length might be 0, and things should still work.
size_t indexOffset = mOutputStream.mLength;
if (indexOffset == 0) {
MOZ_RELEASE_ASSERT(mIndex.mLength);
}
// write out the index
mOutputStream.write(mIndex.mData, mIndex.mLength);
mIndex = MemStream();
Expand Down
1 change: 1 addition & 0 deletions gfx/layers/wr/IpcResourceUpdateQueue.cpp
Expand Up @@ -249,6 +249,7 @@ IpcResourceUpdateQueue::AddBlobImage(ImageKey key, const ImageDescriptor& aDescr
Range<uint8_t> aBytes)
{
auto bytes = mWriter.Write(aBytes);
MOZ_RELEASE_ASSERT(bytes.length() != 111);
if (!bytes.length()) {
return false;
}
Expand Down
14 changes: 9 additions & 5 deletions gfx/layers/wr/WebRenderCommandBuilder.cpp
Expand Up @@ -180,7 +180,8 @@ struct DIGroup {
Maybe<wr::ImageKey> mKey;

void InvalidateRect(IntRect aRect) {
mInvalidRect = mInvalidRect.UnionEdges(aRect);
// Empty rects get dropped
mInvalidRect = mInvalidRect.Union(aRect);
}

IntRect ItemBounds(nsDisplayItem *item)
Expand Down Expand Up @@ -253,7 +254,7 @@ struct DIGroup {
aData->mRect.y,
aData->mRect.width,
aData->mRect.height);
InvalidateRect(aData->mRect);
InvalidateRect(aData->mRect.Intersect(imageRect));
// We want to snap to outside pixels. When should we multiply by the matrix?
// XXX: TransformBounds is expensive. We should avoid doing it if we have no transform
IntRect transformedRect = RoundedOut(mMatrix.TransformBounds(ToRect(nsLayoutUtils::RectToGfxRect(combined.GetBounds(), appUnitsPerDevPixel)))) - mGroupOffset;
Expand Down Expand Up @@ -294,12 +295,14 @@ struct DIGroup {
IntRect transformedRect = RoundedOut(mMatrix.TransformBounds(ToRect(nsLayoutUtils::RectToGfxRect(combined.GetBounds(), appUnitsPerDevPixel)))) - mGroupOffset;
IntRect newBounds = transformedRect.Intersect(imageRect);
if (!aData->mRect.IsEqualEdges(newBounds)) {
printf("Changed transform/position\n");
InvalidateRect(aData->mRect);
printf("Changed transform/position %d %d %d %d\n", aData->mRect.x, aData->mRect.y, aData->mRect.XMost(), aData->mRect.YMost());
InvalidateRect(aData->mRect.Intersect(imageRect));
aData->mRect = newBounds;
printf("New rect: %d %d %d %d\n", aData->mRect.x, aData->mRect.y, aData->mRect.XMost(), aData->mRect.YMost());
InvalidateRect(aData->mRect);
} else {
printf("NoChange: %s\n", item->Name());
printf("NoChange: %s %d %d %d %d\n", item->Name(),
aData->mRect.x, aData->mRect.y, aData->mRect.XMost(), aData->mRect.YMost());
}
}
}
Expand Down Expand Up @@ -439,6 +442,7 @@ struct DIGroup {
printf("paint check invalid %d %d - %d %d\n", bottomRight.x, bottomRight.y, size.width, size.height);
MOZ_RELEASE_ASSERT(bottomRight.x <= size.width && bottomRight.y <= size.height);
// skip items not in inside the invalidation bounds
// empty 'bounds' will be skipped
if (!mInvalidRect.Intersects(bounds)) {
printf("Passing\n");
continue;
Expand Down
1 change: 1 addition & 0 deletions gfx/webrender_bindings/src/bindings.rs
Expand Up @@ -981,6 +981,7 @@ pub extern "C" fn wr_resource_updates_add_image(
) {
println!("key {:?} length {}", image_key, bytes.length);
assert!(bytes.length > 4);
assert!(bytes.length != 111);
resources.add_image(
image_key,
descriptor.into(),
Expand Down

0 comments on commit f45e10c

Please sign in to comment.