OLD | NEW |
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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 typedef GrFragmentProcessor INHERITED; | 320 typedef GrFragmentProcessor INHERITED; |
321 }; | 321 }; |
322 | 322 |
323 class GLColorTableEffect : public GrGLFragmentProcessor { | 323 class GLColorTableEffect : public GrGLFragmentProcessor { |
324 public: | 324 public: |
325 GLColorTableEffect(const GrBackendProcessorFactory&, const GrProcessor&); | 325 GLColorTableEffect(const GrBackendProcessorFactory&, const GrProcessor&); |
326 | 326 |
327 virtual void emitCode(GrGLFPBuilder*, | 327 virtual void emitCode(GrGLFPBuilder*, |
328 const GrFragmentProcessor&, | 328 const GrFragmentProcessor&, |
329 const GrProcessorKey&, | |
330 const char* outputColor, | 329 const char* outputColor, |
331 const char* inputColor, | 330 const char* inputColor, |
332 const TransformedCoordsArray&, | 331 const TransformedCoordsArray&, |
333 const TextureSamplerArray&) SK_OVERRIDE; | 332 const TextureSamplerArray&) SK_OVERRIDE; |
334 | 333 |
335 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; | 334 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; |
336 | 335 |
337 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilde
r* b) {} | 336 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilde
r* b) {} |
338 | 337 |
339 private: | 338 private: |
(...skipping 19 matching lines...) Expand all Loading... |
359 rgbaYValues[3] = 0.125; | 358 rgbaYValues[3] = 0.125; |
360 rgbaYValues[0] = 0.375; | 359 rgbaYValues[0] = 0.375; |
361 rgbaYValues[1] = 0.625; | 360 rgbaYValues[1] = 0.625; |
362 rgbaYValues[2] = 0.875; | 361 rgbaYValues[2] = 0.875; |
363 } | 362 } |
364 pdm.set4fv(fRGBAYValuesUni, 1, rgbaYValues); | 363 pdm.set4fv(fRGBAYValuesUni, 1, rgbaYValues); |
365 } | 364 } |
366 | 365 |
367 void GLColorTableEffect::emitCode(GrGLFPBuilder* builder, | 366 void GLColorTableEffect::emitCode(GrGLFPBuilder* builder, |
368 const GrFragmentProcessor&, | 367 const GrFragmentProcessor&, |
369 const GrProcessorKey&, | |
370 const char* outputColor, | 368 const char* outputColor, |
371 const char* inputColor, | 369 const char* inputColor, |
372 const TransformedCoordsArray&, | 370 const TransformedCoordsArray&, |
373 const TextureSamplerArray& samplers) { | 371 const TextureSamplerArray& samplers) { |
374 const char* yoffsets; | 372 const char* yoffsets; |
375 fRGBAYValuesUni = builder->addUniform(GrGLFPBuilder::kFragment_Visibility, | 373 fRGBAYValuesUni = builder->addUniform(GrGLFPBuilder::kFragment_Visibility, |
376 kVec4f_GrSLType, "yoffsets", &yoffsets
); | 374 kVec4f_GrSLType, "yoffsets", &yoffsets
); |
377 static const float kColorScaleFactor = 255.0f / 256.0f; | 375 static const float kColorScaleFactor = 255.0f / 256.0f; |
378 static const float kColorOffsetFactor = 1.0f / 512.0f; | 376 static const float kColorOffsetFactor = 1.0f / 512.0f; |
379 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 377 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], | 546 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], |
549 const uint8_t tableR[256], | 547 const uint8_t tableR[256], |
550 const uint8_t tableG[256], | 548 const uint8_t tableG[256], |
551 const uint8_t tableB[256]) { | 549 const uint8_t tableB[256]) { |
552 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); | 550 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); |
553 } | 551 } |
554 | 552 |
555 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) | 553 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) |
556 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) | 554 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) |
557 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 555 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |