| 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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
| (...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1839 } | 1839 } |
| 1840 | 1840 |
| 1841 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { | 1841 void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) { |
| 1842 this->onDrawPath(path, paint); | 1842 this->onDrawPath(path, paint); |
| 1843 } | 1843 } |
| 1844 | 1844 |
| 1845 void SkCanvas::drawImage(const SkImage* image, SkScalar x, SkScalar y, const SkP
aint* paint) { | 1845 void SkCanvas::drawImage(const SkImage* image, SkScalar x, SkScalar y, const SkP
aint* paint) { |
| 1846 this->onDrawImage(image, x, y, paint); | 1846 this->onDrawImage(image, x, y, paint); |
| 1847 } | 1847 } |
| 1848 | 1848 |
| 1849 #ifdef SK_SUPPORT_LEGACY_SRCPTR_DRAWIMAGERECT | |
| 1850 void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src, const SkRe
ct& dst, | |
| 1851 const SkPaint* paint, SrcRectConstraint constraint)
{ | |
| 1852 if (dst.isEmpty()) { | |
| 1853 return; | |
| 1854 } | |
| 1855 this->onDrawImageRect(image, src, dst, paint, constraint); | |
| 1856 } | |
| 1857 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const S
kRect& dst, | |
| 1858 const SkPaint* paint, SrcRectConstraint constraint
) { | |
| 1859 if (bitmap.drawsNothing() || dst.isEmpty()) { | |
| 1860 return; | |
| 1861 } | |
| 1862 this->onDrawBitmapRect(bitmap, src, dst, paint, constraint); | |
| 1863 } | |
| 1864 #endif | |
| 1865 | |
| 1866 void SkCanvas::drawImageRect(const SkImage* image, const SkRect& src, const SkRe
ct& dst, | 1849 void SkCanvas::drawImageRect(const SkImage* image, const SkRect& src, const SkRe
ct& dst, |
| 1867 const SkPaint* paint, SrcRectConstraint constraint)
{ | 1850 const SkPaint* paint, SrcRectConstraint constraint)
{ |
| 1868 if (dst.isEmpty() || src.isEmpty()) { | 1851 if (dst.isEmpty() || src.isEmpty()) { |
| 1869 return; | 1852 return; |
| 1870 } | 1853 } |
| 1871 this->onDrawImageRect(image, &src, dst, paint, constraint); | 1854 this->onDrawImageRect(image, &src, dst, paint, constraint); |
| 1872 } | 1855 } |
| 1873 | 1856 |
| 1874 void SkCanvas::drawImageRect(const SkImage* image, const SkIRect& isrc, const Sk
Rect& dst, | 1857 void SkCanvas::drawImageRect(const SkImage* image, const SkIRect& isrc, const Sk
Rect& dst, |
| 1875 const SkPaint* paint, SrcRectConstraint constraint)
{ | 1858 const SkPaint* paint, SrcRectConstraint constraint)
{ |
| 1876 this->drawImageRect(image, SkRect::Make(isrc), dst, paint, constraint); | 1859 this->drawImageRect(image, SkRect::Make(isrc), dst, paint, constraint); |
| 1877 } | 1860 } |
| 1878 | 1861 |
| 1879 #ifdef SK_SUPPORT_LEGACY_SIMPLE_DRAWIMAGERECT | |
| 1880 void SkCanvas::drawImageRect(const SkImage* image, const SkRect& dst, const SkPa
int* paint) { | |
| 1881 this->drawImageRect(image, SkRect::MakeIWH(image->width(), image->height()),
dst, paint); | |
| 1882 } | |
| 1883 #else | |
| 1884 void SkCanvas::drawImageRect(const SkImage* image, const SkRect& dst, const SkPa
int* paint, | 1862 void SkCanvas::drawImageRect(const SkImage* image, const SkRect& dst, const SkPa
int* paint, |
| 1885 SrcRectConstraint constraint) { | 1863 SrcRectConstraint constraint) { |
| 1886 this->drawImageRect(image, SkRect::MakeIWH(image->width(), image->height()),
dst, paint, | 1864 this->drawImageRect(image, SkRect::MakeIWH(image->width(), image->height()),
dst, paint, |
| 1887 constraint); | 1865 constraint); |
| 1888 } | 1866 } |
| 1889 #endif | |
| 1890 | 1867 |
| 1891 void SkCanvas::drawImageNine(const SkImage* image, const SkIRect& center, const
SkRect& dst, | 1868 void SkCanvas::drawImageNine(const SkImage* image, const SkIRect& center, const
SkRect& dst, |
| 1892 const SkPaint* paint) { | 1869 const SkPaint* paint) { |
| 1893 if (dst.isEmpty()) { | 1870 if (dst.isEmpty()) { |
| 1894 return; | 1871 return; |
| 1895 } | 1872 } |
| 1896 if (!SkNinePatchIter::Valid(image->width(), image->height(), center)) { | 1873 if (!SkNinePatchIter::Valid(image->width(), image->height(), center)) { |
| 1897 this->drawImageRect(image, dst, paint); | 1874 this->drawImageRect(image, dst, paint); |
| 1898 } | 1875 } |
| 1899 this->onDrawImageNine(image, center, dst, paint); | 1876 this->onDrawImageNine(image, center, dst, paint); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1912 return; | 1889 return; |
| 1913 } | 1890 } |
| 1914 this->onDrawBitmapRect(bitmap, &src, dst, paint, constraint); | 1891 this->onDrawBitmapRect(bitmap, &src, dst, paint, constraint); |
| 1915 } | 1892 } |
| 1916 | 1893 |
| 1917 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, const
SkRect& dst, | 1894 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, const
SkRect& dst, |
| 1918 const SkPaint* paint, SrcRectConstraint constraint
) { | 1895 const SkPaint* paint, SrcRectConstraint constraint
) { |
| 1919 this->drawBitmapRect(bitmap, SkRect::Make(isrc), dst, paint, constraint); | 1896 this->drawBitmapRect(bitmap, SkRect::Make(isrc), dst, paint, constraint); |
| 1920 } | 1897 } |
| 1921 | 1898 |
| 1922 #ifdef SK_SUPPORT_LEGACY_SIMPLE_DRAWIMAGERECT | |
| 1923 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, const S
kPaint* paint) { | |
| 1924 this->drawBitmapRect(bitmap, SkRect::MakeIWH(bitmap.width(), bitmap.height()
), dst, paint); | |
| 1925 } | |
| 1926 #else | |
| 1927 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, const S
kPaint* paint, | 1899 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, const S
kPaint* paint, |
| 1928 SrcRectConstraint constraint) { | 1900 SrcRectConstraint constraint) { |
| 1929 this->drawBitmapRect(bitmap, SkRect::MakeIWH(bitmap.width(), bitmap.height()
), dst, paint, | 1901 this->drawBitmapRect(bitmap, SkRect::MakeIWH(bitmap.width(), bitmap.height()
), dst, paint, |
| 1930 constraint); | 1902 constraint); |
| 1931 } | 1903 } |
| 1932 #endif | |
| 1933 | 1904 |
| 1934 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con
st SkRect& dst, | 1905 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con
st SkRect& dst, |
| 1935 const SkPaint* paint) { | 1906 const SkPaint* paint) { |
| 1936 if (bitmap.drawsNothing() || dst.isEmpty()) { | 1907 if (bitmap.drawsNothing() || dst.isEmpty()) { |
| 1937 return; | 1908 return; |
| 1938 } | 1909 } |
| 1939 if (!SkNinePatchIter::Valid(bitmap.width(), bitmap.height(), center)) { | 1910 if (!SkNinePatchIter::Valid(bitmap.width(), bitmap.height(), center)) { |
| 1940 this->drawBitmapRect(bitmap, dst, paint); | 1911 this->drawBitmapRect(bitmap, dst, paint); |
| 1941 } | 1912 } |
| 1942 this->onDrawBitmapNine(bitmap, center, dst, paint); | 1913 this->onDrawBitmapNine(bitmap, center, dst, paint); |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2913 } | 2884 } |
| 2914 | 2885 |
| 2915 if (matrix) { | 2886 if (matrix) { |
| 2916 canvas->concat(*matrix); | 2887 canvas->concat(*matrix); |
| 2917 } | 2888 } |
| 2918 } | 2889 } |
| 2919 | 2890 |
| 2920 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2891 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
| 2921 fCanvas->restoreToCount(fSaveCount); | 2892 fCanvas->restoreToCount(fSaveCount); |
| 2922 } | 2893 } |
| OLD | NEW |