skia2/samplecode/SampleNimaActor.h
Ruiqi Mao c5c3df6643 renamed samplecode/Nima to samplecode/SampleNimaActor
Bug: skia:
Change-Id: I305ca837d5ed35df4b519e7283201f0a0f87b1c3
Reviewed-on: https://skia-review.googlesource.com/136636
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Ruiqi Mao <ruiqimao@google.com>
2018-06-22 20:36:17 +00:00

55 lines
1.2 KiB
C++

/*
* Copyright 2018 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SampleNimaActor_DEFINED
#define SampleNimaActor_DEFINED
#include <nima/Actor.hpp>
#include <nima/ActorImage.hpp>
#include <nima/Vec2D.hpp>
#include "SkCanvas.h"
#include "SkImage.h"
class SampleActor;
class SampleActorImage;
class SampleActor : public nima::Actor {
public:
SampleActor(std::string baseName);
~SampleActor();
void render(SkCanvas* canvas) const;
private:
sk_sp<SkImage> fTexture;
std::vector<SampleActorImage> fActorImages;
std::unique_ptr<SkPaint> fPaint;
typedef nima::Actor INHERITED;
};
class SampleActorImage {
public:
SampleActorImage(nima::ActorImage* actorImage, sk_sp<SkImage> texture, SkPaint* paint);
~SampleActorImage();
void render(const SampleActor* actor, SkCanvas* canvas) const;
int drawOrder() const { return fActorImage->drawOrder(); }
private:
nima::Vec2D deform(const nima::Vec2D& position, float* boneIdx, float* boneWgt) const;
private:
nima::ActorImage* fActorImage;
sk_sp<SkImage> fTexture;
SkPaint* fPaint;
};
#endif