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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 canvas->drawBitmapNine(*bitmap, *center, *dst, | 629 canvas->drawBitmapNine(*bitmap, *center, *dst, |
630 hasPaint ? &state->paint() : NULL); | 630 hasPaint ? &state->paint() : NULL); |
631 } | 631 } |
632 } | 632 } |
633 | 633 |
634 static void drawBitmapRect_rp(SkCanvas* canvas, SkReader32* reader, | 634 static void drawBitmapRect_rp(SkCanvas* canvas, SkReader32* reader, |
635 uint32_t op32, SkGPipeState* state) { | 635 uint32_t op32, SkGPipeState* state) { |
636 BitmapHolder holder(reader, op32, state); | 636 BitmapHolder holder(reader, op32, state); |
637 unsigned flags = DrawOp_unpackFlags(op32); | 637 unsigned flags = DrawOp_unpackFlags(op32); |
638 bool hasPaint = SkToBool(flags & kDrawBitmap_HasPaint_DrawOpFlag); | 638 bool hasPaint = SkToBool(flags & kDrawBitmap_HasPaint_DrawOpFlag); |
639 bool hasSrc = SkToBool(flags & kDrawBitmap_HasSrcRect_DrawOpFlag); | 639 bool hasSrc = SkToBool(flags & kDrawBitmap_HasSrcRect_DrawOpFlag); |
robertphillips
2015/08/06 17:23:00
Could we write/read the bitmap/image earlier and t
| |
640 const SkRect* src; | 640 const SkRect* src; |
641 if (hasSrc) { | 641 if (hasSrc) { |
642 src = skip<SkRect>(reader); | 642 src = skip<SkRect>(reader); |
643 } else { | 643 } else { |
644 src = NULL; | 644 src = NULL; |
645 } | 645 } |
646 SkCanvas::SrcRectConstraint constraint = SkCanvas::kStrict_SrcRectConstraint ; | 646 SkCanvas::SrcRectConstraint constraint = SkCanvas::kStrict_SrcRectConstraint ; |
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->drawBitmapRect(*bitmap, src, *dst, hasPaint ? &state->paint() : NULL, constraint); | 653 canvas->legacy_drawBitmapRect(*bitmap, src, *dst, hasPaint ? &state->pai nt() : NULL, constraint); |
654 } | 654 } |
655 } | 655 } |
656 | 656 |
657 static void drawSprite_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, | 657 static void drawSprite_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, |
658 SkGPipeState* state) { | 658 SkGPipeState* state) { |
659 BitmapHolder holder(reader, op32, state); | 659 BitmapHolder holder(reader, op32, state); |
660 bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_Dra wOpFlag); | 660 bool hasPaint = SkToBool(DrawOp_unpackFlags(op32) & kDrawBitmap_HasPaint_Dra wOpFlag); |
661 const SkIPoint* point = skip<SkIPoint>(reader); | 661 const SkIPoint* point = skip<SkIPoint>(reader); |
662 const SkBitmap* bitmap = holder.getBitmap(); | 662 const SkBitmap* bitmap = holder.getBitmap(); |
663 if (state->shouldDraw()) { | 663 if (state->shouldDraw()) { |
(...skipping 21 matching lines...) Expand all Loading... | |
685 bool hasSrc = SkToBool(flags & kDrawBitmap_HasSrcRect_DrawOpFlag); | 685 bool hasSrc = SkToBool(flags & kDrawBitmap_HasSrcRect_DrawOpFlag); |
686 const SkRect* src = NULL; | 686 const SkRect* src = NULL; |
687 if (hasSrc) { | 687 if (hasSrc) { |
688 src = skip<SkRect>(reader); | 688 src = skip<SkRect>(reader); |
689 } | 689 } |
690 const SkRect* dst = skip<SkRect>(reader); | 690 const SkRect* dst = skip<SkRect>(reader); |
691 SkCanvas::SrcRectConstraint constraint = (SkCanvas::SrcRectConstraint)reader ->readInt(); | 691 SkCanvas::SrcRectConstraint constraint = (SkCanvas::SrcRectConstraint)reader ->readInt(); |
692 | 692 |
693 const SkImage* image = state->getImage(slot); | 693 const SkImage* image = state->getImage(slot); |
694 if (state->shouldDraw()) { | 694 if (state->shouldDraw()) { |
695 canvas->drawImageRect(image, src, *dst, hasPaint ? &state->paint() : NUL L, constraint); | 695 canvas->legacy_drawImageRect(image, src, *dst, hasPaint ? &state->paint( ) : NULL, constraint); |
696 } | 696 } |
697 } | 697 } |
698 | 698 |
699 static void drawImageNine_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32 , | 699 static void drawImageNine_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32 , |
700 SkGPipeState* state) { | 700 SkGPipeState* state) { |
701 unsigned slot = DrawOp_unpackData(op32); | 701 unsigned slot = DrawOp_unpackData(op32); |
702 unsigned flags = DrawOp_unpackFlags(op32); | 702 unsigned flags = DrawOp_unpackFlags(op32); |
703 bool hasPaint = SkToBool(flags & kDrawBitmap_HasPaint_DrawOpFlag); | 703 bool hasPaint = SkToBool(flags & kDrawBitmap_HasPaint_DrawOpFlag); |
704 const SkIRect* center = skip<SkIRect>(reader); | 704 const SkIRect* center = skip<SkIRect>(reader); |
705 const SkRect* dst = skip<SkRect>(reader); | 705 const SkRect* dst = skip<SkRect>(reader); |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1008 status = kReadAtom_Status; | 1008 status = kReadAtom_Status; |
1009 break; | 1009 break; |
1010 } | 1010 } |
1011 } | 1011 } |
1012 | 1012 |
1013 if (bytesRead) { | 1013 if (bytesRead) { |
1014 *bytesRead = reader.offset(); | 1014 *bytesRead = reader.offset(); |
1015 } | 1015 } |
1016 return status; | 1016 return status; |
1017 } | 1017 } |
OLD | NEW |