void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const FloatSize& scale, const FloatPoint& phase, CompositeOperator op, const FloatRect& destRect, WebBlendMode blendMode, const IntSize& repeatSpacing) { if (!isSurfaceValid()) return; const SkBitmap& bitmap = m_surface->bitmap(); RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsCopy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); image->drawPattern(context, srcRect, scale, phase, op, destRect, blendMode, repeatSpacing); }
void ImageBuffer::draw(GraphicsContext* context, const FloatRect& destRect, const FloatRect* srcPtr, CompositeOperator op, WebBlendMode blendMode) { if (!isSurfaceValid()) return; FloatRect srcRect = srcPtr ? *srcPtr : FloatRect(FloatPoint(), size()); RefPtr<SkPicture> picture = m_surface->getPicture(); if (picture) { context->drawPicture(picture.get(), destRect, srcRect, op, blendMode); return; } SkBitmap bitmap = m_surface->bitmap(); // For ImageBufferSurface that enables cachedBitmap, Use the cached Bitmap for CPU side usage // if it is available, otherwise generate and use it. if (!context->isAccelerated() && m_surface->isAccelerated() && m_surface->cachedBitmapEnabled() && isSurfaceValid()) { m_surface->updateCachedBitmapIfNeeded(); bitmap = m_surface->cachedBitmap(); } RefPtr<Image> image = BitmapImage::create(NativeImageSkia::create(drawNeedsCopy(m_context.get(), context) ? deepSkBitmapCopy(bitmap) : bitmap)); context->drawImage(image.get(), destRect, srcRect, op, blendMode, DoNotRespectImageOrientation); }
void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect) { RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), drawNeedsCopy(m_context.get(), context)); image->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect); }
void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator op, bool useLowQualityScale) { RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), drawNeedsCopy(m_context.get(), context)); context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, DoNotRespectImageOrientation, useLowQualityScale); }