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::drawPicture(SkPicture& picture) { |
| 2408 SkBaseDevice* device = this->getDevice(); |
| 2409 if (NULL != device) { |
| 2410 if (device->optimizedRender(picture)) { |
| 2411 return; // the device has rendered the entire picture |
| 2412 } |
| 2413 } |
2407 | 2414 |
2408 void SkCanvas::drawPicture(SkPicture& picture) { | |
2409 picture.draw(this); | 2415 picture.draw(this); |
2410 } | 2416 } |
2411 | 2417 |
2412 /////////////////////////////////////////////////////////////////////////////// | 2418 /////////////////////////////////////////////////////////////////////////////// |
2413 /////////////////////////////////////////////////////////////////////////////// | 2419 /////////////////////////////////////////////////////////////////////////////// |
2414 | 2420 |
2415 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { | 2421 SkCanvas::LayerIter::LayerIter(SkCanvas* canvas, bool skipEmptyClips) { |
2416 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small
); | 2422 SK_COMPILE_ASSERT(sizeof(fStorage) >= sizeof(SkDrawIter), fStorage_too_small
); |
2417 | 2423 |
2418 SkASSERT(canvas); | 2424 SkASSERT(canvas); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2485 if (!bitmap.allocPixels(info)) { | 2491 if (!bitmap.allocPixels(info)) { |
2486 return NULL; | 2492 return NULL; |
2487 } | 2493 } |
2488 | 2494 |
2489 // should this functionality be moved into allocPixels()? | 2495 // should this functionality be moved into allocPixels()? |
2490 if (!bitmap.info().isOpaque()) { | 2496 if (!bitmap.info().isOpaque()) { |
2491 bitmap.eraseColor(0); | 2497 bitmap.eraseColor(0); |
2492 } | 2498 } |
2493 return SkNEW_ARGS(SkCanvas, (bitmap)); | 2499 return SkNEW_ARGS(SkCanvas, (bitmap)); |
2494 } | 2500 } |
OLD | NEW |