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 #include "SkPictureRecord.h" | 8 #include "SkPictureRecord.h" |
9 #include "SkTSearch.h" | 9 #include "SkTSearch.h" |
10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 uint32_t initialOffset = this->addDraw(DRAW_BITMAP, &size); | 895 uint32_t initialOffset = this->addDraw(DRAW_BITMAP, &size); |
896 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.size()); | 896 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.size()); |
897 addPaintPtr(paint); | 897 addPaintPtr(paint); |
898 addBitmap(bitmap); | 898 addBitmap(bitmap); |
899 addScalar(left); | 899 addScalar(left); |
900 addScalar(top); | 900 addScalar(top); |
901 validate(initialOffset, size); | 901 validate(initialOffset, size); |
902 } | 902 } |
903 | 903 |
904 void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect*
src, | 904 void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect*
src, |
905 const SkRect& dst, const SkPaint* paint) { | 905 const SkRect& dst, const SkPaint* pai
nt, |
906 // id + paint index + bitmap index + bool for 'src' | 906 DrawBitmapRectFlags flags) { |
907 uint32_t size = 4 * kUInt32Size; | 907 // id + paint index + bitmap index + bool for 'src' + flags |
| 908 uint32_t size = 5 * kUInt32Size; |
908 if (NULL != src) { | 909 if (NULL != src) { |
909 size += sizeof(*src); // + rect | 910 size += sizeof(*src); // + rect |
910 } | 911 } |
911 size += sizeof(dst); // + rect | 912 size += sizeof(dst); // + rect |
912 | 913 |
913 uint32_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size); | 914 uint32_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size); |
914 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) == fWr
iter.size()); | 915 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) == fWr
iter.size()); |
915 addPaintPtr(paint); | 916 addPaintPtr(paint); |
916 addBitmap(bitmap); | 917 addBitmap(bitmap); |
917 addRectPtr(src); // may be null | 918 addRectPtr(src); // may be null |
918 addRect(dst); | 919 addRect(dst); |
| 920 addInt(flags); |
919 validate(initialOffset, size); | 921 validate(initialOffset, size); |
920 } | 922 } |
921 | 923 |
922 void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m
atrix, | 924 void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m
atrix, |
923 const SkPaint* paint) { | 925 const SkPaint* paint) { |
924 // id + paint index + bitmap index + matrix index | 926 // id + paint index + bitmap index + matrix index |
925 uint32_t size = 4 * kUInt32Size; | 927 uint32_t size = 4 * kUInt32Size; |
926 uint32_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size); | 928 uint32_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size); |
927 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.s
ize()); | 929 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.s
ize()); |
928 addPaintPtr(paint); | 930 addPaintPtr(paint); |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1472 void SkPictureRecord::validateRegions() const { | 1474 void SkPictureRecord::validateRegions() const { |
1473 int count = fRegions.count(); | 1475 int count = fRegions.count(); |
1474 SkASSERT((unsigned) count < 0x1000); | 1476 SkASSERT((unsigned) count < 0x1000); |
1475 for (int index = 0; index < count; index++) { | 1477 for (int index = 0; index < count; index++) { |
1476 const SkFlatData* region = fRegions[index]; | 1478 const SkFlatData* region = fRegions[index]; |
1477 SkASSERT(region); | 1479 SkASSERT(region); |
1478 // region->validate(); | 1480 // region->validate(); |
1479 } | 1481 } |
1480 } | 1482 } |
1481 #endif | 1483 #endif |
OLD | NEW |