| OLD | NEW |
| 1 Coding Style Guidelines | 1 Coding Style Guidelines |
| 2 ======================= | 2 ======================= |
| 3 | 3 |
| 4 These conventions have evolved over time. Some of the earlier code in both | 4 These conventions have evolved over time. Some of the earlier code in both |
| 5 projects doesn’t strictly adhere to the guidelines. However, as the code evolves | 5 projects doesn’t strictly adhere to the guidelines. However, as the code evolves |
| 6 we hope to make the existing code conform to the guildelines. | 6 we hope to make the existing code conform to the guildelines. |
| 7 | 7 |
| 8 Files | 8 Files |
| 9 ----- | 9 ----- |
| 10 | 10 |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 ... | 369 ... |
| 370 }; | 370 }; |
| 371 ~~~~ | 371 ~~~~ |
| 372 | 372 |
| 373 Method calls within method calls should be prefixed with dereference of the | 373 Method calls within method calls should be prefixed with dereference of the |
| 374 'this' pointer. For example: | 374 'this' pointer. For example: |
| 375 | 375 |
| 376 <!--?prettify?--> | 376 <!--?prettify?--> |
| 377 ~~~~ | 377 ~~~~ |
| 378 this->method(); | 378 this->method(); |
| 379 Memory Managemt | 379 Memory Management |
| 380 ~~~~ | 380 ~~~~ |
| 381 | 381 |
| 382 All memory allocation should be routed through SkNEW and its variants. These are | 382 All memory allocation should be routed through SkNEW and its variants. These are |
| 383 #defined in SkPostConfig.h, but the correct way to get access to the config | 383 #defined in SkPostConfig.h, but the correct way to get access to the config |
| 384 system is to #include SkTypes.h, which will allow external users of the library | 384 system is to #include SkTypes.h, which will allow external users of the library |
| 385 to provide a custom memory manager or other adaptations. | 385 to provide a custom memory manager or other adaptations. |
| 386 | 386 |
| 387 <!--?prettify?--> | 387 <!--?prettify?--> |
| 388 ~~~~ | 388 ~~~~ |
| 389 SkNEW(type_name) | 389 SkNEW(type_name) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 for packing or performance reasons. | 449 for packing or performance reasons. |
| 450 | 450 |
| 451 NULL, 0 | 451 NULL, 0 |
| 452 ------- | 452 ------- |
| 453 | 453 |
| 454 Use NULL for pointers, 0 for ints. We prefer explicit NULL comparisons when | 454 Use NULL for pointers, 0 for ints. We prefer explicit NULL comparisons when |
| 455 checking for NULL pointers (as documentation): | 455 checking for NULL pointers (as documentation): |
| 456 | 456 |
| 457 <!--?prettify?--> | 457 <!--?prettify?--> |
| 458 ~~~~ | 458 ~~~~ |
| 459 if (NULL == x) { // slightly preferred over if (x) | 459 if (NULL == x) { // slightly preferred over if (!x) |
| 460 ... | 460 ... |
| 461 } | 461 } |
| 462 ~~~~ | 462 ~~~~ |
| 463 | 463 |
| 464 When checking non-NULL pointers explicit comparisons are not required because it | 464 When checking non-NULL pointers explicit comparisons are not required because it |
| 465 reads like a double negative: | 465 reads like a double negative: |
| 466 | 466 |
| 467 <!--?prettify?--> | 467 <!--?prettify?--> |
| 468 ~~~~ | 468 ~~~~ |
| 469 if (x) { // slightly preferred over if (NULL != x) | 469 if (x) { // slightly preferred over if (NULL != x) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 this->drawBitmapRectToRect( | 551 this->drawBitmapRectToRect( |
| 552 bitmap, NULL, dst, paint, kNone_DrawBitmapRectFlag); | 552 bitmap, NULL, dst, paint, kNone_DrawBitmapRectFlag); |
| 553 } | 553 } |
| 554 ~~~~ | 554 ~~~~ |
| 555 | 555 |
| 556 Python | 556 Python |
| 557 ------ | 557 ------ |
| 558 | 558 |
| 559 Python code follows the [Google Python Style Guide](http://google-styleguide.goo
glecode.com/svn/trunk/pyguide.html). | 559 Python code follows the [Google Python Style Guide](http://google-styleguide.goo
glecode.com/svn/trunk/pyguide.html). |
| 560 | 560 |
| OLD | NEW |