Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: src/gpu/GrColorSpaceXform.cpp

Issue 2329553002: Cleanup GPU gamut transformation code (Closed)
Patch Set: Switch from float[16] to SkMatrix44 Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/GrColorSpaceXform.h ('k') | src/gpu/GrTextureParamsAdjuster.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 "GrColorSpaceXform.h" 8 #include "GrColorSpaceXform.h"
9 #include "SkColorSpace.h" 9 #include "SkColorSpace.h"
10 #include "SkColorSpace_Base.h" 10 #include "SkColorSpace_Base.h"
(...skipping 17 matching lines...) Expand all
28 sk_float_almost_equals(m.getFloat(2, 0), 0.0f, tol) && 28 sk_float_almost_equals(m.getFloat(2, 0), 0.0f, tol) &&
29 sk_float_almost_equals(m.getFloat(2, 1), 0.0f, tol) && 29 sk_float_almost_equals(m.getFloat(2, 1), 0.0f, tol) &&
30 sk_float_almost_equals(m.getFloat(2, 2), 1.0f, tol) && 30 sk_float_almost_equals(m.getFloat(2, 2), 1.0f, tol) &&
31 sk_float_almost_equals(m.getFloat(2, 3), 0.0f, tol) && 31 sk_float_almost_equals(m.getFloat(2, 3), 0.0f, tol) &&
32 sk_float_almost_equals(m.getFloat(3, 0), 0.0f, tol) && 32 sk_float_almost_equals(m.getFloat(3, 0), 0.0f, tol) &&
33 sk_float_almost_equals(m.getFloat(3, 1), 0.0f, tol) && 33 sk_float_almost_equals(m.getFloat(3, 1), 0.0f, tol) &&
34 sk_float_almost_equals(m.getFloat(3, 2), 0.0f, tol) && 34 sk_float_almost_equals(m.getFloat(3, 2), 0.0f, tol) &&
35 sk_float_almost_equals(m.getFloat(3, 3), 1.0f, tol); 35 sk_float_almost_equals(m.getFloat(3, 3), 1.0f, tol);
36 } 36 }
37 37
38 GrColorSpaceXform::GrColorSpaceXform(const SkMatrix44& srcToDst, SkAlphaType src AlphaType) 38 GrColorSpaceXform::GrColorSpaceXform(const SkMatrix44& srcToDst)
39 : fSrcAlphaType(srcAlphaType) { 39 : fSrcToDst(srcToDst) {}
40 srcToDst.asColMajorf(fSrcToDst);
41 }
42 40
43 sk_sp<GrColorSpaceXform> GrColorSpaceXform::Make(SkColorSpace* src, SkColorSpace * dst, 41 sk_sp<GrColorSpaceXform> GrColorSpaceXform::Make(SkColorSpace* src, SkColorSpace * dst) {
44 SkAlphaType srcAlphaType) {
45 if (!src || !dst) { 42 if (!src || !dst) {
46 // Invalid 43 // Invalid
47 return nullptr; 44 return nullptr;
48 } 45 }
49 46
50 if (src == dst) { 47 if (src == dst) {
51 // Quick equality check - no conversion needed in this case 48 // Quick equality check - no conversion needed in this case
52 return nullptr; 49 return nullptr;
53 } 50 }
54 51
55 SkMatrix44 srcToDst(SkMatrix44::kUninitialized_Constructor); 52 SkMatrix44 srcToDst(SkMatrix44::kUninitialized_Constructor);
56 srcToDst.setConcat(as_CSB(dst)->fromXYZD50(), src->toXYZD50()); 53 srcToDst.setConcat(as_CSB(dst)->fromXYZD50(), src->toXYZD50());
57 54
58 if (matrix_is_almost_identity(srcToDst)) { 55 if (matrix_is_almost_identity(srcToDst)) {
59 return nullptr; 56 return nullptr;
60 } 57 }
61 58
62 return sk_make_sp<GrColorSpaceXform>(srcToDst, srcAlphaType); 59 return sk_make_sp<GrColorSpaceXform>(srcToDst);
63 } 60 }
OLDNEW
« no previous file with comments | « include/gpu/GrColorSpaceXform.h ('k') | src/gpu/GrTextureParamsAdjuster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698