| 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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 uint32_t initialOffset = this->addDraw(DRAW_BITMAP, &size); | 906 uint32_t initialOffset = this->addDraw(DRAW_BITMAP, &size); |
| 907 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.size()); | 907 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP, size) == fWriter.size()); |
| 908 addPaintPtr(paint); | 908 addPaintPtr(paint); |
| 909 addBitmap(bitmap); | 909 addBitmap(bitmap); |
| 910 addScalar(left); | 910 addScalar(left); |
| 911 addScalar(top); | 911 addScalar(top); |
| 912 validate(initialOffset, size); | 912 validate(initialOffset, size); |
| 913 } | 913 } |
| 914 | 914 |
| 915 void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect*
src, | 915 void SkPictureRecord::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect*
src, |
| 916 const SkRect& dst, const SkPaint* paint) { | 916 const SkRect& dst, const SkPaint* pai
nt, |
| 917 // id + paint index + bitmap index + bool for 'src' | 917 DrawBitmapRectFlags flags) { |
| 918 uint32_t size = 4 * kUInt32Size; | 918 // id + paint index + bitmap index + bool for 'src' + flags |
| 919 uint32_t size = 5 * kUInt32Size; |
| 919 if (NULL != src) { | 920 if (NULL != src) { |
| 920 size += sizeof(*src); // + rect | 921 size += sizeof(*src); // + rect |
| 921 } | 922 } |
| 922 size += sizeof(dst); // + rect | 923 size += sizeof(dst); // + rect |
| 923 | 924 |
| 924 uint32_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size); | 925 uint32_t initialOffset = this->addDraw(DRAW_BITMAP_RECT_TO_RECT, &size); |
| 925 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) == fWr
iter.size()); | 926 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_RECT_TO_RECT, size) == fWr
iter.size()); |
| 926 addPaintPtr(paint); | 927 addPaintPtr(paint); |
| 927 addBitmap(bitmap); | 928 addBitmap(bitmap); |
| 928 addRectPtr(src); // may be null | 929 addRectPtr(src); // may be null |
| 929 addRect(dst); | 930 addRect(dst); |
| 931 addInt(flags); |
| 930 validate(initialOffset, size); | 932 validate(initialOffset, size); |
| 931 } | 933 } |
| 932 | 934 |
| 933 void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m
atrix, | 935 void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m
atrix, |
| 934 const SkPaint* paint) { | 936 const SkPaint* paint) { |
| 935 // id + paint index + bitmap index + matrix index | 937 // id + paint index + bitmap index + matrix index |
| 936 uint32_t size = 4 * kUInt32Size; | 938 uint32_t size = 4 * kUInt32Size; |
| 937 uint32_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size); | 939 uint32_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size); |
| 938 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.s
ize()); | 940 SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.s
ize()); |
| 939 addPaintPtr(paint); | 941 addPaintPtr(paint); |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 void SkPictureRecord::validateRegions() const { | 1485 void SkPictureRecord::validateRegions() const { |
| 1484 int count = fRegions.count(); | 1486 int count = fRegions.count(); |
| 1485 SkASSERT((unsigned) count < 0x1000); | 1487 SkASSERT((unsigned) count < 0x1000); |
| 1486 for (int index = 0; index < count; index++) { | 1488 for (int index = 0; index < count; index++) { |
| 1487 const SkFlatData* region = fRegions[index]; | 1489 const SkFlatData* region = fRegions[index]; |
| 1488 SkASSERT(region); | 1490 SkASSERT(region); |
| 1489 // region->validate(); | 1491 // region->validate(); |
| 1490 } | 1492 } |
| 1491 } | 1493 } |
| 1492 #endif | 1494 #endif |
| OLD | NEW |