OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 University of Szeged | 2 * Copyright (C) 2010 University of Szeged |
3 * Copyright (C) 2010 Zoltan Herczeg | 3 * Copyright (C) 2010 Zoltan Herczeg |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 inline void FELighting::platformApplyGeneric(LightingData& data, LightSource::Pa
intingData& paintingData) | 250 inline void FELighting::platformApplyGeneric(LightingData& data, LightSource::Pa
intingData& paintingData) |
251 { | 251 { |
252 int optimalThreadNumber = ((data.widthDecreasedByOne - 1) * (data.heightDecr
easedByOne - 1)) / s_minimalRectDimension; | 252 int optimalThreadNumber = ((data.widthDecreasedByOne - 1) * (data.heightDecr
easedByOne - 1)) / s_minimalRectDimension; |
253 if (optimalThreadNumber > 1) { | 253 if (optimalThreadNumber > 1) { |
254 // Initialize parallel jobs | 254 // Initialize parallel jobs |
255 WTF::ParallelJobs<PlatformApplyGenericParameters> parallelJobs(&platform
ApplyGenericWorker, optimalThreadNumber); | 255 WTF::ParallelJobs<PlatformApplyGenericParameters> parallelJobs(&platform
ApplyGenericWorker, optimalThreadNumber); |
256 | 256 |
257 // Fill the parameter array | 257 // Fill the parameter array |
258 int job = parallelJobs.numberOfJobs(); | 258 int job = parallelJobs.numberOfJobs(); |
259 if (job > 1) { | 259 if (job > 1) { |
| 260 // Split the job into "yStep"-sized jobs but there a few jobs that n
eed to be slightly larger since |
| 261 // yStep * jobs < total size. These extras are handled by the remain
der "jobsWithExtra". |
| 262 const int yStep = (data.heightDecreasedByOne - 1) / job; |
| 263 const int jobsWithExtra = (data.heightDecreasedByOne - 1) % job; |
| 264 |
260 int yStart = 1; | 265 int yStart = 1; |
261 int yStep = (data.heightDecreasedByOne - 1) / job; | |
262 for (--job; job >= 0; --job) { | 266 for (--job; job >= 0; --job) { |
263 PlatformApplyGenericParameters& params = parallelJobs.parameter(
job); | 267 PlatformApplyGenericParameters& params = parallelJobs.parameter(
job); |
264 params.filter = this; | 268 params.filter = this; |
265 params.data = data; | 269 params.data = data; |
266 params.paintingData = paintingData; | 270 params.paintingData = paintingData; |
267 params.yStart = yStart; | 271 params.yStart = yStart; |
268 if (job > 0) { | 272 yStart += job < jobsWithExtra ? yStep + 1 : yStep; |
269 params.yEnd = yStart + yStep; | 273 params.yEnd = yStart; |
270 yStart += yStep; | |
271 } else | |
272 params.yEnd = data.heightDecreasedByOne; | |
273 } | 274 } |
274 parallelJobs.execute(); | 275 parallelJobs.execute(); |
275 return; | 276 return; |
276 } | 277 } |
277 // Fallback to single threaded mode. | 278 // Fallback to single threaded mode. |
278 } | 279 } |
279 | 280 |
280 platformApplyGenericPaint(data, paintingData, 1, data.heightDecreasedByOne); | 281 platformApplyGenericPaint(data, paintingData, 1, data.heightDecreasedByOne); |
281 } | 282 } |
282 | 283 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 // output for various kernelUnitLengths, and I am not sure they are reliable
. | 403 // output for various kernelUnitLengths, and I am not sure they are reliable
. |
403 // Anyway, feConvolveMatrix should also use the implementation | 404 // Anyway, feConvolveMatrix should also use the implementation |
404 | 405 |
405 IntSize absolutePaintSize = absolutePaintRect().size(); | 406 IntSize absolutePaintSize = absolutePaintRect().size(); |
406 drawLighting(srcPixelArray, absolutePaintSize.width(), absolutePaintSize.hei
ght()); | 407 drawLighting(srcPixelArray, absolutePaintSize.width(), absolutePaintSize.hei
ght()); |
407 } | 408 } |
408 | 409 |
409 } // namespace WebCore | 410 } // namespace WebCore |
410 | 411 |
411 #endif // ENABLE(FILTERS) | 412 #endif // ENABLE(FILTERS) |
OLD | NEW |