diff options
author | Steve Block <steveblock@google.com> | 2010-04-27 16:31:00 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-05-11 14:42:12 +0100 |
commit | dcc8cf2e65d1aa555cce12431a16547e66b469ee (patch) | |
tree | 92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/platform/graphics/haiku/GradientHaiku.cpp | |
parent | ccac38a6b48843126402088a309597e682f40fe6 (diff) | |
download | external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2 |
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/platform/graphics/haiku/GradientHaiku.cpp')
-rw-r--r-- | WebCore/platform/graphics/haiku/GradientHaiku.cpp | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/WebCore/platform/graphics/haiku/GradientHaiku.cpp b/WebCore/platform/graphics/haiku/GradientHaiku.cpp index 469a17f..fdc4690 100644 --- a/WebCore/platform/graphics/haiku/GradientHaiku.cpp +++ b/WebCore/platform/graphics/haiku/GradientHaiku.cpp @@ -1,6 +1,7 @@ /* * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> All rights reserved. * Copyright (C) 2009 Maxime Simon <simon.maxime@theolliviers.com> + * Copyright (C) 2010 Stephan Aßmus <superstippi@gmx.de> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,26 +28,45 @@ #include "config.h" #include "Gradient.h" -#include "CSSParser.h" -#include "NotImplemented.h" +#include "GraphicsContext.h" +#include <GradientLinear.h> +#include <GradientRadial.h> +#include <View.h> namespace WebCore { void Gradient::platformDestroy() { - notImplemented(); + delete m_gradient; } PlatformGradient Gradient::platformGradient() { - notImplemented(); - return 0; + if (m_gradient) + return m_gradient; + + if (m_radial) { + // TODO: Support m_r0? + m_gradient = new BGradientRadial(m_p0, m_r1); + } else + m_gradient = new BGradientLinear(m_p0, m_p1); + size_t size = m_stops.size(); + for (size_t i = 0; i < size; i++) { + const ColorStop& stop = m_stops[i]; + rgb_color color; + color.red = static_cast<uint8>(stop.red * 255); + color.green = static_cast<uint8>(stop.green * 255); + color.blue = static_cast<uint8>(stop.blue * 255); + color.alpha = static_cast<uint8>(stop.alpha * 255); + m_gradient->AddColor(color, stop.stop); + } + return m_gradient; } -void Gradient::fill(GraphicsContext*, const FloatRect&) +void Gradient::fill(GraphicsContext* context, const FloatRect& rect) { - notImplemented(); + context->platformContext()->FillRect(rect, *platformGradient()); } } // namespace WebCore |