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" |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
13 #include "SkGPipe.h" | 13 #include "SkGPipe.h" |
14 #include "SkGPipePriv.h" | 14 #include "SkGPipePriv.h" |
15 #include "SkReader32.h" | 15 #include "SkReader32.h" |
16 #include "SkStream.h" | 16 #include "SkStream.h" |
17 | 17 |
18 #include "SkAnnotation.h" | 18 #include "SkAnnotation.h" |
19 #include "SkColorFilter.h" | 19 #include "SkColorFilter.h" |
20 #include "SkDrawLooper.h" | 20 #include "SkDrawLooper.h" |
21 #include "SkImageFilter.h" | 21 #include "SkImageFilter.h" |
22 #include "SkMaskFilter.h" | 22 #include "SkMaskFilter.h" |
23 #include "SkReadBuffer.h" | 23 #include "SkReadBuffer.h" |
24 #include "SkPatchUtils.h" | 24 #include "SkPatchUtils.h" |
25 #include "SkPathEffect.h" | 25 #include "SkPathEffect.h" |
26 #include "SkRasterizer.h" | 26 #include "SkRasterizer.h" |
27 #include "SkRRect.h" | 27 #include "SkRRect.h" |
28 #include "SkShader.h" | 28 #include "SkShader.h" |
| 29 #include "SkTextBlob.h" |
29 #include "SkTypeface.h" | 30 #include "SkTypeface.h" |
30 #include "SkXfermode.h" | 31 #include "SkXfermode.h" |
31 | 32 |
32 static SkFlattenable::Type paintflat_to_flattype(PaintFlats pf) { | 33 static SkFlattenable::Type paintflat_to_flattype(PaintFlats pf) { |
33 static const uint8_t gEffectTypesInPaintFlatsOrder[] = { | 34 static const uint8_t gEffectTypesInPaintFlatsOrder[] = { |
34 SkFlattenable::kSkColorFilter_Type, | 35 SkFlattenable::kSkColorFilter_Type, |
35 SkFlattenable::kSkDrawLooper_Type, | 36 SkFlattenable::kSkDrawLooper_Type, |
36 SkFlattenable::kSkImageFilter_Type, | 37 SkFlattenable::kSkImageFilter_Type, |
37 SkFlattenable::kSkMaskFilter_Type, | 38 SkFlattenable::kSkMaskFilter_Type, |
38 SkFlattenable::kSkPathEffect_Type, | 39 SkFlattenable::kSkPathEffect_Type, |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 } | 666 } |
666 } | 667 } |
667 | 668 |
668 static void drawPicture_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, | 669 static void drawPicture_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, |
669 SkGPipeState* state) { | 670 SkGPipeState* state) { |
670 UNIMPLEMENTED | 671 UNIMPLEMENTED |
671 } | 672 } |
672 | 673 |
673 static void drawTextBlob_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, | 674 static void drawTextBlob_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32, |
674 SkGPipeState* state) { | 675 SkGPipeState* state) { |
675 UNIMPLEMENTED | 676 SkScalar x = reader->readScalar(); |
| 677 SkScalar y = reader->readScalar(); |
| 678 |
| 679 size_t blobSize = reader->readU32(); |
| 680 const void* data = reader->skip(SkAlign4(blobSize)); |
| 681 |
| 682 if (state->shouldDraw()) { |
| 683 SkReadBuffer blobBuffer(data, blobSize); |
| 684 SkAutoTUnref<const SkTextBlob> blob(SkTextBlob::CreateFromBuffer(blobBuf
fer)); |
| 685 SkASSERT(blob.get()); |
| 686 |
| 687 canvas->drawTextBlob(blob, x, y, state->paint()); |
| 688 } |
676 } | 689 } |
677 /////////////////////////////////////////////////////////////////////////////// | 690 /////////////////////////////////////////////////////////////////////////////// |
678 | 691 |
679 static void paintOp_rp(SkCanvas*, SkReader32* reader, uint32_t op32, | 692 static void paintOp_rp(SkCanvas*, SkReader32* reader, uint32_t op32, |
680 SkGPipeState* state) { | 693 SkGPipeState* state) { |
681 size_t offset = reader->offset(); | 694 size_t offset = reader->offset(); |
682 size_t stop = offset + PaintOp_unpackData(op32); | 695 size_t stop = offset + PaintOp_unpackData(op32); |
683 SkPaint* p = state->editPaint(); | 696 SkPaint* p = state->editPaint(); |
684 | 697 |
685 do { | 698 do { |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 status = kReadAtom_Status; | 945 status = kReadAtom_Status; |
933 break; | 946 break; |
934 } | 947 } |
935 } | 948 } |
936 | 949 |
937 if (bytesRead) { | 950 if (bytesRead) { |
938 *bytesRead = reader.offset(); | 951 *bytesRead = reader.offset(); |
939 } | 952 } |
940 return status; | 953 return status; |
941 } | 954 } |
OLD | NEW |