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

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

Issue 980273002: Revert of Add image as a draw type that can be filtered (Closed) Base URL: https://skia.googlesource.com/skia.git@skimage-filters-04-snapshot-devices-and-use-snapshots-in-skcanvas
Patch Set: Created 5 years, 9 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 | « include/core/SkDrawFilter.h ('k') | tests/SkImageTest.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 1830 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 1841
1842 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, bounds) 1842 LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, bounds)
1843 1843
1844 while (iter.next()) { 1844 while (iter.next()) {
1845 iter.fDevice->drawPath(iter, path, looper.paint()); 1845 iter.fDevice->drawPath(iter, path, looper.paint());
1846 } 1846 }
1847 1847
1848 LOOPER_END 1848 LOOPER_END
1849 } 1849 }
1850 1850
1851 void SkCanvas::onDrawImage(const SkImage* image, SkScalar dx, SkScalar dy, 1851 void SkCanvas::onDrawImage(const SkImage* image, SkScalar dx, SkScalar dy, const SkPaint* paint) {
1852 const SkPaint* paint) {
1853 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImage()"); 1852 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImage()");
1854 1853 image->draw(this, dx, dy, paint);
1855 SkRect bounds = SkRect::MakeXYWH(dx, dy, image->width(), image->height());
1856 if (NULL == paint || paint->canComputeFastBounds()) {
1857 if (NULL != paint) {
1858 paint->computeFastBounds(bounds, &bounds);
1859 }
1860 if (this->quickReject(bounds)) {
1861 return;
1862 }
1863 }
1864
1865 SkLazyPaint lazy;
1866 if (NULL == paint) {
1867 paint = lazy.init();
1868 }
1869
1870 LOOPER_BEGIN(*paint, SkDrawFilter::kImage_Type, &bounds)
1871
1872 while (iter.next()) {
1873 SkPaint p = looper.paint();
1874 p.setLooper(NULL);
1875 image->draw(this, dx, dy, &p);
1876 }
1877
1878 LOOPER_END
1879 } 1854 }
1880 1855
1881 void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk Rect& dst, 1856 void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const Sk Rect& dst,
1882 const SkPaint* paint) { 1857 const SkPaint* paint) {
1883 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageRect()"); 1858 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageRect()");
1884 SkRect storage; 1859 image->drawRect(this, src, dst, paint);
1885 const SkRect* bounds = &dst;
1886 if (NULL == paint || paint->canComputeFastBounds()) {
1887 if (NULL != paint) {
1888 bounds = &paint->computeFastBounds(dst, &storage);
1889 }
1890 if (this->quickReject(*bounds)) {
1891 return;
1892 }
1893 }
1894
1895 SkLazyPaint lazy;
1896 if (NULL == paint) {
1897 paint = lazy.init();
1898 }
1899
1900 LOOPER_BEGIN(*paint, SkDrawFilter::kImage_Type, bounds)
1901
1902 while (iter.next()) {
1903 SkPaint p = looper.paint();
1904 p.setLooper(NULL);
1905 image->drawRect(this, src, dst, &p);
1906 }
1907
1908 LOOPER_END
1909 } 1860 }
1910 1861
1911 void SkCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, cons t SkPaint* paint) { 1862 void SkCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, cons t SkPaint* paint) {
1912 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmap()"); 1863 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmap()");
1913 SkDEBUGCODE(bitmap.validate();) 1864 SkDEBUGCODE(bitmap.validate();)
1914 1865
1915 if (NULL == paint || paint->canComputeFastBounds()) { 1866 if (NULL == paint || paint->canComputeFastBounds()) {
1916 SkRect bounds = { 1867 SkRect bounds = {
1917 x, y, 1868 x, y,
1918 x + SkIntToScalar(bitmap.width()), 1869 x + SkIntToScalar(bitmap.width()),
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
2572 } 2523 }
2573 2524
2574 if (matrix) { 2525 if (matrix) {
2575 canvas->concat(*matrix); 2526 canvas->concat(*matrix);
2576 } 2527 }
2577 } 2528 }
2578 2529
2579 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { 2530 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
2580 fCanvas->restoreToCount(fSaveCount); 2531 fCanvas->restoreToCount(fSaveCount);
2581 } 2532 }
OLDNEW
« no previous file with comments | « include/core/SkDrawFilter.h ('k') | tests/SkImageTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698