 Chromium Code Reviews
 Chromium Code Reviews Issue 1155033003:
  [qcms] Add matrix transform flag and matrix extraction api  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1155033003:
  [qcms] Add matrix transform flag and matrix extraction api  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| Index: third_party/qcms/src/transform.c | 
| diff --git a/third_party/qcms/src/transform.c b/third_party/qcms/src/transform.c | 
| index d3e3e1b21a22e1840e339b4da80de94d03f4f91e..3ea4944309789905c16657f1057dabd68d9e3df8 100644 | 
| --- a/third_party/qcms/src/transform.c | 
| +++ b/third_party/qcms/src/transform.c | 
| @@ -1365,6 +1365,9 @@ qcms_transform* qcms_transform_create( | 
| transform->matrix[1][2] = result.m[2][1]; | 
| transform->matrix[2][2] = result.m[2][2]; | 
| + /* Flag transform as matrix. */ | 
| + transform->transform_flags |= TRANSFORM_FLAG_MATRIX; | 
| 
Stephen White
2015/05/27 17:17:49
Does transform_flags need to be initialized to zer
 
Noel Gordon
2015/05/27 17:42:56
calloc-ed as you noted, that's the normal case for
 | 
| + | 
| } else if (in->color_space == GRAY_SIGNATURE) { | 
| if (in_type != QCMS_DATA_GRAY_8 && | 
| in_type != QCMS_DATA_GRAYA_8){ | 
| @@ -1431,7 +1434,27 @@ void qcms_transform_data_type(qcms_transform *transform, void *src, void *dest, | 
| } | 
| qcms_bool qcms_supports_iccv4; | 
| + | 
| void qcms_enable_iccv4() | 
| { | 
| qcms_supports_iccv4 = true; | 
| } | 
| + | 
| +static inline qcms_bool transform_is_matrix(qcms_transform *t) | 
| +{ | 
| + return (t->transform_flags & TRANSFORM_FLAG_MATRIX) ? true : false; | 
| +} | 
| + | 
| +qcms_bool qcms_transform_is_matrix(qcms_transform *t) | 
| +{ | 
| + return transform_is_matrix(t); | 
| +} | 
| + | 
| +float qcms_transform_get_matrix(qcms_transform *t, int i, int j) | 
| 
robert.bradford
2015/05/27 16:03:27
Perhaps call it _matrix_value - in case in the fut
 
robert.bradford
2015/05/27 16:03:27
unsigned int or size_t?
 
Noel Gordon
2015/05/27 17:21:55
The i, j kinda does that for me too.  Let's leave
 
Noel Gordon
2015/05/27 17:21:55
Yes, made it unsigned.
 | 
| +{ | 
| + assert(transform_is_matrix(t)); | 
| + | 
| + // Return transform matrix elements in row major order (permute i and j) | 
| + | 
| + return t->matrix[j][i]; | 
| 
robert.bradford
2015/05/27 16:03:27
Should we be doing bounds checks on array derefere
 
Noel Gordon
2015/05/27 17:21:55
Done.
 | 
| +} |