// The generic PrintTo *must* come after the non-generic PrintTo otherwise it // will end up calling itself. void PrintTo(const TimingFunction& timingFunction, ::std::ostream* os) { switch (timingFunction.type()) { case TimingFunction::LinearFunction: { const LinearTimingFunction& linear = toLinearTimingFunction(timingFunction); PrintTo(linear, os); return; } case TimingFunction::CubicBezierFunction: { const CubicBezierTimingFunction& cubic = toCubicBezierTimingFunction(timingFunction); PrintTo(cubic, os); return; } case TimingFunction::StepsFunction: { const StepsTimingFunction& step = toStepsTimingFunction(timingFunction); PrintTo(step, os); return; } case TimingFunction::ChainedFunction: { const ChainedTimingFunction& chained = toChainedTimingFunction(timingFunction); PrintTo(chained, os); return; } default: ASSERT_NOT_REACHED(); } }
void PrintTo(const PaintChunk& chunk, std::ostream* os) { *os << "PaintChunk(begin=" << chunk.beginIndex << ", end=" << chunk.endIndex << ", id="; if (!chunk.id) { *os << "null"; } else { *os << "(" << &chunk.id->client << ", "; #ifndef NDEBUG *os << DisplayItem::typeAsDebugString(chunk.id->type); #else *os << static_cast<int>(chunk.id->type); #endif *os << ")"; } *os << ", props="; PrintTo(chunk.properties, os); *os << ", bounds="; PrintTo(chunk.bounds, os); *os << ", knownToBeOpaque=" << chunk.knownToBeOpaque << ")"; *os << ", rerasterizationRects=["; bool first = true; for (auto& r : chunk.rasterInvalidationRects) { if (!first) *os << ", "; first = false; PrintTo(r, os); }; *os << "]"; }
void PrintTo(const AnimatableLengthSize& animLengthSize, ::std::ostream* os) { *os << "AnimatableLengthSize("; PrintTo(*(animLengthSize.width()), os); *os << ", "; PrintTo(*(animLengthSize.height()), os); *os << ")"; }
void PrintTo(const FloatRoundedRect& roundedRect, std::ostream* os) { *os << "FloatRoundedRect("; PrintTo(roundedRect.rect(), os); *os << ", "; PrintTo(roundedRect.getRadii(), os); *os << ")"; }
void PrintTo(const SourceRange &sourceRange, ::std::ostream* os) { *os << "["; PrintTo(sourceRange.start(), os); *os << ", "; PrintTo(sourceRange.end(), os); *os << "]"; }
void PrintTo(const AnimatableLengthPoint& animLengthPoint, ::std::ostream* os) { *os << "AnimatableLengthPoint("; PrintTo(*(animLengthPoint.x()), os); *os << ", "; PrintTo(*(animLengthPoint.y()), os); *os << ")"; }
void PrintTo(const TransformPaintPropertyNode& transformPaintProperty, std::ostream* os) { *os << "TransformPaintPropertyNode(matrix="; PrintTo(transformPaintProperty.matrix(), os); *os << ", origin="; PrintTo(transformPaintProperty.origin(), os); *os << ")"; }
void PrintTo(const AnimatableLengthBox& animLengthBox, ::std::ostream* os) { *os << "AnimatableLengthBox("; PrintTo(*(animLengthBox.left()), os); *os << ", "; PrintTo(*(animLengthBox.right()), os); *os << ", "; PrintTo(*(animLengthBox.top()), os); *os << ", "; PrintTo(*(animLengthBox.bottom()), os); *os << ")"; }
void PrintTo(const FloatRoundedRect::Radii& radii, std::ostream* os) { *os << "FloatRoundedRect::Radii("; PrintTo(radii.topLeft(), os); *os << ", "; PrintTo(radii.topRight(), os); *os << ", "; PrintTo(radii.bottomLeft(), os); *os << ", "; PrintTo(radii.bottomRight(), os); *os << ")"; }
void PrintTo(const ScrollPaintPropertyNode& node, std::ostream* os) { *os << "ScrollPaintPropertyNode(clip="; PrintTo(node.clip(), os); *os << ", bounds="; PrintTo(node.bounds(), os); *os << ", userScrollableHorizontal=" << node.userScrollableHorizontal(); *os << ", userScrollableVertical=" << node.userScrollableVertical(); *os << ", scrollOffsetTranslation="; PrintPointer(node.scrollOffsetTranslation(), *os); *os << ", parent="; PrintPointer(node.parent(), *os); *os << ")"; }
void PrintTo(const HighlightingMark &information, ::std::ostream *os) { *os << "type: "; PrintTo(information.types, os); *os << " line: " << information.line << " column: " << information.column << " length: " << information.length; }
void PrintTo(const PaintChunk& chunk, std::ostream* os) { *os << "PaintChunk(begin=" << chunk.beginIndex << ", end=" << chunk.endIndex << ", props="; PrintTo(chunk.properties, os); *os << ")"; }
void PrintTo(const RegisterUnsavedFilesForEditorMessage &message, ::std::ostream* os) { *os << "RegisterUnsavedFilesForEditorMessage("; for (const FileContainer &fileContainer : message.fileContainers()) PrintTo(fileContainer, os); *os << ")"; }
void PrintTo(const ClipPaintPropertyNode& node, std::ostream* os) { *os << "ClipPaintPropertyNode(clip="; PrintTo(node.clipRect(), os); *os << ", localTransformSpace="; PrintPointer(node.localTransformSpace(), *os); *os << ", parent="; PrintPointer(node.parent(), *os); *os << ")"; }
void PrintTo(const PaintChunkProperties& properties, std::ostream* os) { *os << "PaintChunkProperties("; if (properties.transform) { *os << "transform="; PrintTo(*properties.transform, os); } *os << ")"; }
void PrintTo(const std::vector<SignatureInformation> &V, std::ostream *O) { *O << "{\n"; for (const auto &I : V) { *O << "\t"; PrintTo(I, O); *O << "\n"; } *O << "}"; }
void PrintTo(const ClipPaintPropertyNode& node, std::ostream* os) { *os << "ClipPaintPropertyNode(clip="; PrintTo(node.clipRect(), os); *os << ", base="; PrintPointer(node.base(), *os); *os << ", parent="; PrintPointer(node.parent(), *os); *os << ")"; }
void PrintTo(const AnimatableRepeatable& animValue, ::std::ostream* os) { *os << "AnimatableRepeatable("; const WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> > v = animValue.values(); for (WillBeHeapVector<RefPtrWillBeMember<AnimatableValue> >::const_iterator it = v.begin(); it != v.end(); ++it) { PrintTo(*(it->get()), os); if (it+1 != v.end()) *os << ", "; } *os << ")"; }
void PrintTo(const PaintChunkProperties& properties, std::ostream* os) { *os << "PaintChunkProperties("; bool printedProperty = false; if (properties.transform) { *os << "transform="; PrintTo(*properties.transform, os); printedProperty = true; } if (properties.clip) { if (printedProperty) *os << ", "; *os << "clip="; PrintTo(*properties.clip, os); printedProperty = true; } if (properties.effect) { if (printedProperty) *os << ", "; *os << "effect="; PrintTo(*properties.effect, os); printedProperty = true; } if (properties.scroll) { if (printedProperty) *os << ", "; *os << "scroll="; PrintTo(*properties.scroll, os); printedProperty = true; } if (printedProperty) *os << ", "; *os << "backfaceHidden=" << properties.backfaceHidden; *os << ")"; }
static void PrintTo(const ChainedTimingFunction& timingFunction, ::std::ostream* os) { // Forward declare the generic PrintTo function as ChainedTimingFunction needs to call it. void PrintTo(const TimingFunction&, ::std::ostream*); *os << "ChainedTimingFunction@" << &timingFunction << "("; for (size_t i = 0; i < timingFunction.m_segments.size(); i++) { ChainedTimingFunction::Segment segment = timingFunction.m_segments[i]; PrintTo(*(segment.m_timingFunction.get()), os); *os << "[" << segment.m_min << " -> " << segment.m_max << "]"; if (i+1 != timingFunction.m_segments.size()) { *os << ", "; } } *os << ")"; }
void PrintTo(const Cursor &cursor, ::std::ostream*os) { if (cursor.isValid()) { ClangString cursorKindSpelling(clang_getCursorKindSpelling(cursor.kind())); *os << cursorKindSpelling.cString() << " "; auto identifier = cursor.displayName(); if (identifier.hasContent()) { *os << "\"" << identifier.constData() << "\": "; } PrintTo(cursor.sourceLocation(), os); } else { *os << "Invalid cursor!"; } }
void PrintTo(const AnimatableUnknown& animUnknown, ::std::ostream* os) { PrintTo(*(animUnknown.toCSSValue().get()), os, "AnimatableUnknown"); }
void PrintTo(SourceRange range, std::ostream *os) { PrintTo(range.Start, os); *os << " - "; PrintTo(range.End, os); }
void PrintTo(const AnimatableDouble& animDouble, ::std::ostream* os) { PrintTo(*(animDouble.toCSSValue().get()), os, "AnimatableDouble"); }
void PrintTo(const AnimatableValue& animValue, ::std::ostream* os) { if (animValue.isClipPathOperation()) PrintTo(*(toAnimatableClipPathOperation(&animValue)), os); else if (animValue.isColor()) PrintTo(*(toAnimatableColor(&animValue)), os); else if (animValue.isDouble()) PrintTo(*(toAnimatableDouble(&animValue)), os); else if (animValue.isImage()) PrintTo(*(toAnimatableImage(&animValue)), os); else if (animValue.isLength()) PrintTo(*(toAnimatableLength(&animValue)), os); else if (animValue.isLengthBox()) PrintTo(*(toAnimatableLengthBox(&animValue)), os); else if (animValue.isLengthPoint()) PrintTo(*(toAnimatableLengthPoint(&animValue)), os); else if (animValue.isLengthSize()) PrintTo(*(toAnimatableLengthSize(&animValue)), os); else if (animValue.isNeutral()) PrintTo(*(static_cast<const AnimatableNeutral*>(&animValue)), os); else if (animValue.isRepeatable()) PrintTo(*(toAnimatableRepeatable(&animValue)), os); else if (animValue.isSVGLength()) PrintTo(*(toAnimatableSVGLength(&animValue)), os); else if (animValue.isSVGPaint()) PrintTo(*(toAnimatableSVGPaint(&animValue)), os); else if (animValue.isShapeValue()) PrintTo(*(toAnimatableShapeValue(&animValue)), os); else if (animValue.isStrokeDasharrayList()) PrintTo(*(toAnimatableStrokeDasharrayList(&animValue)), os); else if (animValue.isTransform()) PrintTo(*(toAnimatableTransform(&animValue)), os); else if (animValue.isUnknown()) PrintTo(*(toAnimatableUnknown(&animValue)), os); else if (animValue.isVisibility()) PrintTo(*(toAnimatableVisibility(&animValue)), os); else *os << "Unknown AnimatableValue - update ifelse chain in AnimatableValueTestHelper.h"; }
void PrintTo(const AnimatableImage& animImage, ::std::ostream* os) { PrintTo(*(animImage.toCSSValue()), os, "AnimatableImage"); }
void MessageMatcher::DescribeNegationTo(::std::ostream* os) const { *os << "is not equal to "; PrintTo(goodmsg, os); }
void PrintTo(const AnimatableLength& animLength, ::std::ostream* os) { PrintTo(*(animLength.toCSSValue().get()), os, "AnimatableLength"); }
void PrintTo(const Columns& bar, ::std::ostream* os) { PrintTo(bar.to_string(), os); }
// Analytical solution to quadratic polynomials exists. This function could return the optimal solution to quadratic polynomials with one or two variables. // Return value: indicator variable for solution status, NOOPT int PolyNomial::Optimize2(Array<double>* vars, double* optValue) { vars->clear(); if (1 == numVar_) // There is only 1 variable in the polynomial. { double a = 0, b = 0; // Get parameters for the Gaussian representation. for(int i = 0; i < items_.size(); ++i) { map<int, double>::const_iterator citer = items_[i].begin(); if (DoubleEqual(citer->second, 2.0, DOUBLE_ZERO_THRESHOLD)) { a = coef_[i]; } if (DoubleEqual(citer->second, 1.0, DOUBLE_ZERO_THRESHOLD)) { b = coef_[i]; } } // ERROR: The quadratic term is empty. if (fabs(a) < DOUBLE_ZERO_THRESHOLD) { cout << "The quadratic term is empty" << endl; exit(0); } vars->append(-b/(2*a)); *optValue = ComputePlValue(*vars); return 0; } // Two-var quadratic polynomial representation: a*x1^2 + b*x2^2 + c*x1*x2 + d*x1 + e*x2. double a = 0, b = 0, c = 0, d = 0, e = 0; //normalize and assume each polynomial are 2-var poly. for(int i = 0; i < items_.size(); ++i) { map<int, double>::const_iterator citer = items_[i].begin(); if (citer->first == 0 && DoubleEqual(citer->second, 2.0, DOUBLE_ZERO_THRESHOLD)) //x1^2 { a = coef_[i]; } if (citer->first == 1 && DoubleEqual(citer->second, 2.0, DOUBLE_ZERO_THRESHOLD)) //x2^2 { b = coef_[i]; } if (citer->first == 0 && DoubleEqual(citer->second, 1.0, DOUBLE_ZERO_THRESHOLD) && items_[i].size() == 2) //x1*x2 { c = coef_[i]; } if (citer->first == 0 && DoubleEqual(citer->second, 1.0, DOUBLE_ZERO_THRESHOLD) && items_[i].size() == 1) //x1 { d = coef_[i]; } if (citer->first == 1 && DoubleEqual(citer->second, 1.0, DOUBLE_ZERO_THRESHOLD) && items_[i].size() == 1)//x2 { e = coef_[i]; } if (citer->first == 1 && DoubleEqual(citer->second, 1.0, DOUBLE_ZERO_THRESHOLD) && items_[i].size() > 1) //wrong { cout << "shouldn't be here," << endl; } } vars->clear(); double delta = 4 * a * b - c * c; //cout << "delta: " << delta << endl; // delta == 0, |a| > 0, |b| > 0 if (fabs(delta) < DOUBLE_ZERO_THRESHOLD) { if (fabs(a)> DOUBLE_ZERO_THRESHOLD) { vars->append(-d / 2 * a); vars->append(0.0); } else if (fabs(a)> DOUBLE_ZERO_THRESHOLD) { vars->append(0.0); vars->append(-e / 2 * b); } else { // In this case, there is no appropriate optimum PrintTo(cout); cout << endl; cout << "delta = 0, no optimums2" << endl; exit(0); } *optValue = ComputePlValue(*vars); return NOOPT; } vars->append((e * c-2 * b * d)/delta); vars->append((d * c-2 * a * e)/delta); *optValue = ComputePlValue(*vars); return 0; }