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

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

Issue 2389983002: Refactored SkColorSpace and added in a Lab PCS GM (Closed)
Patch Set: Responding to comments Created 4 years, 2 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Invalid 43 // Invalid
44 return nullptr; 44 return nullptr;
45 } 45 }
46 46
47 if (src == dst) { 47 if (src == dst) {
48 // Quick equality check - no conversion needed in this case 48 // Quick equality check - no conversion needed in this case
49 return nullptr; 49 return nullptr;
50 } 50 }
51 51
52 SkMatrix44 srcToDst(SkMatrix44::kUninitialized_Constructor); 52 SkMatrix44 srcToDst(SkMatrix44::kUninitialized_Constructor);
53 srcToDst.setConcat(as_CSB(dst)->fromXYZD50(), as_CSB(src)->toXYZD50()); 53 const SkMatrix44* toXYZD50 = as_CSB(src)->toXYZD50();
msarett 2016/10/14 21:31:40 Asserts in test code are good. Asserts in *unreac
raftias 2016/10/17 15:28:02 Done. Everywhere else seems to either be test code
54 SkASSERT(toXYZD50);
55 const SkMatrix44* fromXYZD50 = as_CSB(dst)->fromXYZD50();
56 SkASSERT(fromXYZD50);
57 srcToDst.setConcat(*fromXYZD50, *toXYZD50);
54 58
55 if (matrix_is_almost_identity(srcToDst)) { 59 if (matrix_is_almost_identity(srcToDst)) {
56 return nullptr; 60 return nullptr;
57 } 61 }
58 62
59 return sk_make_sp<GrColorSpaceXform>(srcToDst); 63 return sk_make_sp<GrColorSpaceXform>(srcToDst);
60 } 64 }
61 65
62 bool GrColorSpaceXform::Equals(const GrColorSpaceXform* a, const GrColorSpaceXfo rm* b) { 66 bool GrColorSpaceXform::Equals(const GrColorSpaceXform* a, const GrColorSpaceXfo rm* b) {
63 if (a == b) { 67 if (a == b) {
64 return true; 68 return true;
65 } 69 }
66 70
67 if (!a || !b) { 71 if (!a || !b) {
68 return false; 72 return false;
69 } 73 }
70 74
71 return a->fSrcToDst == b->fSrcToDst; 75 return a->fSrcToDst == b->fSrcToDst;
72 } 76 }
73 77
74 GrColor4f GrColorSpaceXform::apply(const GrColor4f& srcColor) { 78 GrColor4f GrColorSpaceXform::apply(const GrColor4f& srcColor) {
75 GrColor4f result; 79 GrColor4f result;
76 fSrcToDst.mapScalars(srcColor.fRGBA, result.fRGBA); 80 fSrcToDst.mapScalars(srcColor.fRGBA, result.fRGBA);
77 return result; 81 return result;
78 } 82 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698