| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 outer[j + 2] * inner[14] + | 219 outer[j + 2] * inner[14] + |
| 220 outer[j + 3] * inner[19] + | 220 outer[j + 3] * inner[19] + |
| 221 outer[j + 4]; | 221 outer[j + 4]; |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 | 224 |
| 225 /////////////////////////////////////////////////////////////////////////////// | 225 /////////////////////////////////////////////////////////////////////////////// |
| 226 // End duplication | 226 // End duplication |
| 227 ////// | 227 ////// |
| 228 | 228 |
| 229 SkColorFilter* SkColorMatrixFilterRowMajor255::newComposed(const SkColorFilter*
innerFilter) const { | 229 sk_sp<SkColorFilter> |
| 230 SkColorMatrixFilterRowMajor255::makeComposed(sk_sp<SkColorFilter> innerFilter) c
onst { |
| 230 SkScalar innerMatrix[20]; | 231 SkScalar innerMatrix[20]; |
| 231 if (innerFilter->asColorMatrix(innerMatrix) && !needs_clamping(innerMatrix))
{ | 232 if (innerFilter->asColorMatrix(innerMatrix) && !needs_clamping(innerMatrix))
{ |
| 232 SkScalar concat[20]; | 233 SkScalar concat[20]; |
| 233 set_concat(concat, fMatrix, innerMatrix); | 234 set_concat(concat, fMatrix, innerMatrix); |
| 234 return new SkColorMatrixFilterRowMajor255(concat); | 235 return sk_make_sp<SkColorMatrixFilterRowMajor255>(concat); |
| 235 } | 236 } |
| 236 return nullptr; | 237 return nullptr; |
| 237 } | 238 } |
| 238 | 239 |
| 239 #if SK_SUPPORT_GPU | 240 #if SK_SUPPORT_GPU |
| 240 #include "GrFragmentProcessor.h" | 241 #include "GrFragmentProcessor.h" |
| 241 #include "GrInvariantOutput.h" | 242 #include "GrInvariantOutput.h" |
| 242 #include "glsl/GrGLSLFragmentProcessor.h" | 243 #include "glsl/GrGLSLFragmentProcessor.h" |
| 243 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 244 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
| 244 #include "glsl/GrGLSLProgramDataManager.h" | 245 #include "glsl/GrGLSLProgramDataManager.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 if (i < 19) { | 411 if (i < 19) { |
| 411 str->append(", "); | 412 str->append(", "); |
| 412 } | 413 } |
| 413 } | 414 } |
| 414 str->append(")"); | 415 str->append(")"); |
| 415 } | 416 } |
| 416 #endif | 417 #endif |
| 417 | 418 |
| 418 /////////////////////////////////////////////////////////////////////////////// | 419 /////////////////////////////////////////////////////////////////////////////// |
| 419 | 420 |
| 420 SkColorFilter* SkColorFilter::CreateMatrixFilterRowMajor255(const SkScalar array
[20]) { | 421 sk_sp<SkColorFilter> SkColorFilter::MakeMatrixFilterRowMajor255(const SkScalar a
rray[20]) { |
| 421 return new SkColorMatrixFilterRowMajor255(array); | 422 return sk_sp<SkColorFilter>(new SkColorMatrixFilterRowMajor255(array)); |
| 422 } | 423 } |
| 423 | 424 |
| 424 /////////////////////////////////////////////////////////////////////////////// | 425 /////////////////////////////////////////////////////////////////////////////// |
| 425 | 426 |
| 426 SkColorFilter* SkColorMatrixFilterRowMajor255::CreateSingleChannelOutput(const S
kScalar row[5]) { | 427 sk_sp<SkColorFilter> |
| 428 SkColorMatrixFilterRowMajor255::MakeSingleChannelOutput(const SkScalar row[5]) { |
| 427 SkASSERT(row); | 429 SkASSERT(row); |
| 428 SkColorMatrixFilterRowMajor255* cf = new SkColorMatrixFilterRowMajor255(); | 430 auto cf = sk_make_sp<SkColorMatrixFilterRowMajor255>(); |
| 429 static_assert(sizeof(SkScalar) * 5 * 4 == sizeof(cf->fMatrix), "sizes don't
match"); | 431 static_assert(sizeof(SkScalar) * 5 * 4 == sizeof(cf->fMatrix), "sizes don't
match"); |
| 430 for (int i = 0; i < 4; ++i) { | 432 for (int i = 0; i < 4; ++i) { |
| 431 memcpy(cf->fMatrix + 5 * i, row, sizeof(SkScalar) * 5); | 433 memcpy(cf->fMatrix + 5 * i, row, sizeof(SkScalar) * 5); |
| 432 } | 434 } |
| 433 cf->initState(); | 435 cf->initState(); |
| 434 return cf; | 436 return cf; |
| 435 } | 437 } |
| OLD | NEW |