| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkDrawColor.h" | 10 #include "SkDrawColor.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 #endif | 119 #endif |
| 120 | 120 |
| 121 DEFINE_GET_MEMBER(SkDrawColor); | 121 DEFINE_GET_MEMBER(SkDrawColor); |
| 122 | 122 |
| 123 SkDrawColor::SkDrawColor() : fDirty(false) { | 123 SkDrawColor::SkDrawColor() : fDirty(false) { |
| 124 color = SK_ColorBLACK; | 124 color = SK_ColorBLACK; |
| 125 fHue = fSaturation = fValue = SK_ScalarNaN; | 125 fHue = fSaturation = fValue = SK_ScalarNaN; |
| 126 } | 126 } |
| 127 | 127 |
| 128 bool SkDrawColor::add() { | 128 bool SkDrawColor::add() { |
| 129 if (fPaint->color != NULL) | 129 if (fPaint->color != nullptr) |
| 130 return true; // error (probably color in paint as attribute as well) | 130 return true; // error (probably color in paint as attribute as well) |
| 131 fPaint->color = this; | 131 fPaint->color = this; |
| 132 fPaint->fOwnsColor = true; | 132 fPaint->fOwnsColor = true; |
| 133 return false; | 133 return false; |
| 134 } | 134 } |
| 135 | 135 |
| 136 SkDisplayable* SkDrawColor::deepCopy(SkAnimateMaker*) { | 136 SkDisplayable* SkDrawColor::deepCopy(SkAnimateMaker*) { |
| 137 SkDrawColor* copy = new SkDrawColor(); | 137 SkDrawColor* copy = new SkDrawColor(); |
| 138 copy->color = color; | 138 copy->color = color; |
| 139 copy->fHue = fHue; | 139 copy->fHue = fHue; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 204 } |
| 205 value->fOperand.fScalar = result; | 205 value->fOperand.fScalar = result; |
| 206 return true; | 206 return true; |
| 207 } | 207 } |
| 208 | 208 |
| 209 void SkDrawColor::onEndElement(SkAnimateMaker&) { | 209 void SkDrawColor::onEndElement(SkAnimateMaker&) { |
| 210 fDirty = true; | 210 fDirty = true; |
| 211 } | 211 } |
| 212 | 212 |
| 213 bool SkDrawColor::setParent(SkDisplayable* parent) { | 213 bool SkDrawColor::setParent(SkDisplayable* parent) { |
| 214 SkASSERT(parent != NULL); | 214 SkASSERT(parent != nullptr); |
| 215 if (parent->getType() == SkType_DrawLinearGradient || parent->getType() == S
kType_DrawRadialGradient) | 215 if (parent->getType() == SkType_DrawLinearGradient || parent->getType() == S
kType_DrawRadialGradient) |
| 216 return false; | 216 return false; |
| 217 if (parent->isPaint() == false) | 217 if (parent->isPaint() == false) |
| 218 return true; | 218 return true; |
| 219 fPaint = (SkDrawPaint*) parent; | 219 fPaint = (SkDrawPaint*) parent; |
| 220 return false; | 220 return false; |
| 221 } | 221 } |
| 222 | 222 |
| 223 bool SkDrawColor::setProperty(int index, SkScriptValue& value) { | 223 bool SkDrawColor::setProperty(int index, SkScriptValue& value) { |
| 224 SkASSERT(value.fType == SkType_Float); | 224 SkASSERT(value.fType == SkType_Float); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 case SK_PROPERTY(value): | 256 case SK_PROPERTY(value): |
| 257 fValue = scalar;//RGB_to_HSV(color, kGetValue); | 257 fValue = scalar;//RGB_to_HSV(color, kGetValue); |
| 258 fDirty = true; | 258 fDirty = true; |
| 259 break; | 259 break; |
| 260 default: | 260 default: |
| 261 SkASSERT(0); | 261 SkASSERT(0); |
| 262 return false; | 262 return false; |
| 263 } | 263 } |
| 264 return true; | 264 return true; |
| 265 } | 265 } |
| OLD | NEW |