OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 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 "SkBitmapHeap.h" | 10 #include "SkBitmapHeap.h" |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 if (flags & kDrawBitmap_Bleed_DrawOpFlag) { | 647 if (flags & kDrawBitmap_Bleed_DrawOpFlag) { |
648 constraint = SkCanvas::kFast_SrcRectConstraint; | 648 constraint = SkCanvas::kFast_SrcRectConstraint; |
649 } | 649 } |
650 const SkRect* dst = skip<SkRect>(reader); | 650 const SkRect* dst = skip<SkRect>(reader); |
651 const SkBitmap* bitmap = holder.getBitmap(); | 651 const SkBitmap* bitmap = holder.getBitmap(); |
652 if (state->shouldDraw()) { | 652 if (state->shouldDraw()) { |
653 canvas->legacy_drawBitmapRect(*bitmap, src, *dst, hasPaint ? &state->pai
nt() : nullptr, constraint); | 653 canvas->legacy_drawBitmapRect(*bitmap, src, *dst, hasPaint ? &state->pai
nt() : nullptr, constraint); |
654 } | 654 } |
655 } | 655 } |
656 | 656 |
| 657 static void drawSprite_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, |
| 658 SkGPipeState* state) { |
| 659 BitmapHolder holder(reader, op32, state); |
| 660 bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_Dra
wOpFlag); |
| 661 const SkIPoint* point = skip<SkIPoint>(reader); |
| 662 const SkBitmap* bitmap = holder.getBitmap(); |
| 663 if (state->shouldDraw()) { |
| 664 canvas->drawSprite(*bitmap, point->fX, point->fY, hasPaint ? &state->pai
nt() : nullptr); |
| 665 } |
| 666 } |
| 667 |
657 static void drawImage_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, Sk
GPipeState* state) { | 668 static void drawImage_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, Sk
GPipeState* state) { |
658 unsigned slot = DrawOp_unpackData(op32); | 669 unsigned slot = DrawOp_unpackData(op32); |
659 unsigned flags = DrawOp_unpackFlags(op32); | 670 unsigned flags = DrawOp_unpackFlags(op32); |
660 bool hasPaint = SkToBool(flags & kDrawBitmap_HasPaint_DrawOpFlag); | 671 bool hasPaint = SkToBool(flags & kDrawBitmap_HasPaint_DrawOpFlag); |
661 SkScalar x = reader->readScalar(); | 672 SkScalar x = reader->readScalar(); |
662 SkScalar y = reader->readScalar(); | 673 SkScalar y = reader->readScalar(); |
663 const SkImage* image = state->getImage(slot); | 674 const SkImage* image = state->getImage(slot); |
664 if (state->shouldDraw()) { | 675 if (state->shouldDraw()) { |
665 canvas->drawImage(image, x, y, hasPaint ? &state->paint() : nullptr); | 676 canvas->drawImage(image, x, y, hasPaint ? &state->paint() : nullptr); |
666 } | 677 } |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 drawOval_rp, | 884 drawOval_rp, |
874 drawPaint_rp, | 885 drawPaint_rp, |
875 drawPatch_rp, | 886 drawPatch_rp, |
876 drawPath_rp, | 887 drawPath_rp, |
877 drawPicture_rp, | 888 drawPicture_rp, |
878 drawPoints_rp, | 889 drawPoints_rp, |
879 drawPosText_rp, | 890 drawPosText_rp, |
880 drawPosTextH_rp, | 891 drawPosTextH_rp, |
881 drawRect_rp, | 892 drawRect_rp, |
882 drawRRect_rp, | 893 drawRRect_rp, |
| 894 drawSprite_rp, |
883 drawText_rp, | 895 drawText_rp, |
884 drawTextBlob_rp, | 896 drawTextBlob_rp, |
885 drawTextOnPath_rp, | 897 drawTextOnPath_rp, |
886 drawVertices_rp, | 898 drawVertices_rp, |
887 restore_rp, | 899 restore_rp, |
888 rotate_rp, | 900 rotate_rp, |
889 save_rp, | 901 save_rp, |
890 saveLayer_rp, | 902 saveLayer_rp, |
891 scale_rp, | 903 scale_rp, |
892 setMatrix_rp, | 904 setMatrix_rp, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 status = kReadAtom_Status; | 1008 status = kReadAtom_Status; |
997 break; | 1009 break; |
998 } | 1010 } |
999 } | 1011 } |
1000 | 1012 |
1001 if (bytesRead) { | 1013 if (bytesRead) { |
1002 *bytesRead = reader.offset(); | 1014 *bytesRead = reader.offset(); |
1003 } | 1015 } |
1004 return status; | 1016 return status; |
1005 } | 1017 } |
OLD | NEW |