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

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

Issue 1416423003: Make GrGLSLProgramBuilder base class for ProgramBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nit Created 5 years, 1 month 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/GrCustomXfermode.cpp ('k') | src/gpu/effects/GrDistanceFieldGeoProc.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 * 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 "GrDashingEffect.h" 8 #include "GrDashingEffect.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 843
844 GLDashingCircleEffect::GLDashingCircleEffect() { 844 GLDashingCircleEffect::GLDashingCircleEffect() {
845 fColor = GrColor_ILLEGAL; 845 fColor = GrColor_ILLEGAL;
846 fPrevRadius = SK_ScalarMin; 846 fPrevRadius = SK_ScalarMin;
847 fPrevCenterX = SK_ScalarMin; 847 fPrevCenterX = SK_ScalarMin;
848 fPrevIntervalLength = SK_ScalarMax; 848 fPrevIntervalLength = SK_ScalarMax;
849 } 849 }
850 850
851 void GLDashingCircleEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { 851 void GLDashingCircleEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
852 const DashingCircleEffect& dce = args.fGP.cast<DashingCircleEffect>(); 852 const DashingCircleEffect& dce = args.fGP.cast<DashingCircleEffect>();
853 GrGLGPBuilder* pb = args.fPB; 853 GrGLSLGPBuilder* pb = args.fPB;
854 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 854 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
855 855
856 // emit attributes 856 // emit attributes
857 vsBuilder->emitAttributes(dce); 857 vsBuilder->emitAttributes(dce);
858 858
859 // XY are dashPos, Z is dashInterval 859 // XY are dashPos, Z is dashInterval
860 GrGLVertToFrag dashParams(kVec3f_GrSLType); 860 GrGLSLVertToFrag dashParams(kVec3f_GrSLType);
861 args.fPB->addVarying("DashParam", &dashParams); 861 args.fPB->addVarying("DashParam", &dashParams);
862 vsBuilder->codeAppendf("%s = %s;", dashParams.vsOut(), dce.inDashParams()->f Name); 862 vsBuilder->codeAppendf("%s = %s;", dashParams.vsOut(), dce.inDashParams()->f Name);
863 863
864 // x refers to circle radius - 0.5, y refers to cicle's center x coord 864 // x refers to circle radius - 0.5, y refers to cicle's center x coord
865 GrGLVertToFrag circleParams(kVec2f_GrSLType); 865 GrGLSLVertToFrag circleParams(kVec2f_GrSLType);
866 args.fPB->addVarying("CircleParams", &circleParams); 866 args.fPB->addVarying("CircleParams", &circleParams);
867 vsBuilder->codeAppendf("%s = %s;", circleParams.vsOut(), dce.inCircleParams( )->fName); 867 vsBuilder->codeAppendf("%s = %s;", circleParams.vsOut(), dce.inCircleParams( )->fName);
868 868
869 // Setup pass through color 869 // Setup pass through color
870 if (!dce.colorIgnored()) { 870 if (!dce.colorIgnored()) {
871 this->setupUniformColor(pb, args.fOutputColor, &fColorUniform); 871 this->setupUniformColor(pb, args.fOutputColor, &fColorUniform);
872 } 872 }
873 873
874 // Setup position 874 // Setup position
875 this->setupPosition(pb, gpArgs, dce.inPosition()->fName); 875 this->setupPosition(pb, gpArgs, dce.inPosition()->fName);
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 UniformHandle fColorUniform; 1047 UniformHandle fColorUniform;
1048 typedef GrGLGeometryProcessor INHERITED; 1048 typedef GrGLGeometryProcessor INHERITED;
1049 }; 1049 };
1050 1050
1051 GLDashingLineEffect::GLDashingLineEffect() { 1051 GLDashingLineEffect::GLDashingLineEffect() {
1052 fColor = GrColor_ILLEGAL; 1052 fColor = GrColor_ILLEGAL;
1053 } 1053 }
1054 1054
1055 void GLDashingLineEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) { 1055 void GLDashingLineEffect::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
1056 const DashingLineEffect& de = args.fGP.cast<DashingLineEffect>(); 1056 const DashingLineEffect& de = args.fGP.cast<DashingLineEffect>();
1057 GrGLGPBuilder* pb = args.fPB; 1057 GrGLSLGPBuilder* pb = args.fPB;
1058 1058
1059 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder(); 1059 GrGLVertexBuilder* vsBuilder = args.fPB->getVertexShaderBuilder();
1060 1060
1061 // emit attributes 1061 // emit attributes
1062 vsBuilder->emitAttributes(de); 1062 vsBuilder->emitAttributes(de);
1063 1063
1064 // XY refers to dashPos, Z is the dash interval length 1064 // XY refers to dashPos, Z is the dash interval length
1065 GrGLVertToFrag inDashParams(kVec3f_GrSLType); 1065 GrGLSLVertToFrag inDashParams(kVec3f_GrSLType);
1066 args.fPB->addVarying("DashParams", &inDashParams, GrSLPrecision::kHigh_GrSLP recision); 1066 args.fPB->addVarying("DashParams", &inDashParams, GrSLPrecision::kHigh_GrSLP recision);
1067 vsBuilder->codeAppendf("%s = %s;", inDashParams.vsOut(), de.inDashParams()-> fName); 1067 vsBuilder->codeAppendf("%s = %s;", inDashParams.vsOut(), de.inDashParams()-> fName);
1068 1068
1069 // The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bot tom - 0.5), 1069 // The rect uniform's xyzw refer to (left + 0.5, top + 0.5, right - 0.5, bot tom - 0.5),
1070 // respectively. 1070 // respectively.
1071 GrGLVertToFrag inRectParams(kVec4f_GrSLType); 1071 GrGLSLVertToFrag inRectParams(kVec4f_GrSLType);
1072 args.fPB->addVarying("RectParams", &inRectParams, GrSLPrecision::kHigh_GrSLP recision); 1072 args.fPB->addVarying("RectParams", &inRectParams, GrSLPrecision::kHigh_GrSLP recision);
1073 vsBuilder->codeAppendf("%s = %s;", inRectParams.vsOut(), de.inRectParams()-> fName); 1073 vsBuilder->codeAppendf("%s = %s;", inRectParams.vsOut(), de.inRectParams()-> fName);
1074 1074
1075 // Setup pass through color 1075 // Setup pass through color
1076 if (!de.colorIgnored()) { 1076 if (!de.colorIgnored()) {
1077 this->setupUniformColor(pb, args.fOutputColor, &fColorUniform); 1077 this->setupUniformColor(pb, args.fOutputColor, &fColorUniform);
1078 } 1078 }
1079 1079
1080 1080
1081 // Setup position 1081 // Setup position
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 info.fIntervals = intervals; 1279 info.fIntervals = intervals;
1280 info.fCount = 2; 1280 info.fCount = 2;
1281 info.fPhase = phase; 1281 info.fPhase = phase;
1282 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); 1282 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info);
1283 SkASSERT(success); 1283 SkASSERT(success);
1284 1284
1285 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); 1285 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT);
1286 } 1286 }
1287 1287
1288 #endif 1288 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCustomXfermode.cpp ('k') | src/gpu/effects/GrDistanceFieldGeoProc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698