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 2386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2397 void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength, | 2397 void SkCanvas::drawTextOnPathHV(const void* text, size_t byteLength, |
2398 const SkPath& path, SkScalar hOffset, | 2398 const SkPath& path, SkScalar hOffset, |
2399 SkScalar vOffset, const SkPaint& paint) { | 2399 SkScalar vOffset, const SkPaint& paint) { |
2400 SkMatrix matrix; | 2400 SkMatrix matrix; |
2401 | 2401 |
2402 matrix.setTranslate(hOffset, vOffset); | 2402 matrix.setTranslate(hOffset, vOffset); |
2403 this->drawTextOnPath(text, byteLength, path, &matrix, paint); | 2403 this->drawTextOnPath(text, byteLength, path, &matrix, paint); |
2404 } | 2404 } |
2405 | 2405 |
2406 /////////////////////////////////////////////////////////////////////////////// | 2406 /////////////////////////////////////////////////////////////////////////////// |
| 2407 void SkCanvas::EXPERIMENTAL_optimize(SkPicture* picture) { |
| 2408 SkBaseDevice* device = this->getDevice(); |
| 2409 if (NULL != device) { |
| 2410 device->EXPERIMENTAL_optimize(picture); |
| 2411 } |
| 2412 } |
2407 | 2413 |
2408 void SkCanvas::drawPicture(SkPicture& picture) { | 2414 void SkCanvas::drawPicture(SkPicture& picture) { |
| 2415 SkBaseDevice* device = this->getTopDevice(); |
| 2416 if (NULL != device) { |
| 2417 // Canvas has to first give the device the opportunity to render |
| 2418 // the picture itself. |
| 2419 if (device->EXPERIMENTAL_drawPicture(picture)) { |
| 2420 return; // the device has rendered the entire picture |
| 2421 } |
| 2422 } |
| 2423 |
2409 picture.draw(this); | 2424 picture.draw(this); |
2410 } | 2425 } |
2411 | 2426 |
2412 /////////////////////////////////////////////////////////////////////////////// | 2427 /////////////////////////////////////////////////////////////////////////////// |
2413 /////////////////////////////////////////////////////////////////////////////// | 2428 /////////////////////////////////////////////////////////////////////////////// |
2414 | 2429 |
2415 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { | 2430 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { |
2416 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small
); | 2431 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small
); |
2417 | 2432 |
2418 SkASSERT(canvas); | 2433 SkASSERT(canvas); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2485 if (!bitmap.allocPixels(info)) { | 2500 if (!bitmap.allocPixels(info)) { |
2486 return NULL; | 2501 return NULL; |
2487 } | 2502 } |
2488 | 2503 |
2489 // should this functionality be moved into allocPixels()? | 2504 // should this functionality be moved into allocPixels()? |
2490 if (!bitmap.info().isOpaque()) { | 2505 if (!bitmap.info().isOpaque()) { |
2491 bitmap.eraseColor(0); | 2506 bitmap.eraseColor(0); |
2492 } | 2507 } |
2493 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2508 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2494 } | 2509 } |
OLD | NEW |