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, | 622 void drawColor(SkColor color, SkXfermode::Mode mode = SkXfermode::kSrcOver_M
ode); |
623 SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode); | |
624 | 623 |
625 /** | 624 // TODO: remove virtual when chrome subclass stop overriding this. |
626 * This erases the entire drawing surface to the specified color, | 625 virtual void clear(SkColor color) { |
627 * irrespective of the clip. It does not blend with the previous pixels, | 626 this->drawColor(color, SkXfermode::kSrc_Mode); |
628 * but always overwrites them. | 627 } |
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); | |
640 | 628 |
641 /** | 629 /** |
642 * This makes the contents of the canvas undefined. Subsequent calls that | 630 * This makes the contents of the canvas undefined. Subsequent calls that |
643 * require reading the canvas contents will produce undefined results. Examp
les | 631 * require reading the canvas contents will produce undefined results. Examp
les |
644 * include blending and readPixels. The actual implementation is backend- | 632 * include blending and readPixels. The actual implementation is backend- |
645 * dependent and one legal implementation is to do nothing. Like clear(), th
is | 633 * dependent and one legal implementation is to do nothing. Like clear(), th
is |
646 * ignores the clip. | 634 * ignores the clip. |
647 * | 635 * |
648 * This function should only be called if the caller intends to subsequently | 636 * This function should only be called if the caller intends to subsequently |
649 * draw to the canvas. The canvas may do real work at discard() time in orde
r | 637 * 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... |
1548 | 1536 |
1549 class SkCanvasClipVisitor { | 1537 class SkCanvasClipVisitor { |
1550 public: | 1538 public: |
1551 virtual ~SkCanvasClipVisitor(); | 1539 virtual ~SkCanvasClipVisitor(); |
1552 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1540 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1553 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1541 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1554 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1542 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1555 }; | 1543 }; |
1556 | 1544 |
1557 #endif | 1545 #endif |
OLD | NEW |