Changeset 105371 in webkit
- Timestamp:
- Jan 18, 2012 6:39:04 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r105370 r105371 1 2012-01-18 James Robinson <jamesr@chromium.org> 2 3 Unreviewed, rolling out r105366. 4 http://trac.webkit.org/changeset/105366 5 https://bugs.webkit.org/show_bug.cgi?id=76015 6 7 Breaks CCLayerTreeHostImplTest unit test 8 9 * platform/graphics/chromium/TiledLayerChromium.cpp: 10 (WebCore::TiledLayerChromium::pushPropertiesTo): 11 (WebCore::TiledLayerChromium::prepareToUpdateTiles): 12 * platform/graphics/chromium/cc/CCDrawQuad.h: 13 (WebCore::CCDrawQuad::drawsOpaque): 14 (WebCore::CCDrawQuad::needsBlending): 15 * platform/graphics/chromium/cc/CCQuadCuller.cpp: 16 (WebCore::CCQuadCuller::cullOccludedQuads): 17 * platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp: 18 (WebCore::CCSolidColorDrawQuad::CCSolidColorDrawQuad): 19 * platform/graphics/chromium/cc/CCTileDrawQuad.cpp: 20 (WebCore::CCTileDrawQuad::create): 21 (WebCore::CCTileDrawQuad::CCTileDrawQuad): 22 * platform/graphics/chromium/cc/CCTileDrawQuad.h: 23 * platform/graphics/chromium/cc/CCTiledLayerImpl.cpp: 24 (WebCore::CCTiledLayerImpl::appendQuads): 25 (WebCore::CCTiledLayerImpl::syncTextureId): 26 * platform/graphics/chromium/cc/CCTiledLayerImpl.h: 27 1 28 2012-01-18 Thiago Marcos P. Santos <tmpsantos@gmail.com> 2 29 -
trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp
r105366 r105371 68 68 IntRect m_dirtyRect; 69 69 IntRect m_updateRect; 70 IntRect m_opaqueRect;71 70 private: 72 71 OwnPtr<LayerTextureUpdater::Texture> m_texture; … … 274 273 continue; 275 274 276 tiledLayer-> pushTileProperties(i, j, tile->managedTexture()->textureId(), tile->m_opaqueRect);275 tiledLayer->syncTextureId(i, j, tile->managedTexture()->textureId()); 277 276 } 278 277 } … … 414 413 // so we grab a local reference here to hold the updater alive until the paint completes. 415 414 RefPtr<LayerTextureUpdater> protector(textureUpdater()); 416 IntRect paintedOpaqueRect;417 textureUpdater()->prepareToUpdate(m_paintRect, m_tiler->tileSize(), m_tiler->hasBorderTexels(), contentsScale(), & paintedOpaqueRect);415 IntRect opaqueRect; // FIXME: unused. remove this and store in the layer to pass to impl for draw culling 416 textureUpdater()->prepareToUpdate(m_paintRect, m_tiler->tileSize(), m_tiler->hasBorderTexels(), contentsScale(), &opaqueRect); 418 417 for (int j = top; j <= bottom; ++j) { 419 418 for (int i = left; i <= right; ++i) { … … 423 422 if (!tile) 424 423 CRASH(); 425 426 IntRect tileRect = m_tiler->tileRect(tile);427 428 // Save what was painted opaque in the tile. If everything painted in the tile was opaque, and the area is a subset of an429 // already opaque area, keep the old area.430 IntRect tilePaintedRect = intersection(tileRect, m_paintRect);431 IntRect tilePaintedOpaqueRect = intersection(tileRect, paintedOpaqueRect);432 if (tilePaintedOpaqueRect != tilePaintedRect || !tile->m_opaqueRect.contains(tilePaintedOpaqueRect))433 tile->m_opaqueRect = tilePaintedOpaqueRect;434 424 435 425 // Use m_updateRect as copyAndClearDirty above moved the existing dirty rect to m_updateRect. … … 438 428 continue; 439 429 440 IntRect sourceRect = tileRect;430 IntRect sourceRect = m_tiler->tileRect(tile); 441 431 sourceRect.intersect(dirtyRect); 442 432 // Paint rect not guaranteed to line up on tile boundaries, so -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCDrawQuad.h
r105366 r105371 52 52 const IntRect& clipRect() const { return m_sharedQuadState->clipRect(); } 53 53 float opacity() const { return m_sharedQuadState->opacity(); } 54 // For the purposes of culling, what part of the contents of this quad are opaque? 55 IntRect opaqueRect() const 56 { 57 if (opacity() != 1) 58 return IntRect(); 59 if (m_sharedQuadState->isOpaque() && m_quadOpaque) 60 return m_quadRect; 61 return m_opaqueRect; 62 } 63 bool needsBlending() const { return m_needsBlending || opaqueRect() != m_quadRect; } 54 // For the purposes of culling, are the contents of this quad opaque? 55 bool drawsOpaque() const { return m_sharedQuadState->isOpaque() && m_quadOpaque && opacity() == 1; } 56 bool needsBlending() const { return !m_sharedQuadState->isOpaque() || m_needsBlending || opacity() != 1; } 64 57 bool isLayerAxisAlignedIntRect() const { return m_sharedQuadState->isLayerAxisAlignedIntRect(); } 65 58 … … 98 91 bool m_quadOpaque; 99 92 bool m_needsBlending; 100 101 // Be default, this rect is empty. It is used when the shared quad state and above102 // variables determine that the quad is not fully opaque but may be partially opaque.103 IntRect m_opaqueRect;104 93 }; 105 94 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCQuadCuller.cpp
r105366 r105371 78 78 bool keepQuad = !regionContainsRect(opaqueCoverageThusFar, quadRect); 79 79 80 if (keepQuad && drawQuad-> isLayerAxisAlignedIntRect())81 opaqueCoverageThusFar.unite( drawQuad->quadTransform().mapRect(drawQuad->opaqueRect()));80 if (keepQuad && drawQuad->drawsOpaque() && drawQuad->isLayerAxisAlignedIntRect()) 81 opaqueCoverageThusFar.unite(Region(quadRect)); 82 82 83 83 if (keepQuad) -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSolidColorDrawQuad.cpp
r105366 r105371 41 41 if (m_color.alpha() != 1) 42 42 m_quadOpaque = false; 43 else44 m_opaqueRect = quadRect;45 43 } 46 44 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.cpp
r105366 r105371 30 30 namespace WebCore { 31 31 32 PassOwnPtr<CCTileDrawQuad> CCTileDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect,Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)32 PassOwnPtr<CCTileDrawQuad> CCTileDrawQuad::create(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) 33 33 { 34 return adoptPtr(new CCTileDrawQuad(sharedQuadState, quadRect, opaqueRect,textureId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA));34 return adoptPtr(new CCTileDrawQuad(sharedQuadState, quadRect, textureId, textureOffset, textureSize, textureFilter, swizzleContents, leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); 35 35 } 36 36 37 CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, const IntRect& opaqueRect,Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA)37 CCTileDrawQuad::CCTileDrawQuad(const CCSharedQuadState* sharedQuadState, const IntRect& quadRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA) 38 38 : CCDrawQuad(sharedQuadState, CCDrawQuad::TiledContent, quadRect) 39 39 , m_textureId(textureId) … … 49 49 if (isAntialiased()) 50 50 m_needsBlending = true; 51 m_opaqueRect = opaqueRect;52 51 } 53 52 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCTileDrawQuad.h
r105366 r105371 36 36 WTF_MAKE_NONCOPYABLE(CCTileDrawQuad); 37 37 public: 38 static PassOwnPtr<CCTileDrawQuad> create(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect,Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);38 static PassOwnPtr<CCTileDrawQuad> create(const CCSharedQuadState*, const IntRect& quadRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); 39 39 40 40 Platform3DObject textureId() const { return m_textureId; } … … 52 52 53 53 private: 54 CCTileDrawQuad(const CCSharedQuadState*, const IntRect& quadRect, const IntRect& opaqueRect,Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA);54 CCTileDrawQuad(const CCSharedQuadState*, const IntRect& quadRect, Platform3DObject textureId, const IntPoint& textureOffset, const IntSize& textureSize, GC3Dint textureFilter, bool swizzleContents, bool leftEdgeAA, bool topEdgeAA, bool rightEdgeAA, bool bottomEdgeAA); 55 55 56 56 Platform3DObject m_textureId; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp
r105366 r105371 52 52 Platform3DObject textureId() const { return m_textureId; } 53 53 void setTextureId(Platform3DObject textureId) { m_textureId = textureId; } 54 55 const IntRect& opaqueRect() const { return m_opaqueRect; }56 void setOpaqueRect(const IntRect& opaqueRect) { m_opaqueRect = opaqueRect; }57 58 54 private: 59 55 Platform3DObject m_textureId; 60 IntRect m_opaqueRect;61 56 }; 62 57 … … 165 160 166 161 const GC3Dint textureFilter = m_tiler->hasBorderTexels() ? GraphicsContext3D::LINEAR : GraphicsContext3D::NEAREST; 167 quadList.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tile-> opaqueRect(), tile->textureId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA));162 quadList.append(CCTileDrawQuad::create(sharedQuadState, tileRect, tile->textureId(), textureOffset, textureSize, textureFilter, contentsSwizzled(), leftEdgeAA, topEdgeAA, rightEdgeAA, bottomEdgeAA)); 168 163 169 164 if (hasDebugBorders()) { … … 184 179 } 185 180 186 void CCTiledLayerImpl:: pushTileProperties(int i, int j, Platform3DObject textureId, const IntRect& opaqueRect)181 void CCTiledLayerImpl::syncTextureId(int i, int j, Platform3DObject textureId) 187 182 { 188 183 DrawableTile* tile = tileAt(i, j); … … 190 185 tile = createTile(i, j); 191 186 tile->setTextureId(textureId); 192 tile->setOpaqueRect(opaqueRect);193 187 } 194 188 195 } // namespace WebCore189 } 196 190 197 191 #endif // USE(ACCELERATED_COMPOSITING) -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.h
r105366 r105371 52 52 void setSkipsDraw(bool skipsDraw) { m_skipsDraw = skipsDraw; } 53 53 void setTilingData(const CCLayerTilingData& tiler); 54 void pushTileProperties(int, int, Platform3DObject textureId, const IntRect& opaqueRect);54 void syncTextureId(int, int, Platform3DObject textureId); 55 55 56 56 void setContentsSwizzled(bool contentsSwizzled) { m_contentsSwizzled = contentsSwizzled; } -
trunk/Source/WebKit/chromium/ChangeLog
r105366 r105371 1 2012-01-18 James Robinson <jamesr@chromium.org> 2 3 Unreviewed, rolling out r105366. 4 http://trac.webkit.org/changeset/105366 5 https://bugs.webkit.org/show_bug.cgi?id=76015 6 7 Breaks CCLayerTreeHostImplTest unit test 8 9 * tests/CCQuadCullerTest.cpp: 10 (WebCore::TestDrawQuad::TestDrawQuad): 11 (WebCore::TestDrawQuad::create): 12 (WebCore::setQuads): 13 * tests/CCTiledLayerImplTest.cpp: 14 (WebCore::createLayer): 15 (WebCore::TEST): 16 (WebCore::getQuads): 17 (WebCore::coverageVisibleRectOnTileBoundaries): 18 (WebCore::coverageVisibleRectIntersectsTiles): 19 (WebCore::coverageVisibleRectIntersectsBounds): 20 1 21 2012-01-18 Dana Jansens <danakj@chromium.org> 2 22 -
trunk/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp
r105366 r105371 39 39 class TestDrawQuad : public CCDrawQuad { 40 40 public: 41 TestDrawQuad(const CCSharedQuadState* state, Material m, const IntRect& rect , const IntRect& opaqueRect)41 TestDrawQuad(const CCSharedQuadState* state, Material m, const IntRect& rect) 42 42 : CCDrawQuad(state, m, rect) 43 43 { 44 m_opaqueRect = opaqueRect;45 44 } 46 45 47 static PassOwnPtr<TestDrawQuad> create(const CCSharedQuadState* state, Material m, const IntRect& rect , const IntRect& opaqueRect)46 static PassOwnPtr<TestDrawQuad> create(const CCSharedQuadState* state, Material m, const IntRect& rect) 48 47 { 49 return adoptPtr(new TestDrawQuad(state, m, rect , opaqueRect));48 return adoptPtr(new TestDrawQuad(state, m, rect)); 50 49 } 51 50 }; 52 51 53 void setQuads(CCSharedQuadState* rootState, CCSharedQuadState* childState, CCQuadList& quadList , const IntRect& childOpaqueRect = IntRect())52 void setQuads(CCSharedQuadState* rootState, CCSharedQuadState* childState, CCQuadList& quadList) 54 53 { 55 54 quadList.clear(); 56 55 57 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(), IntSize(100, 100)) , childOpaqueRect));58 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 0), IntSize(100, 100)) , childOpaqueRect));59 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(200, 0), IntSize(100, 100)) , childOpaqueRect));60 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(0, 100), IntSize(100, 100)) , childOpaqueRect));61 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 100), IntSize(100, 100)) , childOpaqueRect));62 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(200, 100), IntSize(100, 100)) , childOpaqueRect));63 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(0, 200), IntSize(100, 100)) , childOpaqueRect));64 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 200), IntSize(100, 100)) , childOpaqueRect));65 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(200, 200), IntSize(100, 100)) , childOpaqueRect));56 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(), IntSize(100, 100)))); 57 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 0), IntSize(100, 100)))); 58 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(200, 0), IntSize(100, 100)))); 59 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(0, 100), IntSize(100, 100)))); 60 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 100), IntSize(100, 100)))); 61 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(200, 100), IntSize(100, 100)))); 62 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(0, 200), IntSize(100, 100)))); 63 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 200), IntSize(100, 100)))); 64 quadList.append(TestDrawQuad::create(rootState, CCDrawQuad::TiledContent, IntRect(IntPoint(200, 200), IntSize(100, 100)))); 66 65 67 quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(), IntSize(100, 100)) , childOpaqueRect));68 quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 0), IntSize(100, 100)) , childOpaqueRect));69 quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(0, 100), IntSize(100, 100)) , childOpaqueRect));70 quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 100), IntSize(100, 100)) , childOpaqueRect));66 quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(), IntSize(100, 100)))); 67 quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 0), IntSize(100, 100)))); 68 quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(0, 100), IntSize(100, 100)))); 69 quadList.append(TestDrawQuad::create(childState, CCDrawQuad::TiledContent, IntRect(IntPoint(100, 100), IntSize(100, 100)))); 71 70 } 72 71 … … 148 147 } 149 148 150 TEST(CCQuadCullerTest, verifyCullSubRegion)151 {152 DECLARE_AND_INITIALIZE_TEST_QUADS153 154 childTransform.translate(50, 50);155 156 OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);157 OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, false);158 IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);159 160 setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect);161 EXPECT_EQ(quadList.size(), 13u);162 CCQuadCuller::cullOccludedQuads(quadList);163 EXPECT_EQ(quadList.size(), 12u);164 }165 166 TEST(CCQuadCullerTest, verifyCullSubRegion2)167 {168 DECLARE_AND_INITIALIZE_TEST_QUADS169 170 childTransform.translate(50, 10);171 172 OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);173 OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, false);174 IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() * 3 / 4);175 176 setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect);177 EXPECT_EQ(quadList.size(), 13u);178 CCQuadCuller::cullOccludedQuads(quadList);179 EXPECT_EQ(quadList.size(), 12u);180 }181 182 TEST(CCQuadCullerTest, verifyCullSubRegionCheckOvercull)183 {184 DECLARE_AND_INITIALIZE_TEST_QUADS185 186 childTransform.translate(50, 49);187 188 OwnPtr<CCSharedQuadState> rootState = CCSharedQuadState::create(TransformationMatrix(), TransformationMatrix(), rootRect, IntRect(), 1.0, true);189 OwnPtr<CCSharedQuadState> childState = CCSharedQuadState::create(childTransform, TransformationMatrix(), childRect, IntRect(), 1.0, false);190 IntRect childOpaqueRect(childRect.x() + childRect.width() / 4, childRect.y() + childRect.height() / 4, childRect.width() / 2, childRect.height() / 2);191 192 setQuads(rootState.get(), childState.get(), quadList, childOpaqueRect);193 EXPECT_EQ(quadList.size(), 13u);194 CCQuadCuller::cullOccludedQuads(quadList);195 EXPECT_EQ(quadList.size(), 13u);196 }197 198 149 TEST(CCQuadCullerTest, verifyNonAxisAlignedQuadsDontOcclude) 199 150 { -
trunk/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp
r105366 r105371 47 47 layer->setSkipsDraw(false); 48 48 layer->setVisibleLayerRect(IntRect(IntPoint(), layerSize)); 49 layer->setDrawOpacity(1);50 49 51 50 int textureId = 1; 52 51 for (int i = 0; i < tiler->numTilesX(); ++i) 53 52 for (int j = 0; j < tiler->numTilesY(); ++j) 54 layer-> pushTileProperties(i, j, static_cast<Platform3DObject>(textureId++), IntRect(0, 0, 1, 1));53 layer->syncTextureId(i, j, static_cast<Platform3DObject>(textureId++)); 55 54 56 55 return layer.release(); … … 136 135 for (int i = 0; i < numTilesX; ++i) 137 136 for (int j = 0; j < numTilesY; ++j) 138 layer-> pushTileProperties(i, j, static_cast<Platform3DObject>(0), IntRect());137 layer->syncTextureId(i, j, static_cast<Platform3DObject>(0)); 139 138 140 139 // All checkerboarding … … 157 156 } 158 157 159 static PassOwnPtr<CCSharedQuadState>getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleLayerRect)158 static void getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleLayerRect) 160 159 { 161 160 RefPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); … … 165 164 OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); 166 165 layer->appendQuads(quads, sharedQuadState.get()); 167 return sharedQuadState.release(); // The shared data must be owned as long as the quad list exists.168 166 } 169 167 … … 203 201 IntSize layerSize(1000, 1000); 204 202 CCQuadList quads; 205 OwnPtr<CCSharedQuadState> sharedState; 206 sharedState = getQuads(quads, IntSize(100, 100), layerSize, borders, IntRect(IntPoint(), layerSize)); 203 getQuads(quads, IntSize(100, 100), layerSize, borders, IntRect(IntPoint(), layerSize)); 207 204 verifyQuadsExactlyCoverRect(quads, IntRect(IntPoint(), layerSize)); 208 205 } … … 220 217 IntSize layerSize(250, 250); 221 218 CCQuadList quads; 222 OwnPtr<CCSharedQuadState> sharedState; 223 sharedState = getQuads(quads, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleLayerRect); 219 getQuads(quads, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleLayerRect); 224 220 verifyQuadsExactlyCoverRect(quads, visibleLayerRect); 225 221 } … … 233 229 IntRect visibleLayerRect(IntPoint(), layerSize); 234 230 CCQuadList quads; 235 OwnPtr<CCSharedQuadState> sharedState; 236 sharedState = getQuads(quads, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleLayerRect); 231 getQuads(quads, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleLayerRect); 237 232 verifyQuadsExactlyCoverRect(quads, visibleLayerRect); 238 233 } … … 246 241 IntSize layerSize(250, 250); 247 242 CCQuadList quads; 248 OwnPtr<CCSharedQuadState> sharedState; 249 sharedState = getQuads(quads, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); 243 getQuads(quads, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); 250 244 251 245 for (size_t i = 0; i < quads.size(); ++i) { … … 256 250 EXPECT_EQ(quad->textureOffset(), IntPoint()) << quadString << i; 257 251 EXPECT_EQ(quad->textureSize(), tileSize) << quadString << i; 258 EXPECT_EQ(IntRect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i; 259 } 260 } 261 262 TEST(CCTiledLayerImplTest, tileOpaqueRectForLayerNoBorders) 263 { 264 DebugScopedSetImplThread scopedImplThread; 265 266 IntSize tileSize(50, 50); 267 IntSize layerSize(250, 250); 268 CCQuadList quads; 269 OwnPtr<CCSharedQuadState> sharedState; 270 sharedState = getQuads(quads, tileSize, layerSize, CCLayerTilingData::NoBorderTexels, IntRect(IntPoint(), layerSize)); 271 272 for (size_t i = 0; i < quads.size(); ++i) { 273 ASSERT_EQ(quads[i]->material(), CCDrawQuad::TiledContent) << quadString << i; 274 CCTileDrawQuad* quad = static_cast<CCTileDrawQuad*>(quads[i].get()); 275 276 EXPECT_EQ(IntRect(0, 0, 1, 1), quad->opaqueRect()) << quadString << i; 277 } 278 } 252 } 253 } 254 279 255 280 256 } // namespace
Note: See TracChangeset
for help on using the changeset viewer.