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 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1846 } | 1846 } |
1847 | 1847 |
1848 void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src, const SkRe
ct& dst, | 1848 void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src, const SkRe
ct& dst, |
1849 const SkPaint* paint, SrcRectConstraint constraint)
{ | 1849 const SkPaint* paint, SrcRectConstraint constraint)
{ |
1850 if (dst.isEmpty()) { | 1850 if (dst.isEmpty()) { |
1851 return; | 1851 return; |
1852 } | 1852 } |
1853 this->onDrawImageRect(image, src, dst, paint SRC_RECT_CONSTRAINT_ARG(constra
int)); | 1853 this->onDrawImageRect(image, src, dst, paint SRC_RECT_CONSTRAINT_ARG(constra
int)); |
1854 } | 1854 } |
1855 | 1855 |
| 1856 void SkCanvas::drawImageRect(const SkImage* image, const SkIRect& isrc, const Sk
Rect& dst, |
| 1857 const SkPaint* paint, SrcRectConstraint constraint)
{ |
| 1858 SkRect src = SkRect::Make(isrc); |
| 1859 this->drawImageRect(image, &src, dst, paint, constraint); |
| 1860 } |
| 1861 |
1856 void SkCanvas::drawImageNine(const SkImage* image, const SkIRect& center, const
SkRect& dst, | 1862 void SkCanvas::drawImageNine(const SkImage* image, const SkIRect& center, const
SkRect& dst, |
1857 const SkPaint* paint) { | 1863 const SkPaint* paint) { |
1858 if (dst.isEmpty()) { | 1864 if (dst.isEmpty()) { |
1859 return; | 1865 return; |
1860 } | 1866 } |
1861 if (!SkNinePatchIter::Valid(image->width(), image->height(), center)) { | 1867 if (!SkNinePatchIter::Valid(image->width(), image->height(), center)) { |
1862 this->drawImageRect(image, NULL, dst, paint); | 1868 this->drawImageRect(image, NULL, dst, paint); |
1863 } | 1869 } |
1864 this->onDrawImageNine(image, center, dst, paint); | 1870 this->onDrawImageNine(image, center, dst, paint); |
1865 } | 1871 } |
1866 | 1872 |
1867 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, cons
t SkPaint* paint) { | 1873 void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, cons
t SkPaint* paint) { |
1868 if (bitmap.drawsNothing()) { | 1874 if (bitmap.drawsNothing()) { |
1869 return; | 1875 return; |
1870 } | 1876 } |
1871 this->onDrawBitmap(bitmap, dx, dy, paint); | 1877 this->onDrawBitmap(bitmap, dx, dy, paint); |
1872 } | 1878 } |
1873 | 1879 |
| 1880 #ifdef SK_SUPPORT_LEGACY_DRAWBITMAPRECTFLAGS_TYPE |
1874 void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, c
onst SkRect& dst, | 1881 void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, c
onst SkRect& dst, |
1875 const SkPaint* paint, DrawBitmapRectFlags fl
ags) { | 1882 const SkPaint* paint, DrawBitmapRectFlags fl
ags) { |
1876 if (bitmap.drawsNothing() || dst.isEmpty()) { | 1883 if (bitmap.drawsNothing() || dst.isEmpty()) { |
1877 return; | 1884 return; |
1878 } | 1885 } |
1879 this->onDrawBitmapRect(bitmap, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_TYPE)
flags); | 1886 this->onDrawBitmapRect(bitmap, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_TYPE)
flags); |
1880 } | 1887 } |
| 1888 #endif |
1881 | 1889 |
1882 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const S
kRect& dst, | 1890 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const S
kRect& dst, |
1883 const SkPaint* paint, SrcRectConstraint constraint
) { | 1891 const SkPaint* paint, SrcRectConstraint constraint
) { |
1884 if (bitmap.drawsNothing() || dst.isEmpty()) { | 1892 if (bitmap.drawsNothing() || dst.isEmpty()) { |
1885 return; | 1893 return; |
1886 } | 1894 } |
1887 this->onDrawBitmapRect(bitmap, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_TYPE)
constraint); | 1895 this->onDrawBitmapRect(bitmap, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_TYPE)
constraint); |
1888 } | 1896 } |
1889 | 1897 |
| 1898 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, const
SkRect& dst, |
| 1899 const SkPaint* paint, SrcRectConstraint constraint
) { |
| 1900 SkRect src = SkRect::Make(isrc); |
| 1901 this->drawBitmapRect(bitmap, &src, dst, paint, constraint); |
| 1902 } |
| 1903 |
1890 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con
st SkRect& dst, | 1904 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con
st SkRect& dst, |
1891 const SkPaint* paint) { | 1905 const SkPaint* paint) { |
1892 if (bitmap.drawsNothing() || dst.isEmpty()) { | 1906 if (bitmap.drawsNothing() || dst.isEmpty()) { |
1893 return; | 1907 return; |
1894 } | 1908 } |
1895 if (!SkNinePatchIter::Valid(bitmap.width(), bitmap.height(), center)) { | 1909 if (!SkNinePatchIter::Valid(bitmap.width(), bitmap.height(), center)) { |
1896 this->drawBitmapRect(bitmap, dst, paint); | 1910 this->drawBitmapRect(bitmap, dst, paint); |
1897 } | 1911 } |
1898 this->onDrawBitmapNine(bitmap, center, dst, paint); | 1912 this->onDrawBitmapNine(bitmap, center, dst, paint); |
1899 } | 1913 } |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2852 } | 2866 } |
2853 | 2867 |
2854 if (matrix) { | 2868 if (matrix) { |
2855 canvas->concat(*matrix); | 2869 canvas->concat(*matrix); |
2856 } | 2870 } |
2857 } | 2871 } |
2858 | 2872 |
2859 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2873 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2860 fCanvas->restoreToCount(fSaveCount); | 2874 fCanvas->restoreToCount(fSaveCount); |
2861 } | 2875 } |
OLD | NEW |