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/gpu/GrContext.cpp

Issue 672473002: Widen the set of nested rects that can be drawn natively on the GPU (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « src/gpu/GrAARectRenderer.cpp ('k') | no next file » | 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 /* 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 8
9 #include "GrContext.h" 9 #include "GrContext.h"
10 10
(...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 if (SkPath::kWinding_FillType == path.getFillType() && dirs[0] == dirs[1]) { 1075 if (SkPath::kWinding_FillType == path.getFillType() && dirs[0] == dirs[1]) {
1076 // The two rects need to be wound opposite to each other 1076 // The two rects need to be wound opposite to each other
1077 return false; 1077 return false;
1078 } 1078 }
1079 1079
1080 // Right now, nested rects where the margin is not the same width 1080 // Right now, nested rects where the margin is not the same width
1081 // all around do not render correctly 1081 // all around do not render correctly
1082 const SkScalar* outer = rects[0].asScalars(); 1082 const SkScalar* outer = rects[0].asScalars();
1083 const SkScalar* inner = rects[1].asScalars(); 1083 const SkScalar* inner = rects[1].asScalars();
1084 1084
1085 bool allEq = true;
1086
1085 SkScalar margin = SkScalarAbs(outer[0] - inner[0]); 1087 SkScalar margin = SkScalarAbs(outer[0] - inner[0]);
1088 bool allGoE1 = margin >= SK_Scalar1;
1089
1086 for (int i = 1; i < 4; ++i) { 1090 for (int i = 1; i < 4; ++i) {
1087 SkScalar temp = SkScalarAbs(outer[i] - inner[i]); 1091 SkScalar temp = SkScalarAbs(outer[i] - inner[i]);
1092 if (temp < SK_Scalar1) {
1093 allGoE1 = false;
1094 }
1088 if (!SkScalarNearlyEqual(margin, temp)) { 1095 if (!SkScalarNearlyEqual(margin, temp)) {
1089 return false; 1096 allEq = false;
1090 } 1097 }
1091 } 1098 }
1092 1099
1093 return true; 1100 return allEq || allGoE1;
1094 } 1101 }
1095 1102
1096 void GrContext::drawPath(const GrPaint& paint, const SkPath& path, const GrStrok eInfo& strokeInfo) { 1103 void GrContext::drawPath(const GrPaint& paint, const SkPath& path, const GrStrok eInfo& strokeInfo) {
1097 1104
1098 if (path.isEmpty()) { 1105 if (path.isEmpty()) {
1099 if (path.isInverseFillType()) { 1106 if (path.isInverseFillType()) {
1100 this->drawPaint(paint); 1107 this->drawPaint(paint);
1101 } 1108 }
1102 return; 1109 return;
1103 } 1110 }
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 fResourceCache->printStats(); 1801 fResourceCache->printStats();
1795 } 1802 }
1796 #endif 1803 #endif
1797 1804
1798 #if GR_GPU_STATS 1805 #if GR_GPU_STATS
1799 const GrContext::GPUStats* GrContext::gpuStats() const { 1806 const GrContext::GPUStats* GrContext::gpuStats() const {
1800 return fGpu->gpuStats(); 1807 return fGpu->gpuStats();
1801 } 1808 }
1802 #endif 1809 #endif
1803 1810
OLDNEW
« no previous file with comments | « src/gpu/GrAARectRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698