| 416 | } |
| 417 | |
| 418 | void MapRenderables::drawColorSeparation(QPainter* painter, const RenderConfig& config, const MapColor* separation, bool use_color) const |
| 419 | { |
| 420 | painter->save(); |
| 421 | |
| 422 | const QPainterPath initial_clip(painter->clipPath()); |
| 423 | const QPainterPath* current_clip = nullptr; |
| 424 | |
| 425 | // As soon as the spot color is actually used for drawing (i.e. drawing_started = true), |
| 426 | // we need to take care of knockouts. |
| 427 | bool drawing_started = false; |
| 428 | |
| 429 | // For each pair of color priority and its renderables collection... |
| 430 | auto end_of_colors = rend(); |
| 431 | auto color = rbegin(); |
| 432 | while (color != end_of_colors && color->first >= map->getNumColors()) |
| 433 | { |
| 434 | ++color; |
| 435 | } |
| 436 | for (; color != end_of_colors; ++color) |
| 437 | { |
| 438 | SpotColorComponent drawing_color(map->getColor(color->first), 1.0f); |
| 439 | |
| 440 | // Check whether the current color [priority] applies to the current separation. |
| 441 | if (color->first > MapColor::Reserved) |
| 442 | { |
| 443 | if (separation->getPriority() == MapColor::Reserved) |
| 444 | { |
| 445 | // Don't process regular colors for the "Reserved" separation. |
| 446 | continue; |
| 447 | } |
| 448 | |
| 449 | switch (drawing_color.spot_color->getSpotColorMethod()) |
| 450 | { |
| 451 | case MapColor::UndefinedMethod: |
| 452 | continue; |
| 453 | |
| 454 | case MapColor::SpotColor: |
| 455 | if (drawing_color.spot_color == separation) |
| 456 | { |
| 457 | ; // okay |
| 458 | } |
| 459 | else if (drawing_started && drawing_color.spot_color->getKnockout()) |
| 460 | { |
| 461 | drawing_color.factor = 0.0f; |
| 462 | } |
| 463 | else |
| 464 | { |
| 465 | continue; |
| 466 | } |
| 467 | break; |
| 468 | |
| 469 | case MapColor::CustomColor: |
| 470 | { |
| 471 | // First, check if the renderables draw color to this separation |
| 472 | // TODO: Use an efficient data structure to avoid reiterating each time a separation is drawn |
| 473 | const SpotColorComponents& components = drawing_color.spot_color->getComponents(); |
| 474 | for (const auto& component : components) |
| 475 | { |
nothing calls this directly
no test coverage detected