| 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 #ifndef SKDRAWCOMMAND_H_ | 9 #ifndef SKDRAWCOMMAND_H_ |
| 10 #define SKDRAWCOMMAND_H_ | 10 #define SKDRAWCOMMAND_H_ |
| 11 | 11 |
| 12 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
| 13 #include "SkString.h" | 13 #include "SkString.h" |
| 14 | 14 |
| 15 class SK_API SkDrawCommand { | 15 class SK_API SkDrawCommand { |
| 16 public: | 16 public: |
| 17 enum OpType { | 17 enum OpType { |
| 18 kBeginCommentGroup_OpType, | |
| 19 kBeginDrawPicture_OpType, | 18 kBeginDrawPicture_OpType, |
| 20 kClipPath_OpType, | 19 kClipPath_OpType, |
| 21 kClipRegion_OpType, | 20 kClipRegion_OpType, |
| 22 kClipRect_OpType, | 21 kClipRect_OpType, |
| 23 kClipRRect_OpType, | 22 kClipRRect_OpType, |
| 24 kComment_OpType, | |
| 25 kConcat_OpType, | 23 kConcat_OpType, |
| 26 kDrawBitmap_OpType, | 24 kDrawBitmap_OpType, |
| 27 kDrawBitmapNine_OpType, | 25 kDrawBitmapNine_OpType, |
| 28 kDrawBitmapRect_OpType, | 26 kDrawBitmapRect_OpType, |
| 29 kDrawClear_OpType, | 27 kDrawClear_OpType, |
| 30 kDrawDRRect_OpType, | 28 kDrawDRRect_OpType, |
| 31 kDrawOval_OpType, | 29 kDrawOval_OpType, |
| 32 kDrawPaint_OpType, | 30 kDrawPaint_OpType, |
| 33 kDrawPatch_OpType, | 31 kDrawPatch_OpType, |
| 34 kDrawPath_OpType, | 32 kDrawPath_OpType, |
| 35 kDrawPoints_OpType, | 33 kDrawPoints_OpType, |
| 36 kDrawPosText_OpType, | 34 kDrawPosText_OpType, |
| 37 kDrawPosTextH_OpType, | 35 kDrawPosTextH_OpType, |
| 38 kDrawRect_OpType, | 36 kDrawRect_OpType, |
| 39 kDrawRRect_OpType, | 37 kDrawRRect_OpType, |
| 40 kDrawSprite_OpType, | 38 kDrawSprite_OpType, |
| 41 kDrawText_OpType, | 39 kDrawText_OpType, |
| 42 kDrawTextBlob_OpType, | 40 kDrawTextBlob_OpType, |
| 43 kDrawTextOnPath_OpType, | 41 kDrawTextOnPath_OpType, |
| 44 kDrawVertices_OpType, | 42 kDrawVertices_OpType, |
| 45 kEndCommentGroup_OpType, | |
| 46 kEndDrawPicture_OpType, | 43 kEndDrawPicture_OpType, |
| 47 kRestore_OpType, | 44 kRestore_OpType, |
| 48 kSave_OpType, | 45 kSave_OpType, |
| 49 kSaveLayer_OpType, | 46 kSaveLayer_OpType, |
| 50 kSetMatrix_OpType, | 47 kSetMatrix_OpType, |
| 51 | 48 |
| 52 kLast_OpType = kSetMatrix_OpType | 49 kLast_OpType = kSetMatrix_OpType |
| 53 }; | 50 }; |
| 54 | 51 |
| 55 static const int kOpTypeCount = kLast_OpType + 1; | 52 static const int kOpTypeCount = kLast_OpType + 1; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 SkBitmap fBitmap; | 257 SkBitmap fBitmap; |
| 261 SkRect fSrc; | 258 SkRect fSrc; |
| 262 SkRect fDst; | 259 SkRect fDst; |
| 263 SkPaint fPaint; | 260 SkPaint fPaint; |
| 264 SkPaint* fPaintPtr; | 261 SkPaint* fPaintPtr; |
| 265 SkCanvas::DrawBitmapRectFlags fFlags; | 262 SkCanvas::DrawBitmapRectFlags fFlags; |
| 266 | 263 |
| 267 typedef SkDrawCommand INHERITED; | 264 typedef SkDrawCommand INHERITED; |
| 268 }; | 265 }; |
| 269 | 266 |
| 270 class SkBeginCommentGroupCommand : public SkDrawCommand { | |
| 271 public: | |
| 272 SkBeginCommentGroupCommand(const char* description); | |
| 273 void execute(SkCanvas* canvas) const override { | |
| 274 canvas->beginCommentGroup(fDescription.c_str()); | |
| 275 }; | |
| 276 private: | |
| 277 SkString fDescription; | |
| 278 | |
| 279 typedef SkDrawCommand INHERITED; | |
| 280 }; | |
| 281 | |
| 282 class SkCommentCommand : public SkDrawCommand { | |
| 283 public: | |
| 284 SkCommentCommand(const char* kywd, const char* value); | |
| 285 void execute(SkCanvas* canvas) const override { | |
| 286 canvas->addComment(fKywd.c_str(), fValue.c_str()); | |
| 287 }; | |
| 288 private: | |
| 289 SkString fKywd; | |
| 290 SkString fValue; | |
| 291 | |
| 292 typedef SkDrawCommand INHERITED; | |
| 293 }; | |
| 294 | |
| 295 class SkEndCommentGroupCommand : public SkDrawCommand { | |
| 296 public: | |
| 297 SkEndCommentGroupCommand(); | |
| 298 void execute(SkCanvas* canvas) const override { | |
| 299 canvas->endCommentGroup(); | |
| 300 }; | |
| 301 private: | |
| 302 typedef SkDrawCommand INHERITED; | |
| 303 }; | |
| 304 | |
| 305 class SkDrawOvalCommand : public SkDrawCommand { | 267 class SkDrawOvalCommand : public SkDrawCommand { |
| 306 public: | 268 public: |
| 307 SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); | 269 SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); |
| 308 void execute(SkCanvas* canvas) const override; | 270 void execute(SkCanvas* canvas) const override; |
| 309 bool render(SkCanvas* canvas) const override; | 271 bool render(SkCanvas* canvas) const override; |
| 310 private: | 272 private: |
| 311 SkRect fOval; | 273 SkRect fOval; |
| 312 SkPaint fPaint; | 274 SkPaint fPaint; |
| 313 | 275 |
| 314 typedef SkDrawCommand INHERITED; | 276 typedef SkDrawCommand INHERITED; |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 void setUserMatrix(const SkMatrix&) override; | 558 void setUserMatrix(const SkMatrix&) override; |
| 597 void execute(SkCanvas* canvas) const override; | 559 void execute(SkCanvas* canvas) const override; |
| 598 private: | 560 private: |
| 599 SkMatrix fUserMatrix; | 561 SkMatrix fUserMatrix; |
| 600 SkMatrix fMatrix; | 562 SkMatrix fMatrix; |
| 601 | 563 |
| 602 typedef SkDrawCommand INHERITED; | 564 typedef SkDrawCommand INHERITED; |
| 603 }; | 565 }; |
| 604 | 566 |
| 605 #endif | 567 #endif |
| OLD | NEW |