| OLD | NEW | 
|    1 /* |    1 /* | 
|    2  * Copyright 2016 Google Inc. |    2  * Copyright 2016 Google Inc. | 
|    3  * |    3  * | 
|    4  * Use of this source code is governed by a BSD-style license that can be |    4  * Use of this source code is governed by a BSD-style license that can be | 
|    5  * found in the LICENSE file. |    5  * found in the LICENSE file. | 
|    6  */ |    6  */ | 
|    7  |    7  | 
|    8 #include "SkNormalFlatSource.h" |    8 #include "SkNormalFlatSource.h" | 
|    9  |    9  | 
|   10 #include "SkNormalSource.h" |   10 #include "SkNormalSource.h" | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   50  |   50  | 
|   51     const char* name() const override { return "NormalFlatFP"; } |   51     const char* name() const override { return "NormalFlatFP"; } | 
|   52  |   52  | 
|   53     void onComputeInvariantOutput(GrInvariantOutput* inout) const override { |   53     void onComputeInvariantOutput(GrInvariantOutput* inout) const override { | 
|   54         inout->setToUnknown(GrInvariantOutput::ReadInput::kWillNot_ReadInput); |   54         inout->setToUnknown(GrInvariantOutput::ReadInput::kWillNot_ReadInput); | 
|   55     } |   55     } | 
|   56  |   56  | 
|   57 private: |   57 private: | 
|   58     GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { return new 
     GLSLNormalFlatFP; } |   58     GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { return new 
     GLSLNormalFlatFP; } | 
|   59  |   59  | 
|   60     bool onIsEqual(const GrFragmentProcessor& proc) const override { |   60     bool onIsEqual(const GrFragmentProcessor&) const override { return true; } | 
|   61         return true; |  | 
|   62     } |  | 
|   63 }; |   61 }; | 
|   64  |   62  | 
|   65 sk_sp<GrFragmentProcessor> SkNormalFlatSourceImpl::asFragmentProcessor( |   63 sk_sp<GrFragmentProcessor> SkNormalFlatSourceImpl::asFragmentProcessor( | 
|   66         const SkShader::AsFPArgs&) const { |   64         const SkShader::AsFPArgs&) const { | 
|   67  |   65  | 
|   68     return sk_make_sp<NormalFlatFP>(); |   66     return sk_make_sp<NormalFlatFP>(); | 
|   69 } |   67 } | 
|   70  |   68  | 
|   71 #endif // SK_SUPPORT_GPU |   69 #endif // SK_SUPPORT_GPU | 
|   72  |   70  | 
|   73 //////////////////////////////////////////////////////////////////////////// |   71 //////////////////////////////////////////////////////////////////////////// | 
|   74  |   72  | 
|   75 SkNormalFlatSourceImpl::Provider::Provider() {} |   73 SkNormalFlatSourceImpl::Provider::Provider() {} | 
|   76  |   74  | 
|   77 SkNormalFlatSourceImpl::Provider::~Provider() {} |   75 SkNormalFlatSourceImpl::Provider::~Provider() {} | 
|   78  |   76  | 
|   79 SkNormalSource::Provider* SkNormalFlatSourceImpl::asProvider(const SkShader::Con
     textRec &rec, |   77 SkNormalSource::Provider* SkNormalFlatSourceImpl::asProvider(const SkShader::Con
     textRec &rec, | 
|   80                                                            void *storage) const 
     { |   78                                                              void *storage) cons
     t { | 
|   81     return new (storage) Provider(); |   79     return new (storage) Provider(); | 
|   82 } |   80 } | 
|   83  |   81  | 
|   84 size_t SkNormalFlatSourceImpl::providerSize(const SkShader::ContextRec&) const { |   82 size_t SkNormalFlatSourceImpl::providerSize(const SkShader::ContextRec&) const { | 
|   85     return sizeof(Provider); |   83     return sizeof(Provider); | 
|   86 } |   84 } | 
|   87  |   85  | 
|   88 void SkNormalFlatSourceImpl::Provider::fillScanLine(int x, int y, SkPoint3 outpu
     t[], |   86 void SkNormalFlatSourceImpl::Provider::fillScanLine(int x, int y, SkPoint3 outpu
     t[], | 
|   89                                                   int count) const { |   87                                                     int count) const { | 
|   90     for (int i = 0; i < count; i++) { |   88     for (int i = 0; i < count; i++) { | 
|   91         output[i] = {0.0f, 0.0f, 1.0f}; |   89         output[i] = {0.0f, 0.0f, 1.0f}; | 
|   92     } |   90     } | 
|   93 } |   91 } | 
|   94  |   92  | 
|   95 //////////////////////////////////////////////////////////////////////////////// |   93 //////////////////////////////////////////////////////////////////////////////// | 
|   96  |   94  | 
|   97 sk_sp<SkFlattenable> SkNormalFlatSourceImpl::CreateProc(SkReadBuffer& buf) { |   95 sk_sp<SkFlattenable> SkNormalFlatSourceImpl::CreateProc(SkReadBuffer& buf) { | 
|   98     return sk_make_sp<SkNormalFlatSourceImpl>(); |   96     return sk_make_sp<SkNormalFlatSourceImpl>(); | 
|   99 } |   97 } | 
|  100  |   98  | 
|  101 void SkNormalFlatSourceImpl::flatten(SkWriteBuffer& buf) const { |   99 void SkNormalFlatSourceImpl::flatten(SkWriteBuffer& buf) const { | 
|  102     this->INHERITED::flatten(buf); |  100     this->INHERITED::flatten(buf); | 
|  103 } |  101 } | 
|  104  |  102  | 
|  105 //////////////////////////////////////////////////////////////////////////// |  103 //////////////////////////////////////////////////////////////////////////// | 
|  106  |  104  | 
|  107 sk_sp<SkNormalSource> SkNormalSource::MakeFlat() { |  105 sk_sp<SkNormalSource> SkNormalSource::MakeFlat() { | 
|  108     return sk_make_sp<SkNormalFlatSourceImpl>(); |  106     return sk_make_sp<SkNormalFlatSourceImpl>(); | 
|  109 } |  107 } | 
| OLD | NEW |