OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkPictureRecord.h" | 8 #include "SkPictureRecord.h" |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkImage_Base.h" | 10 #include "SkImage_Base.h" |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 size_t initialOffset = this->addDraw(DRAW_BITMAP, &size); | 545 size_t initialOffset = this->addDraw(DRAW_BITMAP, &size); |
546 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP, size) == fWriter.bytesW
ritten()); | 546 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP, size) == fWriter.bytesW
ritten()); |
547 this->addPaintPtr(paint); | 547 this->addPaintPtr(paint); |
548 this->addBitmap(bitmap); | 548 this->addBitmap(bitmap); |
549 this->addScalar(left); | 549 this->addScalar(left); |
550 this->addScalar(top); | 550 this->addScalar(top); |
551 this->validate(initialOffset, size); | 551 this->validate(initialOffset, size); |
552 } | 552 } |
553 | 553 |
554 void SkPictureRecord::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src
, const SkRect& dst, | 554 void SkPictureRecord::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src
, const SkRect& dst, |
555 const SkPaint* paint, | 555 const SkPaint* paint, SrcRectConstraint c
onstraint) { |
556 SK_VIRTUAL_CONSTRAINT_TYPE constraint) { | |
557 // id + paint index + bitmap index + bool for 'src' + flags | 556 // id + paint index + bitmap index + bool for 'src' + flags |
558 size_t size = 5 * kUInt32Size; | 557 size_t size = 5 * kUInt32Size; |
559 if (src) { | 558 if (src) { |
560 size += sizeof(*src); // + rect | 559 size += sizeof(*src); // + rect |
561 } | 560 } |
562 size += sizeof(dst); // + rect | 561 size += sizeof(dst); // + rect |
563 | 562 |
564 size_t initialOffset = this->addDraw(DRAW_BITMAP_RECT, &size); | 563 size_t initialOffset = this->addDraw(DRAW_BITMAP_RECT, &size); |
565 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_RECT, size) == fWriter.b
ytesWritten()); | 564 SkASSERT(initialOffset+get_paint_offset(DRAW_BITMAP_RECT, size) == fWriter.b
ytesWritten()); |
566 this->addPaintPtr(paint); | 565 this->addPaintPtr(paint); |
(...skipping 11 matching lines...) Expand all Loading... |
578 size_t initialOffset = this->addDraw(DRAW_IMAGE, &size); | 577 size_t initialOffset = this->addDraw(DRAW_IMAGE, &size); |
579 SkASSERT(initialOffset+get_paint_offset(DRAW_IMAGE, size) == fWriter.bytesWr
itten()); | 578 SkASSERT(initialOffset+get_paint_offset(DRAW_IMAGE, size) == fWriter.bytesWr
itten()); |
580 this->addPaintPtr(paint); | 579 this->addPaintPtr(paint); |
581 this->addImage(image); | 580 this->addImage(image); |
582 this->addScalar(x); | 581 this->addScalar(x); |
583 this->addScalar(y); | 582 this->addScalar(y); |
584 this->validate(initialOffset, size); | 583 this->validate(initialOffset, size); |
585 } | 584 } |
586 | 585 |
587 void SkPictureRecord::onDrawImageRect(const SkImage* image, const SkRect* src, c
onst SkRect& dst, | 586 void SkPictureRecord::onDrawImageRect(const SkImage* image, const SkRect* src, c
onst SkRect& dst, |
588 const SkPaint* paint SRC_RECT_CONSTRAINT_P
ARAM(constraint)) { | 587 const SkPaint* paint, SrcRectConstraint co
nstraint) { |
589 SRC_RECT_CONSTRAINT_LOCAL_DEFAULT(constraint) | |
590 // id + paint_index + image_index + bool_for_src + constraint | 588 // id + paint_index + image_index + bool_for_src + constraint |
591 size_t size = 5 * kUInt32Size; | 589 size_t size = 5 * kUInt32Size; |
592 if (src) { | 590 if (src) { |
593 size += sizeof(*src); // + rect | 591 size += sizeof(*src); // + rect |
594 } | 592 } |
595 size += sizeof(dst); // + rect | 593 size += sizeof(dst); // + rect |
596 | 594 |
597 size_t initialOffset = this->addDraw(DRAW_IMAGE_RECT, &size); | 595 size_t initialOffset = this->addDraw(DRAW_IMAGE_RECT, &size); |
598 SkASSERT(initialOffset+get_paint_offset(DRAW_IMAGE_RECT, size) | 596 SkASSERT(initialOffset+get_paint_offset(DRAW_IMAGE_RECT, size) |
599 == fWriter.bytesWritten()); | 597 == fWriter.bytesWritten()); |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1066 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { | 1064 void SkPictureRecord::addTextBlob(const SkTextBlob *blob) { |
1067 int index = fTextBlobRefs.count(); | 1065 int index = fTextBlobRefs.count(); |
1068 *fTextBlobRefs.append() = blob; | 1066 *fTextBlobRefs.append() = blob; |
1069 blob->ref(); | 1067 blob->ref(); |
1070 // follow the convention of recording a 1-based index | 1068 // follow the convention of recording a 1-based index |
1071 this->addInt(index + 1); | 1069 this->addInt(index + 1); |
1072 } | 1070 } |
1073 | 1071 |
1074 /////////////////////////////////////////////////////////////////////////////// | 1072 /////////////////////////////////////////////////////////////////////////////// |
1075 | 1073 |
OLD | NEW |