Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: src/core/SkCanvas.cpp

Issue 1239193002: remove all guards for changes to drawBitmapRect / drawImageRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 1843
1844 void SkCanvas::drawImage(const SkImage* image, SkScalar x, SkScalar y, const SkP aint* paint) { 1844 void SkCanvas::drawImage(const SkImage* image, SkScalar x, SkScalar y, const SkP aint* paint) {
1845 this->onDrawImage(image, x, y, paint); 1845 this->onDrawImage(image, x, y, paint);
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, constraint);
1854 } 1854 }
1855 1855
1856 void SkCanvas::drawImageRect(const SkImage* image, const SkIRect& isrc, const Sk Rect& dst, 1856 void SkCanvas::drawImageRect(const SkImage* image, const SkIRect& isrc, const Sk Rect& dst,
1857 const SkPaint* paint, SrcRectConstraint constraint) { 1857 const SkPaint* paint, SrcRectConstraint constraint) {
1858 SkRect src = SkRect::Make(isrc); 1858 SkRect src = SkRect::Make(isrc);
1859 this->drawImageRect(image, &src, dst, paint, constraint); 1859 this->drawImageRect(image, &src, dst, paint, constraint);
1860 } 1860 }
1861 1861
1862 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,
1863 const SkPaint* paint) { 1863 const SkPaint* paint) {
1864 if (dst.isEmpty()) { 1864 if (dst.isEmpty()) {
1865 return; 1865 return;
1866 } 1866 }
1867 if (!SkNinePatchIter::Valid(image->width(), image->height(), center)) { 1867 if (!SkNinePatchIter::Valid(image->width(), image->height(), center)) {
1868 this->drawImageRect(image, NULL, dst, paint); 1868 this->drawImageRect(image, NULL, dst, paint);
1869 } 1869 }
1870 this->onDrawImageNine(image, center, dst, paint); 1870 this->onDrawImageNine(image, center, dst, paint);
1871 } 1871 }
1872 1872
1873 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) {
1874 if (bitmap.drawsNothing()) { 1874 if (bitmap.drawsNothing()) {
1875 return; 1875 return;
1876 } 1876 }
1877 this->onDrawBitmap(bitmap, dx, dy, paint); 1877 this->onDrawBitmap(bitmap, dx, dy, paint);
1878 } 1878 }
1879 1879
1880 #ifdef SK_SUPPORT_LEGACY_DRAWBITMAPRECTFLAGS_TYPE
1881 void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, c onst SkRect& dst,
1882 const SkPaint* paint, DrawBitmapRectFlags fl ags) {
1883 if (bitmap.drawsNothing() || dst.isEmpty()) {
1884 return;
1885 }
1886 this->onDrawBitmapRect(bitmap, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_TYPE) flags);
1887 }
1888 #endif
1889
1890 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const S kRect& dst, 1880 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const S kRect& dst,
1891 const SkPaint* paint, SrcRectConstraint constraint ) { 1881 const SkPaint* paint, SrcRectConstraint constraint ) {
1892 if (bitmap.drawsNothing() || dst.isEmpty()) { 1882 if (bitmap.drawsNothing() || dst.isEmpty()) {
1893 return; 1883 return;
1894 } 1884 }
1895 this->onDrawBitmapRect(bitmap, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_TYPE) constraint); 1885 this->onDrawBitmapRect(bitmap, src, dst, paint, constraint);
1896 } 1886 }
1897 1887
1898 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, const SkRect& dst, 1888 void SkCanvas::drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, const SkRect& dst,
1899 const SkPaint* paint, SrcRectConstraint constraint ) { 1889 const SkPaint* paint, SrcRectConstraint constraint ) {
1900 SkRect src = SkRect::Make(isrc); 1890 SkRect src = SkRect::Make(isrc);
1901 this->drawBitmapRect(bitmap, &src, dst, paint, constraint); 1891 this->drawBitmapRect(bitmap, &src, dst, paint, constraint);
1902 } 1892 }
1903 1893
1904 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con st SkRect& dst, 1894 void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, con st SkRect& dst,
1905 const SkPaint* paint) { 1895 const SkPaint* paint) {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2138 LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, &bounds) 2128 LOOPER_BEGIN(*paint, SkDrawFilter::kBitmap_Type, &bounds)
2139 2129
2140 while (iter.next()) { 2130 while (iter.next()) {
2141 iter.fDevice->drawImage(iter, image, x, y, looper.paint()); 2131 iter.fDevice->drawImage(iter, image, x, y, looper.paint());
2142 } 2132 }
2143 2133
2144 LOOPER_END 2134 LOOPER_END
2145 } 2135 }
2146 2136
2147 void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk Rect& dst, 2137 void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk Rect& dst,
2148 const SkPaint* paint SRC_RECT_CONSTRAINT_PARAM(co nstraint)) { 2138 const SkPaint* paint, SrcRectConstraint constrain t) {
2149 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageRect()"); 2139 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageRect()");
2150 SRC_RECT_CONSTRAINT_LOCAL_DEFAULT(constraint)
2151 SkRect storage; 2140 SkRect storage;
2152 const SkRect* bounds = &dst; 2141 const SkRect* bounds = &dst;
2153 if (NULL == paint || paint->canComputeFastBounds()) { 2142 if (NULL == paint || paint->canComputeFastBounds()) {
2154 if (paint) { 2143 if (paint) {
2155 bounds = &paint->computeFastBounds(dst, &storage); 2144 bounds = &paint->computeFastBounds(dst, &storage);
2156 } 2145 }
2157 if (this->quickReject(*bounds)) { 2146 if (this->quickReject(*bounds)) {
2158 return; 2147 return;
2159 } 2148 }
2160 } 2149 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
2217 2206
2218 SkLazyPaint lazy; 2207 SkLazyPaint lazy;
2219 if (NULL == paint) { 2208 if (NULL == paint) {
2220 paint = lazy.init(); 2209 paint = lazy.init();
2221 } 2210 }
2222 2211
2223 LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(*paint, SkDrawFilter::kBitmap_Type, bo unds, 2212 LOOPER_BEGIN_CHECK_COMPLETE_OVERWRITE(*paint, SkDrawFilter::kBitmap_Type, bo unds,
2224 bitmap.isOpaque()) 2213 bitmap.isOpaque())
2225 2214
2226 while (iter.next()) { 2215 while (iter.next()) {
2227 iter.fDevice->drawBitmapRect(iter, bitmap, src, dst, looper.paint(), 2216 iter.fDevice->drawBitmapRect(iter, bitmap, src, dst, looper.paint(), con straint);
2228 (SK_VIRTUAL_CONSTRAINT_TYPE)constraint);
2229 } 2217 }
2230 2218
2231 LOOPER_END 2219 LOOPER_END
2232 } 2220 }
2233 2221
2234 void SkCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst, 2222 void SkCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
2235 const SkPaint* paint, SK_VIRTUAL_CONSTRAINT_TYPE constraint) { 2223 const SkPaint* paint, SrcRectConstraint constrai nt) {
2236 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapRectToRect()") ; 2224 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapRectToRect()") ;
2237 SkDEBUGCODE(bitmap.validate();) 2225 SkDEBUGCODE(bitmap.validate();)
2238 this->internalDrawBitmapRect(bitmap, src, dst, paint, (SrcRectConstraint)con straint); 2226 this->internalDrawBitmapRect(bitmap, src, dst, paint, constraint);
2239 } 2227 }
2240 2228
2241 void SkCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, cons t SkRect& dst, 2229 void SkCanvas::onDrawImageNine(const SkImage* image, const SkIRect& center, cons t SkRect& dst,
2242 const SkPaint* paint) { 2230 const SkPaint* paint) {
2243 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageNine()"); 2231 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageNine()");
2244 2232
2245 SkRect storage; 2233 SkRect storage;
2246 const SkRect* bounds = &dst; 2234 const SkRect* bounds = &dst;
2247 if (NULL == paint || paint->canComputeFastBounds()) { 2235 if (NULL == paint || paint->canComputeFastBounds()) {
2248 if (paint) { 2236 if (paint) {
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
2866 } 2854 }
2867 2855
2868 if (matrix) { 2856 if (matrix) {
2869 canvas->concat(*matrix); 2857 canvas->concat(*matrix);
2870 } 2858 }
2871 } 2859 }
2872 2860
2873 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2861 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2874 fCanvas->restoreToCount(fSaveCount); 2862 fCanvas->restoreToCount(fSaveCount);
2875 } 2863 }
OLDNEW
« no previous file with comments | « src/core/SkBitmapDevice.cpp ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698