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 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 } | 1765 } |
1766 | 1766 |
1767 void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src, const SkRe
ct& dst, | 1767 void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src, const SkRe
ct& dst, |
1768 const SkPaint* paint, SrcRectConstraint constraint)
{ | 1768 const SkPaint* paint, SrcRectConstraint constraint)
{ |
1769 if (dst.isEmpty()) { | 1769 if (dst.isEmpty()) { |
1770 return; | 1770 return; |
1771 } | 1771 } |
1772 this->onDrawImageRect(image, src, dst, paint SRC_RECT_CONSTRAINT_ARG(constra
int)); | 1772 this->onDrawImageRect(image, src, dst, paint SRC_RECT_CONSTRAINT_ARG(constra
int)); |
1773 } | 1773 } |
1774 | 1774 |
1775 void SkCanvas::drawImageRect(const SkImage* image, const SkIRect& isrc, const Sk
Rect& dst, | |
1776 const SkPaint* paint, SrcRectConstraint constraint)
{ | |
1777 SkRect src = SkRect::Make(isrc); | |
1778 this->drawImageRect(image, &src, dst, paint, constraint); | |
1779 } | |
1780 | |
1781 void SkCanvas::drawImageNine(const SkImage* image, const SkIRect& center, const
SkRect& dst, | 1775 void SkCanvas::drawImageNine(const SkImage* image, const SkIRect& center, const
SkRect& dst, |
1782 const SkPaint* paint) { | 1776 const SkPaint* paint) { |
1783 if (dst.isEmpty()) { | 1777 if (dst.isEmpty()) { |
1784 return; | 1778 return; |
1785 } | 1779 } |
1786 if (!SkNinePatchIter::Valid(image->width(), image->height(), center)) { | 1780 if (!SkNinePatchIter::Valid(image->width(), image->height(), center)) { |
1787 this->drawImageRect(image, NULL, dst, paint); | 1781 this->drawImageRect(image, NULL, dst, paint); |
1788 } | 1782 } |
1789 this->onDrawImageNine(image, center, dst, paint); | 1783 this->onDrawImageNine(image, center, dst, paint); |
1790 } | 1784 } |
1791 | 1785 |
1792 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, cons
t SkPaint* paint) { | 1786 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, cons
t SkPaint* paint) { |
1793 if (bitmap.drawsNothing()) { | 1787 if (bitmap.drawsNothing()) { |
1794 return; | 1788 return; |
1795 } | 1789 } |
1796 this->onDrawBitmap(bitmap, dx, dy, paint); | 1790 this->onDrawBitmap(bitmap, dx, dy, paint); |
1797 } | 1791 } |
1798 | 1792 |
1799 #ifdef SK_SUPPORT_LEGACY_DRAWBITMAPRECTFLAGS_TYPE | |
1800 void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, c
onst SkRect& dst, | 1793 void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, c
onst SkRect& dst, |
1801 const SkPaint* paint, DrawBitmapRectFlags fl
ags) { | 1794 const SkPaint* paint, DrawBitmapRectFlags fl
ags) { |
1802 if (bitmap.drawsNothing() || dst.isEmpty()) { | 1795 if (bitmap.drawsNothing() || dst.isEmpty()) { |
1803 return; | 1796 return; |
1804 } | 1797 } |
1805 this->onDrawBitmapRect(bitmap, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_TYPE)
flags); | 1798 this->onDrawBitmapRect(bitmap, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_TYPE)
flags); |
1806 } | 1799 } |
1807 #endif | |
1808 | 1800 |
1809 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const S
kRect& dst, | 1801 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const S
kRect& dst, |
1810 const SkPaint* paint, SrcRectConstraint constraint
) { | 1802 const SkPaint* paint, SrcRectConstraint constraint
) { |
1811 if (bitmap.drawsNothing() || dst.isEmpty()) { | 1803 if (bitmap.drawsNothing() || dst.isEmpty()) { |
1812 return; | 1804 return; |
1813 } | 1805 } |
1814 this->onDrawBitmapRect(bitmap, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_TYPE)
constraint); | 1806 this->onDrawBitmapRect(bitmap, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_TYPE)
constraint); |
1815 } | 1807 } |
1816 | 1808 |
1817 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, const
SkRect& dst, | |
1818 const SkPaint* paint, SrcRectConstraint constraint
) { | |
1819 SkRect src = SkRect::Make(isrc); | |
1820 this->drawBitmapRect(bitmap, &src, dst, paint, constraint); | |
1821 } | |
1822 | |
1823 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con
st SkRect& dst, | 1809 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con
st SkRect& dst, |
1824 const SkPaint* paint) { | 1810 const SkPaint* paint) { |
1825 if (bitmap.drawsNothing() || dst.isEmpty()) { | 1811 if (bitmap.drawsNothing() || dst.isEmpty()) { |
1826 return; | 1812 return; |
1827 } | 1813 } |
1828 if (!SkNinePatchIter::Valid(bitmap.width(), bitmap.height(), center)) { | 1814 if (!SkNinePatchIter::Valid(bitmap.width(), bitmap.height(), center)) { |
1829 this->drawBitmapRect(bitmap, dst, paint); | 1815 this->drawBitmapRect(bitmap, dst, paint); |
1830 } | 1816 } |
1831 this->onDrawBitmapNine(bitmap, center, dst, paint); | 1817 this->onDrawBitmapNine(bitmap, center, dst, paint); |
1832 } | 1818 } |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2783 } | 2769 } |
2784 | 2770 |
2785 if (matrix) { | 2771 if (matrix) { |
2786 canvas->concat(*matrix); | 2772 canvas->concat(*matrix); |
2787 } | 2773 } |
2788 } | 2774 } |
2789 | 2775 |
2790 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2776 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2791 fCanvas->restoreToCount(fSaveCount); | 2777 fCanvas->restoreToCount(fSaveCount); |
2792 } | 2778 } |
OLD | NEW |