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

Side by Side Diff: src/effects/SkMatrixConvolutionImageFilter.cpp

Issue 23826002: Rename ShaderType enum to ShaderVisibility (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.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 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 "SkMatrixConvolutionImageFilter.h" 8 #include "SkMatrixConvolutionImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 coord = clampedCoord.c_str(); 369 coord = clampedCoord.c_str();
370 break; 370 break;
371 case SkMatrixConvolutionImageFilter::kRepeat_TileMode: 371 case SkMatrixConvolutionImageFilter::kRepeat_TileMode:
372 clampedCoord.printf("fract(%s)", coord); 372 clampedCoord.printf("fract(%s)", coord);
373 coord = clampedCoord.c_str(); 373 coord = clampedCoord.c_str();
374 break; 374 break;
375 case SkMatrixConvolutionImageFilter::kClampToBlack_TileMode: 375 case SkMatrixConvolutionImageFilter::kClampToBlack_TileMode:
376 builder->fsCodeAppendf("clamp(%s, 0.0, 1.0) != %s ? vec4(0, 0, 0, 0) : ", coord, coord); 376 builder->fsCodeAppendf("clamp(%s, 0.0, 1.0) != %s ? vec4(0, 0, 0, 0) : ", coord, coord);
377 break; 377 break;
378 } 378 }
379 builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType, sample r, coord); 379 builder->fsAppendTextureLookup(sampler, coord);
380 } 380 }
381 381
382 void GrGLMatrixConvolutionEffect::emitCode(GrGLShaderBuilder* builder, 382 void GrGLMatrixConvolutionEffect::emitCode(GrGLShaderBuilder* builder,
383 const GrDrawEffect&, 383 const GrDrawEffect&,
384 EffectKey key, 384 EffectKey key,
385 const char* outputColor, 385 const char* outputColor,
386 const char* inputColor, 386 const char* inputColor,
387 const TextureSamplerArray& samplers) { 387 const TextureSamplerArray& samplers) {
388 SkString coords; 388 SkString coords;
389 fEffectMatrix.emitCodeMakeFSCoords2D(builder, key, &coords); 389 fEffectMatrix.emitCodeMakeFSCoords2D(builder, key, &coords);
390 fImageIncrementUni = builder->addUniform(GrGLShaderBuilder::kFragment_Shader Type, 390 fImageIncrementUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibi lity,
391 kVec2f_GrSLType, "ImageIncrement"); 391 kVec2f_GrSLType, "ImageIncrement");
392 fKernelUni = builder->addUniformArray(GrGLShaderBuilder::kFragment_ShaderTyp e, 392 fKernelUni = builder->addUniformArray(GrGLShaderBuilder::kFragment_Visibilit y,
393 kFloat_GrSLType, "Kernel", fKernelS ize.width() * fKernelSize.height()); 393 kFloat_GrSLType, "Kernel", fKernelS ize.width() * fKernelSize.height());
394 fTargetUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, 394 fTargetUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
395 kVec2f_GrSLType, "Target"); 395 kVec2f_GrSLType, "Target");
396 fGainUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, 396 fGainUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
397 kFloat_GrSLType, "Gain"); 397 kFloat_GrSLType, "Gain");
398 fBiasUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, 398 fBiasUni = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility,
399 kFloat_GrSLType, "Bias"); 399 kFloat_GrSLType, "Bias");
400 400
401 const char* target = builder->getUniformCStr(fTargetUni); 401 const char* target = builder->getUniformCStr(fTargetUni);
402 const char* imgInc = builder->getUniformCStr(fImageIncrementUni); 402 const char* imgInc = builder->getUniformCStr(fImageIncrementUni);
403 const char* kernel = builder->getUniformCStr(fKernelUni); 403 const char* kernel = builder->getUniformCStr(fKernelUni);
404 const char* gain = builder->getUniformCStr(fGainUni); 404 const char* gain = builder->getUniformCStr(fGainUni);
405 const char* bias = builder->getUniformCStr(fBiasUni); 405 const char* bias = builder->getUniformCStr(fBiasUni);
406 int kWidth = fKernelSize.width(); 406 int kWidth = fKernelSize.width();
407 int kHeight = fKernelSize.height(); 407 int kHeight = fKernelSize.height();
408 408
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 fBias, 573 fBias,
574 fTarget, 574 fTarget,
575 fTileMode, 575 fTileMode,
576 fConvolveAlpha); 576 fConvolveAlpha);
577 return true; 577 return true;
578 } 578 }
579 579
580 /////////////////////////////////////////////////////////////////////////////// 580 ///////////////////////////////////////////////////////////////////////////////
581 581
582 #endif 582 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/effects/SkMorphologyImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698