OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 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 #ifndef SkCanvas_DEFINED | 8 #ifndef SkCanvas_DEFINED |
9 #define SkCanvas_DEFINED | 9 #define SkCanvas_DEFINED |
10 | 10 |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 @param mode the mode to apply the color in (defaults to SrcOver) | 612 @param mode the mode to apply the color in (defaults to SrcOver) |
613 */ | 613 */ |
614 void drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, | 614 void drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, |
615 SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode); | 615 SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode); |
616 | 616 |
617 /** Fill the entire canvas' bitmap (restricted to the current clip) with the | 617 /** Fill the entire canvas' bitmap (restricted to the current clip) with the |
618 specified color and mode. | 618 specified color and mode. |
619 @param color the color to draw with | 619 @param color the color to draw with |
620 @param mode the mode to apply the color in (defaults to SrcOver) | 620 @param mode the mode to apply the color in (defaults to SrcOver) |
621 */ | 621 */ |
622 void drawColor(SkColor color, SkXfermode::Mode mode = SkXfermode::kSrcOver_M
ode); | 622 void drawColor(SkColor color, |
| 623 SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode); |
623 | 624 |
624 // TODO: remove virtual when chrome subclass stop overriding this. | 625 /** |
625 virtual void clear(SkColor color) { | 626 * This erases the entire drawing surface to the specified color, |
626 this->drawColor(color, SkXfermode::kSrc_Mode); | 627 * irrespective of the clip. It does not blend with the previous pixels, |
627 } | 628 * but always overwrites them. |
| 629 * |
| 630 * It is roughly equivalent to the following: |
| 631 * canvas.save(); |
| 632 * canvas.clipRect(hugeRect, kReplace_Op); |
| 633 * paint.setColor(color); |
| 634 * paint.setXfermodeMode(kSrc_Mode); |
| 635 * canvas.drawPaint(paint); |
| 636 * canvas.restore(); |
| 637 * though it is almost always much more efficient. |
| 638 */ |
| 639 virtual void clear(SkColor); |
628 | 640 |
629 /** | 641 /** |
630 * This makes the contents of the canvas undefined. Subsequent calls that | 642 * This makes the contents of the canvas undefined. Subsequent calls that |
631 * require reading the canvas contents will produce undefined results. Examp
les | 643 * require reading the canvas contents will produce undefined results. Examp
les |
632 * include blending and readPixels. The actual implementation is backend- | 644 * include blending and readPixels. The actual implementation is backend- |
633 * dependent and one legal implementation is to do nothing. Like clear(), th
is | 645 * dependent and one legal implementation is to do nothing. Like clear(), th
is |
634 * ignores the clip. | 646 * ignores the clip. |
635 * | 647 * |
636 * This function should only be called if the caller intends to subsequently | 648 * This function should only be called if the caller intends to subsequently |
637 * draw to the canvas. The canvas may do real work at discard() time in orde
r | 649 * draw to the canvas. The canvas may do real work at discard() time in orde
r |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 | 1548 |
1537 class SkCanvasClipVisitor { | 1549 class SkCanvasClipVisitor { |
1538 public: | 1550 public: |
1539 virtual ~SkCanvasClipVisitor(); | 1551 virtual ~SkCanvasClipVisitor(); |
1540 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1552 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1541 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1553 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1542 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1554 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1543 }; | 1555 }; |
1544 | 1556 |
1545 #endif | 1557 #endif |
OLD | NEW |