OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2008 The Android Open Source Project | 3 * Copyright 2008 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 "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 2529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2540 if (NULL != device) { | 2540 if (NULL != device) { |
2541 device->EXPERIMENTAL_optimize(picture); | 2541 device->EXPERIMENTAL_optimize(picture); |
2542 } | 2542 } |
2543 } | 2543 } |
2544 | 2544 |
2545 void SkCanvas::drawPicture(SkPicture& picture) { | 2545 void SkCanvas::drawPicture(SkPicture& picture) { |
2546 SkBaseDevice* device = this->getTopDevice(); | 2546 SkBaseDevice* device = this->getTopDevice(); |
2547 if (NULL != device) { | 2547 if (NULL != device) { |
2548 // Canvas has to first give the device the opportunity to render | 2548 // Canvas has to first give the device the opportunity to render |
2549 // the picture itself. | 2549 // the picture itself. |
2550 if (device->EXPERIMENTAL_drawPicture(&picture)) { | 2550 if (device->EXPERIMENTAL_drawPicture(this, &picture)) { |
2551 return; // the device has rendered the entire picture | 2551 return; // the device has rendered the entire picture |
2552 } | 2552 } |
2553 } | 2553 } |
2554 | 2554 |
2555 picture.draw(this); | 2555 picture.draw(this); |
2556 } | 2556 } |
2557 | 2557 |
| 2558 void SkCanvas::EXPERIMENTAL_purge() { |
| 2559 SkBaseDevice* device = this->getTopDevice(); |
| 2560 if (NULL != device) { |
| 2561 device->EXPERIMENTAL_purge(); |
| 2562 } |
| 2563 } |
| 2564 |
2558 /////////////////////////////////////////////////////////////////////////////// | 2565 /////////////////////////////////////////////////////////////////////////////// |
2559 /////////////////////////////////////////////////////////////////////////////// | 2566 /////////////////////////////////////////////////////////////////////////////// |
2560 | 2567 |
2561 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { | 2568 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { |
2562 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small
); | 2569 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small
); |
2563 | 2570 |
2564 SkASSERT(canvas); | 2571 SkASSERT(canvas); |
2565 | 2572 |
2566 fImpl = new (fStorage) SkDrawIter(canvas, skipEmptyClips); | 2573 fImpl = new (fStorage) SkDrawIter(canvas, skipEmptyClips); |
2567 fDone = !fImpl->next(); | 2574 fDone = !fImpl->next(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2648 if (!bitmap.installPixels(info, pixels, rowBytes)) { | 2655 if (!bitmap.installPixels(info, pixels, rowBytes)) { |
2649 return NULL; | 2656 return NULL; |
2650 } | 2657 } |
2651 | 2658 |
2652 // should this functionality be moved into allocPixels()? | 2659 // should this functionality be moved into allocPixels()? |
2653 if (!bitmap.info().isOpaque()) { | 2660 if (!bitmap.info().isOpaque()) { |
2654 bitmap.eraseColor(0); | 2661 bitmap.eraseColor(0); |
2655 } | 2662 } |
2656 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2663 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2657 } | 2664 } |
OLD | NEW |