#include <ToolUtils.h>
Definition at line 320 of file ToolUtils.h.
◆ VariationSliders() [1/2]
ToolUtils::VariationSliders::VariationSliders |
( |
| ) |
|
|
inline |
◆ VariationSliders() [2/2]
Definition at line 522 of file ToolUtils.cpp.
523 {
524 if (!typeface) {
525 return;
526 }
527
529 if (numAxes < 0) {
530 return;
531 }
532
533 std::unique_ptr<SkFontParameters::Variation::Axis[]> copiedAxes =
534 std::make_unique<SkFontParameters::Variation::Axis[]>(numAxes);
535
537 if (numAxes < 0) {
538 return;
539 }
540
541 auto argVariationPositionOrDefault = [&variationPosition](
SkFourByteTag tag,
546 }
547 }
548 return defaultValue;
549 };
550
551 fAxisSliders.resize(numAxes);
552 fCoords = std::make_unique<SkFontArguments::VariationPosition::Coordinate[]>(numAxes);
553 for (
int i = 0;
i < numAxes; ++
i) {
554 fAxisSliders[
i].axis = copiedAxes[
i];
555 fAxisSliders[
i].current =
556 argVariationPositionOrDefault(copiedAxes[
i].tag, copiedAxes[
i].def);
557 fAxisSliders[
i].name =
tagToString(fAxisSliders[
i].axis.tag);
558 fCoords[
i] = { fAxisSliders[
i].axis.tag, fAxisSliders[
i].current };
559 }
560}
int getVariationDesignParameters(SkFontParameters::Variation::Axis parameters[], int parameterCount) const
const Coordinate * coordinates
◆ getCoordinates()
Definition at line 600 of file ToolUtils.cpp.
600 {
602 fAxisSliders.size()};
603}
◆ readControls()
void ToolUtils::VariationSliders::readControls |
( |
const SkMetaData & |
controls, |
|
|
bool * |
changed = nullptr |
|
) |
| |
Definition at line 585 of file ToolUtils.cpp.
585 {
586 for (
size_t i = 0;
i < fAxisSliders.size(); ++
i) {
587 SkScalar axisVars[kAxisVarsSize] = {0};
588 int resultAxisVarsSize = 0;
592 if (changed) {
593 *changed |= fAxisSliders[
i].current != axisVars[0];
594 }
595 fAxisSliders[
i].current = axisVars[0];
596 fCoords[
i] = { fAxisSliders[
i].axis.tag, fAxisSliders[
i].current };
597 }
598}
#define SkASSERT_RELEASE(cond)
const char * c_str() const
◆ tagToString()
Definition at line 563 of file ToolUtils.cpp.
563 {
564 char tagAsString[5];
565 tagAsString[4] = 0;
566 tagAsString[0] = (char)(uint8_t)(tag >> 24);
567 tagAsString[1] = (char)(uint8_t)(tag >> 16);
568 tagAsString[2] = (char)(uint8_t)(tag >> 8);
569 tagAsString[3] = (char)(uint8_t)(tag >> 0);
571}
◆ writeControls()
bool ToolUtils::VariationSliders::writeControls |
( |
SkMetaData * |
controls | ) |
|
Definition at line 573 of file ToolUtils.cpp.
573 {
574 for (
size_t i = 0;
i < fAxisSliders.size(); ++
i) {
576
577 axisVars[0] = fAxisSliders[
i].current;
578 axisVars[1] = fAxisSliders[
i].axis.min;
579 axisVars[2] = fAxisSliders[
i].axis.max;
580 controls->
setScalars(fAxisSliders[
i].
name.c_str(), kAxisVarsSize, axisVars);
581 }
582 return true;
583}
DEF_SWITCHES_START aot vmservice shared library name
The documentation for this class was generated from the following files: