Index: src/core/SkColorSpace_Base.h |
diff --git a/src/core/SkColorSpace_Base.h b/src/core/SkColorSpace_Base.h |
index 6cfbb8c837bf4b3a398e59523d551cb795f3b8bb..f4507732b5eaf8b623b270441e0d859bce8d75cc 100644 |
--- a/src/core/SkColorSpace_Base.h |
+++ b/src/core/SkColorSpace_Base.h |
@@ -70,38 +70,57 @@ struct SkGammas : SkRefCnt { |
}; |
bool isNamed(int i) const { |
- SkASSERT(0 <= i && i < 3); |
- return (&fRedType)[i] == Type::kNamed_Type; |
+ return Type::kNamed_Type == this->type(i); |
} |
bool isValue(int i) const { |
- SkASSERT(0 <= i && i < 3); |
- return (&fRedType)[i] == Type::kValue_Type; |
+ return Type::kValue_Type == this->type(i); |
} |
bool isTable(int i) const { |
- SkASSERT(0 <= i && i < 3); |
- return (&fRedType)[i] == Type::kTable_Type; |
+ return Type::kTable_Type == this->type(i); |
} |
bool isParametric(int i) const { |
- SkASSERT(0 <= i && i < 3); |
- return (&fRedType)[i] == Type::kParam_Type; |
+ return Type::kParam_Type == this->type(i); |
} |
const Data& data(int i) const { |
- SkASSERT(0 <= i && i < 3); |
- return (&fRedData)[i]; |
+ switch (i) { |
+ case 0: |
+ return fRedData; |
+ case 1: |
+ return fGreenData; |
+ case 2: |
+ return fBlueData; |
+ default: |
+ SkASSERT(false); |
+ return fRedData; |
+ } |
} |
const float* table(int i) const { |
SkASSERT(isTable(i)); |
- return (&fRedData)[i].fTable.table(this); |
+ return this->data(i).fTable.table(this); |
} |
const Params& params(int i) const { |
SkASSERT(isParametric(i)); |
- return (&fRedData)[i].params(this); |
+ return this->data(i).params(this); |
+ } |
+ |
+ Type type(int i) const { |
+ switch (i) { |
+ case 0: |
+ return fRedType; |
+ case 1: |
+ return fGreenType; |
+ case 2: |
+ return fBlueType; |
+ default: |
+ SkASSERT(false); |
+ return fRedType; |
+ } |
} |
SkGammas() |