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

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: Add counting of AA hairline stroked concave paths 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
« no previous file with comments | « src/core/SkPicture.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 (paint.isAntiAlias() && !path.isConvex()) {
1069 fPicture->incAAConcavePaths();
1070
1071 if (SkPaint::kStroke_Style == paint.getStyle() &&
1072 0 == paint.getStrokeWidth()) {
1073 fPicture->incAAHairlineConcavePaths();
1074 }
1075 }
1076
1068 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE 1077 #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE
1069 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType); 1078 fMCMgr.call(SkMatrixClipStateMgr::kOther_CallType);
1070 #endif 1079 #endif
1071 1080
1072 // op + paint index + path index 1081 // op + paint index + path index
1073 size_t size = 3 * kUInt32Size; 1082 size_t size = 3 * kUInt32Size;
1074 size_t initialOffset = this->addDraw(DRAW_PATH, &size); 1083 size_t initialOffset = this->addDraw(DRAW_PATH, &size);
1075 SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.bytesWritt en()); 1084 SkASSERT(initialOffset+getPaintOffset(DRAW_PATH, size) == fWriter.bytesWritt en());
1076 this->addPaint(paint); 1085 this->addPaint(paint);
1077 this->addPath(path); 1086 this->addPath(path);
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 1580
1572 void SkPictureRecord::addMatrix(const SkMatrix& matrix) { 1581 void SkPictureRecord::addMatrix(const SkMatrix& matrix) {
1573 fWriter.writeMatrix(matrix); 1582 fWriter.writeMatrix(matrix);
1574 } 1583 }
1575 1584
1576 const SkFlatData* SkPictureRecord::getFlatPaintData(const SkPaint& paint) { 1585 const SkFlatData* SkPictureRecord::getFlatPaintData(const SkPaint& paint) {
1577 return fPaints.findAndReturnFlat(paint); 1586 return fPaints.findAndReturnFlat(paint);
1578 } 1587 }
1579 1588
1580 const SkFlatData* SkPictureRecord::addPaintPtr(const SkPaint* paint) { 1589 const SkFlatData* SkPictureRecord::addPaintPtr(const SkPaint* paint) {
1590 if (NULL != paint && NULL != paint->getPathEffect()) {
1591 fPicture->incPaintWithPathEffectUses();
1592 }
1593
1581 const SkFlatData* data = paint ? getFlatPaintData(*paint) : NULL; 1594 const SkFlatData* data = paint ? getFlatPaintData(*paint) : NULL;
1582 this->addFlatPaint(data); 1595 this->addFlatPaint(data);
1583 return data; 1596 return data;
1584 } 1597 }
1585 1598
1586 void SkPictureRecord::addFlatPaint(const SkFlatData* flatPaint) { 1599 void SkPictureRecord::addFlatPaint(const SkFlatData* flatPaint) {
1587 int index = flatPaint ? flatPaint->index() : 0; 1600 int index = flatPaint ? flatPaint->index() : 0;
1588 this->addInt(index); 1601 this->addInt(index);
1589 } 1602 }
1590 1603
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 void SkPictureRecord::validateRegions() const { 1812 void SkPictureRecord::validateRegions() const {
1800 int count = fRegions.count(); 1813 int count = fRegions.count();
1801 SkASSERT((unsigned) count < 0x1000); 1814 SkASSERT((unsigned) count < 0x1000);
1802 for (int index = 0; index < count; index++) { 1815 for (int index = 0; index < count; index++) {
1803 const SkFlatData* region = fRegions[index]; 1816 const SkFlatData* region = fRegions[index];
1804 SkASSERT(region); 1817 SkASSERT(region);
1805 // region->validate(); 1818 // region->validate();
1806 } 1819 }
1807 } 1820 }
1808 #endif 1821 #endif
OLDNEW
« no previous file with comments | « src/core/SkPicture.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698