Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(640)

Side by Side Diff: src/gpu/effects/GrDitherEffect.cpp

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/effects/GrDitherEffect.h ('k') | src/gpu/effects/GrGammaEffect.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "GrDitherEffect.h" 8 #include "GrDitherEffect.h"
9 #include "GrFragmentProcessor.h" 9 #include "GrFragmentProcessor.h"
10 #include "GrInvariantOutput.h" 10 #include "GrInvariantOutput.h"
11 #include "SkRect.h" 11 #include "SkRect.h"
12 #include "glsl/GrGLSLFragmentProcessor.h" 12 #include "glsl/GrGLSLFragmentProcessor.h"
13 #include "glsl/GrGLSLFragmentShaderBuilder.h" 13 #include "glsl/GrGLSLFragmentShaderBuilder.h"
14 14
15 ////////////////////////////////////////////////////////////////////////////// 15 //////////////////////////////////////////////////////////////////////////////
16 16
17 class DitherEffect : public GrFragmentProcessor { 17 class DitherEffect : public GrFragmentProcessor {
18 public: 18 public:
19 static GrFragmentProcessor* Create() { 19 static sk_sp<GrFragmentProcessor> Make() {
20 return new DitherEffect; 20 return sk_sp<GrFragmentProcessor>(new DitherEffect);
21 } 21 }
22 22
23 virtual ~DitherEffect() {}; 23 virtual ~DitherEffect() {};
24 24
25 const char* name() const override { return "Dither"; } 25 const char* name() const override { return "Dither"; }
26 26
27 private: 27 private:
28 DitherEffect() { 28 DitherEffect() {
29 this->initClassID<DitherEffect>(); 29 this->initClassID<DitherEffect>();
30 this->setWillReadFragmentPosition(); 30 this->setWillReadFragmentPosition();
(...skipping 14 matching lines...) Expand all
45 }; 45 };
46 46
47 void DitherEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { 47 void DitherEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
48 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput); 48 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
49 } 49 }
50 50
51 ////////////////////////////////////////////////////////////////////////////// 51 //////////////////////////////////////////////////////////////////////////////
52 52
53 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(DitherEffect); 53 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(DitherEffect);
54 54
55 const GrFragmentProcessor* DitherEffect::TestCreate(GrProcessorTestData*) { 55 sk_sp<GrFragmentProcessor> DitherEffect::TestCreate(GrProcessorTestData*) {
56 return DitherEffect::Create(); 56 return DitherEffect::Make();
57 } 57 }
58 58
59 ////////////////////////////////////////////////////////////////////////////// 59 //////////////////////////////////////////////////////////////////////////////
60 60
61 class GLDitherEffect : public GrGLSLFragmentProcessor { 61 class GLDitherEffect : public GrGLSLFragmentProcessor {
62 public: 62 public:
63 void emitCode(EmitArgs& args) override; 63 void emitCode(EmitArgs& args) override;
64 64
65 private: 65 private:
66 typedef GrGLSLFragmentProcessor INHERITED; 66 typedef GrGLSLFragmentProcessor INHERITED;
(...skipping 21 matching lines...) Expand all
88 88
89 void DitherEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps, 89 void DitherEffect::onGetGLSLProcessorKey(const GrGLSLCaps& caps,
90 GrProcessorKeyBuilder* b) const { 90 GrProcessorKeyBuilder* b) const {
91 GLDitherEffect::GenKey(*this, caps, b); 91 GLDitherEffect::GenKey(*this, caps, b);
92 } 92 }
93 93
94 GrGLSLFragmentProcessor* DitherEffect::onCreateGLSLInstance() const { 94 GrGLSLFragmentProcessor* DitherEffect::onCreateGLSLInstance() const {
95 return new GLDitherEffect; 95 return new GLDitherEffect;
96 } 96 }
97 97
98 GrFragmentProcessor* GrDitherEffect::Create() { return DitherEffect::Create(); } 98 sk_sp<GrFragmentProcessor> GrDitherEffect::Make() { return DitherEffect::Make(); }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrDitherEffect.h ('k') | src/gpu/effects/GrGammaEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698