| Index: cc/tiled_layer_unittest.cc
|
| diff --git a/cc/tiled_layer_unittest.cc b/cc/tiled_layer_unittest.cc
|
| index 07891b97433dedaf18bd2494f5b9386dc7ef5b65..64217e940c1da0e1018c2bb83697976d36785a19 100644
|
| --- a/cc/tiled_layer_unittest.cc
|
| +++ b/cc/tiled_layer_unittest.cc
|
| @@ -173,9 +173,9 @@ TEST_F(TiledLayerTest, pushDirtyTiles)
|
| ScopedFakeTiledLayerImpl layerImpl(1);
|
|
|
| // The tile size is 100x100, so this invalidates and then paints two tiles.
|
| - layer->setBounds(IntSize(100, 200));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
| - layer->invalidateContentRect(IntRect(0, 0, 100, 200));
|
| + layer->setBounds(gfx::Size(100, 200));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
|
| updateAndPush(layer.get(), layerImpl.get());
|
|
|
| // We should have both tiles on the impl side.
|
| @@ -183,9 +183,9 @@ TEST_F(TiledLayerTest, pushDirtyTiles)
|
| EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 1));
|
|
|
| // Invalidates both tiles, but then only update one of them.
|
| - layer->setBounds(IntSize(100, 200));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
|
| - layer->invalidateContentRect(IntRect(0, 0, 100, 200));
|
| + layer->setBounds(gfx::Size(100, 200));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
|
| updateAndPush(layer.get(), layerImpl.get());
|
|
|
| // We should only have the first tile since the other tile was invalidated but not painted.
|
| @@ -201,9 +201,9 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
|
| m_occlusion = &occluded;
|
|
|
| // The tile size is 100x100, so this invalidates and then paints two tiles.
|
| - layer->setBounds(IntSize(100, 200));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
| - layer->invalidateContentRect(IntRect(0, 0, 100, 200));
|
| + layer->setBounds(gfx::Size(100, 200));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
|
| updateAndPush(layer.get(), layerImpl.get());
|
|
|
| EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
|
| @@ -215,9 +215,9 @@ TEST_F(TiledLayerTest, pushOccludedDirtyTiles)
|
| EXPECT_TRUE(layerImpl->hasResourceIdForTileAt(0, 1));
|
|
|
| // Invalidates part of the top tile...
|
| - layer->invalidateContentRect(IntRect(0, 0, 50, 50));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 50, 50));
|
| // ....but the area is occluded.
|
| - occluded.setOcclusion(IntRect(0, 0, 50, 50));
|
| + occluded.setOcclusion(cc::IntRect(0, 0, 50, 50));
|
| updateAndPush(layer.get(), layerImpl.get());
|
|
|
| EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1);
|
| @@ -235,9 +235,9 @@ TEST_F(TiledLayerTest, pushDeletedTiles)
|
| ScopedFakeTiledLayerImpl layerImpl(1);
|
|
|
| // The tile size is 100x100, so this invalidates and then paints two tiles.
|
| - layer->setBounds(IntSize(100, 200));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
| - layer->invalidateContentRect(IntRect(0, 0, 100, 200));
|
| + layer->setBounds(gfx::Size(100, 200));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
|
| updateAndPush(layer.get(), layerImpl.get());
|
|
|
| // We should have both tiles on the impl side.
|
| @@ -256,7 +256,7 @@ TEST_F(TiledLayerTest, pushDeletedTiles)
|
| EXPECT_FALSE(layerImpl->hasResourceIdForTileAt(0, 1));
|
|
|
| // This should recreate and update one of the deleted textures.
|
| - layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
|
| updateAndPush(layer.get(), layerImpl.get());
|
|
|
| // We should have one tiles on the impl side.
|
| @@ -271,9 +271,9 @@ TEST_F(TiledLayerTest, pushIdlePaintTiles)
|
|
|
| // The tile size is 100x100. Setup 5x5 tiles with one visible tile in the center.
|
| // This paints 1 visible of the 25 invalid tiles.
|
| - layer->setBounds(IntSize(500, 500));
|
| - layer->setVisibleContentRect(IntRect(200, 200, 100, 100));
|
| - layer->invalidateContentRect(IntRect(0, 0, 500, 500));
|
| + layer->setBounds(gfx::Size(500, 500));
|
| + layer->setVisibleContentRect(gfx::Rect(200, 200, 100, 100));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 500, 500));
|
| bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
| // We should need idle-painting for surrounding tiles.
|
| EXPECT_TRUE(needsUpdate);
|
| @@ -307,35 +307,35 @@ TEST_F(TiledLayerTest, predictivePainting)
|
|
|
| // Prepainting should occur in the scroll direction first, and the
|
| // visible rect should be extruded only along the dominant axis.
|
| - IntSize directions[6] = { IntSize(-10, 0),
|
| - IntSize(10, 0),
|
| - IntSize(0, -10),
|
| - IntSize(0, 10),
|
| - IntSize(10, 20),
|
| - IntSize(-20, 10) };
|
| + gfx::Vector2d directions[6] = { gfx::Vector2d(-10, 0),
|
| + gfx::Vector2d(10, 0),
|
| + gfx::Vector2d(0, -10),
|
| + gfx::Vector2d(0, 10),
|
| + gfx::Vector2d(10, 20),
|
| + gfx::Vector2d(-20, 10) };
|
| // We should push all tiles that touch the extruded visible rect.
|
| - IntRect pushedVisibleTiles[6] = { IntRect(2, 2, 2, 1),
|
| - IntRect(1, 2, 2, 1),
|
| - IntRect(2, 2, 1, 2),
|
| - IntRect(2, 1, 1, 2),
|
| - IntRect(2, 1, 1, 2),
|
| - IntRect(2, 2, 2, 1) };
|
| + gfx::Rect pushedVisibleTiles[6] = { gfx::Rect(2, 2, 2, 1),
|
| + gfx::Rect(1, 2, 2, 1),
|
| + gfx::Rect(2, 2, 1, 2),
|
| + gfx::Rect(2, 1, 1, 2),
|
| + gfx::Rect(2, 1, 1, 2),
|
| + gfx::Rect(2, 2, 2, 1) };
|
| // The first pre-paint should also paint first in the scroll
|
| // direction so we should find one additional tile in the scroll direction.
|
| - IntRect pushedPrepaintTiles[6] = { IntRect(2, 2, 3, 1),
|
| - IntRect(0, 2, 3, 1),
|
| - IntRect(2, 2, 1, 3),
|
| - IntRect(2, 0, 1, 3),
|
| - IntRect(2, 0, 1, 3),
|
| - IntRect(2, 2, 3, 1) };
|
| + gfx::Rect pushedPrepaintTiles[6] = { gfx::Rect(2, 2, 3, 1),
|
| + gfx::Rect(0, 2, 3, 1),
|
| + gfx::Rect(2, 2, 1, 3),
|
| + gfx::Rect(2, 0, 1, 3),
|
| + gfx::Rect(2, 0, 1, 3),
|
| + gfx::Rect(2, 2, 3, 1) };
|
| for(int k = 0; k < 6; k++) {
|
| // The tile size is 100x100. Setup 5x5 tiles with one visible tile
|
| // in the center.
|
| - IntSize contentBounds = IntSize(500, 500);
|
| - IntRect contentRect = IntRect(0, 0, 500, 500);
|
| - IntRect visibleRect = IntRect(200, 200, 100, 100);
|
| - IntRect previousVisibleRect = IntRect(visibleRect.location() + directions[k], visibleRect.size());
|
| - IntRect nextVisibleRect = IntRect(visibleRect.location() - directions[k], visibleRect.size());
|
| + gfx::Size contentBounds = gfx::Size(500, 500);
|
| + gfx::Rect contentRect = gfx::Rect(0, 0, 500, 500);
|
| + gfx::Rect visibleRect = gfx::Rect(200, 200, 100, 100);
|
| + gfx::Rect previousVisibleRect = gfx::Rect(visibleRect.origin() + directions[k], visibleRect.size());
|
| + gfx::Rect nextVisibleRect = gfx::Rect(visibleRect.origin() - directions[k], visibleRect.size());
|
|
|
| // Setup. Use the previousVisibleRect to setup the prediction for next frame.
|
| layer->setBounds(contentBounds);
|
| @@ -350,7 +350,7 @@ TEST_F(TiledLayerTest, predictivePainting)
|
| needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
| for (int i = 0; i < 5; i++) {
|
| for (int j = 0; j < 5; j++)
|
| - EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedVisibleTiles[k].contains(i, j));
|
| + EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedVisibleTiles[k].Contains(i, j));
|
| }
|
|
|
| // Move the transform in the same direction without invalidating.
|
| @@ -361,7 +361,7 @@ TEST_F(TiledLayerTest, predictivePainting)
|
| needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
| for (int i = 0; i < 5; i++) {
|
| for (int j = 0; j < 5; j++)
|
| - EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedPrepaintTiles[k].contains(i, j));
|
| + EXPECT_EQ(layerImpl->hasResourceIdForTileAt(i, j), pushedPrepaintTiles[k].Contains(i, j));
|
| }
|
| }
|
|
|
| @@ -386,16 +386,16 @@ TEST_F(TiledLayerTest, pushTilesAfterIdlePaintFailed)
|
| // layer2, we will fail on the third tile of layer2, and this should not leave the second tile in a bad state.
|
|
|
| // This uses 960000 bytes, leaving 88576 bytes of memory left, which is enough for 2 tiles only in the other layer.
|
| - IntRect layer1Rect(0, 0, 100, 2400);
|
| + gfx::Rect layer1Rect(0, 0, 100, 2400);
|
|
|
| // This requires 4*30000 bytes of memory.
|
| - IntRect layer2Rect(0, 0, 100, 300);
|
| + gfx::Rect layer2Rect(0, 0, 100, 300);
|
|
|
| // Paint a single tile in layer2 so that it will idle paint.
|
| layer1->setBounds(layer1Rect.size());
|
| layer1->setVisibleContentRect(layer1Rect);
|
| layer2->setBounds(layer2Rect.size());
|
| - layer2->setVisibleContentRect(IntRect(0, 0, 100, 100));
|
| + layer2->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
|
| bool needsUpdate = updateAndPush(layer1.get(), layerImpl1.get(),
|
| layer2.get(), layerImpl2.get());
|
| // We should need idle-painting for both remaining tiles in layer2.
|
| @@ -434,10 +434,10 @@ TEST_F(TiledLayerTest, pushIdlePaintedOccludedTiles)
|
| m_occlusion = &occluded;
|
|
|
| // The tile size is 100x100, so this invalidates one occluded tile, culls it during paint, but prepaints it.
|
| - occluded.setOcclusion(IntRect(0, 0, 100, 100));
|
| + occluded.setOcclusion(cc::IntRect(0, 0, 100, 100));
|
|
|
| - layer->setBounds(IntSize(100, 100));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
|
| + layer->setBounds(gfx::Size(100, 100));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
|
| updateAndPush(layer.get(), layerImpl.get());
|
|
|
| // We should have the prepainted tile on the impl side, but culled it during paint.
|
| @@ -453,9 +453,9 @@ TEST_F(TiledLayerTest, pushTilesMarkedDirtyDuringPaint)
|
| // The tile size is 100x100, so this invalidates and then paints two tiles.
|
| // However, during the paint, we invalidate one of the tiles. This should
|
| // not prevent the tile from being pushed.
|
| - layer->fakeLayerUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get());
|
| - layer->setBounds(IntSize(100, 200));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
| + layer->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer.get());
|
| + layer->setBounds(gfx::Size(100, 200));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
| updateAndPush(layer.get(), layerImpl.get());
|
|
|
| // We should have both tiles on the impl side.
|
| @@ -471,11 +471,11 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer)
|
| ScopedFakeTiledLayerImpl layer2Impl(2);
|
|
|
| // Invalidate a tile on layer1, during update of layer 2.
|
| - layer2->fakeLayerUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get());
|
| - layer1->setBounds(IntSize(100, 200));
|
| - layer1->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
| - layer2->setBounds(IntSize(100, 200));
|
| - layer2->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
| + layer2->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer1.get());
|
| + layer1->setBounds(gfx::Size(100, 200));
|
| + layer1->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
| + layer2->setBounds(gfx::Size(100, 200));
|
| + layer2->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
| updateAndPush(layer1.get(), layer1Impl.get(),
|
| layer2.get(), layer2Impl.get());
|
|
|
| @@ -493,11 +493,11 @@ TEST_F(TiledLayerTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLayer)
|
| ScopedFakeTiledLayerImpl layer1Impl(1);
|
| ScopedFakeTiledLayerImpl layer2Impl(2);
|
|
|
| - layer1->fakeLayerUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get());
|
| - layer1->setBounds(IntSize(100, 200));
|
| - layer1->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
| - layer2->setBounds(IntSize(100, 200));
|
| - layer2->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
| + layer1->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(0, 50, 100, 50), layer2.get());
|
| + layer1->setBounds(gfx::Size(100, 200));
|
| + layer1->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
| + layer2->setBounds(gfx::Size(100, 200));
|
| + layer2->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
| updateAndPush(layer1.get(), layer1Impl.get(),
|
| layer2.get(), layer2Impl.get());
|
|
|
| @@ -521,7 +521,7 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
|
| int layerWidth = 4 * FakeTiledLayer::tileSize().width();
|
| int layerHeight = 4 * FakeTiledLayer::tileSize().height();
|
| int memoryForLayer = layerWidth * layerHeight * 4;
|
| - IntSize viewportSize = IntSize(layerWidth, layerHeight);
|
| + gfx::Size viewportSize = gfx::Size(layerWidth, layerHeight);
|
| layerTreeHost->setViewportSize(viewportSize, viewportSize);
|
|
|
| // Use 8x4 tiles to run out of memory.
|
| @@ -534,9 +534,9 @@ TEST_F(TiledLayerTest, paintSmallAnimatedLayersImmediately)
|
| ScopedFakeTiledLayerImpl layerImpl(1);
|
|
|
| // Full size layer with half being visible.
|
| - IntSize contentBounds(layerWidth, layerHeight);
|
| - IntRect contentRect(IntPoint::zero(), contentBounds);
|
| - IntRect visibleRect(IntPoint::zero(), IntSize(layerWidth / 2, layerHeight));
|
| + gfx::Size contentBounds(layerWidth, layerHeight);
|
| + gfx::Rect contentRect(gfx::Point(), contentBounds);
|
| + gfx::Rect visibleRect(gfx::Point(), gfx::Size(layerWidth / 2, layerHeight));
|
|
|
| // Pretend the layer is animating.
|
| layer->setDrawTransformIsAnimating(true);
|
| @@ -581,8 +581,8 @@ TEST_F(TiledLayerTest, idlePaintOutOfMemory)
|
|
|
| // The tile size is 100x100, so this invalidates and then paints two tiles.
|
| bool needsUpdate = false;
|
| - layer->setBounds(IntSize(300, 300));
|
| - layer->setVisibleContentRect(IntRect(100, 100, 100, 100));
|
| + layer->setBounds(gfx::Size(300, 300));
|
| + layer->setVisibleContentRect(gfx::Rect(100, 100, 100, 100));
|
| for (int i = 0; i < 2; i++)
|
| needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
|
|
| @@ -605,8 +605,8 @@ TEST_F(TiledLayerTest, idlePaintZeroSizedLayer)
|
|
|
| // The layer's bounds are empty.
|
| // Empty layers don't paint or idle-paint.
|
| - layer->setBounds(IntSize());
|
| - layer->setVisibleContentRect(IntRect());
|
| + layer->setBounds(gfx::Size());
|
| + layer->setVisibleContentRect(gfx::Rect());
|
| bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
|
|
| // Empty layers don't have tiles.
|
| @@ -626,9 +626,9 @@ TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
|
| ScopedFakeTiledLayerImpl layerImpl(1);
|
|
|
| // Alternate between not visible and visible.
|
| - IntRect v(0, 0, 100, 100);
|
| - IntRect nv(0, 0, 0, 0);
|
| - IntRect visibleRect[10] = {nv, nv, v, v, nv, nv, v, v, nv, nv};
|
| + gfx::Rect v(0, 0, 100, 100);
|
| + gfx::Rect nv(0, 0, 0, 0);
|
| + gfx::Rect visibleRect[10] = {nv, nv, v, v, nv, nv, v, v, nv, nv};
|
| bool invalidate[10] = {true, true, true, true, true, true, true, true, false, false };
|
|
|
| // We should not have any tiles except for when the layer was visible
|
| @@ -636,11 +636,11 @@ TEST_F(TiledLayerTest, idlePaintNonVisibleLayers)
|
| bool haveTile[10] = { false, false, true, true, false, false, true, true, true, true };
|
|
|
| for (int i = 0; i < 10; i++) {
|
| - layer->setBounds(IntSize(100, 100));
|
| + layer->setBounds(gfx::Size(100, 100));
|
| layer->setVisibleContentRect(visibleRect[i]);
|
|
|
| if (invalidate[i])
|
| - layer->invalidateContentRect(IntRect(0, 0, 100, 100));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 100, 100));
|
| bool needsUpdate = updateAndPush(layer.get(), layerImpl.get());
|
|
|
| // We should never signal idle paint, as we painted the entire layer
|
| @@ -656,8 +656,8 @@ TEST_F(TiledLayerTest, invalidateFromPrepare)
|
| ScopedFakeTiledLayerImpl layerImpl(1);
|
|
|
| // The tile size is 100x100, so this invalidates and then paints two tiles.
|
| - layer->setBounds(IntSize(100, 200));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
| + layer->setBounds(gfx::Size(100, 200));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
| updateAndPush(layer.get(), layerImpl.get());
|
|
|
| // We should have both tiles on the impl side.
|
| @@ -671,9 +671,9 @@ TEST_F(TiledLayerTest, invalidateFromPrepare)
|
| EXPECT_EQ(0, layer->fakeLayerUpdater()->prepareCount());
|
|
|
| // setRectToInvalidate triggers invalidateContentRect() being invoked from update.
|
| - layer->fakeLayerUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get());
|
| + layer->fakeLayerUpdater()->setRectToInvalidate(gfx::Rect(25, 25, 50, 50), layer.get());
|
| layer->fakeLayerUpdater()->clearPrepareCount();
|
| - layer->invalidateContentRect(IntRect(0, 0, 50, 50));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 50, 50));
|
| updateAndPush(layer.get(), layerImpl.get());
|
| EXPECT_EQ(1, layer->fakeLayerUpdater()->prepareCount());
|
| layer->fakeLayerUpdater()->clearPrepareCount();
|
| @@ -689,8 +689,8 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
|
| // layer space, not the content space.
|
| scoped_refptr<FakeTiledLayerWithScaledBounds> layer = make_scoped_refptr(new FakeTiledLayerWithScaledBounds(m_textureManager.get()));
|
|
|
| - IntRect layerBounds(0, 0, 300, 200);
|
| - IntRect contentBounds(0, 0, 200, 250);
|
| + gfx::Rect layerBounds(0, 0, 300, 200);
|
| + gfx::Rect contentBounds(0, 0, 200, 250);
|
|
|
| layer->setBounds(layerBounds.size());
|
| layer->setContentBounds(contentBounds.size());
|
| @@ -703,7 +703,7 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| layer->update(*m_queue.get(), 0, m_stats);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect());
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 300, 300 * 0.8), layer->updateRect());
|
| updateTextures();
|
|
|
| // After the tiles are updated once, another invalidate only needs to update the bounds of the layer.
|
| @@ -711,16 +711,16 @@ TEST_F(TiledLayerTest, verifyUpdateRectWhenContentBoundsAreScaled)
|
| m_textureManager->prioritizeTextures();
|
| layer->invalidateContentRect(contentBounds);
|
| layer->update(*m_queue.get(), 0, m_stats);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect());
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(layerBounds), layer->updateRect());
|
| updateTextures();
|
|
|
| // Partial re-paint should also be represented by the updateRect in layer space, not content space.
|
| - IntRect partialDamage(30, 100, 10, 10);
|
| + gfx::Rect partialDamage(30, 100, 10, 10);
|
| layer->invalidateContentRect(partialDamage);
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| layer->update(*m_queue.get(), 0, m_stats);
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect());
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(45, 80, 15, 8), layer->updateRect());
|
| }
|
|
|
| TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
|
| @@ -729,12 +729,12 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
|
| ScopedFakeTiledLayerImpl layerImpl(1);
|
|
|
| // Create a layer with one tile.
|
| - layer->setBounds(IntSize(100, 100));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 100, 100));
|
| + layer->setBounds(gfx::Size(100, 100));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 100));
|
|
|
| // Invalidate the entire layer.
|
| layer->setNeedsDisplay();
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 100, 100), layer->lastNeedsDisplayRect());
|
|
|
| // Push the tiles to the impl side and check that there is exactly one.
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| @@ -750,8 +750,8 @@ TEST_F(TiledLayerTest, verifyInvalidationWhenContentsScaleChanges)
|
| // Change the contents scale and verify that the content rectangle requiring painting
|
| // is not scaled.
|
| layer->setContentsScale(2);
|
| - layer->setVisibleContentRect(IntRect(0, 0, 200, 200));
|
| - EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect());
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 200, 200));
|
| + EXPECT_FLOAT_RECT_EQ(gfx::RectF(0, 0, 100, 100), layer->lastNeedsDisplayRect());
|
|
|
| // The impl side should get 2x2 tiles now.
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| @@ -784,8 +784,8 @@ TEST_F(TiledLayerTest, skipsDrawGetsReset)
|
| ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded());
|
|
|
| // Create two 300 x 300 tiled layers.
|
| - IntSize contentBounds(300, 300);
|
| - IntRect contentRect(IntPoint::zero(), contentBounds);
|
| + gfx::Size contentBounds(300, 300);
|
| + gfx::Rect contentRect(gfx::Point(), contentBounds);
|
|
|
| // We have enough memory for only one of the two layers.
|
| int memoryLimit = 4 * 300 * 300; // 4 bytes per pixel.
|
| @@ -796,15 +796,15 @@ TEST_F(TiledLayerTest, skipsDrawGetsReset)
|
|
|
| rootLayer->setBounds(contentBounds);
|
| rootLayer->setVisibleContentRect(contentRect);
|
| - rootLayer->setPosition(FloatPoint(0, 0));
|
| + rootLayer->setPosition(gfx::PointF(0, 0));
|
| childLayer->setBounds(contentBounds);
|
| childLayer->setVisibleContentRect(contentRect);
|
| - childLayer->setPosition(FloatPoint(0, 0));
|
| + childLayer->setPosition(gfx::PointF(0, 0));
|
| rootLayer->invalidateContentRect(contentRect);
|
| childLayer->invalidateContentRect(contentRect);
|
|
|
| layerTreeHost->setRootLayer(rootLayer);
|
| - layerTreeHost->setViewportSize(IntSize(300, 300), IntSize(300, 300));
|
| + layerTreeHost->setViewportSize(gfx::Size(300, 300), gfx::Size(300, 300));
|
|
|
| layerTreeHost->updateLayers(*m_queue.get(), memoryLimit);
|
|
|
| @@ -828,16 +828,16 @@ TEST_F(TiledLayerTest, resizeToSmaller)
|
| {
|
| scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
|
|
|
| - layer->setBounds(IntSize(700, 700));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 700, 700));
|
| - layer->invalidateContentRect(IntRect(0, 0, 700, 700));
|
| + layer->setBounds(gfx::Size(700, 700));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 700, 700));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 700, 700));
|
|
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| layer->update(*m_queue.get(), 0, m_stats);
|
|
|
| - layer->setBounds(IntSize(200, 200));
|
| - layer->invalidateContentRect(IntRect(0, 0, 200, 200));
|
| + layer->setBounds(gfx::Size(200, 200));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 200, 200));
|
| }
|
|
|
| TEST_F(TiledLayerTest, hugeLayerUpdateCrash)
|
| @@ -845,9 +845,9 @@ TEST_F(TiledLayerTest, hugeLayerUpdateCrash)
|
| scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
|
|
|
| int size = 1 << 30;
|
| - layer->setBounds(IntSize(size, size));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 700, 700));
|
| - layer->invalidateContentRect(IntRect(0, 0, size, size));
|
| + layer->setBounds(gfx::Size(size, size));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 700, 700));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, size, size));
|
|
|
| // Ensure no crash for bounds where size * size would overflow an int.
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| @@ -865,17 +865,17 @@ TEST_F(TiledLayerTest, partialUpdates)
|
| ASSERT_TRUE(layerTreeHost->initializeRendererIfNeeded());
|
|
|
| // Create one 300 x 200 tiled layer with 3 x 2 tiles.
|
| - IntSize contentBounds(300, 200);
|
| - IntRect contentRect(IntPoint::zero(), contentBounds);
|
| + gfx::Size contentBounds(300, 200);
|
| + gfx::Rect contentRect(gfx::Point(), contentBounds);
|
|
|
| scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
|
| layer->setBounds(contentBounds);
|
| - layer->setPosition(FloatPoint(0, 0));
|
| + layer->setPosition(gfx::PointF(0, 0));
|
| layer->setVisibleContentRect(contentRect);
|
| layer->invalidateContentRect(contentRect);
|
|
|
| layerTreeHost->setRootLayer(layer);
|
| - layerTreeHost->setViewportSize(IntSize(300, 200), IntSize(300, 200));
|
| + layerTreeHost->setViewportSize(gfx::Size(300, 200), gfx::Size(300, 200));
|
|
|
| // Full update of all 6 tiles.
|
| layerTreeHost->updateLayers(
|
| @@ -893,7 +893,7 @@ TEST_F(TiledLayerTest, partialUpdates)
|
| layerTreeHost->commitComplete();
|
|
|
| // Full update of 3 tiles and partial update of 3 tiles.
|
| - layer->invalidateContentRect(IntRect(0, 0, 300, 150));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 300, 150));
|
| layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| {
|
| ScopedFakeTiledLayerImpl layerImpl(1);
|
| @@ -908,7 +908,7 @@ TEST_F(TiledLayerTest, partialUpdates)
|
| layerTreeHost->commitComplete();
|
|
|
| // Partial update of 6 tiles.
|
| - layer->invalidateContentRect(IntRect(50, 50, 200, 100));
|
| + layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100));
|
| {
|
| ScopedFakeTiledLayerImpl layerImpl(1);
|
| layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| @@ -923,7 +923,7 @@ TEST_F(TiledLayerTest, partialUpdates)
|
| layerTreeHost->commitComplete();
|
|
|
| // Checkerboard all tiles.
|
| - layer->invalidateContentRect(IntRect(0, 0, 300, 200));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 300, 200));
|
| {
|
| ScopedFakeTiledLayerImpl layerImpl(1);
|
| layerPushPropertiesTo(layer.get(), layerImpl.get());
|
| @@ -931,7 +931,7 @@ TEST_F(TiledLayerTest, partialUpdates)
|
| layerTreeHost->commitComplete();
|
|
|
| // Partial update of 6 checkerboard tiles.
|
| - layer->invalidateContentRect(IntRect(50, 50, 200, 100));
|
| + layer->invalidateContentRect(gfx::Rect(50, 50, 200, 100));
|
| {
|
| ScopedFakeTiledLayerImpl layerImpl(1);
|
| layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| @@ -946,7 +946,7 @@ TEST_F(TiledLayerTest, partialUpdates)
|
| layerTreeHost->commitComplete();
|
|
|
| // Partial update of 4 tiles.
|
| - layer->invalidateContentRect(IntRect(50, 50, 100, 100));
|
| + layer->invalidateContentRect(gfx::Rect(50, 50, 100, 100));
|
| {
|
| ScopedFakeTiledLayerImpl layerImpl(1);
|
| layerTreeHost->updateLayers(*m_queue.get(), std::numeric_limits<size_t>::max());
|
| @@ -969,10 +969,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithoutOcclusion)
|
| scoped_refptr<FakeTiledLayer> layer = make_scoped_refptr(new FakeTiledLayer(m_textureManager.get()));
|
|
|
| // The tile size is 100x100, so this invalidates and then paints two tiles.
|
| - layer->setBounds(IntSize(100, 200));
|
| - layer->setDrawableContentRect(IntRect(0, 0, 100, 200));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 100, 200));
|
| - layer->invalidateContentRect(IntRect(0, 0, 100, 200));
|
| + layer->setBounds(gfx::Size(100, 200));
|
| + layer->setDrawableContentRect(gfx::Rect(0, 0, 100, 200));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 100, 200));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 100, 200));
|
|
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| @@ -987,12 +987,12 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
|
|
|
| // The tile size is 100x100.
|
|
|
| - layer->setBounds(IntSize(600, 600));
|
| + layer->setBounds(gfx::Size(600, 600));
|
|
|
| - occluded.setOcclusion(IntRect(200, 200, 300, 100));
|
| - layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
| - layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
| - layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
| + occluded.setOcclusion(cc::IntRect(200, 200, 300, 100));
|
| + layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
| + layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
|
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| @@ -1007,8 +1007,8 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
|
|
| - occluded.setOcclusion(IntRect(250, 200, 300, 100));
|
| - layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
| + occluded.setOcclusion(cc::IntRect(250, 200, 300, 100));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| EXPECT_EQ(36-2, layer->fakeLayerUpdater()->updateCount());
|
|
|
| @@ -1020,8 +1020,8 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusion)
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
|
|
| - occluded.setOcclusion(IntRect(250, 250, 300, 100));
|
| - layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
| + occluded.setOcclusion(cc::IntRect(250, 250, 300, 100));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| EXPECT_EQ(36, layer->fakeLayerUpdater()->updateCount());
|
|
|
| @@ -1037,13 +1037,13 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
|
|
|
| // The tile size is 100x100.
|
|
|
| - layer->setBounds(IntSize(600, 600));
|
| + layer->setBounds(gfx::Size(600, 600));
|
|
|
| // The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled.
|
| - occluded.setOcclusion(IntRect(200, 200, 300, 150));
|
| - layer->setDrawableContentRect(IntRect(0, 0, 600, 360));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 600, 360));
|
| - layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
| + occluded.setOcclusion(cc::IntRect(200, 200, 300, 150));
|
| + layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 360));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 360));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
|
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| @@ -1057,10 +1057,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
|
| layer->fakeLayerUpdater()->clearUpdateCount();
|
|
|
| // Now the visible region stops at the edge of the occlusion so the partly visible tiles become fully occluded.
|
| - occluded.setOcclusion(IntRect(200, 200, 300, 150));
|
| - layer->setDrawableContentRect(IntRect(0, 0, 600, 350));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 600, 350));
|
| - layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
| + occluded.setOcclusion(cc::IntRect(200, 200, 300, 150));
|
| + layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 350));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 350));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| @@ -1073,10 +1073,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndVisiblityConstraints)
|
| layer->fakeLayerUpdater()->clearUpdateCount();
|
|
|
| // Now the visible region is even smaller than the occlusion, it should have the same result.
|
| - occluded.setOcclusion(IntRect(200, 200, 300, 150));
|
| - layer->setDrawableContentRect(IntRect(0, 0, 600, 340));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 600, 340));
|
| - layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
| + occluded.setOcclusion(cc::IntRect(200, 200, 300, 150));
|
| + layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 340));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 340));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| @@ -1095,12 +1095,12 @@ TEST_F(TiledLayerTest, tilesNotPaintedWithoutInvalidation)
|
|
|
| // The tile size is 100x100.
|
|
|
| - layer->setBounds(IntSize(600, 600));
|
| + layer->setBounds(gfx::Size(600, 600));
|
|
|
| - occluded.setOcclusion(IntRect(200, 200, 300, 100));
|
| - layer->setDrawableContentRect(IntRect(0, 0, 600, 600));
|
| - layer->setVisibleContentRect(IntRect(0, 0, 600, 600));
|
| - layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
| + occluded.setOcclusion(cc::IntRect(200, 200, 300, 100));
|
| + layer->setDrawableContentRect(gfx::Rect(0, 0, 600, 600));
|
| + layer->setVisibleContentRect(gfx::Rect(0, 0, 600, 600));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| @@ -1135,16 +1135,16 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndTransforms)
|
|
|
| // This makes sure the painting works when the occluded region (in screen space)
|
| // is transformed differently than the layer.
|
| - layer->setBounds(IntSize(600, 600));
|
| + layer->setBounds(gfx::Size(600, 600));
|
| WebTransformationMatrix screenTransform;
|
| screenTransform.scale(0.5);
|
| layer->setScreenSpaceTransform(screenTransform);
|
| layer->setDrawTransform(screenTransform);
|
|
|
| - occluded.setOcclusion(IntRect(100, 100, 150, 50));
|
| - layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
| - layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
| - layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
| + occluded.setOcclusion(cc::IntRect(100, 100, 150, 50));
|
| + layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
| + layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| @@ -1166,16 +1166,16 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
|
| // a different layer space. In this case tiles are scaled to be 200x200
|
| // pixels, which means none should be occluded.
|
| layer->setContentsScale(0.5);
|
| - layer->setBounds(IntSize(600, 600));
|
| + layer->setBounds(gfx::Size(600, 600));
|
| WebTransformationMatrix drawTransform;
|
| drawTransform.scale(1 / layer->contentsScale());
|
| layer->setDrawTransform(drawTransform);
|
| layer->setScreenSpaceTransform(drawTransform);
|
|
|
| - occluded.setOcclusion(IntRect(200, 200, 300, 100));
|
| - layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
| - layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
| - layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
| + occluded.setOcclusion(cc::IntRect(200, 200, 300, 100));
|
| + layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
| + layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| @@ -1193,10 +1193,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
|
| // This makes sure the painting works when the content space is scaled to
|
| // a different layer space. In this case the occluded region catches the
|
| // blown up tiles.
|
| - occluded.setOcclusion(IntRect(200, 200, 300, 200));
|
| - layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
| - layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
| - layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
| + occluded.setOcclusion(cc::IntRect(200, 200, 300, 200));
|
| + layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
| + layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| @@ -1214,10 +1214,10 @@ TEST_F(TiledLayerTest, tilesPaintedWithOcclusionAndScaling)
|
| layer->setScreenSpaceTransform(screenTransform);
|
| layer->setDrawTransform(screenTransform);
|
|
|
| - occluded.setOcclusion(IntRect(100, 100, 150, 100));
|
| - layer->setDrawableContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
| - layer->setVisibleContentRect(IntRect(IntPoint(), layer->contentBounds()));
|
| - layer->invalidateContentRect(IntRect(0, 0, 600, 600));
|
| + occluded.setOcclusion(cc::IntRect(100, 100, 150, 100));
|
| + layer->setDrawableContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
| + layer->setVisibleContentRect(gfx::Rect(gfx::Point(), layer->contentBounds()));
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 600, 600));
|
| layer->setTexturePriorities(m_priorityCalculator);
|
| m_textureManager->prioritizeTextures();
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| @@ -1235,11 +1235,11 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
|
|
| // The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
|
|
|
| - IntRect opaquePaintRect;
|
| + gfx::Rect opaquePaintRect;
|
| Region opaqueContents;
|
|
|
| - IntRect contentBounds = IntRect(0, 0, 100, 200);
|
| - IntRect visibleBounds = IntRect(0, 0, 100, 150);
|
| + gfx::Rect contentBounds = gfx::Rect(0, 0, 100, 200);
|
| + gfx::Rect visibleBounds = gfx::Rect(0, 0, 100, 150);
|
|
|
| layer->setBounds(contentBounds.size());
|
| layer->setDrawableContentRect(visibleBounds);
|
| @@ -1250,7 +1250,7 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
| m_textureManager->prioritizeTextures();
|
|
|
| // If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty.
|
| - layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
| + layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
| layer->invalidateContentRect(contentBounds);
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| opaqueContents = layer->visibleContentOpaqueRegion();
|
| @@ -1262,13 +1262,13 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
| EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
|
|
|
| // visibleContentOpaqueRegion should match the visible part of what is painted opaque.
|
| - opaquePaintRect = IntRect(10, 10, 90, 190);
|
| + opaquePaintRect = gfx::Rect(10, 10, 90, 190);
|
| layer->fakeLayerUpdater()->setOpaquePaintRect(opaquePaintRect);
|
| layer->invalidateContentRect(contentBounds);
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| updateTextures();
|
| opaqueContents = layer->visibleContentOpaqueRegion();
|
| - EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
| + EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
| EXPECT_EQ(1u, opaqueContents.rects().size());
|
|
|
| EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1);
|
| @@ -1277,11 +1277,11 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
| EXPECT_EQ(0, occluded.overdrawMetrics().tilesCulledForUpload());
|
|
|
| // If we paint again without invalidating, the same stuff should be opaque.
|
| - layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
| + layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| updateTextures();
|
| opaqueContents = layer->visibleContentOpaqueRegion();
|
| - EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
| + EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
| EXPECT_EQ(1u, opaqueContents.rects().size());
|
|
|
| EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2, 1);
|
| @@ -1291,12 +1291,12 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
|
|
| // If we repaint a non-opaque part of the tile, then it shouldn't lose its opaque-ness. And other tiles should
|
| // not be affected.
|
| - layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
| - layer->invalidateContentRect(IntRect(0, 0, 1, 1));
|
| + layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 1, 1));
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| updateTextures();
|
| opaqueContents = layer->visibleContentOpaqueRegion();
|
| - EXPECT_RECT_EQ(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
| + EXPECT_RECT_EQ(gfx::IntersectRects(opaquePaintRect, visibleBounds), opaqueContents.bounds());
|
| EXPECT_EQ(1u, opaqueContents.rects().size());
|
|
|
| EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1, 1);
|
| @@ -1306,12 +1306,12 @@ TEST_F(TiledLayerTest, visibleContentOpaqueRegion)
|
|
|
| // If we repaint an opaque part of the tile, then it should lose its opaque-ness. But other tiles should still
|
| // not be affected.
|
| - layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
| - layer->invalidateContentRect(IntRect(10, 10, 1, 1));
|
| + layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
| + layer->invalidateContentRect(gfx::Rect(10, 10, 1, 1));
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| updateTextures();
|
| opaqueContents = layer->visibleContentOpaqueRegion();
|
| - EXPECT_RECT_EQ(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds());
|
| + EXPECT_RECT_EQ(gfx::IntersectRects(gfx::Rect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds());
|
| EXPECT_EQ(1u, opaqueContents.rects().size());
|
|
|
| EXPECT_NEAR(occluded.overdrawMetrics().pixelsPainted(), 20000 * 2 + 1 + 1, 1);
|
| @@ -1327,11 +1327,11 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
|
|
|
| // The tile size is 100x100, so this invalidates and then paints two tiles in various ways.
|
|
|
| - IntRect opaquePaintRect;
|
| + gfx::Rect opaquePaintRect;
|
| Region opaqueContents;
|
|
|
| - IntRect contentBounds = IntRect(0, 0, 100, 300);
|
| - IntRect visibleBounds = IntRect(0, 0, 100, 300);
|
| + gfx::Rect contentBounds = gfx::Rect(0, 0, 100, 300);
|
| + gfx::Rect visibleBounds = gfx::Rect(0, 0, 100, 300);
|
|
|
| layer->setBounds(contentBounds.size());
|
| layer->setDrawableContentRect(visibleBounds);
|
| @@ -1342,7 +1342,7 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
|
| m_textureManager->prioritizeTextures();
|
|
|
| // Invalidates and paints the whole layer.
|
| - layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
| + layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
| layer->invalidateContentRect(contentBounds);
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| updateTextures();
|
| @@ -1356,9 +1356,9 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
|
|
|
| // Invalidates an area on the top and bottom tile, which will cause us to paint the tile in the middle,
|
| // even though it is not dirty and will not be uploaded.
|
| - layer->fakeLayerUpdater()->setOpaquePaintRect(IntRect());
|
| - layer->invalidateContentRect(IntRect(0, 0, 1, 1));
|
| - layer->invalidateContentRect(IntRect(50, 200, 10, 10));
|
| + layer->fakeLayerUpdater()->setOpaquePaintRect(gfx::Rect());
|
| + layer->invalidateContentRect(gfx::Rect(0, 0, 1, 1));
|
| + layer->invalidateContentRect(gfx::Rect(50, 200, 10, 10));
|
| layer->update(*m_queue.get(), &occluded, m_stats);
|
| updateTextures();
|
| opaqueContents = layer->visibleContentOpaqueRegion();
|
| @@ -1375,9 +1375,9 @@ TEST_F(TiledLayerTest, pixelsPaintedMetrics)
|
| TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
|
| {
|
| // Tile size is 100x100.
|
| - IntRect rootRect(0, 0, 300, 200);
|
| - IntRect childRect(0, 0, 300, 100);
|
| - IntRect child2Rect(0, 100, 300, 100);
|
| + gfx::Rect rootRect(0, 0, 300, 200);
|
| + gfx::Rect childRect(0, 0, 300, 100);
|
| + gfx::Rect child2Rect(0, 100, 300, 100);
|
|
|
| LayerTreeSettings settings;
|
| FakeLayerImplTreeHostClient fakeLayerImplTreeHostClient;
|
| @@ -1390,26 +1390,26 @@ TEST_F(TiledLayerTest, dontAllocateContentsWhenTargetSurfaceCantBeAllocated)
|
| scoped_refptr<FakeTiledLayer> child2 = make_scoped_refptr(new FakeTiledLayer(layerTreeHost->contentsTextureManager()));
|
|
|
| root->setBounds(rootRect.size());
|
| - root->setAnchorPoint(FloatPoint());
|
| + root->setAnchorPoint(gfx::PointF());
|
| root->setDrawableContentRect(rootRect);
|
| root->setVisibleContentRect(rootRect);
|
| root->addChild(surface);
|
|
|
| surface->setForceRenderSurface(true);
|
| - surface->setAnchorPoint(FloatPoint());
|
| + surface->setAnchorPoint(gfx::PointF());
|
| surface->setOpacity(0.5);
|
| surface->addChild(child);
|
| surface->addChild(child2);
|
|
|
| child->setBounds(childRect.size());
|
| - child->setAnchorPoint(FloatPoint());
|
| - child->setPosition(childRect.location());
|
| + child->setAnchorPoint(gfx::PointF());
|
| + child->setPosition(childRect.origin());
|
| child->setVisibleContentRect(childRect);
|
| child->setDrawableContentRect(rootRect);
|
|
|
| child2->setBounds(child2Rect.size());
|
| - child2->setAnchorPoint(FloatPoint());
|
| - child2->setPosition(child2Rect.location());
|
| + child2->setAnchorPoint(gfx::PointF());
|
| + child2->setPosition(child2Rect.origin());
|
| child2->setVisibleContentRect(child2Rect);
|
| child2->setDrawableContentRect(rootRect);
|
|
|
| @@ -1568,12 +1568,12 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
|
| {
|
| scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_textureManager.get()));
|
|
|
| - IntRect layerRect(0, 0, 30, 31);
|
| - layer->setPosition(layerRect.location());
|
| + gfx::Rect layerRect(0, 0, 30, 31);
|
| + layer->setPosition(layerRect.origin());
|
| layer->setBounds(layerRect.size());
|
| layer->setContentsScale(1.5);
|
|
|
| - IntRect contentRect(0, 0, 45, 47);
|
| + gfx::Rect contentRect(0, 0, 45, 47);
|
| EXPECT_EQ(contentRect.size(), layer->contentBounds());
|
| layer->setVisibleContentRect(contentRect);
|
| layer->setDrawableContentRect(contentRect);
|
| @@ -1585,7 +1585,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringPaint)
|
| layer->update(*m_queue.get(), 0, m_stats);
|
| layer->trackingLayerPainter()->resetPaintedRect();
|
|
|
| - EXPECT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect());
|
| + EXPECT_RECT_EQ(gfx::Rect(), layer->trackingLayerPainter()->paintedRect());
|
| updateTextures();
|
|
|
| // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds.
|
| @@ -1599,12 +1599,12 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
|
| {
|
| scoped_refptr<UpdateTrackingTiledLayer> layer = make_scoped_refptr(new UpdateTrackingTiledLayer(m_textureManager.get()));
|
|
|
| - IntRect layerRect(0, 0, 30, 31);
|
| - layer->setPosition(layerRect.location());
|
| + gfx::Rect layerRect(0, 0, 30, 31);
|
| + layer->setPosition(layerRect.origin());
|
| layer->setBounds(layerRect.size());
|
| layer->setContentsScale(1.3f);
|
|
|
| - IntRect contentRect(IntPoint(), layer->contentBounds());
|
| + gfx::Rect contentRect(gfx::Point(), layer->contentBounds());
|
| layer->setVisibleContentRect(contentRect);
|
| layer->setDrawableContentRect(contentRect);
|
|
|
| @@ -1615,7 +1615,7 @@ TEST_F(TiledLayerTest, nonIntegerContentsScaleIsNotDistortedDuringInvalidation)
|
| layer->update(*m_queue.get(), 0, m_stats);
|
| layer->trackingLayerPainter()->resetPaintedRect();
|
|
|
| - EXPECT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect());
|
| + EXPECT_RECT_EQ(gfx::Rect(), layer->trackingLayerPainter()->paintedRect());
|
| updateTextures();
|
|
|
| // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds.
|
|
|