void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom) { GraphicsContext* context = paintInfo.context; RenderStyle* style = renderer().style(isFirstLineStyle()); const Font& font = style->font(); FloatPoint boxOrigin = locationIncludingFlipping(); boxOrigin.moveBy(FloatPoint(paintOffset)); if (!isHorizontal()) boxOrigin.move(0, -virtualLogicalHeight()); FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), virtualLogicalHeight())); GraphicsContextStateSaver stateSaver(*context); if (!isHorizontal()) context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Clockwise)); FloatPoint textOrigin(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().ascent()); bool isPrinting = renderer().document().printing(); bool haveSelection = !isPrinting && paintInfo.phase != PaintPhaseTextClip && selectionState() != RenderObject::SelectionNone; if (haveSelection) paintSelection(context, boxOrigin, style, font); else if (paintInfo.phase == PaintPhaseSelection) return; TextPainter::Style textStyle = TextPainter::textPaintingStyle(renderer(), style, paintInfo.forceBlackText(), isPrinting); if (haveSelection) textStyle = TextPainter::selectionPaintingStyle(renderer(), true, paintInfo.forceBlackText(), isPrinting, textStyle); TextRun textRun = constructTextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion); TextPainter textPainter(context, font, textRun, textOrigin, boxRect, isHorizontal()); textPainter.paint(0, m_str.length(), m_str.length(), textStyle); paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style); }
bool PlaneDetector::linesMatch(Vec4i& line1, Vec4i& line2) { if (isHorizontal(line1) != isHorizontal(line2)) return false; bool horiz = isHorizontal(line1); if (horiz) { if (!((line2[0] < line1[2] && line2[2] > line1[0]) || (line2[2] > line1[0] && line2[0] < line1[2]))) { return false; } } else { if (!((line2[1] < line1[3] && line2[3] > line1[1]) || (line2[3] > line1[1] && line2[1] < line1[3]))) { return false; } } double slope1 = (double) (line1[3] - line1[1]) / (line1[2] - line1[0]); double slope2 = (double) (line2[3] - line2[1]) / (line2[2] - line2[0]); double maxSlope = max(abs(slope1), abs(slope2)); double slope1norm = slope1 / maxSlope; double slope2norm = slope2 / maxSlope; if (abs(slope1norm - slope2norm) > 0.1) return false; double m1 = line1[1] - slope1 * line1[0]; double m2 = line2[1] - slope2 * line2[0]; if (abs(m2 - m1) < 50) { printf("Matched (%d, %d), (%d, %d) to (%d, %d), (%d, %d)\n", line1[0], line1[1], line1[2], line1[3], line2[0], line2[1], line2[2], line2[3]); return true; } return false; }
void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom) { GraphicsContext* context = paintInfo.context; RenderStyle* style = m_renderer->style(isFirstLineStyle()); Color styleTextColor = style->visitedDependentColor(CSSPropertyWebkitTextFillColor); if (styleTextColor != context->fillColor()) context->setFillColor(styleTextColor, style->colorSpace()); Color textColor = styleTextColor; const Font& font = style->font(); if (selectionState() != RenderObject::SelectionNone) { paintSelection(context, paintOffset, style, font); // Select the correct color for painting the text. Color foreground = paintInfo.forceBlackText() ? Color::black : renderer()->selectionForegroundColor(); if (foreground.isValid() && foreground != styleTextColor) context->setFillColor(foreground, style->colorSpace()); } const ShadowData* shadow = style->textShadow(); bool hasShadow = shadow; if (hasShadow) { // FIXME: it would be better if we could get the shadows top-to-bottom from the style. Vector<const ShadowData*, 4> shadows; do { shadows.append(shadow); } while ((shadow = shadow->next())); DrawLooper drawLooper; drawLooper.addUnmodifiedContent(); for (int i = shadows.size() - 1; i >= 0; i--) { shadow = shadows[i]; int shadowX = isHorizontal() ? shadow->x() : shadow->y(); int shadowY = isHorizontal() ? shadow->y() : -shadow->x(); FloatSize offset(shadowX, shadowY); drawLooper.addShadow(offset, shadow->blur(), shadow->color(), DrawLooper::ShadowRespectsTransforms, DrawLooper::ShadowIgnoresAlpha); } context->setDrawLooper(drawLooper); } // FIXME: Why is this always LTR? Fix by passing correct text run flags below. FloatPoint boxOrigin(paintOffset); boxOrigin.move(x(), y()); FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), logicalHeight())); FloatPoint textOrigin(boxOrigin.x(), boxOrigin.y() + style->fontMetrics().ascent()); TextRun textRun = RenderBlock::constructTextRun(renderer(), font, m_str, style, TextRun::AllowTrailingExpansion); TextRunPaintInfo textRunPaintInfo(textRun); textRunPaintInfo.bounds = boxRect; context->drawText(font, textRunPaintInfo, textOrigin); // Restore the regular fill color. if (styleTextColor != context->fillColor()) context->setFillColor(styleTextColor, style->colorSpace()); if (hasShadow) context->clearDrawLooper(); paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style); }
void EllipsisBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom) { GraphicsContext* context = paintInfo.context; RenderStyle* style = renderer().style(isFirstLineStyle()); const Font& font = style->font(); FloatPoint boxOrigin = locationIncludingFlipping(); boxOrigin.moveBy(FloatPoint(paintOffset)); if (!isHorizontal()) boxOrigin.move(0, -virtualLogicalHeight()); FloatRect boxRect(boxOrigin, LayoutSize(logicalWidth(), virtualLogicalHeight())); GraphicsContextStateSaver stateSaver(*context); if (!isHorizontal()) context->concatCTM(InlineTextBox::rotation(boxRect, InlineTextBox::Clockwise)); FloatPoint textOrigin = FloatPoint(boxOrigin.x(), boxOrigin.y() + font.fontMetrics().ascent()); Color styleTextColor = renderer().resolveColor(style, CSSPropertyWebkitTextFillColor); if (styleTextColor != context->fillColor()) context->setFillColor(styleTextColor); if (selectionState() != RenderObject::SelectionNone) { paintSelection(context, boxOrigin, style, font); // Select the correct color for painting the text. Color foreground = paintInfo.forceBlackText() ? Color::black : renderer().selectionForegroundColor(); if (foreground != styleTextColor) context->setFillColor(foreground); } // Text shadows are disabled when printing. http://crbug.com/258321 const ShadowList* shadowList = context->printing() ? 0 : style->textShadow(); bool hasShadow = shadowList; if (hasShadow) { OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); for (size_t i = shadowList->shadows().size(); i--; ) { const ShadowData& shadow = shadowList->shadows()[i]; float shadowX = isHorizontal() ? shadow.x() : shadow.y(); float shadowY = isHorizontal() ? shadow.y() : -shadow.x(); FloatSize offset(shadowX, shadowY); drawLooperBuilder->addShadow(offset, shadow.blur(), shadow.color(), DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder::ShadowIgnoresAlpha); } drawLooperBuilder->addUnmodifiedContent(); context->setDrawLooper(drawLooperBuilder.release()); } TextRun textRun = RenderBlockFlow::constructTextRun(&renderer(), font, m_str, style, TextRun::AllowTrailingExpansion); TextRunPaintInfo textRunPaintInfo(textRun); textRunPaintInfo.bounds = boxRect; context->drawText(font, textRunPaintInfo, textOrigin); // Restore the regular fill color. if (styleTextColor != context->fillColor()) context->setFillColor(styleTextColor); if (hasShadow) context->clearDrawLooper(); paintMarkupBox(paintInfo, paintOffset, lineTop, lineBottom, style); }
void InlineBox::logicalRectToPhysicalRect(LayoutRect& current) const { if (isHorizontal() && !lineLayoutItem().hasFlippedBlocksWritingMode()) return; if (!isHorizontal()) { current = current.transposedRect(); } current.setLocation(logicalPositionToPhysicalPoint(current.location(), current.size())); return; }
Vector<IntRect> RenderTextLineBoxes::absoluteRectsForRange(const RenderText& renderer, unsigned start, unsigned end, bool useSelectionHeight, bool* wasFixed) const { Vector<IntRect> rects; for (auto box = m_first; box; box = box->nextTextBox()) { // Note: box->end() returns the index of the last character, not the index past it if (start <= box->start() && box->end() < end) { FloatRect boundaries = box->calculateBoundaries(); if (useSelectionHeight) { LayoutRect selectionRect = box->localSelectionRect(start, end); if (box->isHorizontal()) { boundaries.setHeight(selectionRect.height()); boundaries.setY(selectionRect.y()); } else { boundaries.setWidth(selectionRect.width()); boundaries.setX(selectionRect.x()); } } rects.append(renderer.localToAbsoluteQuad(boundaries, 0, wasFixed).enclosingBoundingBox()); continue; } // FIXME: This code is wrong. It's converting local to absolute twice. http://webkit.org/b/65722 FloatRect rect = localQuadForTextBox(*box, start, end, useSelectionHeight); if (!rect.isZero()) rects.append(renderer.localToAbsoluteQuad(rect, 0, wasFixed).enclosingBoundingBox()); } return rects; }
int InlineBox::logicalHeight() const { //SISO_HTMLComposer Start int result = 0; int lineHeightAdjust = root()->isLineHeightAdjust()? root()->lineHeightAdjustValue() : 0; //SISO_HTMLComposer End #if ENABLE(SVG) if (hasVirtualLogicalHeight()) return virtualLogicalHeight(); #endif //SISO_HTMLComposer Start if (renderer()->isText()) { result = m_isText ? renderer()->style(m_firstLine)->fontMetrics().height() : 0; result += lineHeightAdjust; return result; } if (renderer()->isBox() && parent()) { result = isHorizontal() ? toRenderBox(m_renderer)->height() : toRenderBox(m_renderer)->width(); result += lineHeightAdjust; return result; } //SISO_HTMLComposer End ASSERT(isInlineFlowBox()); RenderBoxModelObject* flowObject = boxModelObject(); const FontMetrics& fontMetrics = renderer()->style(m_firstLine)->fontMetrics(); result = fontMetrics.height(); if (parent()) result += flowObject->borderAndPaddingLogicalHeight(); //SISO_HTMLComposer Start result += lineHeightAdjust; //SISO_HTMLComposer End return result; }
Vector<FloatQuad> RenderTextLineBoxes::absoluteQuadsForRange(const RenderText& renderer, unsigned start, unsigned end, bool useSelectionHeight, bool* wasFixed) const { Vector<FloatQuad> quads; for (auto box = m_first; box; box = box->nextTextBox()) { // Note: box->end() returns the index of the last character, not the index past it if (start <= box->start() && box->end() < end) { FloatRect boundaries = box->calculateBoundaries(); if (useSelectionHeight) { LayoutRect selectionRect = box->localSelectionRect(start, end); if (box->isHorizontal()) { boundaries.setHeight(selectionRect.height()); boundaries.setY(selectionRect.y()); } else { boundaries.setWidth(selectionRect.width()); boundaries.setX(selectionRect.x()); } } quads.append(renderer.localToAbsoluteQuad(boundaries, 0, wasFixed)); continue; } FloatRect rect = localQuadForTextBox(*box, start, end, useSelectionHeight); if (!rect.isZero()) quads.append(renderer.localToAbsoluteQuad(rect, 0, wasFixed)); } return quads; }
float64 ContinuousSlider::computeValue(const QPoint &pos) const { auto seekRect = myrtlrect(getSeekRect()); auto result = isHorizontal() ? (pos.x() - seekRect.x()) / float64(seekRect.width()) : (1. - (pos.y() - seekRect.y()) / float64(seekRect.height())); return snap(result, 0., 1.); }
LayoutRect InlineTextBox::localSelectionRect(int startPos, int endPos) const { int sPos = std::max(startPos - m_start, 0); int ePos = std::min(endPos - m_start, (int)m_len); if (sPos > ePos) return LayoutRect(); FontCachePurgePreventer fontCachePurgePreventer; LayoutUnit selTop = root().selectionTop(); LayoutUnit selHeight = root().selectionHeight(); const ComputedStyle& styleToUse = lineLayoutItem().styleRef(isFirstLineStyle()); const Font& font = styleToUse.font(); StringBuilder charactersWithHyphen; bool respectHyphen = ePos == m_len && hasHyphen(); TextRun textRun = constructTextRun(styleToUse, font, respectHyphen ? &charactersWithHyphen : 0); LayoutPoint startingPoint = LayoutPoint(logicalLeft(), selTop); LayoutRect r; if (sPos || ePos != static_cast<int>(m_len)) { r = LayoutRect(enclosingIntRect(font.selectionRectForText(textRun, FloatPoint(startingPoint), selHeight, sPos, ePos))); } else { // Avoid computing the font width when the entire line box is selected as an optimization. // FIXME: the call to rawValue() below is temporary and should be removed once the transition // to LayoutUnit-based types is complete (crbug.com/321237) r = LayoutRect(enclosingIntRect(LayoutRect(startingPoint, LayoutSize(m_logicalWidth, selHeight)))); } LayoutUnit logicalWidth = r.width(); if (r.x() > logicalRight()) logicalWidth = 0; else if (r.maxX() > logicalRight()) logicalWidth = logicalRight() - r.x(); LayoutPoint topPoint; LayoutUnit width; LayoutUnit height; if (isHorizontal()) { topPoint = LayoutPoint(r.x(), selTop); width = logicalWidth; height = selHeight; if (hasWrappedSelectionNewline()) { if (!isLeftToRightDirection()) topPoint.setX(topPoint.x() - newlineSpaceWidth()); width += newlineSpaceWidth(); } } else { topPoint = LayoutPoint(selTop, r.x()); width = selHeight; height = logicalWidth; // TODO(wkorman): RTL text embedded in top-to-bottom text can create // bottom-to-top situations. Add tests and ensure we handle correctly. if (hasWrappedSelectionNewline()) height += newlineSpaceWidth(); } return LayoutRect(topPoint, LayoutSize(width, height)); }
void MediaSlider::paintEvent(QPaintEvent *e) { Painter p(this); PainterHighQualityEnabler hq(p); p.setPen(Qt::NoPen); p.setOpacity(fadeOpacity()); auto horizontal = isHorizontal(); auto ms = getms(); auto radius = _st.width / 2; auto disabled = isDisabled(); auto over = getCurrentOverFactor(ms); auto seekRect = getSeekRect(); auto value = getCurrentValue(ms); // invert colors and value for vertical if (!horizontal) value = 1. - value; auto markerFrom = (horizontal ? seekRect.x() : seekRect.y()); auto markerLength = (horizontal ? seekRect.width() : seekRect.height()); auto from = _alwaysDisplayMarker ? 0 : markerFrom; auto length = _alwaysDisplayMarker ? (horizontal ? width() : height()) : markerLength; auto mid = qRound(from + value * length); auto end = from + length; auto activeFg = disabled ? _st.activeFgDisabled : anim::brush(_st.activeFg, _st.activeFgOver, over); auto inactiveFg = disabled ? _st.inactiveFgDisabled : anim::brush(_st.inactiveFg, _st.inactiveFgOver, over); if (mid > from) { auto fromClipRect = horizontal ? QRect(0, 0, mid, height()) : QRect(0, 0, width(), mid); auto fromRect = horizontal ? QRect(from, (height() - _st.width) / 2, mid + radius - from, _st.width) : QRect((width() - _st.width) / 2, from, _st.width, mid + radius - from); p.setClipRect(fromClipRect); p.setBrush(horizontal ? activeFg : inactiveFg); p.drawRoundedRect(fromRect, radius, radius); } if (end > mid) { auto endClipRect = horizontal ? QRect(mid, 0, width() - mid, height()) : QRect(0, mid, width(), height() - mid); auto endRect = horizontal ? QRect(mid - radius, (height() - _st.width) / 2, end - (mid - radius), _st.width) : QRect((width() - _st.width) / 2, mid - radius, _st.width, end - (mid - radius)); p.setClipRect(endClipRect); p.setBrush(horizontal ? inactiveFg : activeFg); p.drawRoundedRect(endRect, radius, radius); } auto markerSizeRatio = disabled ? 0. : (_alwaysDisplayMarker ? 1. : over); if (markerSizeRatio > 0) { auto position = qRound(markerFrom + value * markerLength) - (horizontal ? seekRect.x() : seekRect.y()); auto seekButton = horizontal ? QRect(position, (height() - _st.seekSize.height()) / 2, _st.seekSize.width(), _st.seekSize.height()) : QRect((width() - _st.seekSize.width()) / 2, position, _st.seekSize.width(), _st.seekSize.height()); auto size = horizontal ? _st.seekSize.width() : _st.seekSize.height(); auto remove = static_cast<int>(((1. - markerSizeRatio) * size) / 2.); if (remove * 2 < size) { p.setClipRect(rect()); p.setBrush(activeFg); p.drawEllipse(seekButton.marginsRemoved(QMargins(remove, remove, remove, remove))); } } }
float64 ContinuousSlider::computeValue(const QPoint &pos) const { const auto seekRect = myrtlrect(getSeekRect()); const auto result = isHorizontal() ? (pos.x() - seekRect.x()) / float64(seekRect.width()) : (1. - (pos.y() - seekRect.y()) / float64(seekRect.height())); const auto snapped = snap(result, 0., 1.); return _adjustCallback ? _adjustCallback(snapped) : snapped; }
void InlineTextBox::move(const LayoutSize& delta) { InlineBox::move(delta); if (!knownToHaveNoOverflow() && gTextBoxesWithOverflow) { const auto& it = gTextBoxesWithOverflow->find(this); if (it != gTextBoxesWithOverflow->end()) it->value.move(isHorizontal() ? delta : delta.transposedSize()); } }
LayoutRect InlineBox::logicalRectToPhysicalRect(const LayoutRect& current) { LayoutRect retval = current; if (!isHorizontal()) { retval = retval.transposedRect(); } retval.setLocation(logicalPositionToPhysicalPoint(FloatPoint(retval.location()), FloatSize(retval.size())).toLayoutPoint()); return retval; }
int InlineTextBox::baselinePosition(FontBaseline baselineType) const { if (!isText() || !parent()) return 0; if (parent()->getLineLayoutItem() == getLineLayoutItem().parent()) return parent()->baselinePosition(baselineType); return LineLayoutBoxModel(getLineLayoutItem().parent()) .baselinePosition(baselineType, isFirstLineStyle(), isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); }
void InlineTextBox::move(const LayoutSize& delta) { InlineBox::move(delta); if (!knownToHaveNoOverflow()) { LayoutRect logicalOverflowRect = this->logicalOverflowRect(); logicalOverflowRect.move(isHorizontal() ? delta : delta.transposedSize()); setLogicalOverflowRect(logicalOverflowRect); } }
void Gage::setHorizontal(bool isH){ if(isH != isHorizontal()){ if(isH){ _state |= MASK_HORIZONTAL; } else{ _state &= (~MASK_HORIZONTAL); } refresh(); } }
void RootInlineBox::adjustPosition(float dx, float dy) { InlineFlowBox::adjustPosition(dx, dy); LayoutUnit blockDirectionDelta = isHorizontal() ? dy : dx; // The block direction delta is a LayoutUnit. m_lineTop += blockDirectionDelta; m_lineBottom += blockDirectionDelta; m_lineTopWithLeading += blockDirectionDelta; m_lineBottomWithLeading += blockDirectionDelta; if (hasEllipsisBox()) ellipsisBox()->adjustPosition(dx, dy); }
HTMLMarqueeElement::Metrics HTMLMarqueeElement::getMetrics() { Metrics metrics; CSSStyleDeclaration* marqueeStyle = document().domWindow()->getComputedStyle(this, String()); // For marquees that are declared inline, getComputedStyle returns "auto" for // width and height. Setting all the metrics to zero disables animation for // inline marquees. if (marqueeStyle->getPropertyValue("width") == "auto" && marqueeStyle->getPropertyValue("height") == "auto") { metrics.contentHeight = 0; metrics.contentWidth = 0; metrics.marqueeWidth = 0; metrics.marqueeHeight = 0; return metrics; } if (isHorizontal()) { m_mover->style()->setProperty("width", "-webkit-max-content", "important", ASSERT_NO_EXCEPTION); } else { m_mover->style()->setProperty("height", "-webkit-max-content", "important", ASSERT_NO_EXCEPTION); } CSSStyleDeclaration* moverStyle = document().domWindow()->getComputedStyle(m_mover, String()); metrics.contentWidth = moverStyle->getPropertyValue("width").toDouble(); metrics.contentHeight = moverStyle->getPropertyValue("height").toDouble(); metrics.marqueeWidth = marqueeStyle->getPropertyValue("width").toDouble(); metrics.marqueeHeight = marqueeStyle->getPropertyValue("height").toDouble(); if (isHorizontal()) { m_mover->style()->setProperty("width", "", "important", ASSERT_NO_EXCEPTION); } else { m_mover->style()->setProperty("height", "", "important", ASSERT_NO_EXCEPTION); } return metrics; }
LayoutUnit InlineTextBox::lineHeight() const { if (!isText() || !getLineLayoutItem().parent()) return LayoutUnit(); if (getLineLayoutItem().isBR()) return LayoutUnit( LineLayoutBR(getLineLayoutItem()).lineHeight(isFirstLineStyle())); if (parent()->getLineLayoutItem() == getLineLayoutItem().parent()) return parent()->lineHeight(); return LineLayoutBoxModel(getLineLayoutItem().parent()) .lineHeight(isFirstLineStyle(), isHorizontal() ? HorizontalLine : VerticalLine, PositionOnContainingLine); }
SRCR_BEGIN_NS //////////////////////////////////////////////////////////////////////////// // 定数 #define TEX_W (1024.0f) // テクスチャ全体の幅 #define TEX_H (1024.0f) // テクスチャ全体の高さ #define W_BTN 32 // 矢印ボタンの幅 #define H_BTN 32 // 矢印ボタンの高さ #define UV_BG 968 / TEX_W, 320 / TEX_H, 32 / TEX_W, 256 / TEX_H #define UV_BG_UBTN 968 / TEX_W, 320 / TEX_H, 32 / TEX_W, 32 / TEX_H #define UV_BG_L 968 / TEX_W, 352 / TEX_H, 32 / TEX_W, 192 / TEX_H #define UV_BG_DBTN 968 / TEX_W, 544 / TEX_H, 32 / TEX_W, 32 / TEX_H #define UV_UBTN_HVR 992 / TEX_W, 256 / TEX_H, 32 / TEX_W, 32 / TEX_H #define UV_DBTN_HVR 992 / TEX_W, 288 / TEX_H, 32 / TEX_W, 32 / TEX_H #define H_KNOB_T 8 #define H_KNOB_B 8 #define H_KNOB_M 16 #define UV_KNOB_T_NRM 928 / TEX_W, 224 / TEX_H, 19 / TEX_W, H_KNOB_T / TEX_H #define UV_KNOB_L_NRM 928 / TEX_W, 232 / TEX_H, 19 / TEX_W, 8 / TEX_H #define UV_KNOB_M_NRM 928 / TEX_W, 240 / TEX_H, 19 / TEX_W, 16 / TEX_H #define UV_KNOB_B_NRM 928 / TEX_W, 256 / TEX_H, 19 / TEX_W, 8 / TEX_H #define UV_KNOB_T_HVR 952 / TEX_W, 224 / TEX_H, 19 / TEX_W, H_KNOB_T / TEX_H #define UV_KNOB_L_HVR 952 / TEX_W, 232 / TEX_H, 19 / TEX_W, 8 / TEX_H #define UV_KNOB_M_HVR 952 / TEX_W, 240 / TEX_H, 19 / TEX_W, 16 / TEX_H #define UV_KNOB_B_HVR 952 / TEX_W, 256 / TEX_H, 19 / TEX_W, 8 / TEX_H //////////////////////////////////////////////////////////////////////////// // クラス //========================================================================== // ScrollBar メソッド // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // アクセサ /*---------------------------------------------------------------------*//** 矩形設定 **//*---------------------------------------------------------------------*/ #if 0 void ScrollBar::setRectangle(const RectF32* rect) { _rectThis->set(rect); ASSERT(!isHorizontal()); // 縦型のみサポート _rectUpArw->set(_rectThis->x(), _rectThis->y(), _rectThis->w(), H_BTN); _rectDownArw->set(_rectThis->x(), _rectThis->y() + _rectThis->h() - H_BTN, _rectThis->w(), H_BTN); setKnobRectangle(); }
int Gage::getCursor(int value){ int cursor; float rate = (float)(value - _min)/(float)(_max - _min); if(isHorizontal()){ rate *= (float)(getWidth() - 4); cursor = (int)(rate + 0.5) + getLeft() + 2; } else{ rate *= (float)(getHeight() - 4); cursor = getTop() + getHeight() - 3 - (int)(rate + 0.5); } return cursor; }
void AngleMeasure::saveSettings() { conf->beginGroup("AngleMeasure"); conf->setValue("angle_format_dms", isDmsFormat()); conf->setValue("show_position_angle", isPaDisplayed()); conf->setValue("show_position_angle_horizontal", isHorPaDisplayed()); conf->setValue("show_equatorial", isEquatorial()); conf->setValue("show_horizontal", isHorizontal()); conf->setValue("link_horizontal_start_to_sky", isHorizontalStartSkylinked()); conf->setValue("link_horizontal_end_to_sky", isHorizontalEndSkylinked()); conf->endGroup(); }
void Gage::drawStatic(){ getGLCD()->drawRoundRect(getLeft(), getTop(), getLeft() + getWidth() - 1, getTop() + getHeight() - 1); _cursor = getCursor(_value.getValue()); if(isHorizontal()){ getGLCD()->fillRect(getLeft() + 2, getTop() + 2, _cursor, getTop() + getHeight() - 3); getGLCD()->setColor(_colorBck); getGLCD()->fillRect(_cursor, getTop() + 2, getLeft() + getWidth() - 3, getTop() + getHeight() - 3); } else{ getGLCD()->fillRect(getLeft() + 2, _cursor , getLeft() + getWidth() - 3, getTop() + getHeight() - 3); getGLCD()->setColor(_colorBck); getGLCD()->fillRect(getLeft() + 2, getTop() + 2, getLeft() + getWidth() - 3, _cursor); } }
float InlineBox::logicalHeight() const { if (hasVirtualLogicalHeight()) return virtualLogicalHeight(); if (renderer()->isText()) return m_bitfields.isText() ? renderer()->style(isFirstLineStyle())->fontMetrics().height() : 0; if (renderer()->isBox() && parent()) return isHorizontal() ? toRenderBox(m_renderer)->height() : toRenderBox(m_renderer)->width(); ASSERT(isInlineFlowBox()); RenderBoxModelObject* flowObject = boxModelObject(); const FontMetrics& fontMetrics = renderer()->style(isFirstLineStyle())->fontMetrics(); float result = fontMetrics.height(); if (parent()) result += flowObject->borderAndPaddingLogicalHeight(); return result; }
LayoutUnit InlineBox::logicalHeight() const { if (hasVirtualLogicalHeight()) return virtualLogicalHeight(); if (lineLayoutItem().isText()) return m_bitfields.isText() ? LayoutUnit(lineLayoutItem().style(isFirstLineStyle())->fontMetrics().height()) : LayoutUnit(); if (lineLayoutItem().isBox() && parent()) return isHorizontal() ? toLayoutBox(layoutObject()).size().height() : toLayoutBox(layoutObject()).size().width(); ASSERT(isInlineFlowBox()); LineLayoutBoxModel flowObject = boxModelObject(); const FontMetrics& fontMetrics = lineLayoutItem().style(isFirstLineStyle())->fontMetrics(); LayoutUnit result = fontMetrics.height(); if (parent()) result += flowObject.borderAndPaddingLogicalHeight(); return result; }
float InlineBox::logicalHeight() const { if (hasVirtualLogicalHeight()) return virtualLogicalHeight(); const RenderStyle& lineStyle = this->lineStyle(); if (renderer().isTextOrLineBreak()) return behavesLikeText() ? lineStyle.fontMetrics().height() : 0; if (renderer().isBox() && parent()) return isHorizontal() ? toRenderBox(renderer()).height() : toRenderBox(renderer()).width(); ASSERT(isInlineFlowBox()); RenderBoxModelObject* flowObject = boxModelObject(); const FontMetrics& fontMetrics = lineStyle.fontMetrics(); float result = fontMetrics.height(); if (parent()) result += flowObject->borderAndPaddingLogicalHeight(); return result; }
void PlaneDetector::fixLineCoords(Vec4i &line) { if (isHorizontal(line)) { if (line[0] > line[2]) { // Flip if x1 is larger than x2. Point2i temp = Point(line[0], line[1]); line[0] = line[2]; line[1] = line[3]; line[2] = temp.x; line[3] = temp.y; } } else { // Vertical line if (line[1] > line[3]) { // Flip if y1 is larger than y2. Point2i temp = Point(line[0], line[1]); line[0] = line[2]; line[1] = line[3]; line[2] = temp.x; line[3] = temp.y; } } }
int InlineBox::logicalHeight() const { #if ENABLE(SVG) if (hasVirtualLogicalHeight()) return virtualLogicalHeight(); #endif if (renderer()->isText()) return m_isText ? renderer()->style(m_firstLine)->fontMetrics().height() : 0; if (renderer()->isBox() && parent()) return isHorizontal() ? toRenderBox(m_renderer)->height() : toRenderBox(m_renderer)->width(); ASSERT(isInlineFlowBox()); RenderBoxModelObject* flowObject = boxModelObject(); const FontMetrics& fontMetrics = renderer()->style(m_firstLine)->fontMetrics(); int result = fontMetrics.height(); if (parent()) result += flowObject->borderAndPaddingLogicalHeight(); return result; }
LayoutRect RootInlineBox::paddedLayoutOverflowRect(LayoutUnit endPadding) const { LayoutRect lineLayoutOverflow = layoutOverflowRect(lineTop(), lineBottom()); if (!endPadding) return lineLayoutOverflow; // FIXME: Audit whether to use pixel snapped values when not using integers for layout: https://bugs.webkit.org/show_bug.cgi?id=63656 if (isHorizontal()) { if (isLeftToRightDirection()) lineLayoutOverflow.shiftMaxXEdgeTo(std::max<LayoutUnit>(lineLayoutOverflow.maxX(), pixelSnappedLogicalRight() + endPadding)); else lineLayoutOverflow.shiftXEdgeTo(std::min<LayoutUnit>(lineLayoutOverflow.x(), pixelSnappedLogicalLeft() - endPadding)); } else { if (isLeftToRightDirection()) lineLayoutOverflow.shiftMaxYEdgeTo(std::max<LayoutUnit>(lineLayoutOverflow.maxY(), pixelSnappedLogicalRight() + endPadding)); else lineLayoutOverflow.shiftYEdgeTo(std::min<LayoutUnit>(lineLayoutOverflow.y(), pixelSnappedLogicalLeft() - endPadding)); } return lineLayoutOverflow; }