void PopupWindow::onPreferredSize(PreferredSizeEvent& ev) { ScreenGraphics g; g.setFont(getFont()); Size resultSize(0, 0); if (hasText()) resultSize = g.fitString(getText(), (getClientBounds() - getBorder()).w, getAlign()); resultSize.w += border_width.l + border_width.r; resultSize.h += border_width.t + border_width.b; if (!getChildren().empty()) { Size maxSize(0, 0); Size reqSize; UI_FOREACH_WIDGET(getChildren(), it) { Widget* child = *it; reqSize = child->getPreferredSize(); maxSize.w = MAX(maxSize.w, reqSize.w); maxSize.h = MAX(maxSize.h, reqSize.h); }
Uint8ClampedArray* FilterEffect::createPremultipliedImageResult() { // Only one result type is allowed. ASSERT(!hasResult()); if (m_absolutePaintRect.isEmpty()) return nullptr; IntSize resultSize(m_absolutePaintRect.size()); ASSERT(!ImageBuffer::sizeNeedsClamping(resultSize)); resultSize.scale(m_filter.filterScale()); m_premultipliedImageResult = Uint8ClampedArray::createUninitialized(resultSize.width() * resultSize.height() * 4); return m_premultipliedImageResult.get(); }
Uint8ClampedArray* FilterEffect::createPremultipliedImageResult() { // Only one result type is allowed. ASSERT(!hasResult()); ASSERT(isFilterSizeValid(m_absolutePaintRect)); if (m_absolutePaintRect.isEmpty()) return 0; IntSize resultSize(m_absolutePaintRect.size()); resultSize.scale(m_filter->filterScale()); m_premultipliedImageResult = Uint8ClampedArray::createUninitialized(resultSize.width() * resultSize.height() * 4); return m_premultipliedImageResult.get(); }