void Gradient::paint(GraphicsContext* context) { #ifdef BUILDING_ON_TIGER CGContextDrawShading(context->platformContext(), platformGradient()); #else CGGradientDrawingOptions extendOptions = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation; if (m_radial) CGContextDrawRadialGradient(context->platformContext(), platformGradient(), m_p0, m_r0, m_p1, m_r1, extendOptions); else CGContextDrawLinearGradient(context->platformContext(), platformGradient(), m_p0, m_p1, extendOptions); #endif }
void Gradient::fill(GraphicsContext* context, const FloatRect& rect) { platformGradient(); context->save(); context->setFillGradient(this); context->fillRect(rect); context->restore(); }
void Gradient::fill(GraphicsContext* context, const FloatRect& rect) { cairo_t* cr = context->platformContext()->cr(); context->save(); cairo_set_source(cr, platformGradient()); cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); cairo_fill(cr); context->restore(); }
void Gradient::paint(CGContextRef context) { CGGradientDrawingOptions extendOptions = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation; if (!m_radial) { CGContextDrawLinearGradient(context, platformGradient(), m_p0, m_p1, extendOptions); return; } bool needScaling = aspectRatio() != 1; if (needScaling) { CGContextSaveGState(context); // Scale from the center of the gradient. We only ever scale non-deprecated gradients, // for which m_p0 == m_p1. ASSERT(m_p0 == m_p1); CGContextTranslateCTM(context, m_p0.x(), m_p0.y()); CGContextScaleCTM(context, 1, 1 / aspectRatio()); CGContextTranslateCTM(context, -m_p0.x(), -m_p0.y()); } CGContextDrawRadialGradient(context, platformGradient(), m_p0, m_r0, m_p1, m_r1, extendOptions); if (needScaling) CGContextRestoreGState(context); }
cairo_pattern_t* Gradient::platformGradient() { return platformGradient(1); }
void Gradient::setPlatformGradientSpaceTransform(const AffineTransform& gradientSpaceTransformation) { platformGradient()->setLocalMatrix(reinterpret_cast<const double*>(&gradientSpaceTransformation)); }
void Gradient::fill(GraphicsContext* context, const FloatRect& rect) { platformGradient()->fill(context->platformContext(), rect); }
void Gradient::fill(GraphicsContext* context, const FloatRect& rect) { context->platformContext()->fillRect(rect, *platformGradient()); }