494 : fCurrentSlide(-1)
495 , fRefresh(false)
496 , fSaveToSKP(false)
497 , fShowSlideDimensions(false)
498 , fShowImGuiDebugWindow(false)
499 , fShowSlidePicker(false)
500 , fShowImGuiTestWindow(false)
501 , fShowHistogramWindow(false)
502 , fShowZoomWindow(false)
503 , fZoomWindowFixed(false)
504 , fZoomWindowLocation{0.0f, 0.0f}
505 , fLastImage(nullptr)
506 , fZoomUI(false)
507 , fBackendType(sk_app::Window::kNativeGL_BackendType)
508 , fColorMode(ColorMode::kLegacy)
510
512 , fApplyBackingScale(true)
513 , fZoomLevel(0.0f)
514 , fRotation(0.0f)
515 , fOffset{0.5f, 0.5f}
516 , fGestureDevice(GestureDevice::kNone)
517 , fTiled(false)
518 , fDrawTileBoundaries(false)
519 , fTileScale{0.25f, 0.25f}
520 , fPerspectiveMode(kPerspective_Off)
521{
523#if defined(SK_ENABLE_SVG)
525#endif
527
534
535 SkDebugf(
"Command line arguments: ");
536 for (int i = 1; i < argc; ++i) {
538 }
540
542#ifdef SK_BUILD_FOR_ANDROID
544#endif
545
548
550 fWindow = Window::CreateNativeWindow(platformData);
551
561 if (FLAGS_dmsaa) {
565 }
567#if defined(SK_GRAPHITE)
568 displayParams.fGraphiteContextOptions.fPriv.fPathRendererStrategy =
569 get_path_renderer_strategy_type(FLAGS_pathstrategy[0]);
570#endif
573 fRefresh = FLAGS_redraw;
574
576 fStatsLayer.
setDisplayScale((fZoomUI ? 2.0f : 1.0f) * fWindow->scaleFactor());
577
578
583
584
585 fCommands.
attach(fWindow);
589
590
591 fCommands.
addCommand(
' ',
"GUI",
"Toggle Debug GUI", [
this]() {
592 this->fShowImGuiDebugWindow = !this->fShowImGuiDebugWindow;
594 });
595
596 fCommands.
addCommand(
'/',
"GUI",
"Jump to slide picker", [
this]() {
597 this->fShowImGuiDebugWindow = true;
598 this->fShowSlidePicker = true;
600 });
601
602 fCommands.
addCommand(skui::Key::kBack,
"Backspace",
"GUI",
"Jump to slide picker", [
this]() {
603 this->fShowImGuiDebugWindow = true;
604 this->fShowSlidePicker = true;
606 });
607 fCommands.
addCommand(
'g',
"GUI",
"Toggle GUI Demo", [
this]() {
608 this->fShowImGuiTestWindow = !this->fShowImGuiTestWindow;
610 });
611 fCommands.
addCommand(
'z',
"GUI",
"Toggle zoom window", [
this]() {
612 this->fShowZoomWindow = !this->fShowZoomWindow;
614 });
615 fCommands.
addCommand(
'Z',
"GUI",
"Toggle zoom window state", [
this]() {
616 this->fZoomWindowFixed = !this->fZoomWindowFixed;
618 });
619 fCommands.
addCommand(
'v',
"Swapchain",
"Toggle vsync on/off", [
this]() {
623 this->updateTitle();
625 });
626 fCommands.
addCommand(
'V',
"Swapchain",
"Toggle delayed acquire on/off (Metal only)", [
this]() {
630 this->updateTitle();
632 });
633 fCommands.
addCommand(
'r',
"Redraw",
"Toggle redraw", [
this]() {
634 fRefresh = !fRefresh;
636 });
637 fCommands.
addCommand(
's',
"Overlays",
"Toggle stats display", [
this]() {
640 });
641 fCommands.
addCommand(
'0',
"Overlays",
"Reset stats", [
this]() {
643 this->updateTitle();
645 });
646 fCommands.
addCommand(
'C',
"GUI",
"Toggle color histogram", [
this]() {
647 this->fShowHistogramWindow = !this->fShowHistogramWindow;
649 });
650 fCommands.
addCommand(
'c',
"Modes",
"Cycle color mode", [
this]() {
651 switch (fColorMode) {
652 case ColorMode::kLegacy:
653 this->setColorMode(ColorMode::kColorManaged8888);
654 break;
655 case ColorMode::kColorManaged8888:
656 this->setColorMode(ColorMode::kColorManagedF16);
657 break;
658 case ColorMode::kColorManagedF16:
659 this->setColorMode(ColorMode::kColorManagedF16Norm);
660 break;
661 case ColorMode::kColorManagedF16Norm:
662 this->setColorMode(ColorMode::kLegacy);
663 break;
664 }
665 });
666 fCommands.
addCommand(
'w',
"Modes",
"Toggle wireframe", [
this]() {
671 });
672 fCommands.
addCommand(
'w',
"Modes",
"Toggle reduced shaders", [
this]() {
675 !
params.fGrContextOptions.fReducedShaderVariations;
678 });
679 fCommands.
addCommand(skui::Key::kRight,
"Right",
"Navigation",
"Next slide", [
this]() {
680 this->setCurrentSlide(fCurrentSlide < fSlides.
size() - 1 ? fCurrentSlide + 1 : 0);
681 });
682 fCommands.
addCommand(skui::Key::kLeft,
"Left",
"Navigation",
"Previous slide", [
this]() {
683 this->setCurrentSlide(fCurrentSlide > 0 ? fCurrentSlide - 1 : fSlides.
size() - 1);
684 });
685 fCommands.
addCommand(skui::Key::kUp,
"Up",
"Transform",
"Zoom in", [
this]() {
686 this->changeZoomLevel(1.f / 32.f);
688 });
689 fCommands.
addCommand(skui::Key::kDown,
"Down",
"Transform",
"Zoom out", [
this]() {
690 this->changeZoomLevel(-1.f / 32.f);
692 });
693 fCommands.
addCommand(
'd',
"Modes",
"Change rendering backend", [
this]() {
696
697#if defined(SK_BUILD_FOR_UNIX) && defined(SK_VULKAN)
698 if (newBackend == sk_app::Window::kVulkan_BackendType) {
701 } else if (fBackendType == sk_app::Window::kVulkan_BackendType) {
702 newBackend = sk_app::Window::kVulkan_BackendType;
703 }
704#endif
705 this->setBackend(newBackend);
706 });
707 fCommands.
addCommand(
'K',
"IO",
"Save slide to SKP", [
this]() {
708 fSaveToSKP = true;
710 });
711 fCommands.
addCommand(
'&',
"Overlays",
"Show slide dimensios", [
this]() {
712 fShowSlideDimensions = !fShowSlideDimensions;
714 });
715 fCommands.
addCommand(
'G',
"Modes",
"Geometry", [
this]() {
722 } else {
723 switch (
params.fSurfaceProps.pixelGeometry()) {
726 break;
729 break;
732 break;
735 break;
739 break;
740 }
741 }
743 this->updateTitle();
745 });
746 fCommands.
addCommand(
'H',
"Font",
"Hinting mode", [
this]() {
750 } else {
754 break;
757 break;
760 break;
764 break;
765 }
766 }
767 this->updateTitle();
769 });
770 fCommands.
addCommand(
'D',
"Modes",
"DFT", [
this]() {
776 this->updateTitle();
778 });
779 fCommands.
addCommand(
'L',
"Font",
"Subpixel Antialias Mode", [
this]() {
783 } else {
787 break;
790 break;
793 fFontOverrides.
fEdging =
false;
794 break;
795 }
796 }
797 this->updateTitle();
799 });
800 fCommands.
addCommand(
'S',
"Font",
"Subpixel Position Mode", [
this]() {
804 } else {
807 } else {
809 }
810 }
811 this->updateTitle();
813 });
814 fCommands.
addCommand(
'B',
"Font",
"Baseline Snapping", [
this]() {
818 } else {
821 } else {
823 }
824 }
825 this->updateTitle();
827 });
828 fCommands.
addCommand(
'p',
"Transform",
"Toggle Perspective Mode", [
this]() {
829 fPerspectiveMode = (kPerspective_Real == fPerspectiveMode) ? kPerspective_Fake
830 : kPerspective_Real;
831 this->updateTitle();
833 });
834 fCommands.
addCommand(
'P',
"Transform",
"Toggle Perspective", [
this]() {
835 fPerspectiveMode = (kPerspective_Off == fPerspectiveMode) ? kPerspective_Real
836 : kPerspective_Off;
837 this->updateTitle();
839 });
840 fCommands.
addCommand(
'a',
"Transform",
"Toggle Animation", [
this]() {
842 });
843 fCommands.
addCommand(
'u',
"GUI",
"Zoom UI", [
this]() {
844 fZoomUI = !fZoomUI;
845 fStatsLayer.
setDisplayScale((fZoomUI ? 2.0f : 1.0f) * fWindow->scaleFactor());
847 });
848 fCommands.
addCommand(
'$',
"ViaSerialize",
"Toggle ViaSerialize", [
this]() {
849 fDrawViaSerialize = !fDrawViaSerialize;
850 this->updateTitle();
852 });
853
854
855 this->initSlides();
856 if (FLAGS_list) {
857 this->listNames();
858 }
859
860 fPerspectivePoints[0].
set(0, 0);
861 fPerspectivePoints[1].
set(1, 0);
862 fPerspectivePoints[2].
set(0, 1);
863 fPerspectivePoints[3].
set(1, 1);
865
867 if (gamutImage) {
869 }
871
873 this->setCurrentSlide(this->startupSlide());
874}
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
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
PersistentCache * fPersistentCache
ShaderErrorHandler * fShaderErrorHandler
bool fSupportBilerpFromGlyphAtlas
bool fReducedShaderVariations
ShaderCacheStrategy fShaderCacheStrategy
void set(float x, float y)
SkSurfacePropsFields fSurfaceProps
bool fDelayDrawableAcquisition
SkSurfaceProps fSurfaceProps
GrContextOptions fGrContextOptions
bool fCreateProtectedNativeBackend