Chromium Code Reviews| 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, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 break; | 138 break; |
| 139 case Gradient: | 139 case Gradient: |
| 140 context->setFillGradient(canvasGradient()->gradient()); | 140 context->setFillGradient(canvasGradient()->gradient()); |
| 141 break; | 141 break; |
| 142 case ImagePattern: | 142 case ImagePattern: |
| 143 context->setFillPattern(canvasPattern()->pattern()); | 143 context->setFillPattern(canvasPattern()->pattern()); |
| 144 break; | 144 break; |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 SkShader* CanvasStyle::shader() const | |
| 149 { | |
| 150 switch (m_type) { | |
| 151 case ColorRGBA: | |
| 152 return nullptr; | |
| 153 case Gradient: | |
| 154 return canvasGradient()->gradient()->shader(); | |
| 155 case ImagePattern: | |
| 156 return canvasPattern()->pattern()->shader(); | |
| 157 default: | |
| 158 ASSERT_NOT_REACHED(); | |
| 159 } | |
| 160 return nullptr; | |
| 161 } | |
| 162 | |
| 163 RGBA32 CanvasStyle::paintColor() const | |
| 164 { | |
| 165 if (m_type == ColorRGBA) | |
| 166 return m_rgba; | |
| 167 ASSERT(m_type == Gradient || m_type == ImagePattern); | |
| 168 return SK_ColorBLACK; | |
|
Stephen White
2015/03/18 22:09:35
Nit: this is an RGBA32 (Blink type) but you're ret
Justin Novosad
2015/03/19 14:32:21
Yeah... RGBA32 and SkColor are completely intercha
| |
| 169 } | |
| 170 | |
| 148 DEFINE_TRACE(CanvasStyle) | 171 DEFINE_TRACE(CanvasStyle) |
| 149 { | 172 { |
| 150 visitor->trace(m_gradient); | 173 visitor->trace(m_gradient); |
| 151 visitor->trace(m_pattern); | 174 visitor->trace(m_pattern); |
| 152 } | 175 } |
| 153 | 176 |
| 154 } | 177 } |
| OLD | NEW |