void FEGaussianBlur::platformApplySoftware() { FilterEffect* in = inputEffect(0); Uint8ClampedArray* srcPixelArray = createPremultipliedImageResult(); if (!srcPixelArray) return; setIsAlphaImage(in->isAlphaImage()); IntRect effectDrawingRect = requestedRegionOfInputImageData(in->absolutePaintRect()); in->copyPremultipliedImage(srcPixelArray, effectDrawingRect); if (!m_stdX && !m_stdY) return; IntSize kernelSize = calculateKernelSize(filter(), FloatPoint(m_stdX, m_stdY)); kernelSize.scale(filter().filterScale()); IntSize paintSize = absolutePaintRect().size(); paintSize.scale(filter().filterScale()); RefPtr<Uint8ClampedArray> tmpImageData = Uint8ClampedArray::createUninitialized((paintSize.area() * 4).unsafeGet()); if (!tmpImageData) { WTFLogAlways("FEGaussianBlur::platformApplySoftware Unable to create buffer. Requested size was %d x %d\n", paintSize.width(), paintSize.height()); return; } platformApply(srcPixelArray, tmpImageData.get(), kernelSize.width(), kernelSize.height(), paintSize); }
void BitmapImage::determineMinimumSubsamplingLevel() const { if (!m_allowSubsampling) return; if (!m_source.allowSubsamplingOfFrameAtIndex(0)) return; // Values chosen to be appropriate for iOS. const int cMaximumImageAreaBeforeSubsampling = 5 * 1024 * 1024; const SubsamplingLevel maxSubsamplingLevel = 3; SubsamplingLevel currentLevel = 0; for ( ; currentLevel <= maxSubsamplingLevel; ++currentLevel) { IntSize frameSize = m_source.frameSizeAtIndex(0, currentLevel); if (frameSize.area() < cMaximumImageAreaBeforeSubsampling) break; } m_minimumSubsamplingLevel = currentLevel; }
unsigned ImageDecoder::frameBytesAtIndex(size_t index, SubsamplingLevel subsamplingLevel) const { IntSize frameSize = frameSizeAtIndex(index, subsamplingLevel); return (frameSize.area() * 4).unsafeGet(); }
bool HTMLPlugInImageElement::isTopLevelFullPagePlugin(const RenderEmbeddedObject& renderer) const { Frame& frame = *document().frame(); if (!frame.isMainFrame()) return false; auto& style = renderer.style(); IntSize visibleSize = frame.view()->visibleSize(); LayoutRect contentRect = renderer.contentBoxRect(); int contentWidth = contentRect.width(); int contentHeight = contentRect.height(); return is100Percent(style.width()) && is100Percent(style.height()) && contentWidth * contentHeight > visibleSize.area() * sizingFullPageAreaRatioThreshold; }