| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // We'll need a fancier Color abstraction to support CYMKA correctly | 140 // We'll need a fancier Color abstraction to support CYMKA correctly |
| 141 #if PLATFORM(CG) | 141 #if PLATFORM(CG) |
| 142 CGContextSetCMYKStrokeColor(context->platformContext(), m_cyan, m_ma
genta, m_yellow, m_black, m_alpha); | 142 CGContextSetCMYKStrokeColor(context->platformContext(), m_cyan, m_ma
genta, m_yellow, m_black, m_alpha); |
| 143 #elif PLATFORM(QT) | 143 #elif PLATFORM(QT) |
| 144 QPen currentPen = context->platformContext()->pen(); | 144 QPen currentPen = context->platformContext()->pen(); |
| 145 QColor clr; | 145 QColor clr; |
| 146 clr.setCmykF(m_cyan, m_magenta, m_yellow, m_black, m_alpha); | 146 clr.setCmykF(m_cyan, m_magenta, m_yellow, m_black, m_alpha); |
| 147 currentPen.setColor(clr); | 147 currentPen.setColor(clr); |
| 148 context->platformContext()->setPen(currentPen); | 148 context->platformContext()->setPen(currentPen); |
| 149 #else | 149 #else |
| 150 context->setStrokeColor(Color(m_cyan, m_magenta, m_yellow, m_black,
m_alpha)); | 150 context->setStrokeColor(cmykToRGB()); |
| 151 #endif | 151 #endif |
| 152 break; | 152 break; |
| 153 } | 153 } |
| 154 case Gradient: | 154 case Gradient: |
| 155 context->setStrokeGradient(canvasGradient()->gradient()); | 155 context->setStrokeGradient(canvasGradient()->gradient()); |
| 156 break; | 156 break; |
| 157 case ImagePattern: | 157 case ImagePattern: |
| 158 context->setStrokePattern(canvasPattern()->pattern()); | 158 context->setStrokePattern(canvasPattern()->pattern()); |
| 159 break; | 159 break; |
| 160 } | 160 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // We'll need a fancier Color abstraction to support CYMKA correctly | 201 // We'll need a fancier Color abstraction to support CYMKA correctly |
| 202 #if PLATFORM(CG) | 202 #if PLATFORM(CG) |
| 203 CGContextSetCMYKFillColor(context->platformContext(), m_cyan, m_mage
nta, m_yellow, m_black, m_alpha); | 203 CGContextSetCMYKFillColor(context->platformContext(), m_cyan, m_mage
nta, m_yellow, m_black, m_alpha); |
| 204 #elif PLATFORM(QT) | 204 #elif PLATFORM(QT) |
| 205 QBrush currentBrush = context->platformContext()->brush(); | 205 QBrush currentBrush = context->platformContext()->brush(); |
| 206 QColor clr; | 206 QColor clr; |
| 207 clr.setCmykF(m_cyan, m_magenta, m_yellow, m_black, m_alpha); | 207 clr.setCmykF(m_cyan, m_magenta, m_yellow, m_black, m_alpha); |
| 208 currentBrush.setColor(clr); | 208 currentBrush.setColor(clr); |
| 209 context->platformContext()->setBrush(currentBrush); | 209 context->platformContext()->setBrush(currentBrush); |
| 210 #else | 210 #else |
| 211 context->setFillColor(Color(m_cyan, m_magenta, m_yellow, m_black, m_
alpha)); | 211 context->setFillColor(cmykToRGB()); |
| 212 #endif | 212 #endif |
| 213 break; | 213 break; |
| 214 } | 214 } |
| 215 case Gradient: | 215 case Gradient: |
| 216 context->setFillGradient(canvasGradient()->gradient()); | 216 context->setFillGradient(canvasGradient()->gradient()); |
| 217 break; | 217 break; |
| 218 case ImagePattern: | 218 case ImagePattern: |
| 219 context->setFillPattern(canvasPattern()->pattern()); | 219 context->setFillPattern(canvasPattern()->pattern()); |
| 220 break; | 220 break; |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 | 223 |
| 224 Color CanvasStyle::cmykToRGB() const | 224 Color CanvasStyle::cmykToRGB() const |
| 225 { | 225 { |
| 226 float colors = 1 - m_black; | 226 float colors = 1 - m_black; |
| 227 int r = static_cast<int>(255 * (colors * (1 - m_cyan))); | 227 int r = static_cast<int>(255 * (colors * (1 - m_cyan))); |
| 228 int g = static_cast<int>(255 * (colors * (1 - m_magenta))); | 228 int g = static_cast<int>(255 * (colors * (1 - m_magenta))); |
| 229 int b = static_cast<int>(255 * (colors * (1 - m_yellow))); | 229 int b = static_cast<int>(255 * (colors * (1 - m_yellow))); |
| 230 return Color(r, g, b, static_cast<int>(m_alpha * 255)); | 230 return Color(r, g, b, static_cast<int>(m_alpha * 255)); |
| 231 } | 231 } |
| 232 | 232 |
| 233 } | 233 } |
| OLD | NEW |