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 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2454 void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength, | 2454 void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength, |
2455 const SkPath& path, SkScalar hOffset, | 2455 const SkPath& path, SkScalar hOffset, |
2456 SkScalar vOffset, const SkPaint& paint) { | 2456 SkScalar vOffset, const SkPaint& paint) { |
2457 SkMatrix matrix; | 2457 SkMatrix matrix; |
2458 | 2458 |
2459 matrix.setTranslate(hOffset, vOffset); | 2459 matrix.setTranslate(hOffset, vOffset); |
2460 this->drawTextOnPath(text, byteLength, path, &matrix, paint); | 2460 this->drawTextOnPath(text, byteLength, path, &matrix, paint); |
2461 } | 2461 } |
2462 | 2462 |
2463 /////////////////////////////////////////////////////////////////////////////// | 2463 /////////////////////////////////////////////////////////////////////////////// |
| 2464 void SkCanvas::EXPERIMENTAL_optimize(SkPicture* picture) { |
| 2465 SkBaseDevice* device = this->getDevice(); |
| 2466 if (NULL != device) { |
| 2467 device->EXPERIMENTAL_optimize(picture); |
| 2468 } |
| 2469 } |
2464 | 2470 |
2465 void SkCanvas::drawPicture(SkPicture& picture) { | 2471 void SkCanvas::drawPicture(SkPicture& picture) { |
| 2472 SkBaseDevice* device = this->getTopDevice(); |
| 2473 if (NULL != device) { |
| 2474 // Canvas has to first give the device the opportunity to render |
| 2475 // the picture itself. |
| 2476 if (device->EXPERIMENTAL_drawPicture(picture)) { |
| 2477 return; // the device has rendered the entire picture |
| 2478 } |
| 2479 } |
| 2480 |
2466 picture.draw(this); | 2481 picture.draw(this); |
2467 } | 2482 } |
2468 | 2483 |
2469 /////////////////////////////////////////////////////////////////////////////// | 2484 /////////////////////////////////////////////////////////////////////////////// |
2470 /////////////////////////////////////////////////////////////////////////////// | 2485 /////////////////////////////////////////////////////////////////////////////// |
2471 | 2486 |
2472 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { | 2487 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { |
2473 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small
); | 2488 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small
); |
2474 | 2489 |
2475 SkASSERT(canvas); | 2490 SkASSERT(canvas); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2542 if (!bitmap.allocPixels(info)) { | 2557 if (!bitmap.allocPixels(info)) { |
2543 return NULL; | 2558 return NULL; |
2544 } | 2559 } |
2545 | 2560 |
2546 // should this functionality be moved into allocPixels()? | 2561 // should this functionality be moved into allocPixels()? |
2547 if (!bitmap.info().isOpaque()) { | 2562 if (!bitmap.info().isOpaque()) { |
2548 bitmap.eraseColor(0); | 2563 bitmap.eraseColor(0); |
2549 } | 2564 } |
2550 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2565 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2551 } | 2566 } |
OLD | NEW |