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

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

Issue 788733003: Make addUniform take a precision (Closed) Base URL: https://skia.googlesource.com/skia.git@move_prec
Patch Set: rebase Created 6 years 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/SkPerlinNoiseShader.cpp ('k') | src/effects/gradients/SkGradientShader.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 #include "SkBitmap.h" 2 #include "SkBitmap.h"
3 #include "SkTableColorFilter.h" 3 #include "SkTableColorFilter.h"
4 #include "SkColorPriv.h" 4 #include "SkColorPriv.h"
5 #include "SkReadBuffer.h" 5 #include "SkReadBuffer.h"
6 #include "SkWriteBuffer.h" 6 #include "SkWriteBuffer.h"
7 #include "SkUnPreMultiply.h" 7 #include "SkUnPreMultiply.h"
8 #include "SkString.h" 8 #include "SkString.h"
9 9
10 class SkTable_ColorFilter : public SkColorFilter { 10 class SkTable_ColorFilter : public SkColorFilter {
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 336 }
337 337
338 void GLColorTableEffect::emitCode(GrGLFPBuilder* builder, 338 void GLColorTableEffect::emitCode(GrGLFPBuilder* builder,
339 const GrFragmentProcessor&, 339 const GrFragmentProcessor&,
340 const char* outputColor, 340 const char* outputColor,
341 const char* inputColor, 341 const char* inputColor,
342 const TransformedCoordsArray&, 342 const TransformedCoordsArray&,
343 const TextureSamplerArray& samplers) { 343 const TextureSamplerArray& samplers) {
344 const char* yoffsets; 344 const char* yoffsets;
345 fRGBAYValuesUni = builder->addUniform(GrGLFPBuilder::kFragment_Visibility, 345 fRGBAYValuesUni = builder->addUniform(GrGLFPBuilder::kFragment_Visibility,
346 kVec4f_GrSLType, "yoffsets", &yoffsets ); 346 kVec4f_GrSLType, kDefault_GrSLPrecisio n,
347 "yoffsets", &yoffsets);
347 static const float kColorScaleFactor = 255.0f / 256.0f; 348 static const float kColorScaleFactor = 255.0f / 256.0f;
348 static const float kColorOffsetFactor = 1.0f / 512.0f; 349 static const float kColorOffsetFactor = 1.0f / 512.0f;
349 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); 350 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder();
350 if (NULL == inputColor) { 351 if (NULL == inputColor) {
351 // the input color is solid white (all ones). 352 // the input color is solid white (all ones).
352 static const float kMaxValue = kColorScaleFactor + kColorOffsetFactor; 353 static const float kMaxValue = kColorScaleFactor + kColorOffsetFactor;
353 fsBuilder->codeAppendf("\t\tvec4 coord = vec4(%f, %f, %f, %f);\n", 354 fsBuilder->codeAppendf("\t\tvec4 coord = vec4(%f, %f, %f, %f);\n",
354 kMaxValue, kMaxValue, kMaxValue, kMaxValue); 355 kMaxValue, kMaxValue, kMaxValue, kMaxValue);
355 356
356 } else { 357 } else {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], 524 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256],
524 const uint8_t tableR[256], 525 const uint8_t tableR[256],
525 const uint8_t tableG[256], 526 const uint8_t tableG[256],
526 const uint8_t tableB[256]) { 527 const uint8_t tableB[256]) {
527 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); 528 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB));
528 } 529 }
529 530
530 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) 531 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter)
531 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) 532 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter)
532 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 533 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkPerlinNoiseShader.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698