Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/core/SkPictureRecord.cpp

Issue 251533004: First pass at GPU veto (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Now with concave path counting Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 size_t initialOffset = this->addDraw(DRAW_DRRECT, &size); 1058 size_t initialOffset = this->addDraw(DRAW_DRRECT, &size);
1059 SkASSERT(initialOffset+getPaintOffset(DRAW_DRRECT, size) == fWriter.bytesWri tten()); 1059 SkASSERT(initialOffset+getPaintOffset(DRAW_DRRECT, size) == fWriter.bytesWri tten());
1060 this->addPaint(paint); 1060 this->addPaint(paint);
1061 this->addRRect(outer); 1061 this->addRRect(outer);
1062 this->addRRect(inner); 1062 this->addRRect(inner);
1063 this->validate(initialOffset, size); 1063 this->validate(initialOffset, size);
1064 } 1064 }
1065 1065
1066 void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) { 1066 void SkPictureRecord::drawPath(const SkPath& path, const SkPaint& paint) {
1067 1067
1068 if (!path.isConvex()) {
1069 fPicture->incAAConcavePaths();
1070 }
1071
1068 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE 1072 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
1069 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); 1073 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
1070 #endif 1074 #endif
1071 1075
1072 // op + paint index + path index 1076 // op + paint index + path index
1073 size_t size = 3 * kUInt32Size; 1077 size_t size = 3 * kUInt32Size;
1074 size_t initialOffset = this->addDraw(DRAW_PATH, &size); 1078 size_t initialOffset = this->addDraw(DRAW_PATH, &size);
1075 SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.bytesWritt en()); 1079 SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.bytesWritt en());
1076 this->addPaint(paint); 1080 this->addPaint(paint);
1077 this->addPath(path); 1081 this->addPath(path);
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 1575
1572 void SkPictureRecord::addMatrix(const SkMatrix& matrix) { 1576 void SkPictureRecord::addMatrix(const SkMatrix& matrix) {
1573 fWriter.writeMatrix(matrix); 1577 fWriter.writeMatrix(matrix);
1574 } 1578 }
1575 1579
1576 const SkFlatData* SkPictureRecord::getFlatPaintData(const SkPaint& paint) { 1580 const SkFlatData* SkPictureRecord::getFlatPaintData(const SkPaint& paint) {
1577 return fPaints.findAndReturnFlat(paint); 1581 return fPaints.findAndReturnFlat(paint);
1578 } 1582 }
1579 1583
1580 const SkFlatData* SkPictureRecord::addPaintPtr(const SkPaint* paint) { 1584 const SkFlatData* SkPictureRecord::addPaintPtr(const SkPaint* paint) {
1585 if (NULL != paint && NULL != paint->getPathEffect()) {
1586 fPicture->incPaintWithPathEffectUses();
1587 }
1588
1581 const SkFlatData* data = paint ? getFlatPaintData(*paint) : NULL; 1589 const SkFlatData* data = paint ? getFlatPaintData(*paint) : NULL;
1582 this->addFlatPaint(data); 1590 this->addFlatPaint(data);
1583 return data; 1591 return data;
1584 } 1592 }
1585 1593
1586 void SkPictureRecord::addFlatPaint(const SkFlatData* flatPaint) { 1594 void SkPictureRecord::addFlatPaint(const SkFlatData* flatPaint) {
1587 int index = flatPaint ? flatPaint->index() : 0; 1595 int index = flatPaint ? flatPaint->index() : 0;
1588 this->addInt(index); 1596 this->addInt(index);
1589 } 1597 }
1590 1598
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 void SkPictureRecord::validateRegions() const { 1807 void SkPictureRecord::validateRegions() const {
1800 int count = fRegions.count(); 1808 int count = fRegions.count();
1801 SkASSERT((unsigned) count < 0x1000); 1809 SkASSERT((unsigned) count < 0x1000);
1802 for (int index = 0; index < count; index++) { 1810 for (int index = 0; index < count; index++) {
1803 const SkFlatData* region = fRegions[index]; 1811 const SkFlatData* region = fRegions[index];
1804 SkASSERT(region); 1812 SkASSERT(region);
1805 // region->validate(); 1813 // region->validate();
1806 } 1814 }
1807 } 1815 }
1808 #endif 1816 #endif
OLDNEW
« src/core/SkPicture.cpp ('K') | « src/core/SkPicture.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698