Changeset 69747 in webkit
- Timestamp:
- Oct 14, 2010 12:18:18 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r69745 r69747 1 2010-10-14 Adrienne Walker <enne@google.com> 2 3 Reviewed by James Robinson. 4 5 Add a test for very large image layers. Skip this test for mac-wk2 6 because of the use of layerTreeAsText(). 7 https://bugs.webkit.org/show_bug.cgi?id=47016 8 9 * compositing/tiling/huge-layer-img.html: Added. 10 * platform/chromium-gpu/compositing/tiling/huge-layer-img-expected.txt: Added. 11 * platform/mac-wk2/Skipped: 12 * platform/mac/compositing/tiling/huge-layer-img-expected.txt: Added. 13 1 14 2010-10-13 James Simonsen <simonjam@chromium.org> 2 15 -
trunk/LayoutTests/platform/mac-wk2/Skipped
r69364 r69747 79 79 compositing/tiling/huge-layer-with-layer-children.html 80 80 compositing/tiling/huge-layer.html 81 compositing/tiling/huge-layer-img.html 81 82 compositing/video/video-poster.html 82 83 -
trunk/WebCore/ChangeLog
r69746 r69747 1 2010-10-14 Adrienne Walker <enne@google.com> 2 3 Reviewed by James Robinson. 4 5 Add a short-term solution for large layers. Layers that are too 6 large to be contained in a single texture just upload the portion of 7 the layer that is within the content rect. A longer-term solution 8 is still tiling with proper memory management. Layers that have full 9 3D transforms (more than just translations) are still not drawn. 10 https://bugs.webkit.org/show_bug.cgi?id=47016 11 12 Test: compositing/tiling 13 14 * platform/graphics/chromium/ContentLayerChromium.cpp: 15 (WebCore::ContentLayerChromium::ContentLayerChromium): 16 (WebCore::ContentLayerChromium::requiresClippedUpdateRect): 17 (WebCore::ContentLayerChromium::calculateClippedUpdateRect): 18 (WebCore::ContentLayerChromium::updateContents): 19 (WebCore::ContentLayerChromium::updateTextureRect): 20 (WebCore::ContentLayerChromium::draw): 21 * platform/graphics/chromium/ContentLayerChromium.h: 22 * platform/graphics/chromium/ImageLayerChromium.cpp: 23 (WebCore::ImageLayerChromium::updateContents): 24 * platform/graphics/chromium/LayerRendererChromium.cpp: 25 (WebCore::LayerRendererChromium::drawLayers): 26 * platform/graphics/chromium/LayerRendererChromium.h: 27 (WebCore::LayerRendererChromium::rootLayerContentRect): 28 1 29 2010-10-14 Chris Rogers <crogers@google.com> 2 30 -
trunk/WebCore/platform/graphics/chromium/ContentLayerChromium.cpp
r69369 r69747 123 123 : LayerChromium(owner) 124 124 , m_contentsTexture(0) 125 , m_skipsDraw(false) 125 126 { 126 127 } … … 141 142 } 142 143 144 bool ContentLayerChromium::requiresClippedUpdateRect() const 145 { 146 return !layerRenderer()->checkTextureSize(m_bounds); 147 } 148 149 void ContentLayerChromium::calculateClippedUpdateRect(IntRect& dirtyRect, IntRect& drawRect) const 150 { 151 // For the given layer size and content rect, calculate: 152 // 1) The minimal texture space rectangle to be uploaded, returned in dirtyRect. 153 // 2) The content rect-relative rectangle to draw this texture in, returned in drawRect. 154 155 const IntRect contentRect = layerRenderer()->rootLayerContentRect(); 156 const TransformationMatrix& transform = drawTransform(); 157 // The layer's draw transform points to the center of the layer, relative to 158 // the content rect. layerPos is the distance from the top left of the 159 // layer to the top left of the content rect. 160 const IntPoint layerPos(m_bounds.width() / 2 - transform.m41(), 161 m_bounds.height() / 2 - transform.m42()); 162 // Transform the contentRect into the space of the layer. 163 IntRect contentRectInLayerSpace(layerPos, contentRect.size()); 164 165 // Clip the entire layer against the visible region in the content rect 166 // and use that as the drawable texture, instead of the entire layer. 167 dirtyRect = IntRect(IntPoint(0, 0), m_bounds); 168 dirtyRect.intersect(contentRectInLayerSpace); 169 170 // The draw position is relative to the content rect. 171 drawRect = IntRect(toPoint(dirtyRect.location() - layerPos), dirtyRect.size()); 172 } 173 143 174 void ContentLayerChromium::updateContents() 144 175 { … … 151 182 ASSERT(layerRenderer()); 152 183 153 // FIXME: Remove this test when tiled layers are implemented.154 m_skipsDraw = false;155 if (!layerRenderer()->checkTextureSize(m_bounds)) {156 m_skipsDraw = true;157 return;158 }159 160 184 void* pixels = 0; 161 IntRect dirtyRect(m_dirtyRect); 185 IntRect dirtyRect; 186 IntRect updateRect; 162 187 IntSize requiredTextureSize; 163 188 IntSize bitmapSize; 164 189 165 requiredTextureSize = m_bounds; 166 IntRect boundsRect(IntPoint(0, 0), m_bounds); 167 168 // If the texture needs to be reallocated then we must redraw the entire 169 // contents of the layer. 170 if (requiredTextureSize != m_allocatedTextureSize) 171 dirtyRect = boundsRect; 172 else { 173 // Clip the dirtyRect to the size of the layer to avoid drawing outside 174 // the bounds of the backing texture. 175 dirtyRect.intersect(boundsRect); 190 // FIXME: Remove this test when tiled layers are implemented. 191 if (requiresClippedUpdateRect()) { 192 // A layer with 3D transforms could require an arbitrarily large number 193 // of texels to be repainted, so ignore these layers until tiling is 194 // implemented. 195 if (!drawTransform().isIdentityOrTranslation()) { 196 m_skipsDraw = true; 197 return; 198 } 199 200 calculateClippedUpdateRect(dirtyRect, m_largeLayerDrawRect); 201 if (!layerRenderer()->checkTextureSize(m_largeLayerDrawRect.size())) { 202 m_skipsDraw = true; 203 return; 204 } 205 if (m_largeLayerDirtyRect == dirtyRect) 206 return; 207 208 m_largeLayerDirtyRect = dirtyRect; 209 requiredTextureSize = dirtyRect.size(); 210 updateRect = IntRect(IntPoint(0, 0), dirtyRect.size()); 211 } else { 212 dirtyRect = IntRect(m_dirtyRect); 213 IntRect boundsRect(IntPoint(0, 0), m_bounds); 214 requiredTextureSize = m_bounds; 215 // If the texture needs to be reallocated then we must redraw the entire 216 // contents of the layer. 217 if (requiredTextureSize != m_allocatedTextureSize) 218 dirtyRect = boundsRect; 219 else { 220 // Clip the dirtyRect to the size of the layer to avoid drawing 221 // outside the bounds of the backing texture. 222 dirtyRect.intersect(boundsRect); 223 } 224 updateRect = dirtyRect; 176 225 } 177 226 … … 237 286 238 287 if (pixels) 239 updateTextureRect(pixels, bitmapSize, requiredTextureSize, dirtyRect, textureId);288 updateTextureRect(pixels, bitmapSize, requiredTextureSize, updateRect, textureId); 240 289 } 241 290 … … 288 337 289 338 m_dirtyRect.setSize(FloatSize()); 290 m_contentsDirty = false; 339 // Large layers always stay dirty, because they need to update when the content rect changes. 340 m_contentsDirty = requiresClippedUpdateRect(); 291 341 } 292 342 … … 304 354 layerRenderer()->useShader(sv->contentShaderProgram()); 305 355 GLC(context, context->uniform1i(sv->shaderSamplerLocation(), 0)); 306 drawTexturedQuad(context, layerRenderer()->projectionMatrix(), drawTransform(), 307 bounds().width(), bounds().height(), drawOpacity(), 308 sv->shaderMatrixLocation(), sv->shaderAlphaLocation()); 356 357 if (requiresClippedUpdateRect()) { 358 float m43 = drawTransform().m43(); 359 TransformationMatrix transform; 360 transform.translate3d(m_largeLayerDrawRect.center().x(), m_largeLayerDrawRect.center().y(), m43); 361 drawTexturedQuad(context, layerRenderer()->projectionMatrix(), 362 transform, m_largeLayerDrawRect.width(), 363 m_largeLayerDrawRect.height(), drawOpacity(), 364 sv->shaderMatrixLocation(), sv->shaderAlphaLocation()); 365 } else { 366 drawTexturedQuad(context, layerRenderer()->projectionMatrix(), 367 drawTransform(), m_bounds.width(), m_bounds.height(), 368 drawOpacity(), sv->shaderMatrixLocation(), 369 sv->shaderAlphaLocation()); 370 } 309 371 } 310 372 -
trunk/WebCore/platform/graphics/chromium/ContentLayerChromium.h
r69172 r69747 85 85 86 86 virtual void cleanupResources(); 87 bool requiresClippedUpdateRect() const; 87 88 88 89 unsigned m_contentsTexture; … … 90 91 bool m_skipsDraw; 91 92 93 private: 94 void calculateClippedUpdateRect(IntRect& dirtyRect, IntRect& drawRect) const; 95 IntRect m_largeLayerDrawRect; 96 IntRect m_largeLayerDirtyRect; 92 97 }; 93 98 -
trunk/WebCore/platform/graphics/chromium/ImageLayerChromium.cpp
r69172 r69747 76 76 ASSERT(layerRenderer()); 77 77 78 // FIXME: Remove this test when tiled layers are implemented. 79 if (requiresClippedUpdateRect()) { 80 // Use the base version of updateContents which draws a subset of the 81 // image to a bitmap, as the pixel contents can't be uploaded directly. 82 ContentLayerChromium::updateContents(); 83 return; 84 } 85 78 86 void* pixels = 0; 79 87 IntSize requiredTextureSize; … … 137 145 #error "Need to implement for your platform." 138 146 #endif 139 // FIXME: Remove this test when tiled layers are implemented.140 m_skipsDraw = false;141 if (!layerRenderer()->checkTextureSize(requiredTextureSize)) {142 m_skipsDraw = true;143 return;144 }145 147 146 148 unsigned textureId = m_contentsTexture; -
trunk/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp
r69624 r69747 308 308 GLC(m_context, m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA)); 309 309 310 // Set the root VisibleRect --- used by subsequent drawLayers calls310 // Set the root visible/content rects --- used by subsequent drawLayers calls. 311 311 m_rootVisibleRect = visibleRect; 312 m_rootContentRect = contentRect; 312 313 313 314 // Traverse the layer tree and update the layer transforms. -
trunk/WebCore/platform/graphics/chromium/LayerRendererChromium.h
r69624 r69747 109 109 110 110 IntSize rootLayerTextureSize() const { return IntSize(m_rootLayerTextureWidth, m_rootLayerTextureHeight); } 111 IntRect rootLayerContentRect() const { return m_rootContentRect; } 111 112 void getFramebufferPixels(void *pixels, const IntRect& rect); 112 113 … … 162 163 163 164 IntRect m_rootVisibleRect; 165 IntRect m_rootContentRect; 164 166 165 167 int m_maxTextureSize;
Note: See TracChangeset
for help on using the changeset viewer.