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

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

Issue 1684063006: Add GrShaderFlags enum (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Bit->Flag Created 4 years, 10 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/SkPixelXorXfermode.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "SkTableColorFilter.h" 8 #include "SkTableColorFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 rgbaYValues[3] = 0.125; 403 rgbaYValues[3] = 0.125;
404 rgbaYValues[0] = 0.375; 404 rgbaYValues[0] = 0.375;
405 rgbaYValues[1] = 0.625; 405 rgbaYValues[1] = 0.625;
406 rgbaYValues[2] = 0.875; 406 rgbaYValues[2] = 0.875;
407 } 407 }
408 pdm.set4fv(fRGBAYValuesUni, 1, rgbaYValues); 408 pdm.set4fv(fRGBAYValuesUni, 1, rgbaYValues);
409 } 409 }
410 410
411 void GLColorTableEffect::emitCode(EmitArgs& args) { 411 void GLColorTableEffect::emitCode(EmitArgs& args) {
412 const char* yoffsets; 412 const char* yoffsets;
413 fRGBAYValuesUni = args.fUniformHandler->addUniform(GrGLSLUniformHandler::kFr agment_Visibility, 413 fRGBAYValuesUni = args.fUniformHandler->addUniform(kFragment_GrShaderFlag,
414 kVec4f_GrSLType, kDefault _GrSLPrecision, 414 kVec4f_GrSLType, kDefault _GrSLPrecision,
415 "yoffsets", &yoffsets); 415 "yoffsets", &yoffsets);
416 static const float kColorScaleFactor = 255.0f / 256.0f; 416 static const float kColorScaleFactor = 255.0f / 256.0f;
417 static const float kColorOffsetFactor = 1.0f / 512.0f; 417 static const float kColorOffsetFactor = 1.0f / 512.0f;
418 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; 418 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
419 if (nullptr == args.fInputColor) { 419 if (nullptr == args.fInputColor) {
420 // the input color is solid white (all ones). 420 // the input color is solid white (all ones).
421 static const float kMaxValue = kColorScaleFactor + kColorOffsetFactor; 421 static const float kMaxValue = kColorScaleFactor + kColorOffsetFactor;
422 fragBuilder->codeAppendf("\t\tvec4 coord = vec4(%f, %f, %f, %f);\n", 422 fragBuilder->codeAppendf("\t\tvec4 coord = vec4(%f, %f, %f, %f);\n",
423 kMaxValue, kMaxValue, kMaxValue, kMaxValue); 423 kMaxValue, kMaxValue, kMaxValue, kMaxValue);
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], 593 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256],
594 const uint8_t tableR[256], 594 const uint8_t tableR[256],
595 const uint8_t tableG[256], 595 const uint8_t tableG[256],
596 const uint8_t tableB[256]) { 596 const uint8_t tableB[256]) {
597 return new SkTable_ColorFilter(tableA, tableR, tableG, tableB); 597 return new SkTable_ColorFilter(tableA, tableR, tableG, tableB);
598 } 598 }
599 599
600 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) 600 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter)
601 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) 601 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter)
602 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 602 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkPixelXorXfermode.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698