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

Side by Side Diff: src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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/effects/gradients/SkTwoPointConicalGradient.cpp ('k') | src/fonts/SkFontMgr_fontconfig.cpp » ('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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkTwoPointConicalGradient_gpu.h" 9 #include "SkTwoPointConicalGradient_gpu.h"
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 class Edge2PtConicalEffect : public GrGradientEffect { 58 class Edge2PtConicalEffect : public GrGradientEffect {
59 public: 59 public:
60 60
61 static GrFragmentProcessor* Create(GrContext* ctx, 61 static GrFragmentProcessor* Create(GrContext* ctx,
62 GrProcessorDataManager* procDataManager, 62 GrProcessorDataManager* procDataManager,
63 const SkTwoPointConicalGradient& shader, 63 const SkTwoPointConicalGradient& shader,
64 const SkMatrix& matrix, 64 const SkMatrix& matrix,
65 SkShader::TileMode tm) { 65 SkShader::TileMode tm) {
66 return SkNEW_ARGS(Edge2PtConicalEffect, (ctx, procDataManager, shader, m atrix, tm)); 66 return new Edge2PtConicalEffect(ctx, procDataManager, shader, matrix, tm );
67 } 67 }
68 68
69 virtual ~Edge2PtConicalEffect() {} 69 virtual ~Edge2PtConicalEffect() {}
70 70
71 const char* name() const override { 71 const char* name() const override {
72 return "Two-Point Conical Gradient Edge Touching"; 72 return "Two-Point Conical Gradient Edge Touching";
73 } 73 }
74 74
75 // The radial gradient parameters can collapse to a linear (instead of quadr atic) equation. 75 // The radial gradient parameters can collapse to a linear (instead of quadr atic) equation.
76 SkScalar center() const { return fCenterX1; } 76 SkScalar center() const { return fCenterX1; }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 typedef GrGLGradientEffect INHERITED; 168 typedef GrGLGradientEffect INHERITED;
169 169
170 }; 170 };
171 171
172 void Edge2PtConicalEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 172 void Edge2PtConicalEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
173 GrProcessorKeyBuilder* b) const { 173 GrProcessorKeyBuilder* b) const {
174 GLEdge2PtConicalEffect::GenKey(*this, caps, b); 174 GLEdge2PtConicalEffect::GenKey(*this, caps, b);
175 } 175 }
176 176
177 GrGLFragmentProcessor* Edge2PtConicalEffect::onCreateGLInstance() const { 177 GrGLFragmentProcessor* Edge2PtConicalEffect::onCreateGLInstance() const {
178 return SkNEW_ARGS(GLEdge2PtConicalEffect, (*this)); 178 return new GLEdge2PtConicalEffect(*this);
179 } 179 }
180 180
181 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Edge2PtConicalEffect); 181 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(Edge2PtConicalEffect);
182 182
183 /* 183 /*
184 * All Two point conical gradient test create functions may occasionally create edge case shaders 184 * All Two point conical gradient test create functions may occasionally create edge case shaders
185 */ 185 */
186 GrFragmentProcessor* Edge2PtConicalEffect::TestCreate(GrProcessorTestData* d) { 186 GrFragmentProcessor* Edge2PtConicalEffect::TestCreate(GrProcessorTestData* d) {
187 SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; 187 SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
188 SkScalar radius1 = d->fRandom->nextUScalar1(); 188 SkScalar radius1 = d->fRandom->nextUScalar1();
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 369
370 class FocalOutside2PtConicalEffect : public GrGradientEffect { 370 class FocalOutside2PtConicalEffect : public GrGradientEffect {
371 public: 371 public:
372 372
373 static GrFragmentProcessor* Create(GrContext* ctx, 373 static GrFragmentProcessor* Create(GrContext* ctx,
374 GrProcessorDataManager* procDataManager, 374 GrProcessorDataManager* procDataManager,
375 const SkTwoPointConicalGradient& shader, 375 const SkTwoPointConicalGradient& shader,
376 const SkMatrix& matrix, 376 const SkMatrix& matrix,
377 SkShader::TileMode tm, 377 SkShader::TileMode tm,
378 SkScalar focalX) { 378 SkScalar focalX) {
379 return SkNEW_ARGS(FocalOutside2PtConicalEffect, (ctx, procDataManager, s hader, matrix, tm, 379 return new FocalOutside2PtConicalEffect(ctx, procDataManager, shader, ma trix, tm, focalX);
380 focalX));
381 } 380 }
382 381
383 virtual ~FocalOutside2PtConicalEffect() { } 382 virtual ~FocalOutside2PtConicalEffect() { }
384 383
385 const char* name() const override { 384 const char* name() const override {
386 return "Two-Point Conical Gradient Focal Outside"; 385 return "Two-Point Conical Gradient Focal Outside";
387 } 386 }
388 387
389 bool isFlipped() const { return fIsFlipped; } 388 bool isFlipped() const { return fIsFlipped; }
390 SkScalar focal() const { return fFocalX; } 389 SkScalar focal() const { return fFocalX; }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 typedef GrGLGradientEffect INHERITED; 450 typedef GrGLGradientEffect INHERITED;
452 451
453 }; 452 };
454 453
455 void FocalOutside2PtConicalEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 454 void FocalOutside2PtConicalEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
456 GrProcessorKeyBuilder* b) c onst { 455 GrProcessorKeyBuilder* b) c onst {
457 GLFocalOutside2PtConicalEffect::GenKey(*this, caps, b); 456 GLFocalOutside2PtConicalEffect::GenKey(*this, caps, b);
458 } 457 }
459 458
460 GrGLFragmentProcessor* FocalOutside2PtConicalEffect::onCreateGLInstance() const { 459 GrGLFragmentProcessor* FocalOutside2PtConicalEffect::onCreateGLInstance() const {
461 return SkNEW_ARGS(GLFocalOutside2PtConicalEffect, (*this)); 460 return new GLFocalOutside2PtConicalEffect(*this);
462 } 461 }
463 462
464 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalOutside2PtConicalEffect); 463 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalOutside2PtConicalEffect);
465 464
466 /* 465 /*
467 * All Two point conical gradient test create functions may occasionally create edge case shaders 466 * All Two point conical gradient test create functions may occasionally create edge case shaders
468 */ 467 */
469 GrFragmentProcessor* FocalOutside2PtConicalEffect::TestCreate(GrProcessorTestDat a* d) { 468 GrFragmentProcessor* FocalOutside2PtConicalEffect::TestCreate(GrProcessorTestDat a* d) {
470 SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; 469 SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
471 SkScalar radius1 = 0.f; 470 SkScalar radius1 = 0.f;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 585
587 class FocalInside2PtConicalEffect : public GrGradientEffect { 586 class FocalInside2PtConicalEffect : public GrGradientEffect {
588 public: 587 public:
589 588
590 static GrFragmentProcessor* Create(GrContext* ctx, 589 static GrFragmentProcessor* Create(GrContext* ctx,
591 GrProcessorDataManager* procDataManager, 590 GrProcessorDataManager* procDataManager,
592 const SkTwoPointConicalGradient& shader, 591 const SkTwoPointConicalGradient& shader,
593 const SkMatrix& matrix, 592 const SkMatrix& matrix,
594 SkShader::TileMode tm, 593 SkShader::TileMode tm,
595 SkScalar focalX) { 594 SkScalar focalX) {
596 return SkNEW_ARGS(FocalInside2PtConicalEffect, (ctx, procDataManager, sh ader, matrix, tm, 595 return new FocalInside2PtConicalEffect(ctx, procDataManager, shader, mat rix, tm, focalX);
597 focalX));
598 } 596 }
599 597
600 virtual ~FocalInside2PtConicalEffect() {} 598 virtual ~FocalInside2PtConicalEffect() {}
601 599
602 const char* name() const override { 600 const char* name() const override {
603 return "Two-Point Conical Gradient Focal Inside"; 601 return "Two-Point Conical Gradient Focal Inside";
604 } 602 }
605 603
606 SkScalar focal() const { return fFocalX; } 604 SkScalar focal() const { return fFocalX; }
607 605
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 typedef GrGLGradientEffect INHERITED; 661 typedef GrGLGradientEffect INHERITED;
664 662
665 }; 663 };
666 664
667 void FocalInside2PtConicalEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 665 void FocalInside2PtConicalEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
668 GrProcessorKeyBuilder* b) const { 666 GrProcessorKeyBuilder* b) const {
669 GLFocalInside2PtConicalEffect::GenKey(*this, caps, b); 667 GLFocalInside2PtConicalEffect::GenKey(*this, caps, b);
670 } 668 }
671 669
672 GrGLFragmentProcessor* FocalInside2PtConicalEffect::onCreateGLInstance() const { 670 GrGLFragmentProcessor* FocalInside2PtConicalEffect::onCreateGLInstance() const {
673 return SkNEW_ARGS(GLFocalInside2PtConicalEffect, (*this)); 671 return new GLFocalInside2PtConicalEffect(*this);
674 } 672 }
675 673
676 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalInside2PtConicalEffect); 674 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(FocalInside2PtConicalEffect);
677 675
678 /* 676 /*
679 * All Two point conical gradient test create functions may occasionally create edge case shaders 677 * All Two point conical gradient test create functions may occasionally create edge case shaders
680 */ 678 */
681 GrFragmentProcessor* FocalInside2PtConicalEffect::TestCreate(GrProcessorTestData * d) { 679 GrFragmentProcessor* FocalInside2PtConicalEffect::TestCreate(GrProcessorTestData * d) {
682 SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; 680 SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
683 SkScalar radius1 = 0.f; 681 SkScalar radius1 = 0.f;
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 823
826 class CircleInside2PtConicalEffect : public GrGradientEffect { 824 class CircleInside2PtConicalEffect : public GrGradientEffect {
827 public: 825 public:
828 826
829 static GrFragmentProcessor* Create(GrContext* ctx, 827 static GrFragmentProcessor* Create(GrContext* ctx,
830 GrProcessorDataManager* procDataManager, 828 GrProcessorDataManager* procDataManager,
831 const SkTwoPointConicalGradient& shader, 829 const SkTwoPointConicalGradient& shader,
832 const SkMatrix& matrix, 830 const SkMatrix& matrix,
833 SkShader::TileMode tm, 831 SkShader::TileMode tm,
834 const CircleConicalInfo& info) { 832 const CircleConicalInfo& info) {
835 return SkNEW_ARGS(CircleInside2PtConicalEffect, (ctx, procDataManager, s hader, matrix, tm, 833 return new CircleInside2PtConicalEffect(ctx, procDataManager, shader, ma trix, tm, info);
836 info));
837 } 834 }
838 835
839 virtual ~CircleInside2PtConicalEffect() {} 836 virtual ~CircleInside2PtConicalEffect() {}
840 837
841 const char* name() const override { return "Two-Point Conical Gradient Insid e"; } 838 const char* name() const override { return "Two-Point Conical Gradient Insid e"; }
842 839
843 SkScalar centerX() const { return fInfo.fCenterEnd.fX; } 840 SkScalar centerX() const { return fInfo.fCenterEnd.fX; }
844 SkScalar centerY() const { return fInfo.fCenterEnd.fY; } 841 SkScalar centerY() const { return fInfo.fCenterEnd.fY; }
845 SkScalar A() const { return fInfo.fA; } 842 SkScalar A() const { return fInfo.fA; }
846 SkScalar B() const { return fInfo.fB; } 843 SkScalar B() const { return fInfo.fB; }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 typedef GrGLGradientEffect INHERITED; 908 typedef GrGLGradientEffect INHERITED;
912 909
913 }; 910 };
914 911
915 void CircleInside2PtConicalEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 912 void CircleInside2PtConicalEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
916 GrProcessorKeyBuilder* b) c onst { 913 GrProcessorKeyBuilder* b) c onst {
917 GLCircleInside2PtConicalEffect::GenKey(*this, caps, b); 914 GLCircleInside2PtConicalEffect::GenKey(*this, caps, b);
918 } 915 }
919 916
920 GrGLFragmentProcessor* CircleInside2PtConicalEffect::onCreateGLInstance() const { 917 GrGLFragmentProcessor* CircleInside2PtConicalEffect::onCreateGLInstance() const {
921 return SkNEW_ARGS(GLCircleInside2PtConicalEffect, (*this)); 918 return new GLCircleInside2PtConicalEffect(*this);
922 } 919 }
923 920
924 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleInside2PtConicalEffect); 921 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleInside2PtConicalEffect);
925 922
926 /* 923 /*
927 * All Two point conical gradient test create functions may occasionally create edge case shaders 924 * All Two point conical gradient test create functions may occasionally create edge case shaders
928 */ 925 */
929 GrFragmentProcessor* 926 GrFragmentProcessor*
930 CircleInside2PtConicalEffect::TestCreate(GrProcessorTestData* d) { 927 CircleInside2PtConicalEffect::TestCreate(GrProcessorTestData* d) {
931 SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; 928 SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 1039
1043 class CircleOutside2PtConicalEffect : public GrGradientEffect { 1040 class CircleOutside2PtConicalEffect : public GrGradientEffect {
1044 public: 1041 public:
1045 1042
1046 static GrFragmentProcessor* Create(GrContext* ctx, 1043 static GrFragmentProcessor* Create(GrContext* ctx,
1047 GrProcessorDataManager* procDataManager, 1044 GrProcessorDataManager* procDataManager,
1048 const SkTwoPointConicalGradient& shader, 1045 const SkTwoPointConicalGradient& shader,
1049 const SkMatrix& matrix, 1046 const SkMatrix& matrix,
1050 SkShader::TileMode tm, 1047 SkShader::TileMode tm,
1051 const CircleConicalInfo& info) { 1048 const CircleConicalInfo& info) {
1052 return SkNEW_ARGS(CircleOutside2PtConicalEffect, (ctx, procDataManager, shader, matrix, 1049 return new CircleOutside2PtConicalEffect(ctx, procDataManager, shader, m atrix, tm, info);
1053 tm, info));
1054 } 1050 }
1055 1051
1056 virtual ~CircleOutside2PtConicalEffect() {} 1052 virtual ~CircleOutside2PtConicalEffect() {}
1057 1053
1058 const char* name() const override { return "Two-Point Conical Gradient Outsi de"; } 1054 const char* name() const override { return "Two-Point Conical Gradient Outsi de"; }
1059 1055
1060 SkScalar centerX() const { return fInfo.fCenterEnd.fX; } 1056 SkScalar centerX() const { return fInfo.fCenterEnd.fX; }
1061 SkScalar centerY() const { return fInfo.fCenterEnd.fY; } 1057 SkScalar centerY() const { return fInfo.fCenterEnd.fY; }
1062 SkScalar A() const { return fInfo.fA; } 1058 SkScalar A() const { return fInfo.fA; }
1063 SkScalar B() const { return fInfo.fB; } 1059 SkScalar B() const { return fInfo.fB; }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 typedef GrGLGradientEffect INHERITED; 1139 typedef GrGLGradientEffect INHERITED;
1144 1140
1145 }; 1141 };
1146 1142
1147 void CircleOutside2PtConicalEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 1143 void CircleOutside2PtConicalEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
1148 GrProcessorKeyBuilder* b) const { 1144 GrProcessorKeyBuilder* b) const {
1149 GLCircleOutside2PtConicalEffect::GenKey(*this, caps, b); 1145 GLCircleOutside2PtConicalEffect::GenKey(*this, caps, b);
1150 } 1146 }
1151 1147
1152 GrGLFragmentProcessor* CircleOutside2PtConicalEffect::onCreateGLInstance() const { 1148 GrGLFragmentProcessor* CircleOutside2PtConicalEffect::onCreateGLInstance() const {
1153 return SkNEW_ARGS(GLCircleOutside2PtConicalEffect, (*this)); 1149 return new GLCircleOutside2PtConicalEffect(*this);
1154 } 1150 }
1155 1151
1156 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleOutside2PtConicalEffect); 1152 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleOutside2PtConicalEffect);
1157 1153
1158 /* 1154 /*
1159 * All Two point conical gradient test create functions may occasionally create edge case shaders 1155 * All Two point conical gradient test create functions may occasionally create edge case shaders
1160 */ 1156 */
1161 GrFragmentProcessor* CircleOutside2PtConicalEffect::TestCreate(GrProcessorTestDa ta* d) { 1157 GrFragmentProcessor* CircleOutside2PtConicalEffect::TestCreate(GrProcessorTestDa ta* d) {
1162 SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()}; 1158 SkPoint center1 = {d->fRandom->nextUScalar1(), d->fRandom->nextUScalar1()};
1163 SkScalar radius1 = d->fRandom->nextUScalar1() + 0.0001f; // make sure radius 1 != 0 1159 SkScalar radius1 = d->fRandom->nextUScalar1() + 0.0001f; // make sure radius 1 != 0
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1339 } else if (type == kEdge_ConicalType) { 1335 } else if (type == kEdge_ConicalType) {
1340 set_matrix_edge_conical(shader, &matrix); 1336 set_matrix_edge_conical(shader, &matrix);
1341 return Edge2PtConicalEffect::Create(ctx, procDataManager, shader, matrix , tm); 1337 return Edge2PtConicalEffect::Create(ctx, procDataManager, shader, matrix , tm);
1342 } else { 1338 } else {
1343 return CircleOutside2PtConicalEffect::Create(ctx, procDataManager, shade r, matrix, tm, 1339 return CircleOutside2PtConicalEffect::Create(ctx, procDataManager, shade r, matrix, tm,
1344 info); 1340 info);
1345 } 1341 }
1346 } 1342 }
1347 1343
1348 #endif 1344 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkTwoPointConicalGradient.cpp ('k') | src/fonts/SkFontMgr_fontconfig.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698