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

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

Issue 791743003: Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: more windows fix Created 6 years 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/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.h » ('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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 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 "GrAADistanceFieldPathRenderer.h" 9 #include "GrAADistanceFieldPathRenderer.h"
10 10
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 SkASSERT(pathData->fPlot); 316 SkASSERT(pathData->fPlot);
317 GrDrawTarget::DrawToken drawToken = target->getCurrentDrawToken(); 317 GrDrawTarget::DrawToken drawToken = target->getCurrentDrawToken();
318 pathData->fPlot->setDrawToken(drawToken); 318 pathData->fPlot->setDrawToken(drawToken);
319 319
320 // set up any flags 320 // set up any flags
321 uint32_t flags = 0; 321 uint32_t flags = 0;
322 const SkMatrix& vm = drawState->getViewMatrix(); 322 const SkMatrix& vm = drawState->getViewMatrix();
323 flags |= vm.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0; 323 flags |= vm.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0;
324 324
325 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBilerp_ FilterMode); 325 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBilerp_ FilterMode);
326 if (flags != fEffectFlags || fCachedGeometryProcessor->getColor() != color) { 326 if (flags != fEffectFlags || fCachedGeometryProcessor->color() != color) {
327 fCachedGeometryProcessor.reset(GrDistanceFieldNoGammaTextureEffect::Crea te(color, 327 fCachedGeometryProcessor.reset(GrDistanceFieldNoGammaTextureEffect::Crea te(color,
328 texture, 328 texture,
329 params, 329 params,
330 flags)); 330 flags,
331 false));
331 fEffectFlags = flags; 332 fEffectFlags = flags;
332 } 333 }
333 drawState->setGeometryProcessor(fCachedGeometryProcessor.get());
334 334
335 void* vertices = NULL; 335 void* vertices = NULL;
336 bool success = target->reserveVertexAndIndexSpace(4, 336 bool success = target->reserveVertexAndIndexSpace(4,
337 fCachedGeometryProcessor-> getVertexStride(), 337 fCachedGeometryProcessor-> getVertexStride(),
338 0, &vertices, NULL); 338 0, &vertices, NULL);
339 SkASSERT(fCachedGeometryProcessor->getVertexStride() == 2 * sizeof(SkPoint)) ; 339 SkASSERT(fCachedGeometryProcessor->getVertexStride() == 2 * sizeof(SkPoint)) ;
340 GrAlwaysAssert(success); 340 GrAlwaysAssert(success);
341 341
342 SkScalar dx = pathData->fBounds.fLeft; 342 SkScalar dx = pathData->fBounds.fLeft;
343 SkScalar dy = pathData->fBounds.fTop; 343 SkScalar dy = pathData->fBounds.fTop;
(...skipping 21 matching lines...) Expand all
365 intptr_t intPtr = reinterpret_cast<intptr_t>(positions); 365 intptr_t intPtr = reinterpret_cast<intptr_t>(positions);
366 SkPoint* textureCoords = reinterpret_cast<SkPoint*>(intPtr + vertSize - size of(SkPoint)); 366 SkPoint* textureCoords = reinterpret_cast<SkPoint*>(intPtr + vertSize - size of(SkPoint));
367 textureCoords->setRectFan(SkFixedToFloat(texture->texturePriv().normalizeFix edX(tx)), 367 textureCoords->setRectFan(SkFixedToFloat(texture->texturePriv().normalizeFix edX(tx)),
368 SkFixedToFloat(texture->texturePriv().normalizeFix edY(ty)), 368 SkFixedToFloat(texture->texturePriv().normalizeFix edY(ty)),
369 SkFixedToFloat(texture->texturePriv().normalizeFix edX(tx + tw)), 369 SkFixedToFloat(texture->texturePriv().normalizeFix edX(tx + tw)),
370 SkFixedToFloat(texture->texturePriv().normalizeFix edY(ty + th)), 370 SkFixedToFloat(texture->texturePriv().normalizeFix edY(ty + th)),
371 vertSize); 371 vertSize);
372 372
373 vm.mapRect(&r); 373 vm.mapRect(&r);
374 target->setIndexSourceToBuffer(fContext->getQuadIndexBuffer()); 374 target->setIndexSourceToBuffer(fContext->getQuadIndexBuffer());
375 target->drawIndexedInstances(drawState, kTriangles_GrPrimitiveType, 1, 4, 6, &r); 375 target->drawIndexedInstances(drawState, fCachedGeometryProcessor.get(),
376 kTriangles_GrPrimitiveType, 1, 4, 6, &r);
376 target->resetVertexSource(); 377 target->resetVertexSource();
377 378
378 return true; 379 return true;
379 } 380 }
380 381
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698