| 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 "SkMatrixParts.h" | 10 #include "SkMatrixParts.h" |
| 11 #include "SkAnimateMaker.h" | 11 #include "SkAnimateMaker.h" |
| 12 #include "SkDrawMatrix.h" | 12 #include "SkDrawMatrix.h" |
| 13 #include "SkDrawRectangle.h" | 13 #include "SkDrawRectangle.h" |
| 14 #include "SkDrawPath.h" | 14 #include "SkDrawPath.h" |
| 15 | 15 |
| 16 SkMatrixPart::SkMatrixPart() : fMatrix(NULL) { | 16 SkMatrixPart::SkMatrixPart() : fMatrix(nullptr) { |
| 17 } | 17 } |
| 18 | 18 |
| 19 void SkMatrixPart::dirty() { | 19 void SkMatrixPart::dirty() { |
| 20 fMatrix->dirty(); | 20 fMatrix->dirty(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 SkDisplayable* SkMatrixPart::getParent() const { | 23 SkDisplayable* SkMatrixPart::getParent() const { |
| 24 return fMatrix; | 24 return fMatrix; |
| 25 } | 25 } |
| 26 | 26 |
| 27 bool SkMatrixPart::setParent(SkDisplayable* parent) { | 27 bool SkMatrixPart::setParent(SkDisplayable* parent) { |
| 28 SkASSERT(parent != NULL); | 28 SkASSERT(parent != nullptr); |
| 29 if (parent->isMatrix() == false) | 29 if (parent->isMatrix() == false) |
| 30 return true; | 30 return true; |
| 31 fMatrix = (SkDrawMatrix*) parent; | 31 fMatrix = (SkDrawMatrix*) parent; |
| 32 return false; | 32 return false; |
| 33 } | 33 } |
| 34 | 34 |
| 35 | 35 |
| 36 #if SK_USE_CONDENSED_INFO == 0 | 36 #if SK_USE_CONDENSED_INFO == 0 |
| 37 | 37 |
| 38 const SkMemberInfo SkRotate::fInfo[] = { | 38 const SkMemberInfo SkRotate::fInfo[] = { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 SK_MEMBER(mode, FromPathMode), | 124 SK_MEMBER(mode, FromPathMode), |
| 125 SK_MEMBER(offset, Float), | 125 SK_MEMBER(offset, Float), |
| 126 SK_MEMBER(path, Path) | 126 SK_MEMBER(path, Path) |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 #endif | 129 #endif |
| 130 | 130 |
| 131 DEFINE_GET_MEMBER(SkFromPath); | 131 DEFINE_GET_MEMBER(SkFromPath); |
| 132 | 132 |
| 133 SkFromPath::SkFromPath() : | 133 SkFromPath::SkFromPath() : |
| 134 mode(0), offset(0), path(NULL) { | 134 mode(0), offset(0), path(nullptr) { |
| 135 } | 135 } |
| 136 | 136 |
| 137 SkFromPath::~SkFromPath() { | 137 SkFromPath::~SkFromPath() { |
| 138 } | 138 } |
| 139 | 139 |
| 140 bool SkFromPath::add() { | 140 bool SkFromPath::add() { |
| 141 if (path == NULL) | 141 if (path == nullptr) |
| 142 return true; | 142 return true; |
| 143 static const uint8_t gFlags[] = { | 143 static const uint8_t gFlags[] = { |
| 144 SkPathMeasure::kGetPosAndTan_MatrixFlag, // normal | 144 SkPathMeasure::kGetPosAndTan_MatrixFlag, // normal |
| 145 SkPathMeasure::kGetTangent_MatrixFlag, // angle | 145 SkPathMeasure::kGetTangent_MatrixFlag, // angle |
| 146 SkPathMeasure::kGetPosition_MatrixFlag // position | 146 SkPathMeasure::kGetPosition_MatrixFlag // position |
| 147 }; | 147 }; |
| 148 if ((unsigned)mode >= SK_ARRAY_COUNT(gFlags)) | 148 if ((unsigned)mode >= SK_ARRAY_COUNT(gFlags)) |
| 149 return true; | 149 return true; |
| 150 SkMatrix result; | 150 SkMatrix result; |
| 151 fPathMeasure.setPath(&path->getPath(), false); | 151 fPathMeasure.setPath(&path->getPath(), false); |
| 152 if (fPathMeasure.getMatrix(offset, &result, (SkPathMeasure::MatrixFlags)gFla
gs[mode])) | 152 if (fPathMeasure.getMatrix(offset, &result, (SkPathMeasure::MatrixFlags)gFla
gs[mode])) |
| 153 fMatrix->set(result); | 153 fMatrix->set(result); |
| 154 return false; | 154 return false; |
| 155 } | 155 } |
| 156 | 156 |
| 157 | 157 |
| 158 #if SK_USE_CONDENSED_INFO == 0 | 158 #if SK_USE_CONDENSED_INFO == 0 |
| 159 | 159 |
| 160 const SkMemberInfo SkRectToRect::fInfo[] = { | 160 const SkMemberInfo SkRectToRect::fInfo[] = { |
| 161 SK_MEMBER(destination, Rect), | 161 SK_MEMBER(destination, Rect), |
| 162 SK_MEMBER(source, Rect) | 162 SK_MEMBER(source, Rect) |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 #endif | 165 #endif |
| 166 | 166 |
| 167 DEFINE_GET_MEMBER(SkRectToRect); | 167 DEFINE_GET_MEMBER(SkRectToRect); |
| 168 | 168 |
| 169 SkRectToRect::SkRectToRect() : | 169 SkRectToRect::SkRectToRect() : |
| 170 source(NULL), destination(NULL) { | 170 source(nullptr), destination(nullptr) { |
| 171 } | 171 } |
| 172 | 172 |
| 173 SkRectToRect::~SkRectToRect() { | 173 SkRectToRect::~SkRectToRect() { |
| 174 } | 174 } |
| 175 | 175 |
| 176 bool SkRectToRect::add() { | 176 bool SkRectToRect::add() { |
| 177 if (source == NULL || destination == NULL) | 177 if (source == nullptr || destination == nullptr) |
| 178 return true; | 178 return true; |
| 179 SkMatrix temp; | 179 SkMatrix temp; |
| 180 temp.setRectToRect(source->fRect, destination->fRect, | 180 temp.setRectToRect(source->fRect, destination->fRect, |
| 181 SkMatrix::kFill_ScaleToFit); | 181 SkMatrix::kFill_ScaleToFit); |
| 182 fMatrix->set(temp); | 182 fMatrix->set(temp); |
| 183 return false; | 183 return false; |
| 184 } | 184 } |
| 185 | 185 |
| 186 #ifdef SK_DUMP_ENABLED | 186 #ifdef SK_DUMP_ENABLED |
| 187 void SkRectToRect::dump(SkAnimateMaker* maker) { | 187 void SkRectToRect::dump(SkAnimateMaker* maker) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 201 destination->dump(maker); | 201 destination->dump(maker); |
| 202 SkDisplayList::fIndent -= 4; | 202 SkDisplayList::fIndent -= 4; |
| 203 SkDebugf("%*s</destination>\n", SkDisplayList::fIndent, ""); | 203 SkDebugf("%*s</destination>\n", SkDisplayList::fIndent, ""); |
| 204 } | 204 } |
| 205 SkDisplayList::fIndent -= 4; | 205 SkDisplayList::fIndent -= 4; |
| 206 dumpEnd(maker); | 206 dumpEnd(maker); |
| 207 } | 207 } |
| 208 #endif | 208 #endif |
| 209 | 209 |
| 210 const SkMemberInfo* SkRectToRect::preferredChild(SkDisplayTypes ) { | 210 const SkMemberInfo* SkRectToRect::preferredChild(SkDisplayTypes ) { |
| 211 if (source == NULL) | 211 if (source == nullptr) |
| 212 return getMember("source"); // !!! cwap! need to refer to member through
enum like kScope instead | 212 return getMember("source"); // !!! cwap! need to refer to member through
enum like kScope instead |
| 213 else { | 213 else { |
| 214 SkASSERT(destination == NULL); | 214 SkASSERT(destination == nullptr); |
| 215 return getMember("destination"); | 215 return getMember("destination"); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 | 219 |
| 220 #if SK_USE_CONDENSED_INFO == 0 | 220 #if SK_USE_CONDENSED_INFO == 0 |
| 221 | 221 |
| 222 const SkMemberInfo SkPolyToPoly::fInfo[] = { | 222 const SkMemberInfo SkPolyToPoly::fInfo[] = { |
| 223 SK_MEMBER(destination, Polygon), | 223 SK_MEMBER(destination, Polygon), |
| 224 SK_MEMBER(source, Polygon) | 224 SK_MEMBER(source, Polygon) |
| 225 }; | 225 }; |
| 226 | 226 |
| 227 #endif | 227 #endif |
| 228 | 228 |
| 229 DEFINE_GET_MEMBER(SkPolyToPoly); | 229 DEFINE_GET_MEMBER(SkPolyToPoly); |
| 230 | 230 |
| 231 SkPolyToPoly::SkPolyToPoly() : source(NULL), destination(NULL) { | 231 SkPolyToPoly::SkPolyToPoly() : source(nullptr), destination(nullptr) { |
| 232 } | 232 } |
| 233 | 233 |
| 234 SkPolyToPoly::~SkPolyToPoly() { | 234 SkPolyToPoly::~SkPolyToPoly() { |
| 235 } | 235 } |
| 236 | 236 |
| 237 bool SkPolyToPoly::add() { | 237 bool SkPolyToPoly::add() { |
| 238 SkASSERT(source); | 238 SkASSERT(source); |
| 239 SkASSERT(destination); | 239 SkASSERT(destination); |
| 240 SkPoint src[4]; | 240 SkPoint src[4]; |
| 241 SkPoint dst[4]; | 241 SkPoint dst[4]; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 #endif | 276 #endif |
| 277 | 277 |
| 278 void SkPolyToPoly::onEndElement(SkAnimateMaker& ) { | 278 void SkPolyToPoly::onEndElement(SkAnimateMaker& ) { |
| 279 SkASSERT(source); | 279 SkASSERT(source); |
| 280 SkASSERT(destination); | 280 SkASSERT(destination); |
| 281 if (source->childHasID() || destination->childHasID()) | 281 if (source->childHasID() || destination->childHasID()) |
| 282 fMatrix->setChildHasID(); | 282 fMatrix->setChildHasID(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 const SkMemberInfo* SkPolyToPoly::preferredChild(SkDisplayTypes ) { | 285 const SkMemberInfo* SkPolyToPoly::preferredChild(SkDisplayTypes ) { |
| 286 if (source == NULL) | 286 if (source == nullptr) |
| 287 return getMember("source"); // !!! cwap! need to refer to member through
enum like kScope instead | 287 return getMember("source"); // !!! cwap! need to refer to member through
enum like kScope instead |
| 288 else { | 288 else { |
| 289 SkASSERT(destination == NULL); | 289 SkASSERT(destination == nullptr); |
| 290 return getMember("destination"); | 290 return getMember("destination"); |
| 291 } | 291 } |
| 292 } | 292 } |
| OLD | NEW |