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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 } | 387 } |
388 | 388 |
389 void LayerTilerChromium::resizeLayer(const IntSize& size) | 389 void LayerTilerChromium::resizeLayer(const IntSize& size) |
390 { | 390 { |
391 if (m_layerSize == size) | 391 if (m_layerSize == size) |
392 return; | 392 return; |
393 | 393 |
394 int width = (size.width() + m_tileSize.width() - 1) / m_tileSize.width(); | 394 int width = (size.width() + m_tileSize.width() - 1) / m_tileSize.width(); |
395 int height = (size.height() + m_tileSize.height() - 1) / m_tileSize.height()
; | 395 int height = (size.height() + m_tileSize.height() - 1) / m_tileSize.height()
; |
396 | 396 |
| 397 if (height && (width > INT_MAX / height)) |
| 398 CRASH(); |
| 399 |
397 Vector<OwnPtr<Tile> > newTiles; | 400 Vector<OwnPtr<Tile> > newTiles; |
398 newTiles.resize(width * height); | 401 newTiles.resize(width * height); |
399 for (int j = 0; j < m_layerTileSize.height(); ++j) | 402 for (int j = 0; j < m_layerTileSize.height(); ++j) |
400 for (int i = 0; i < m_layerTileSize.width(); ++i) | 403 for (int i = 0; i < m_layerTileSize.width(); ++i) |
401 newTiles[i + j * width].swap(m_tiles[i + j * m_layerTileSize.width()
]); | 404 newTiles[i + j * width].swap(m_tiles[i + j * m_layerTileSize.width()
]); |
402 | 405 |
403 m_tiles.swap(newTiles); | 406 m_tiles.swap(newTiles); |
404 m_layerSize = size; | 407 m_layerSize = size; |
405 m_layerTileSize = IntSize(width, height); | 408 m_layerTileSize = IntSize(width, height); |
406 } | 409 } |
407 | 410 |
408 void LayerTilerChromium::growLayerToContain(const IntRect& contentRect) | 411 void LayerTilerChromium::growLayerToContain(const IntRect& contentRect) |
409 { | 412 { |
410 // Grow the tile array to contain this content rect. | 413 // Grow the tile array to contain this content rect. |
411 IntRect layerRect = contentRectToLayerRect(contentRect); | 414 IntRect layerRect = contentRectToLayerRect(contentRect); |
412 IntSize layerSize = IntSize(layerRect.right(), layerRect.bottom()); | 415 IntSize layerSize = IntSize(layerRect.right(), layerRect.bottom()); |
413 | 416 |
414 IntSize newSize = layerSize.expandedTo(m_layerSize); | 417 IntSize newSize = layerSize.expandedTo(m_layerSize); |
415 resizeLayer(newSize); | 418 resizeLayer(newSize); |
416 } | 419 } |
417 | 420 |
418 } // namespace WebCore | 421 } // namespace WebCore |
419 | 422 |
420 #endif // USE(ACCELERATED_COMPOSITING) | 423 #endif // USE(ACCELERATED_COMPOSITING) |
OLD | NEW |