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     sk_sp<GrFragmentProcessor> asFragmentProcessor(const SkShader::AsFPArgs&) const override;
     19 #endif
     20 
     21     SkNormalSource::Provider* asProvider(const SkShader::ContextRec& rec,
     22                                          SkArenaAlloc* alloc) const override;
     23 
     24     SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkNormalFlatSourceImpl)
     25 
     26 protected:
     27     void flatten(SkWriteBuffer& buf) const override;
     28 
     29 private:
     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