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 "SkTSearch.h" | 9 #include "SkTSearch.h" |
10 #include "SkPixelRef.h" | 10 #include "SkPixelRef.h" |
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.write
ToMemory(NULL); | 1380 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.write
ToMemory(NULL); |
1381 size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size); | 1381 size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size); |
1382 SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.by
tesWritten()); | 1382 SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.by
tesWritten()); |
1383 this->addPaint(paint); | 1383 this->addPaint(paint); |
1384 this->addText(text, byteLength); | 1384 this->addText(text, byteLength); |
1385 this->addPath(path); | 1385 this->addPath(path); |
1386 this->addMatrix(m); | 1386 this->addMatrix(m); |
1387 this->validate(initialOffset, size); | 1387 this->validate(initialOffset, size); |
1388 } | 1388 } |
1389 | 1389 |
1390 void SkPictureRecord::onDrawPicture(const SkPicture* picture) { | 1390 void SkPictureRecord::onDrawPicture(const SkPicture* picture, const SkMatrix* ma
trix, |
| 1391 const SkPaint* paint) { |
1391 | 1392 |
1392 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 1393 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
1393 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); | 1394 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
1394 #endif | 1395 #endif |
1395 | 1396 |
1396 // op + picture index | 1397 // op + picture index |
1397 size_t size = 2 * kUInt32Size; | 1398 size_t size = 2 * kUInt32Size; |
1398 size_t initialOffset = this->addDraw(DRAW_PICTURE, &size); | 1399 size_t initialOffset; |
1399 this->addPicture(picture); | 1400 |
| 1401 if (NULL == matrix && NULL == paint) { |
| 1402 initialOffset = this->addDraw(DRAW_PICTURE, &size); |
| 1403 this->addPicture(picture); |
| 1404 } else { |
| 1405 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); |
| 1406 size += m.writeToMemory(NULL) + kUInt32Size; // matrix + paint |
| 1407 initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size); |
| 1408 this->addPicture(picture); |
| 1409 this->addMatrix(m); |
| 1410 this->addPaintPtr(paint); |
| 1411 } |
1400 this->validate(initialOffset, size); | 1412 this->validate(initialOffset, size); |
1401 } | 1413 } |
1402 | 1414 |
1403 void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount, | 1415 void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount, |
1404 const SkPoint vertices[], const SkPoint texs[], | 1416 const SkPoint vertices[], const SkPoint texs[], |
1405 const SkColor colors[], SkXfermode* xfer, | 1417 const SkColor colors[], SkXfermode* xfer, |
1406 const uint16_t indices[], int indexCount, | 1418 const uint16_t indices[], int indexCount, |
1407 const SkPaint& paint) { | 1419 const SkPaint& paint) { |
1408 | 1420 |
1409 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 1421 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1827 void SkPictureRecord::validateRegions() const { | 1839 void SkPictureRecord::validateRegions() const { |
1828 int count = fRegions.count(); | 1840 int count = fRegions.count(); |
1829 SkASSERT((unsigned) count < 0x1000); | 1841 SkASSERT((unsigned) count < 0x1000); |
1830 for (int index = 0; index < count; index++) { | 1842 for (int index = 0; index < count; index++) { |
1831 const SkFlatData* region = fRegions[index]; | 1843 const SkFlatData* region = fRegions[index]; |
1832 SkASSERT(region); | 1844 SkASSERT(region); |
1833 // region->validate(); | 1845 // region->validate(); |
1834 } | 1846 } |
1835 } | 1847 } |
1836 #endif | 1848 #endif |
OLD | NEW |