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

Side by Side Diff: src/gpu/GrContext.cpp

Issue 683483004: aa rect renderer takes a gpu on construction (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: feedback inc Created 6 years, 1 month 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/GrClipMaskManager.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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 MAX_RESOURCE_CACHE_BYTES)); 139 MAX_RESOURCE_CACHE_BYTES));
140 fResourceCache->setOverbudgetCallback(OverbudgetCB, this); 140 fResourceCache->setOverbudgetCallback(OverbudgetCB, this);
141 fResourceCache2 = SkNEW(GrResourceCache2); 141 fResourceCache2 = SkNEW(GrResourceCache2);
142 142
143 fFontCache = SkNEW_ARGS(GrFontCache, (fGpu)); 143 fFontCache = SkNEW_ARGS(GrFontCache, (fGpu));
144 144
145 fLayerCache.reset(SkNEW_ARGS(GrLayerCache, (this))); 145 fLayerCache.reset(SkNEW_ARGS(GrLayerCache, (this)));
146 146
147 fLastDrawWasBuffered = kNo_BufferedDraw; 147 fLastDrawWasBuffered = kNo_BufferedDraw;
148 148
149 fAARectRenderer = SkNEW(GrAARectRenderer); 149 fAARectRenderer = SkNEW_ARGS(GrAARectRenderer, (fGpu));
150 fOvalRenderer = SkNEW(GrOvalRenderer); 150 fOvalRenderer = SkNEW(GrOvalRenderer);
151 151
152 fDidTestPMConversions = false; 152 fDidTestPMConversions = false;
153 153
154 this->setupDrawBuffer(); 154 this->setupDrawBuffer();
155 155
156 return true; 156 return true;
157 } 157 }
158 158
159 GrContext::~GrContext() { 159 GrContext::~GrContext() {
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix, &devBoun dRect); 772 bool doAA = needAA && apply_aa_to_rect(target, rect, width, matrix, &devBoun dRect);
773 773
774 const SkStrokeRec& strokeRec = strokeInfo->getStrokeRec(); 774 const SkStrokeRec& strokeRec = strokeInfo->getStrokeRec();
775 775
776 if (doAA) { 776 if (doAA) {
777 GrDrawState::AutoViewMatrixRestore avmr; 777 GrDrawState::AutoViewMatrixRestore avmr;
778 if (!avmr.setIdentity(target->drawState())) { 778 if (!avmr.setIdentity(target->drawState())) {
779 return; 779 return;
780 } 780 }
781 if (width >= 0) { 781 if (width >= 0) {
782 fAARectRenderer->strokeAARect(this->getGpu(), target, rect, 782 fAARectRenderer->strokeAARect(target, rect,
783 matrix, devBoundRect, 783 matrix, devBoundRect,
784 strokeRec); 784 strokeRec);
785 } else { 785 } else {
786 // filled AA rect 786 // filled AA rect
787 fAARectRenderer->fillAARect(this->getGpu(), target, 787 fAARectRenderer->fillAARect(target,
788 rect, matrix, devBoundRect); 788 rect, matrix, devBoundRect);
789 } 789 }
790 return; 790 return;
791 } 791 }
792 792
793 if (width >= 0) { 793 if (width >= 0) {
794 // TODO: consider making static vertex buffers for these cases. 794 // TODO: consider making static vertex buffers for these cases.
795 // Hairline could be done by just adding closing vertex to 795 // Hairline could be done by just adding closing vertex to
796 // unitSquareVertexBuffer() 796 // unitSquareVertexBuffer()
797 797
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 // Concave AA paths are expensive - try to avoid them for special cases 1167 // Concave AA paths are expensive - try to avoid them for special cases
1168 SkRect rects[2]; 1168 SkRect rects[2];
1169 1169
1170 if (is_nested_rects(target, path, strokeRec, rects)) { 1170 if (is_nested_rects(target, path, strokeRec, rects)) {
1171 SkMatrix origViewMatrix = drawState->getViewMatrix(); 1171 SkMatrix origViewMatrix = drawState->getViewMatrix();
1172 GrDrawState::AutoViewMatrixRestore avmr; 1172 GrDrawState::AutoViewMatrixRestore avmr;
1173 if (!avmr.setIdentity(target->drawState())) { 1173 if (!avmr.setIdentity(target->drawState())) {
1174 return; 1174 return;
1175 } 1175 }
1176 1176
1177 fAARectRenderer->fillAANestedRects(this->getGpu(), target, rects, or igViewMatrix); 1177 fAARectRenderer->fillAANestedRects(target, rects, origViewMatrix);
1178 return; 1178 return;
1179 } 1179 }
1180 } 1180 }
1181 1181
1182 SkRect ovalRect; 1182 SkRect ovalRect;
1183 bool isOval = path.isOval(&ovalRect); 1183 bool isOval = path.isOval(&ovalRect);
1184 1184
1185 if (!isOval || path.isInverseFillType() 1185 if (!isOval || path.isInverseFillType()
1186 || !fOvalRenderer->drawOval(target, this, paint.isAntiAlias(), ovalRect, strokeRec)) { 1186 || !fOvalRenderer->drawOval(target, this, paint.isAntiAlias(), ovalRect, strokeRec)) {
1187 this->internalDrawPath(target, paint.isAntiAlias(), path, strokeInfo); 1187 this->internalDrawPath(target, paint.isAntiAlias(), path, strokeInfo);
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 fResourceCache->printStats(); 1801 fResourceCache->printStats();
1802 } 1802 }
1803 #endif 1803 #endif
1804 1804
1805 #if GR_GPU_STATS 1805 #if GR_GPU_STATS
1806 const GrContext::GPUStats* GrContext::gpuStats() const { 1806 const GrContext::GPUStats* GrContext::gpuStats() const {
1807 return fGpu->gpuStats(); 1807 return fGpu->gpuStats();
1808 } 1808 }
1809 #endif 1809 #endif
1810 1810
OLDNEW
« no previous file with comments | « src/gpu/GrClipMaskManager.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698