OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkDrawCommand.h" | 10 #include "SkDrawCommand.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 case kDrawImageRect_OpType: return "DrawImageRect"; | 41 case kDrawImageRect_OpType: return "DrawImageRect"; |
42 case kDrawOval_OpType: return "DrawOval"; | 42 case kDrawOval_OpType: return "DrawOval"; |
43 case kDrawPaint_OpType: return "DrawPaint"; | 43 case kDrawPaint_OpType: return "DrawPaint"; |
44 case kDrawPatch_OpType: return "DrawPatch"; | 44 case kDrawPatch_OpType: return "DrawPatch"; |
45 case kDrawPath_OpType: return "DrawPath"; | 45 case kDrawPath_OpType: return "DrawPath"; |
46 case kDrawPoints_OpType: return "DrawPoints"; | 46 case kDrawPoints_OpType: return "DrawPoints"; |
47 case kDrawPosText_OpType: return "DrawPosText"; | 47 case kDrawPosText_OpType: return "DrawPosText"; |
48 case kDrawPosTextH_OpType: return "DrawPosTextH"; | 48 case kDrawPosTextH_OpType: return "DrawPosTextH"; |
49 case kDrawRect_OpType: return "DrawRect"; | 49 case kDrawRect_OpType: return "DrawRect"; |
50 case kDrawRRect_OpType: return "DrawRRect"; | 50 case kDrawRRect_OpType: return "DrawRRect"; |
51 case kDrawSprite_OpType: return "DrawSprite"; | |
52 case kDrawText_OpType: return "DrawText"; | 51 case kDrawText_OpType: return "DrawText"; |
53 case kDrawTextBlob_OpType: return "DrawTextBlob"; | 52 case kDrawTextBlob_OpType: return "DrawTextBlob"; |
54 case kDrawTextOnPath_OpType: return "DrawTextOnPath"; | 53 case kDrawTextOnPath_OpType: return "DrawTextOnPath"; |
55 case kDrawVertices_OpType: return "DrawVertices"; | 54 case kDrawVertices_OpType: return "DrawVertices"; |
56 case kEndDrawPicture_OpType: return "EndDrawPicture"; | 55 case kEndDrawPicture_OpType: return "EndDrawPicture"; |
57 case kRestore_OpType: return "Restore"; | 56 case kRestore_OpType: return "Restore"; |
58 case kSave_OpType: return "Save"; | 57 case kSave_OpType: return "Save"; |
59 case kSaveLayer_OpType: return "SaveLayer"; | 58 case kSaveLayer_OpType: return "SaveLayer"; |
60 case kSetMatrix_OpType: return "SetMatrix"; | 59 case kSetMatrix_OpType: return "SetMatrix"; |
61 default: | 60 default: |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 | 791 |
793 void SkDrawDRRectCommand::execute(SkCanvas* canvas) const { | 792 void SkDrawDRRectCommand::execute(SkCanvas* canvas) const { |
794 canvas->drawDRRect(fOuter, fInner, fPaint); | 793 canvas->drawDRRect(fOuter, fInner, fPaint); |
795 } | 794 } |
796 | 795 |
797 bool SkDrawDRRectCommand::render(SkCanvas* canvas) const { | 796 bool SkDrawDRRectCommand::render(SkCanvas* canvas) const { |
798 render_drrect(canvas, fOuter, fInner); | 797 render_drrect(canvas, fOuter, fInner); |
799 return true; | 798 return true; |
800 } | 799 } |
801 | 800 |
802 SkDrawSpriteCommand::SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int t
op, | |
803 const SkPaint* paint) | |
804 : INHERITED(kDrawSprite_OpType) { | |
805 fBitmap = bitmap; | |
806 fLeft = left; | |
807 fTop = top; | |
808 if (paint) { | |
809 fPaint = *paint; | |
810 fPaintPtr = &fPaint; | |
811 } else { | |
812 fPaintPtr = nullptr; | |
813 } | |
814 | |
815 fInfo.push(SkObjectParser::BitmapToString(bitmap)); | |
816 fInfo.push(SkObjectParser::IntToString(left, "Left: ")); | |
817 fInfo.push(SkObjectParser::IntToString(top, "Top: ")); | |
818 if (paint) { | |
819 fInfo.push(SkObjectParser::PaintToString(*paint)); | |
820 } | |
821 } | |
822 | |
823 void SkDrawSpriteCommand::execute(SkCanvas* canvas) const { | |
824 canvas->drawSprite(fBitmap, fLeft, fTop, fPaintPtr); | |
825 } | |
826 | |
827 bool SkDrawSpriteCommand::render(SkCanvas* canvas) const { | |
828 render_bitmap(canvas, fBitmap); | |
829 return true; | |
830 } | |
831 | |
832 SkDrawTextCommand::SkDrawTextCommand(const void* text, size_t byteLength, SkScal
ar x, SkScalar y, | 801 SkDrawTextCommand::SkDrawTextCommand(const void* text, size_t byteLength, SkScal
ar x, SkScalar y, |
833 const SkPaint& paint) | 802 const SkPaint& paint) |
834 : INHERITED(kDrawText_OpType) { | 803 : INHERITED(kDrawText_OpType) { |
835 fText = new char[byteLength]; | 804 fText = new char[byteLength]; |
836 memcpy(fText, text, byteLength); | 805 memcpy(fText, text, byteLength); |
837 fByteLength = byteLength; | 806 fByteLength = byteLength; |
838 fX = x; | 807 fX = x; |
839 fY = y; | 808 fY = y; |
840 fPaint = paint; | 809 fPaint = paint; |
841 | 810 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 | 971 |
1003 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { | 972 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { |
1004 fUserMatrix = userMatrix; | 973 fUserMatrix = userMatrix; |
1005 } | 974 } |
1006 | 975 |
1007 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { | 976 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { |
1008 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); | 977 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); |
1009 canvas->setMatrix(temp); | 978 canvas->setMatrix(temp); |
1010 } | 979 } |
1011 | 980 |
OLD | NEW |