Home | History | Annotate | Download | only in core
      1 /*
      2  * Copyright 2016 Google Inc.
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #ifndef SkNormalFlatSource_DEFINED
      9 #define SkNormalFlatSource_DEFINED
     10 
     11 #include "SkNormalSource.h"
     12 
     13 class SK_API SkNormalFlatSourceImpl : public SkNormalSource {
     14 public:
     15     SkNormalFlatSourceImpl(){}
     16 
     17 #if SK_SUPPORT_GPU
     18     std::unique_ptr<GrFragmentProcessor> asFragmentProcessor(const GrFPArgs& args) const override;
     19 #endif
     20 
     21     SkNormalSource::Provider* asProvider(const SkShaderBase::ContextRec& rec,
     22                                          SkArenaAlloc* alloc) const override;
     23 
     24 protected:
     25     void flatten(SkWriteBuffer& buf) const override;
     26 
     27 private:
     28     SK_FLATTENABLE_HOOKS(SkNormalFlatSourceImpl)
     29 
     30     class Provider : public SkNormalSource::Provider {
     31     public:
     32         Provider();
     33 
     34         ~Provider() override;
     35 
     36         void fillScanLine(int x, int y, SkPoint3 output[], int count) const override;
     37 
     38     private:
     39         typedef SkNormalSource::Provider INHERITED;
     40     };
     41 
     42     friend class SkNormalSource;
     43 
     44     typedef SkNormalSource INHERITED;
     45 };
     46 
     47 #endif
     48