| 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 ... | 378 ... |
| 379 }; | 379 }; |
| 380 ~~~~ | 380 ~~~~ |
| 381 | 381 |
| 382 Method calls within method calls should be prefixed with dereference of the | 382 Method calls within method calls should be prefixed with dereference of the |
| 383 'this' pointer. For example: | 383 'this' pointer. For example: |
| 384 | 384 |
| 385 <!--?prettify?--> | 385 <!--?prettify?--> |
| 386 ~~~~ | 386 ~~~~ |
| 387 this->method(); | 387 this->method(); |
| 388 Memory Management | |
| 389 ~~~~ | |
| 390 | |
| 391 All memory allocation should be routed through SkNEW and its variants. These are | |
| 392 #defined in SkPostConfig.h, but the correct way to get access to the config | |
| 393 system is to #include SkTypes.h, which will allow external users of the library | |
| 394 to provide a custom memory manager or other adaptations. | |
| 395 | |
| 396 <!--?prettify?--> | |
| 397 ~~~~ | |
| 398 SkNEW(type_name) | |
| 399 SkNEW_ARGS(type_name, args) | |
| 400 SkNEW_ARRAY(type_name, count) | |
| 401 SkNEW_PLACEMENT(buf, type_name) | |
| 402 SkNEW_PLACEMENT_ARGS(buf, type_name, args) | |
| 403 SkDELETE(obj) | |
| 404 SkDELETE_ARRAY(array) | |
| 405 ~~~~ | 388 ~~~~ |
| 406 | 389 |
| 407 Comparisons | 390 Comparisons |
| 408 ----------- | 391 ----------- |
| 409 | 392 |
| 410 We prefer that equality operators between lvalues and rvalues place the lvalue | 393 We prefer that equality operators between lvalues and rvalues place the lvalue |
| 411 on the right: | 394 on the right: |
| 412 | 395 |
| 413 <!--?prettify?--> | 396 <!--?prettify?--> |
| 414 ~~~~ | 397 ~~~~ |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 this->drawBitmapRectToRect( | 543 this->drawBitmapRectToRect( |
| 561 bitmap, NULL, dst, paint, kNone_DrawBitmapRectFlag); | 544 bitmap, NULL, dst, paint, kNone_DrawBitmapRectFlag); |
| 562 } | 545 } |
| 563 ~~~~ | 546 ~~~~ |
| 564 | 547 |
| 565 Python | 548 Python |
| 566 ------ | 549 ------ |
| 567 | 550 |
| 568 Python code follows the [Google Python Style Guide](http://google-styleguide.goo
glecode.com/svn/trunk/pyguide.html). | 551 Python code follows the [Google Python Style Guide](http://google-styleguide.goo
glecode.com/svn/trunk/pyguide.html). |
| 569 | 552 |
| OLD | NEW |