Chromium Code Reviews| 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 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1794 this->onDrawBitmapNine(bitmap, center, dst, paint); | 1794 this->onDrawBitmapNine(bitmap, center, dst, paint); |
| 1795 } | 1795 } |
| 1796 | 1796 |
| 1797 void SkCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, const SkPai nt* paint) { | 1797 void SkCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, const SkPai nt* paint) { |
| 1798 if (bitmap.empty()) { | 1798 if (bitmap.empty()) { |
| 1799 return; | 1799 return; |
| 1800 } | 1800 } |
| 1801 this->onDrawSprite(bitmap, left, top, paint); | 1801 this->onDrawSprite(bitmap, left, top, paint); |
| 1802 } | 1802 } |
| 1803 | 1803 |
| 1804 void SkCanvas::drawAtlas(const SkImage* atlas, const SkRSXform xform[], const Sk Rect tex[], | |
| 1805 const SkColor colors[], int count, SkXfermode::Mode mod e, | |
| 1806 const SkRect* cull, const SkPaint* paint) { | |
| 1807 if (count <= 0) { | |
| 1808 return; | |
| 1809 } | |
| 1810 SkASSERT(atlas); | |
| 1811 SkASSERT(xform); | |
| 1812 SkASSERT(tex); | |
| 1813 this->onDrawAtlas(atlas, xform, tex, colors, count, mode, cull, paint); | |
| 1814 } | |
| 1815 | |
| 1804 ////////////////////////////////////////////////////////////////////////////// | 1816 ////////////////////////////////////////////////////////////////////////////// |
| 1805 // These are the virtual drawing methods | 1817 // These are the virtual drawing methods |
| 1806 ////////////////////////////////////////////////////////////////////////////// | 1818 ////////////////////////////////////////////////////////////////////////////// |
| 1807 | 1819 |
| 1808 void SkCanvas::onDiscard() { | 1820 void SkCanvas::onDiscard() { |
| 1809 if (fSurfaceBase) { | 1821 if (fSurfaceBase) { |
| 1810 fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode); | 1822 fSurfaceBase->aboutToDraw(SkSurface::kDiscard_ContentChangeMode); |
| 1811 } | 1823 } |
| 1812 } | 1824 } |
| 1813 | 1825 |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2442 void SkCanvas::drawDrawable(SkDrawable* dr) { | 2454 void SkCanvas::drawDrawable(SkDrawable* dr) { |
| 2443 if (dr && !this->quickReject(dr->getBounds())) { | 2455 if (dr && !this->quickReject(dr->getBounds())) { |
| 2444 this->onDrawDrawable(dr); | 2456 this->onDrawDrawable(dr); |
| 2445 } | 2457 } |
| 2446 } | 2458 } |
| 2447 | 2459 |
| 2448 void SkCanvas::onDrawDrawable(SkDrawable* dr) { | 2460 void SkCanvas::onDrawDrawable(SkDrawable* dr) { |
| 2449 dr->draw(this); | 2461 dr->draw(this); |
| 2450 } | 2462 } |
| 2451 | 2463 |
| 2464 void SkCanvas::onDrawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[], | |
| 2465 const SkColor colors[], int count, SkXfermode::Mode m ode, | |
| 2466 const SkRect* cull, const SkPaint* paint) { | |
|
robertphillips
2015/06/24 15:11:02
Why not quickReject in the non-virtual method ?
reed1
2015/06/24 16:17:48
We don't seem to do that for any calls (afaik). Th
robertphillips
2015/06/24 16:26:26
Don't we do it for drawDrawable & drawPath (just l
| |
| 2467 if (cull && this->quickReject(*cull)) { | |
| 2468 return; | |
| 2469 } | |
| 2470 | |
| 2471 SkPaint pnt; | |
| 2472 if (paint) { | |
| 2473 pnt = *paint; | |
| 2474 } | |
| 2475 | |
| 2476 LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, NULL) | |
| 2477 while (iter.next()) { | |
| 2478 iter.fDevice->drawAtlas(iter, atlas, xform, tex, colors, count, mode, pn t); | |
| 2479 } | |
| 2480 LOOPER_END | |
| 2481 } | |
| 2482 | |
| 2452 ////////////////////////////////////////////////////////////////////////////// | 2483 ////////////////////////////////////////////////////////////////////////////// |
| 2453 // These methods are NOT virtual, and therefore must call back into virtual | 2484 // These methods are NOT virtual, and therefore must call back into virtual |
| 2454 // methods, rather than actually drawing themselves. | 2485 // methods, rather than actually drawing themselves. |
| 2455 ////////////////////////////////////////////////////////////////////////////// | 2486 ////////////////////////////////////////////////////////////////////////////// |
| 2456 | 2487 |
| 2457 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, | 2488 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, |
| 2458 SkXfermode::Mode mode) { | 2489 SkXfermode::Mode mode) { |
| 2459 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawARGB()"); | 2490 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawARGB()"); |
| 2460 SkPaint paint; | 2491 SkPaint paint; |
| 2461 | 2492 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2712 } | 2743 } |
| 2713 | 2744 |
| 2714 if (matrix) { | 2745 if (matrix) { |
| 2715 canvas->concat(*matrix); | 2746 canvas->concat(*matrix); |
| 2716 } | 2747 } |
| 2717 } | 2748 } |
| 2718 | 2749 |
| 2719 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2750 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
| 2720 fCanvas->restoreToCount(fSaveCount); | 2751 fCanvas->restoreToCount(fSaveCount); |
| 2721 } | 2752 } |
| OLD | NEW |