void CrossfadeGeneratedImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace, CompositeOperator compositeOp, BlendMode blendMode, ImageOrientationDescription) { GraphicsContextStateSaver stateSaver(*context); context->setCompositeOperation(compositeOp, blendMode); context->clip(dstRect); context->translate(dstRect.x(), dstRect.y()); if (dstRect.size() != srcRect.size()) context->scale(FloatSize(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height())); context->translate(-srcRect.x(), -srcRect.y()); drawCrossfade(context); }
void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode) { std::unique_ptr<ImageBuffer> imageBuffer = ImageBuffer::create(size(), 1, ColorSpaceDeviceRGB, context->isAcceleratedContext() ? Accelerated : Unaccelerated); if (!imageBuffer) return; // Fill with the cross-faded image. GraphicsContext* graphicsContext = imageBuffer->context(); drawCrossfade(graphicsContext); // Tile the image buffer into the context. imageBuffer->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, compositeOp, dstRect, blendMode); }
void CrossfadeGeneratedImage::drawTile(GraphicsContext& context, const FloatRect& srcRect) { // Draw nothing if either of the images hasn't loaded yet. if (m_fromImage == Image::nullImage() || m_toImage == Image::nullImage()) return; SkPaint paint = context.fillPaint(); paint.setBlendMode(SkBlendMode::kSrcOver); paint.setAntiAlias(context.shouldAntialias()); FloatRect destRect((FloatPoint()), FloatSize(m_crossfadeSize)); paint.setFilterQuality(context.computeFilterQuality(this, destRect, srcRect)); drawCrossfade(context.canvas(), paint, ClampImageToSourceRect); }
void CrossfadeGeneratedImage::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const FloatSize& scale, const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, blink::WebBlendMode blendMode, const IntSize& repeatSpacing) { OwnPtr<ImageBuffer> imageBuffer = context->createCompatibleBuffer(m_size); if (!imageBuffer) return; // Fill with the cross-faded image. GraphicsContext* graphicsContext = imageBuffer->context(); drawCrossfade(graphicsContext); // Tile the image buffer into the context. imageBuffer->drawPattern(context, srcRect, scale, phase, compositeOp, dstRect, blendMode, repeatSpacing); }
void CrossfadeGeneratedImage::draw(SkCanvas* canvas, const SkPaint& paint, const FloatRect& dstRect, const FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode clampMode) { // Draw nothing if either of the images hasn't loaded yet. if (m_fromImage == Image::nullImage() || m_toImage == Image::nullImage()) return; SkAutoCanvasRestore ar(canvas, true); canvas->clipRect(dstRect); canvas->translate(dstRect.x(), dstRect.y()); if (dstRect.size() != srcRect.size()) canvas->scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.height()); canvas->translate(-srcRect.x(), -srcRect.y()); drawCrossfade(canvas, paint, clampMode); canvas->restore(); }