OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkCanvasPriv.h" |
9 #include "SkPatchUtils.h" | 10 #include "SkPatchUtils.h" |
10 #include "SkPictureData.h" | 11 #include "SkPictureData.h" |
11 #include "SkPicturePlayback.h" | 12 #include "SkPicturePlayback.h" |
12 #include "SkPictureRecord.h" | 13 #include "SkPictureRecord.h" |
13 #include "SkReadBuffer.h" | 14 #include "SkReadBuffer.h" |
14 #include "SkRSXform.h" | 15 #include "SkRSXform.h" |
15 #include "SkTextBlob.h" | 16 #include "SkTextBlob.h" |
16 #include "SkTDArray.h" | 17 #include "SkTDArray.h" |
17 #include "SkTypes.h" | 18 #include "SkTypes.h" |
18 | 19 |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } break; | 242 } break; |
242 case DRAW_BITMAP_NINE: { | 243 case DRAW_BITMAP_NINE: { |
243 const SkPaint* paint = fPictureData->getPaint(reader); | 244 const SkPaint* paint = fPictureData->getPaint(reader); |
244 const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader)
); | 245 const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader)
); |
245 SkIRect src; | 246 SkIRect src; |
246 reader->readIRect(&src); | 247 reader->readIRect(&src); |
247 SkRect dst; | 248 SkRect dst; |
248 reader->readRect(&dst); | 249 reader->readRect(&dst); |
249 canvas->drawBitmapNine(bitmap, src, dst, paint); | 250 canvas->drawBitmapNine(bitmap, src, dst, paint); |
250 } break; | 251 } break; |
| 252 case DRAW_BITMAP_NINE_DIVS: { |
| 253 const SkPaint* paint = fPictureData->getPaint(reader); |
| 254 const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader)
); |
| 255 sk_sp<SkData> divData = reader->readByteArrayAsData(); |
| 256 const SkCanvas::NinePatchDivs divs = SkNinePatchDivs::FromData(divDa
ta.get()); |
| 257 SkRect dst; |
| 258 reader->readRect(&dst); |
| 259 canvas->drawBitmapNine(bitmap, divs, dst, paint); |
| 260 } break; |
251 case DRAW_CLEAR: | 261 case DRAW_CLEAR: |
252 canvas->clear(reader->readInt()); | 262 canvas->clear(reader->readInt()); |
253 break; | 263 break; |
254 case DRAW_DATA: { | 264 case DRAW_DATA: { |
255 // This opcode is now dead, just need to skip it for backwards compa
tibility | 265 // This opcode is now dead, just need to skip it for backwards compa
tibility |
256 size_t length = reader->readInt(); | 266 size_t length = reader->readInt(); |
257 (void)reader->skip(length); | 267 (void)reader->skip(length); |
258 // skip handles padding the read out to a multiple of 4 | 268 // skip handles padding the read out to a multiple of 4 |
259 } break; | 269 } break; |
260 case DRAW_DRAWABLE: | 270 case DRAW_DRAWABLE: |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 } break; | 623 } break; |
614 case TRANSLATE: { | 624 case TRANSLATE: { |
615 SkScalar dx = reader->readScalar(); | 625 SkScalar dx = reader->readScalar(); |
616 SkScalar dy = reader->readScalar(); | 626 SkScalar dy = reader->readScalar(); |
617 canvas->translate(dx, dy); | 627 canvas->translate(dx, dy); |
618 } break; | 628 } break; |
619 default: | 629 default: |
620 SkASSERTF(false, "Unknown draw type: %d", op); | 630 SkASSERTF(false, "Unknown draw type: %d", op); |
621 } | 631 } |
622 } | 632 } |
OLD | NEW |