OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkBlitRow.h" | 8 #include "SkBlitRow.h" |
9 #include "SkColorFilter.h" | 9 #include "SkColorFilter.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 typedef GrEffect INHERITED; | 299 typedef GrEffect INHERITED; |
300 }; | 300 }; |
301 | 301 |
302 namespace { | 302 namespace { |
303 | 303 |
304 /** Function color_component_to_int tries to reproduce the GLSL rounding. The sp
ec doesn't specify | 304 /** Function color_component_to_int tries to reproduce the GLSL rounding. The sp
ec doesn't specify |
305 * to which direction the 0.5 goes. | 305 * to which direction the 0.5 goes. |
306 */ | 306 */ |
307 static inline int color_component_to_int(float value) { | 307 static inline int color_component_to_int(float value) { |
308 return sk_float_round2int(GrMax(0.f, GrMin(1.f, value)) * 255.f); | 308 return sk_float_round2int(SkTMax(0.f, SkTMin(1.f, value)) * 255.f); |
309 } | 309 } |
310 | 310 |
311 /** MaskedColorExpr is used to evaluate the color and valid color component flag
s through the | 311 /** MaskedColorExpr is used to evaluate the color and valid color component flag
s through the |
312 * blending equation. It has members similar to GrGLSLExpr so that it can be use
d with the | 312 * blending equation. It has members similar to GrGLSLExpr so that it can be use
d with the |
313 * templated helpers above. | 313 * templated helpers above. |
314 */ | 314 */ |
315 class MaskedColorExpr { | 315 class MaskedColorExpr { |
316 public: | 316 public: |
317 MaskedColorExpr(const float color[], uint32_t flags) | 317 MaskedColorExpr(const float color[], uint32_t flags) |
318 : fFlags(flags) { | 318 : fFlags(flags) { |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 SkIntToScalar(SkColorGetB(add)), | 558 SkIntToScalar(SkColorGetB(add)), |
559 0); | 559 0); |
560 return SkColorMatrixFilter::Create(matrix); | 560 return SkColorMatrixFilter::Create(matrix); |
561 } | 561 } |
562 | 562 |
563 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkColorFilter) | 563 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkColorFilter) |
564 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkModeColorFilter) | 564 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkModeColorFilter) |
565 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(Src_SkModeColorFilter) | 565 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(Src_SkModeColorFilter) |
566 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SrcOver_SkModeColorFilter) | 566 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SrcOver_SkModeColorFilter) |
567 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 567 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |