OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkCanvasPriv.h" | 9 #include "SkCanvasPriv.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 2726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2737 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect(
)); | 2737 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect(
)); |
2738 picture->playback(this); | 2738 picture->playback(this); |
2739 } else { | 2739 } else { |
2740 this->onDrawPicture(picture, matrix, paint); | 2740 this->onDrawPicture(picture, matrix, paint); |
2741 } | 2741 } |
2742 } | 2742 } |
2743 } | 2743 } |
2744 | 2744 |
2745 void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, | 2745 void SkCanvas::onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, |
2746 const SkPaint* paint) { | 2746 const SkPaint* paint) { |
2747 if (!paint || paint->canComputeFastBounds()) { | |
2748 SkRect bounds = picture->cullRect(); | |
2749 if (paint) { | |
2750 paint->computeFastBounds(bounds, &bounds); | |
2751 } | |
2752 if (matrix) { | |
2753 matrix->mapRect(&bounds); | |
2754 } | |
2755 if (this->quickReject(bounds)) { | |
2756 return; | |
2757 } | |
2758 } | |
2759 | |
2760 SkBaseDevice* device = this->getTopDevice(); | 2747 SkBaseDevice* device = this->getTopDevice(); |
2761 if (device) { | 2748 if (device) { |
2762 // Canvas has to first give the device the opportunity to render | 2749 // Canvas has to first give the device the opportunity to render |
2763 // the picture itself. | 2750 // the picture itself. |
2764 if (device->EXPERIMENTAL_drawPicture(this, picture, matrix, paint)) { | 2751 if (device->EXPERIMENTAL_drawPicture(this, picture, matrix, paint)) { |
2765 return; // the device has rendered the entire picture | 2752 return; // the device has rendered the entire picture |
2766 } | 2753 } |
2767 } | 2754 } |
2768 | 2755 |
2769 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect()); | 2756 SkAutoCanvasMatrixPaint acmp(this, matrix, paint, picture->cullRect()); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2867 } | 2854 } |
2868 | 2855 |
2869 if (matrix) { | 2856 if (matrix) { |
2870 canvas->concat(*matrix); | 2857 canvas->concat(*matrix); |
2871 } | 2858 } |
2872 } | 2859 } |
2873 | 2860 |
2874 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2861 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2875 fCanvas->restoreToCount(fSaveCount); | 2862 fCanvas->restoreToCount(fSaveCount); |
2876 } | 2863 } |
OLD | NEW |