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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 SkGPipeState* state) { | 684 SkGPipeState* state) { |
685 SkASSERT(!SkToBool(state->getFlags() & SkGPipeWriter::kCrossProcess_Flag)); | 685 SkASSERT(!SkToBool(state->getFlags() & SkGPipeWriter::kCrossProcess_Flag)); |
686 SkPaint* p = state->editPaint(); | 686 SkPaint* p = state->editPaint(); |
687 p->setTypeface(static_cast<SkTypeface*>(reader->readPtr())); | 687 p->setTypeface(static_cast<SkTypeface*>(reader->readPtr())); |
688 } | 688 } |
689 | 689 |
690 static void annotation_rp(SkCanvas*, SkReader32* reader, uint32_t op32, | 690 static void annotation_rp(SkCanvas*, SkReader32* reader, uint32_t op32, |
691 SkGPipeState* state) { | 691 SkGPipeState* state) { |
692 SkPaint* p = state->editPaint(); | 692 SkPaint* p = state->editPaint(); |
693 | 693 |
694 if (SkToBool(PaintOp_unpackData(op32))) { | 694 const size_t size = DrawOp_unpackData(op32); |
695 const size_t size = reader->readU32(); | 695 if (size > 0) { |
696 SkAutoMalloc storage(size); | 696 SkOrderedReadBuffer buffer(reader->skip(size), size); |
697 | |
698 reader->read(storage.get(), size); | |
699 SkOrderedReadBuffer buffer(storage.get(), size); | |
700 p->setAnnotation(SkNEW_ARGS(SkAnnotation, (buffer)))->unref(); | 697 p->setAnnotation(SkNEW_ARGS(SkAnnotation, (buffer)))->unref(); |
| 698 SkASSERT(buffer.offset() == size); |
701 } else { | 699 } else { |
702 p->setAnnotation(NULL); | 700 p->setAnnotation(NULL); |
703 } | 701 } |
704 } | 702 } |
705 | 703 |
706 /////////////////////////////////////////////////////////////////////////////// | 704 /////////////////////////////////////////////////////////////////////////////// |
707 | 705 |
708 static void def_Typeface_rp(SkCanvas*, SkReader32*, uint32_t, SkGPipeState* stat
e) { | 706 static void def_Typeface_rp(SkCanvas*, SkReader32*, uint32_t, SkGPipeState* stat
e) { |
709 state->addTypeface(); | 707 state->addTypeface(); |
710 } | 708 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 status = kReadAtom_Status; | 884 status = kReadAtom_Status; |
887 break; | 885 break; |
888 } | 886 } |
889 } | 887 } |
890 | 888 |
891 if (bytesRead) { | 889 if (bytesRead) { |
892 *bytesRead = reader.offset(); | 890 *bytesRead = reader.offset(); |
893 } | 891 } |
894 return status; | 892 return status; |
895 } | 893 } |
OLD | NEW |