Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: Source/WebCore/platform/graphics/chromium/LayerTilerChromium.cpp

Issue 6478030: Merge 78143 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/648/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698