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

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

Issue 858343002: Rename GrOptDrawState to GrPipeline and GrDrawState to GrPipelineBuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more nits Created 5 years, 11 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/GrStencilAndCoverTextContext.h ('k') | src/gpu/GrTest.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 2014 Google Inc. 2 * Copyright 2014 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 "GrStencilAndCoverTextContext.h" 8 #include "GrStencilAndCoverTextContext.h"
9 #include "GrBitmapTextContext.h" 9 #include "GrBitmapTextContext.h"
10 #include "GrDrawTarget.h" 10 #include "GrDrawTarget.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 fViewMatrix.preConcat(textMatrix); 337 fViewMatrix.preConcat(textMatrix);
338 fLocalMatrix = textMatrix; 338 fLocalMatrix = textMatrix;
339 339
340 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, true /*igno reGamma*/); 340 fGlyphCache = fSkPaint.detachCache(&fDeviceProperties, NULL, true /*igno reGamma*/);
341 fGlyphs = canUseRawPaths ? 341 fGlyphs = canUseRawPaths ?
342 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr oke) : 342 get_gr_glyphs(fContext, fSkPaint.getTypeface(), NULL, fStr oke) :
343 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g etTypeface(), 343 get_gr_glyphs(fContext, fGlyphCache->getScalerContext()->g etTypeface(),
344 &fGlyphCache->getDescriptor(), fStroke); 344 &fGlyphCache->getDescriptor(), fStroke);
345 } 345 }
346 346
347 fStateRestore.set(&fDrawState); 347 fStateRestore.set(&fPipelineBuilder);
348 348
349 fDrawState.setFromPaint(fPaint, fContext->getRenderTarget()); 349 fPipelineBuilder.setFromPaint(fPaint, fContext->getRenderTarget());
350 350
351 GR_STATIC_CONST_SAME_STENCIL(kStencilPass, 351 GR_STATIC_CONST_SAME_STENCIL(kStencilPass,
352 kZero_StencilOp, 352 kZero_StencilOp,
353 kZero_StencilOp, 353 kZero_StencilOp,
354 kNotEqual_StencilFunc, 354 kNotEqual_StencilFunc,
355 0xffff, 355 0xffff,
356 0x0000, 356 0x0000,
357 0xffff); 357 0xffff);
358 358
359 *fDrawState.stencil() = kStencilPass; 359 *fPipelineBuilder.stencil() = kStencilPass;
360 360
361 SkASSERT(0 == fQueuedGlyphCount); 361 SkASSERT(0 == fQueuedGlyphCount);
362 SkASSERT(kGlyphBufferSize == fFallbackGlyphsIdx); 362 SkASSERT(kGlyphBufferSize == fFallbackGlyphsIdx);
363 } 363 }
364 364
365 bool GrStencilAndCoverTextContext::mapToFallbackContext(SkMatrix* inverse) { 365 bool GrStencilAndCoverTextContext::mapToFallbackContext(SkMatrix* inverse) {
366 // The current view matrix is flipped because GPU path rendering glyphs have an 366 // The current view matrix is flipped because GPU path rendering glyphs have an
367 // inverted y-direction. Unflip the view matrix for the fallback context. If using 367 // inverted y-direction. Unflip the view matrix for the fallback context. If using
368 // device-space glyphs, we'll also need to restore the original view matrix since 368 // device-space glyphs, we'll also need to restore the original view matrix since
369 // we moved that transfomation into our local glyph cache for this scenario. Also 369 // we moved that transfomation into our local glyph cache for this scenario. Also
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 GR_STATIC_ASSERT(0 == offsetof(SkPoint, fX)); 401 GR_STATIC_ASSERT(0 == offsetof(SkPoint, fX));
402 402
403 return &pointArray[0].fX; 403 return &pointArray[0].fX;
404 } 404 }
405 405
406 void GrStencilAndCoverTextContext::flush() { 406 void GrStencilAndCoverTextContext::flush() {
407 if (fQueuedGlyphCount > 0) { 407 if (fQueuedGlyphCount > 0) {
408 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor (), 408 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(fPaint.getColor (),
409 fViewMatrix, 409 fViewMatrix,
410 fLocalMatrix)); 410 fLocalMatrix));
411 fDrawTarget->drawPaths(&fDrawState, pp, fGlyphs, 411 fDrawTarget->drawPaths(&fPipelineBuilder, pp, fGlyphs,
412 fGlyphIndices, GrPathRange::kU16_PathIndexType, 412 fGlyphIndices, GrPathRange::kU16_PathIndexType,
413 get_xy_scalar_array(fGlyphPositions), 413 get_xy_scalar_array(fGlyphPositions),
414 GrPathRendering::kTranslate_PathTransformType, 414 GrPathRendering::kTranslate_PathTransformType,
415 fQueuedGlyphCount, GrPathRendering::kWinding_Fill Type); 415 fQueuedGlyphCount, GrPathRendering::kWinding_Fill Type);
416 416
417 fQueuedGlyphCount = 0; 417 fQueuedGlyphCount = 0;
418 } 418 }
419 419
420 if (fFallbackGlyphsIdx < kGlyphBufferSize) { 420 if (fFallbackGlyphsIdx < kGlyphBufferSize) {
421 int fallbackGlyphCount = kGlyphBufferSize - fFallbackGlyphsIdx; 421 int fallbackGlyphCount = kGlyphBufferSize - fFallbackGlyphsIdx;
(...skipping 24 matching lines...) Expand all
446 446
447 void GrStencilAndCoverTextContext::finish() { 447 void GrStencilAndCoverTextContext::finish() {
448 this->flush(); 448 this->flush();
449 449
450 fGlyphs->unref(); 450 fGlyphs->unref();
451 fGlyphs = NULL; 451 fGlyphs = NULL;
452 452
453 SkGlyphCache::AttachCache(fGlyphCache); 453 SkGlyphCache::AttachCache(fGlyphCache);
454 fGlyphCache = NULL; 454 fGlyphCache = NULL;
455 455
456 fDrawState.stencil()->setDisabled(); 456 fPipelineBuilder.stencil()->setDisabled();
457 fStateRestore.set(NULL); 457 fStateRestore.set(NULL);
458 fViewMatrix = fContextInitialMatrix; 458 fViewMatrix = fContextInitialMatrix;
459 GrTextContext::finish(); 459 GrTextContext::finish();
460 } 460 }
461 461
OLDNEW
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.h ('k') | src/gpu/GrTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698