| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #include "config.h" | 28 #include "config.h" |
| 29 #include "platform/graphics/Gradient.h" | 29 #include "platform/graphics/Gradient.h" |
| 30 | 30 |
| 31 #include "platform/geometry/FloatRect.h" | 31 #include "platform/geometry/FloatRect.h" |
| 32 #include "platform/graphics/GraphicsContext.h" | 32 #include "platform/graphics/GraphicsContext.h" |
| 33 #include "platform/graphics/skia/SkiaUtils.h" | 33 #include "platform/graphics/skia/SkiaUtils.h" |
| 34 #include "third_party/skia/include/core/SkColor.h" | 34 #include "third_party/skia/include/core/SkColor.h" |
| 35 #include "third_party/skia/include/core/SkShader.h" | 35 #include "third_party/skia/include/core/SkShader.h" |
| 36 #include "third_party/skia/include/effects/SkGradientShader.h" | 36 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 37 #include <algorithm> |
| 37 | 38 |
| 38 typedef Vector<SkScalar, 8> ColorStopOffsetVector; | 39 typedef Vector<SkScalar, 8> ColorStopOffsetVector; |
| 39 typedef Vector<SkColor, 8> ColorStopColorVector; | 40 typedef Vector<SkColor, 8> ColorStopColorVector; |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 Gradient::Gradient(const FloatPoint& p0, const FloatPoint& p1) | 44 Gradient::Gradient(const FloatPoint& p0, const FloatPoint& p1) |
| 44 : m_p0(p0) | 45 : m_p0(p0) |
| 45 , m_p1(p1) | 46 , m_p1(p1) |
| 46 , m_r0(0) | 47 , m_r0(0) |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 } | 249 } |
| 249 | 250 |
| 250 if (!m_gradient) { | 251 if (!m_gradient) { |
| 251 // use last color, since our "geometry" was degenerate (e.g. radius==0) | 252 // use last color, since our "geometry" was degenerate (e.g. radius==0) |
| 252 m_gradient = adoptRef(SkShader::CreateColorShader(colors[countUsed - 1])
); | 253 m_gradient = adoptRef(SkShader::CreateColorShader(colors[countUsed - 1])
); |
| 253 } | 254 } |
| 254 return m_gradient.get(); | 255 return m_gradient.get(); |
| 255 } | 256 } |
| 256 | 257 |
| 257 } // namespace blink | 258 } // namespace blink |
| OLD | NEW |