skia2/tools/viewer/SkSLSlide.h
Brian Osman ee426f223f Move SkRuntimeEffect.h to include/effects
Change-Id: I0b11d4210c6e663cfb4854fc33e1396fd79fe9a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/261780
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
2020-01-02 17:37:46 +00:00

40 lines
926 B
C++

/*
* Copyright 2019 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkSLSlide_DEFINED
#define SkSLSlide_DEFINED
#include "tools/viewer/Slide.h"
#include "include/effects/SkRuntimeEffect.h"
class SkSLSlide : public Slide {
public:
SkSLSlide();
// TODO: We need a way for primarily interactive slides to always be as large as the window
SkISize getDimensions() const override { return SkISize::MakeEmpty(); }
void draw(SkCanvas* canvas) override;
void load(SkScalar winWidth, SkScalar winHeight) override;
void unload() override;
private:
bool rebuild();
SkString fSkSL;
sk_sp<SkRuntimeEffect> fEffect;
SkAutoTMalloc<char> fInputs;
SkTArray<sk_sp<SkShader>> fChildren;
// Named shaders that can be selected as inputs
SkTArray<std::pair<const char*, sk_sp<SkShader>>> fShaders;
};
#endif