| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> | 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> |
| 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> | 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> |
| 6 * Copyright (C) 2010 Renata Hodovan <reni@inf.u-szeged.hu> | 6 * Copyright (C) 2010 Renata Hodovan <reni@inf.u-szeged.hu> |
| 7 * Copyright (C) 2011 Gabor Loki <loki@webkit.org> | 7 * Copyright (C) 2011 Gabor Loki <loki@webkit.org> |
| 8 * | 8 * |
| 9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
| 10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 initPaint(paintingData); | 369 initPaint(paintingData); |
| 370 | 370 |
| 371 int optimalThreadNumber = (absolutePaintRect().width() * absolutePaintRect()
.height()) / s_minimalRectDimension; | 371 int optimalThreadNumber = (absolutePaintRect().width() * absolutePaintRect()
.height()) / s_minimalRectDimension; |
| 372 if (optimalThreadNumber > 1) { | 372 if (optimalThreadNumber > 1) { |
| 373 // Initialize parallel jobs | 373 // Initialize parallel jobs |
| 374 WTF::ParallelJobs<FillRegionParameters> parallelJobs(&WebCore::FETurbule
nce::fillRegionWorker, optimalThreadNumber); | 374 WTF::ParallelJobs<FillRegionParameters> parallelJobs(&WebCore::FETurbule
nce::fillRegionWorker, optimalThreadNumber); |
| 375 | 375 |
| 376 // Fill the parameter array | 376 // Fill the parameter array |
| 377 int i = parallelJobs.numberOfJobs(); | 377 int i = parallelJobs.numberOfJobs(); |
| 378 if (i > 1) { | 378 if (i > 1) { |
| 379 // Split the job into "stepY"-sized jobs but there a few jobs that n
eed to be slightly larger since |
| 380 // stepY * jobs < total size. These extras are handled by the remain
der "jobsWithExtra". |
| 381 const int stepY = absolutePaintRect().height() / i; |
| 382 const int jobsWithExtra = absolutePaintRect().height() % i; |
| 383 |
| 379 int startY = 0; | 384 int startY = 0; |
| 380 int stepY = absolutePaintRect().height() / i; | |
| 381 for (; i > 0; --i) { | 385 for (; i > 0; --i) { |
| 382 FillRegionParameters& params = parallelJobs.parameter(i-1); | 386 FillRegionParameters& params = parallelJobs.parameter(i-1); |
| 383 params.filter = this; | 387 params.filter = this; |
| 384 params.pixelArray = pixelArray; | 388 params.pixelArray = pixelArray; |
| 385 params.paintingData = &paintingData; | 389 params.paintingData = &paintingData; |
| 386 params.startY = startY; | 390 params.startY = startY; |
| 387 if (i != 1) { | 391 startY += i < jobsWithExtra ? stepY + 1 : stepY; |
| 388 params.endY = startY + stepY; | 392 params.endY = startY; |
| 389 startY = startY + stepY; | |
| 390 } else | |
| 391 params.endY = absolutePaintRect().height(); | |
| 392 } | 393 } |
| 393 | 394 |
| 394 // Execute parallel jobs | 395 // Execute parallel jobs |
| 395 parallelJobs.execute(); | 396 parallelJobs.execute(); |
| 396 return; | 397 return; |
| 397 } | 398 } |
| 398 } | 399 } |
| 399 | 400 |
| 400 // Fallback to single threaded mode if there is no room for a new thread or
the paint area is too small. | 401 // Fallback to single threaded mode if there is no room for a new thread or
the paint area is too small. |
| 401 fillRegion(pixelArray, paintingData, 0, absolutePaintRect().height()); | 402 fillRegion(pixelArray, paintingData, 0, absolutePaintRect().height()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 430 << "baseFrequency=\"" << baseFrequencyX() << ", " << baseFrequencyY() <<
"\" " | 431 << "baseFrequency=\"" << baseFrequencyX() << ", " << baseFrequencyY() <<
"\" " |
| 431 << "seed=\"" << seed() << "\" " | 432 << "seed=\"" << seed() << "\" " |
| 432 << "numOctaves=\"" << numOctaves() << "\" " | 433 << "numOctaves=\"" << numOctaves() << "\" " |
| 433 << "stitchTiles=\"" << stitchTiles() << "\"]\n"; | 434 << "stitchTiles=\"" << stitchTiles() << "\"]\n"; |
| 434 return ts; | 435 return ts; |
| 435 } | 436 } |
| 436 | 437 |
| 437 } // namespace WebCore | 438 } // namespace WebCore |
| 438 | 439 |
| 439 #endif // ENABLE(FILTERS) | 440 #endif // ENABLE(FILTERS) |
| OLD | NEW |