499 : fCurrentSlide(-1)
500 , fRefresh(false)
501 , fSaveToSKP(false)
502 , fShowSlideDimensions(false)
503 , fShowImGuiDebugWindow(false)
504 , fShowSlidePicker(false)
505 , fShowImGuiTestWindow(false)
506 , fShowHistogramWindow(false)
507 , fShowZoomWindow(false)
508 , fZoomWindowFixed(false)
509 , fZoomWindowLocation{0.0f, 0.0f}
510 , fLastImage(nullptr)
511 , fZoomUI(false)
512 , fBackendType(sk_app::Window::kNativeGL_BackendType)
513 , fColorMode(ColorMode::kLegacy)
515
517 , fApplyBackingScale(true)
518 , fZoomLevel(0.0f)
519 , fRotation(0.0f)
520 , fOffset{0.5f, 0.5f}
521 , fGestureDevice(GestureDevice::kNone)
522 , fTiled(false)
523 , fDrawTileBoundaries(false)
524 , fTileScale{0.25f, 0.25f}
525 , fPerspectiveMode(kPerspective_Off)
526{
528#if defined(SK_ENABLE_SVG)
530#endif
532
539
540 SkDebugf(
"Command line arguments: ");
541 for (
int i = 1;
i < argc; ++
i) {
543 }
545
547#ifdef SK_BUILD_FOR_ANDROID
549#endif
550
553
555 fWindow = Window::CreateNativeWindow(platformData);
556
566 if (FLAGS_dmsaa) {
570 }
572#if defined(SK_GRAPHITE)
573 displayParams.fGraphiteContextOptions.fPriv.fPathRendererStrategy =
574 get_path_renderer_strategy_type(FLAGS_pathstrategy[0]);
575#if defined(SK_DAWN)
576 displayParams.fDisableTintSymbolRenaming = FLAGS_disable_tint_symbol_renaming;
577#endif
578#endif
581 fRefresh = FLAGS_redraw;
582
585
586
591
592
593 fCommands.
attach(fWindow);
597
598
599 fCommands.
addCommand(
' ',
"GUI",
"Toggle Debug GUI", [
this]() {
600 this->fShowImGuiDebugWindow = !this->fShowImGuiDebugWindow;
602 });
603
604 fCommands.
addCommand(
'/',
"GUI",
"Jump to slide picker", [
this]() {
605 this->fShowImGuiDebugWindow = true;
606 this->fShowSlidePicker = true;
608 });
609
611 this->fShowImGuiDebugWindow = true;
612 this->fShowSlidePicker = true;
614 });
615 fCommands.
addCommand(
'g',
"GUI",
"Toggle GUI Demo", [
this]() {
616 this->fShowImGuiTestWindow = !this->fShowImGuiTestWindow;
618 });
619 fCommands.
addCommand(
'z',
"GUI",
"Toggle zoom window", [
this]() {
620 this->fShowZoomWindow = !this->fShowZoomWindow;
622 });
623 fCommands.
addCommand(
'Z',
"GUI",
"Toggle zoom window state", [
this]() {
624 this->fZoomWindowFixed = !this->fZoomWindowFixed;
626 });
627 fCommands.
addCommand(
'v',
"Swapchain",
"Toggle vsync on/off", [
this]() {
631 this->updateTitle();
633 });
634 fCommands.
addCommand(
'V',
"Swapchain",
"Toggle delayed acquire on/off (Metal only)", [
this]() {
636 params.fDelayDrawableAcquisition = !
params.fDelayDrawableAcquisition;
638 this->updateTitle();
640 });
641 fCommands.
addCommand(
'r',
"Redraw",
"Toggle redraw", [
this]() {
642 fRefresh = !fRefresh;
644 });
645 fCommands.
addCommand(
's',
"Overlays",
"Toggle stats display", [
this]() {
648 });
649 fCommands.
addCommand(
'0',
"Overlays",
"Reset stats", [
this]() {
651 this->updateTitle();
653 });
654 fCommands.
addCommand(
'C',
"GUI",
"Toggle color histogram", [
this]() {
655 this->fShowHistogramWindow = !this->fShowHistogramWindow;
657 });
658 fCommands.
addCommand(
'c',
"Modes",
"Cycle color mode", [
this]() {
659 switch (fColorMode) {
660 case ColorMode::kLegacy:
661 this->setColorMode(ColorMode::kColorManaged8888);
662 break;
663 case ColorMode::kColorManaged8888:
664 this->setColorMode(ColorMode::kColorManagedF16);
665 break;
666 case ColorMode::kColorManagedF16:
667 this->setColorMode(ColorMode::kColorManagedF16Norm);
668 break;
669 case ColorMode::kColorManagedF16Norm:
670 this->setColorMode(ColorMode::kLegacy);
671 break;
672 }
673 });
674 fCommands.
addCommand(
'w',
"Modes",
"Toggle wireframe", [
this]() {
676 params.fGrContextOptions.fWireframeMode = !
params.fGrContextOptions.fWireframeMode;
679 });
680 fCommands.
addCommand(
'w',
"Modes",
"Toggle reduced shaders", [
this]() {
682 params.fGrContextOptions.fReducedShaderVariations =
683 !
params.fGrContextOptions.fReducedShaderVariations;
686 });
688 this->setCurrentSlide(fCurrentSlide < fSlides.
size() - 1 ? fCurrentSlide + 1 : 0);
689 });
691 this->setCurrentSlide(fCurrentSlide > 0 ? fCurrentSlide - 1 : fSlides.
size() - 1);
692 });
694 this->changeZoomLevel(1.f / 32.f);
696 });
698 this->changeZoomLevel(-1.f / 32.f);
700 });
701 fCommands.
addCommand(
'd',
"Modes",
"Change rendering backend", [
this]() {
704
705#if defined(SK_BUILD_FOR_UNIX) && defined(SK_VULKAN)
706 if (newBackend == sk_app::Window::kVulkan_BackendType) {
709 } else if (fBackendType == sk_app::Window::kVulkan_BackendType) {
710 newBackend = sk_app::Window::kVulkan_BackendType;
711 }
712#endif
713 this->setBackend(newBackend);
714 });
715 fCommands.
addCommand(
'K',
"IO",
"Save slide to SKP", [
this]() {
716 fSaveToSKP = true;
718 });
719 fCommands.
addCommand(
'&',
"Overlays",
"Show slide dimensios", [
this]() {
720 fShowSlideDimensions = !fShowSlideDimensions;
722 });
723 fCommands.
addCommand(
'G',
"Modes",
"Geometry", [
this]() {
730 } else {
731 switch (
params.fSurfaceProps.pixelGeometry()) {
734 break;
737 break;
740 break;
743 break;
747 break;
748 }
749 }
751 this->updateTitle();
753 });
754 fCommands.
addCommand(
'H',
"Font",
"Hinting mode", [
this]() {
758 } else {
762 break;
765 break;
768 break;
772 break;
773 }
774 }
775 this->updateTitle();
777 });
778 fCommands.
addCommand(
'D',
"Modes",
"DFT", [
this]() {
784 this->updateTitle();
786 });
787 fCommands.
addCommand(
'L',
"Font",
"Subpixel Antialias Mode", [
this]() {
791 } else {
795 break;
798 break;
801 fFontOverrides.
fEdging =
false;
802 break;
803 }
804 }
805 this->updateTitle();
807 });
808 fCommands.
addCommand(
'S',
"Font",
"Subpixel Position Mode", [
this]() {
812 } else {
815 } else {
817 }
818 }
819 this->updateTitle();
821 });
822 fCommands.
addCommand(
'B',
"Font",
"Baseline Snapping", [
this]() {
826 } else {
829 } else {
831 }
832 }
833 this->updateTitle();
835 });
836 fCommands.
addCommand(
'p',
"Transform",
"Toggle Perspective Mode", [
this]() {
837 fPerspectiveMode = (kPerspective_Real == fPerspectiveMode) ? kPerspective_Fake
838 : kPerspective_Real;
839 this->updateTitle();
841 });
842 fCommands.
addCommand(
'P',
"Transform",
"Toggle Perspective", [
this]() {
843 fPerspectiveMode = (kPerspective_Off == fPerspectiveMode) ? kPerspective_Real
844 : kPerspective_Off;
845 this->updateTitle();
847 });
848 fCommands.
addCommand(
'a',
"Transform",
"Toggle Animation", [
this]() {
850 });
851 fCommands.
addCommand(
'u',
"GUI",
"Zoom UI", [
this]() {
852 fZoomUI = !fZoomUI;
855 });
856 fCommands.
addCommand(
'=',
"Transform",
"Apply Backing Scale", [
this]() {
857 fApplyBackingScale = !fApplyBackingScale;
859 });
860 fCommands.
addCommand(
'$',
"ViaSerialize",
"Toggle ViaSerialize", [
this]() {
861 fDrawViaSerialize = !fDrawViaSerialize;
862 this->updateTitle();
864 });
865
866
867 this->initSlides();
868 if (FLAGS_list) {
869 this->listNames();
870 }
871
872 fPerspectivePoints[0].
set(0, 0);
873 fPerspectivePoints[1].
set(1, 0);
874 fPerspectivePoints[2].
set(0, 1);
875 fPerspectivePoints[3].
set(1, 1);
877
879 if (gamutImage) {
881 }
883
885 this->setCurrentSlide(this->startupSlide());
886}
void initializeEventTracingForTools(const char *traceFlag)
void SetResourcePath(const char *resource)
constexpr SkColor SK_ColorMAGENTA
constexpr SkColor SK_ColorRED
constexpr SkColor SK_ColorGREEN
constexpr SkColor SK_ColorWHITE
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
@ kNormal
glyph outlines modified to improve constrast
@ kNone
glyph outlines unchanged
@ kSlight
minimal modification to improve constrast
@ kFull
modifies glyph outlines for maximum constrast
@ kUnknown_SkPixelGeometry
static SkColorSpacePrimaries gSrgbPrimaries
static std::map< GpuPathRenderers, std::string > gGaneshPathRendererNames
static CapturingShaderErrorHandler gShaderErrorHandler
static Window::BackendType backend_type_for_window(Window::BackendType backendType)
static sk_app::Window::BackendType get_backend_type(const char *str)
static void Parse(int argc, const char *const *argv)
void setScaleFactor(float scaleFactor)
bool isBaselineSnap() const
void setSubpixel(bool subpixel)
void setBaselineSnap(bool baselineSnap)
void setEdging(Edging edging)
SkFontHinting getHinting() const
void setHinting(SkFontHinting hintingLevel)
@ kAntiAlias
may have transparent pixels on glyph edges
@ kAlias
no transparent pixels on glyph edges
@ kSubpixelAntiAlias
glyph positioned in pixel using transparency
static OpenTypeSVGDecoderFactory SetOpenTypeSVGDecoderFactory(OpenTypeSVGDecoderFactory)
void setColor(SkColor color)
void setShader(sk_sp< SkShader > shader)
static std::unique_ptr< SkOpenTypeSVGDecoder > Make(const uint8_t *svg, size_t svgLength)
@ kUseDeviceIndependentFonts_Flag
SkPixelGeometry pixelGeometry() const
Timer addTimer(const char *label, SkColor color, SkColor labelColor=0)
void setDisplayScale(float scale)
void attach(Window *window)
void addCommand(SkUnichar c, const char *group, const char *description, std::function< void(void)> function)
void setActive(bool active)
virtual const DisplayParams & getRequestedDisplayParams()
void pushLayer(Layer *layer)
virtual void setRequestedDisplayParams(const DisplayParams &, bool allowReattach=true)
virtual bool attach(BackendType)=0
virtual float scaleFactor() const
const EmbeddedViewParams * params
FlutterSemanticsFlag flags
void RegisterAllAvailable()
void SetCtxOptions(struct GrContextOptions *)
static constexpr skcms_TransferFunction k2Dot2
PersistentCache * fPersistentCache
ShaderErrorHandler * fShaderErrorHandler
bool fSupportBilerpFromGlyphAtlas
ShaderCacheStrategy fShaderCacheStrategy
void set(float x, float y)
SkSurfacePropsFields fSurfaceProps
SkSurfaceProps fSurfaceProps
GrContextOptions fGrContextOptions
bool fCreateProtectedNativeBackend