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/batches/GrDrawPathBatch.cpp

Issue 2078483002: Start using GrGpuCommandBuffer in GrDrawTarget. (Closed) Base URL: https://skia.googlesource.com/skia.git@memoryWAR
Patch Set: clean up Created 4 years, 6 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "GrDrawPathBatch.h" 8 #include "GrDrawPathBatch.h"
9 9
10 #include "GrRenderTargetPriv.h" 10 #include "GrRenderTargetPriv.h"
11 11
12 static void pre_translate_transform_values(const float* xforms, 12 static void pre_translate_transform_values(const float* xforms,
13 GrPathRendering::PathTransformType ty pe, int count, 13 GrPathRendering::PathTransformType ty pe, int count,
14 SkScalar x, SkScalar y, float* dst); 14 SkScalar x, SkScalar y, float* dst);
15 15
16 void GrDrawPathBatchBase::onPrepare(GrBatchFlushState*) { 16 void GrDrawPathBatchBase::onPrepare(GrBatchFlushState*) {
17 const GrRenderTargetPriv& rtPriv = this->pipeline()->getRenderTarget()->rend erTargetPriv(); 17 const GrRenderTargetPriv& rtPriv = this->pipeline()->getRenderTarget()->rend erTargetPriv();
18 fStencilPassSettings.reset(GrPathRendering::GetStencilPassSettings(fFillType ), 18 fStencilPassSettings.reset(GrPathRendering::GetStencilPassSettings(fFillType ),
19 this->pipeline()->hasStencilClip(), rtPriv.numSte ncilBits()); 19 this->pipeline()->hasStencilClip(), rtPriv.numSte ncilBits());
20 } 20 }
21 21
22 SkString GrDrawPathBatch::dumpInfo() const { 22 SkString GrDrawPathBatch::dumpInfo() const {
23 SkString string; 23 SkString string;
24 string.printf("PATH: 0x%p", fPath.get()); 24 string.printf("PATH: 0x%p", fPath.get());
25 return string; 25 return string;
26 } 26 }
27 27
28 void GrDrawPathBatch::onDraw(GrBatchFlushState* state) { 28 void GrDrawPathBatch::onDraw(GrBatchFlushState* state, GrGpuCommandBuffer* buffe r) {
29 GrProgramDesc desc; 29 GrProgramDesc desc;
30 30
31 SkAutoTUnref<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color() , 31 SkAutoTUnref<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color() ,
32 this->overrid es(), 32 this->overrid es(),
33 this->viewMat rix())); 33 this->viewMat rix()));
34 state->gpu()->pathRendering()->drawPath(*this->pipeline(), *pathProc, 34 state->gpu()->pathRendering()->drawPath(*this->pipeline(), *pathProc,
35 this->stencilPassSettings(), fPath.g et()); 35 this->stencilPassSettings(), fPath.g et());
36 } 36 }
37 37
38 SkString GrDrawPathRangeBatch::dumpInfo() const { 38 SkString GrDrawPathRangeBatch::dumpInfo() const {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 Draw* draw = fDraws.addToTail(); 107 Draw* draw = fDraws.addToTail();
108 draw->fInstanceData.reset(head->fInstanceData.release()); 108 draw->fInstanceData.reset(head->fInstanceData.release());
109 draw->fX = head->fX; 109 draw->fX = head->fX;
110 draw->fY = head->fY; 110 draw->fY = head->fY;
111 that->fDraws.popHead(); 111 that->fDraws.popHead();
112 } 112 }
113 this->joinBounds(that->fBounds); 113 this->joinBounds(that->fBounds);
114 return true; 114 return true;
115 } 115 }
116 116
117 void GrDrawPathRangeBatch::onDraw(GrBatchFlushState* state) { 117 void GrDrawPathRangeBatch::onDraw(GrBatchFlushState* state, GrGpuCommandBuffer* buffer) {
118 const Draw& head = *fDraws.head(); 118 const Draw& head = *fDraws.head();
119 119
120 SkMatrix drawMatrix(this->viewMatrix()); 120 SkMatrix drawMatrix(this->viewMatrix());
121 drawMatrix.preScale(fScale, fScale); 121 drawMatrix.preScale(fScale, fScale);
122 drawMatrix.preTranslate(head.fX, head.fY); 122 drawMatrix.preTranslate(head.fX, head.fY);
123 123
124 SkMatrix localMatrix; 124 SkMatrix localMatrix;
125 localMatrix.setScale(fScale, fScale); 125 localMatrix.setScale(fScale, fScale);
126 localMatrix.preTranslate(head.fX, head.fY); 126 localMatrix.preTranslate(head.fX, head.fY);
127 127
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 dst[i + 3] = xforms[i + 3]; 210 dst[i + 3] = xforms[i + 3];
211 dst[i + 4] = xforms[i + 4]; 211 dst[i + 4] = xforms[i + 4];
212 dst[i + 5] = xforms[i + 3] * x + xforms[i + 4] * y + xforms[i + 5]; 212 dst[i + 5] = xforms[i + 3] * x + xforms[i + 4] * y + xforms[i + 5];
213 } 213 }
214 break; 214 break;
215 default: 215 default:
216 SkFAIL("Unknown transform type."); 216 SkFAIL("Unknown transform type.");
217 break; 217 break;
218 } 218 }
219 } 219 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698