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 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1393 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.write ToMemory(NULL); | 1393 size_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.write ToMemory(NULL); |
1394 size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size); | 1394 size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size); |
1395 SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.by tesWritten()); | 1395 SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.by tesWritten()); |
1396 this->addPaint(paint); | 1396 this->addPaint(paint); |
1397 this->addText(text, byteLength); | 1397 this->addText(text, byteLength); |
1398 this->addPath(path); | 1398 this->addPath(path); |
1399 this->addMatrix(m); | 1399 this->addMatrix(m); |
1400 this->validate(initialOffset, size); | 1400 this->validate(initialOffset, size); |
1401 } | 1401 } |
1402 | 1402 |
1403 void SkPictureRecord::onDrawPicture(const SkPicture* picture) { | 1403 void SkPictureRecord::onDrawPicture(const SkPicture* picture, const SkMatrix* ma trix, |
1404 const SkPaint* paint) { | |
1404 | 1405 |
1405 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 1406 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
1406 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); | 1407 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); |
1407 #endif | 1408 #endif |
1408 | 1409 |
1409 // op + picture index | 1410 // op + picture index |
1410 size_t size = 2 * kUInt32Size; | 1411 size_t size = 2 * kUInt32Size; |
1411 size_t initialOffset = this->addDraw(DRAW_PICTURE, &size); | 1412 size_t initialOffset; |
1412 this->addPicture(picture); | 1413 |
1414 if (NULL == matrix && NULL == paint) { | |
1415 initialOffset = this->addDraw(DRAW_PICTURE, &size); | |
1416 this->addPicture(picture); | |
1417 } else { | |
1418 const SkMatrix& m = matrix ? *matrix : SkMatrix::I(); | |
1419 size += m.writeToMemory(NULL) + kUInt32Size; // matrix + paint | |
1420 initialOffset = this->addDraw(DRAW_PICTURE_MATRIX_PAINT, &size); | |
1421 this->addPicture(picture); | |
1422 this->addMatrix(m); | |
1423 this->addPaintPtr(paint); | |
robertphillips
2014/08/08 14:59:53
Don't need this next line.
| |
1424 this->validate(initialOffset, size); | |
1425 } | |
1413 this->validate(initialOffset, size); | 1426 this->validate(initialOffset, size); |
1414 } | 1427 } |
1415 | 1428 |
1416 void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount, | 1429 void SkPictureRecord::drawVertices(VertexMode vmode, int vertexCount, |
1417 const SkPoint vertices[], const SkPoint texs[], | 1430 const SkPoint vertices[], const SkPoint texs[], |
1418 const SkColor colors[], SkXfermode* xfer, | 1431 const SkColor colors[], SkXfermode* xfer, |
1419 const uint16_t indices[], int indexCount, | 1432 const uint16_t indices[], int indexCount, |
1420 const SkPaint& paint) { | 1433 const SkPaint& paint) { |
1421 | 1434 |
1422 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE | 1435 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1841 void SkPictureRecord::validateRegions() const { | 1854 void SkPictureRecord::validateRegions() const { |
1842 int count = fRegions.count(); | 1855 int count = fRegions.count(); |
1843 SkASSERT((unsigned) count < 0x1000); | 1856 SkASSERT((unsigned) count < 0x1000); |
1844 for (int index = 0; index < count; index++) { | 1857 for (int index = 0; index < count; index++) { |
1845 const SkFlatData* region = fRegions[index]; | 1858 const SkFlatData* region = fRegions[index]; |
1846 SkASSERT(region); | 1859 SkASSERT(region); |
1847 // region->validate(); | 1860 // region->validate(); |
1848 } | 1861 } |
1849 } | 1862 } |
1850 #endif | 1863 #endif |
OLD | NEW |