| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 CGContextTranslateCTM(m_cgContext.get(), -paintRect.x(), -paintRect.y()); | 292 CGContextTranslateCTM(m_cgContext.get(), -paintRect.x(), -paintRect.y()); |
| 293 painter.paint(*m_graphicsContext, paintRect); | 293 painter.paint(*m_graphicsContext, paintRect); |
| 294 | 294 |
| 295 // Get the contents of the updated rect. | 295 // Get the contents of the updated rect. |
| 296 ASSERT(static_cast<int>(CGBitmapContextGetWidth(m_cgContext.get())) == paint
Rect.width() && static_cast<int>(CGBitmapContextGetHeight(m_cgContext.get())) ==
paintRect.height()); | 296 ASSERT(static_cast<int>(CGBitmapContextGetWidth(m_cgContext.get())) == paint
Rect.width() && static_cast<int>(CGBitmapContextGetHeight(m_cgContext.get())) ==
paintRect.height()); |
| 297 uint8_t* paintPixels = static_cast<uint8_t*>(canvasPixels.data()); | 297 uint8_t* paintPixels = static_cast<uint8_t*>(canvasPixels.data()); |
| 298 #else | 298 #else |
| 299 #error "Need to implement for your platform." | 299 #error "Need to implement for your platform." |
| 300 #endif | 300 #endif |
| 301 | 301 |
| 302 // Painting could cause compositing to get turned off, which may cause the t
iler to become invalidated mid-update. |
| 303 if (!m_tiles.size()) |
| 304 return; |
| 305 |
| 302 for (int j = top; j <= bottom; ++j) { | 306 for (int j = top; j <= bottom; ++j) { |
| 303 for (int i = left; i <= right; ++i) { | 307 for (int i = left; i <= right; ++i) { |
| 304 Tile* tile = m_tiles[tileIndex(i, j)].get(); | 308 Tile* tile = m_tiles[tileIndex(i, j)].get(); |
| 305 if (!tile->dirty()) | 309 if (!tile->dirty()) |
| 306 continue; | 310 continue; |
| 307 | 311 |
| 308 // Calculate page-space rectangle to copy from. | 312 // Calculate page-space rectangle to copy from. |
| 309 IntRect sourceRect = tileContentRect(i, j); | 313 IntRect sourceRect = tileContentRect(i, j); |
| 310 const IntPoint anchor = sourceRect.location(); | 314 const IntPoint anchor = sourceRect.location(); |
| 311 sourceRect.intersect(layerRectToContentRect(tile->m_dirtyLayerRect))
; | 315 sourceRect.intersect(layerRectToContentRect(tile->m_dirtyLayerRect))
; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } | 354 } |
| 351 } | 355 } |
| 352 | 356 |
| 353 void LayerTilerChromium::setLayerPosition(const IntPoint& layerPosition) | 357 void LayerTilerChromium::setLayerPosition(const IntPoint& layerPosition) |
| 354 { | 358 { |
| 355 m_layerPosition = layerPosition; | 359 m_layerPosition = layerPosition; |
| 356 } | 360 } |
| 357 | 361 |
| 358 void LayerTilerChromium::draw(const IntRect& contentRect) | 362 void LayerTilerChromium::draw(const IntRect& contentRect) |
| 359 { | 363 { |
| 360 if (m_skipsDraw) | 364 if (m_skipsDraw || !m_tiles.size()) |
| 361 return; | 365 return; |
| 362 | 366 |
| 363 // We reuse the shader program used by ContentLayerChromium. | 367 // We reuse the shader program used by ContentLayerChromium. |
| 364 GraphicsContext3D* context = layerRendererContext(); | 368 GraphicsContext3D* context = layerRendererContext(); |
| 365 const ContentLayerChromium::SharedValues* contentLayerValues = layerRenderer
()->contentLayerSharedValues(); | 369 const ContentLayerChromium::SharedValues* contentLayerValues = layerRenderer
()->contentLayerSharedValues(); |
| 366 layerRenderer()->useShader(contentLayerValues->contentShaderProgram()); | 370 layerRenderer()->useShader(contentLayerValues->contentShaderProgram()); |
| 367 GLC(context, context->uniform1i(contentLayerValues->shaderSamplerLocation(),
0)); | 371 GLC(context, context->uniform1i(contentLayerValues->shaderSamplerLocation(),
0)); |
| 368 | 372 |
| 369 int left, top, right, bottom; | 373 int left, top, right, bottom; |
| 370 contentRectToTileIndices(contentRect, left, top, right, bottom); | 374 contentRectToTileIndices(contentRect, left, top, right, bottom); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 IntRect layerRect = contentRectToLayerRect(contentRect); | 418 IntRect layerRect = contentRectToLayerRect(contentRect); |
| 415 IntSize layerSize = IntSize(layerRect.right(), layerRect.bottom()); | 419 IntSize layerSize = IntSize(layerRect.right(), layerRect.bottom()); |
| 416 | 420 |
| 417 IntSize newSize = layerSize.expandedTo(m_layerSize); | 421 IntSize newSize = layerSize.expandedTo(m_layerSize); |
| 418 resizeLayer(newSize); | 422 resizeLayer(newSize); |
| 419 } | 423 } |
| 420 | 424 |
| 421 } // namespace WebCore | 425 } // namespace WebCore |
| 422 | 426 |
| 423 #endif // USE(ACCELERATED_COMPOSITING) | 427 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |