| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkColorMatrixFilterRowMajor255.h" | 8 #include "SkColorMatrixFilterRowMajor255.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkNx.h" | 10 #include "SkNx.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 250 |
| 251 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 251 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 252 | 252 |
| 253 class GLSLProcessor : public GrGLSLFragmentProcessor { | 253 class GLSLProcessor : public GrGLSLFragmentProcessor { |
| 254 public: | 254 public: |
| 255 // this class always generates the same code. | 255 // this class always generates the same code. |
| 256 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey
Builder*) {} | 256 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey
Builder*) {} |
| 257 | 257 |
| 258 void emitCode(EmitArgs& args) override { | 258 void emitCode(EmitArgs& args) override { |
| 259 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; | 259 GrGLSLUniformHandler* uniformHandler = args.fUniformHandler; |
| 260 fMatrixHandle = uniformHandler->addUniform(GrGLSLUniformHandler::kFr
agment_Visibility, | 260 fMatrixHandle = uniformHandler->addUniform(kFragment_GrShaderFlag, |
| 261 kMat44f_GrSLType, kDefaul
t_GrSLPrecision, | 261 kMat44f_GrSLType, kDefaul
t_GrSLPrecision, |
| 262 "ColorMatrix"); | 262 "ColorMatrix"); |
| 263 fVectorHandle = uniformHandler->addUniform(GrGLSLUniformHandler::kFr
agment_Visibility, | 263 fVectorHandle = uniformHandler->addUniform(kFragment_GrShaderFlag, |
| 264 kVec4f_GrSLType, kDefault
_GrSLPrecision, | 264 kVec4f_GrSLType, kDefault
_GrSLPrecision, |
| 265 "ColorMatrixVector"); | 265 "ColorMatrixVector"); |
| 266 | 266 |
| 267 if (nullptr == args.fInputColor) { | 267 if (nullptr == args.fInputColor) { |
| 268 // could optimize this case, but we aren't for now. | 268 // could optimize this case, but we aren't for now. |
| 269 args.fInputColor = "vec4(1)"; | 269 args.fInputColor = "vec4(1)"; |
| 270 } | 270 } |
| 271 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; | 271 GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder; |
| 272 // The max() is to guard against 0 / 0 during unpremul when the inco
ming color is | 272 // The max() is to guard against 0 / 0 during unpremul when the inco
ming color is |
| 273 // transparent black. | 273 // transparent black. |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 SkColorFilter* SkColorMatrixFilterRowMajor255::CreateSingleChannelOutput(const S
kScalar row[5]) { | 422 SkColorFilter* SkColorMatrixFilterRowMajor255::CreateSingleChannelOutput(const S
kScalar row[5]) { |
| 423 SkASSERT(row); | 423 SkASSERT(row); |
| 424 SkColorMatrixFilterRowMajor255* cf = new SkColorMatrixFilterRowMajor255(); | 424 SkColorMatrixFilterRowMajor255* cf = new SkColorMatrixFilterRowMajor255(); |
| 425 static_assert(sizeof(SkScalar) * 5 * 4 == sizeof(cf->fMatrix), "sizes don't
match"); | 425 static_assert(sizeof(SkScalar) * 5 * 4 == sizeof(cf->fMatrix), "sizes don't
match"); |
| 426 for (int i = 0; i < 4; ++i) { | 426 for (int i = 0; i < 4; ++i) { |
| 427 memcpy(cf->fMatrix + 5 * i, row, sizeof(SkScalar) * 5); | 427 memcpy(cf->fMatrix + 5 * i, row, sizeof(SkScalar) * 5); |
| 428 } | 428 } |
| 429 cf->initState(); | 429 cf->initState(); |
| 430 return cf; | 430 return cf; |
| 431 } | 431 } |
| OLD | NEW |