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

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

Issue 815553003: Move ViewMatrix off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@remove-fragment-stage
Patch Set: more cleaning 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/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrDrawState.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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "GrDistanceFieldTextContext.h" 8 #include "GrDistanceFieldTextContext.h"
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "GrBitmapTextContext.h" 10 #include "GrBitmapTextContext.h"
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 flags |= ctm.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0; 400 flags |= ctm.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0;
401 flags |= fUseLCDText ? kUseLCD_DistanceFieldEffectFlag : 0; 401 flags |= fUseLCDText ? kUseLCD_DistanceFieldEffectFlag : 0;
402 flags |= fUseLCDText && ctm.rectStaysRect() ? 402 flags |= fUseLCDText && ctm.rectStaysRect() ?
403 kRectToRect_DistanceFieldEffectFlag : 0; 403 kRectToRect_DistanceFieldEffectFlag : 0;
404 bool useBGR = SkPixelGeometryIsBGR(fDeviceProperties.pixelGeometry()); 404 bool useBGR = SkPixelGeometryIsBGR(fDeviceProperties.pixelGeometry());
405 flags |= fUseLCDText && useBGR ? kBGR_DistanceFieldEffectFlag : 0; 405 flags |= fUseLCDText && useBGR ? kBGR_DistanceFieldEffectFlag : 0;
406 406
407 // see if we need to create a new effect 407 // see if we need to create a new effect
408 if (textureUniqueID != fEffectTextureUniqueID || 408 if (textureUniqueID != fEffectTextureUniqueID ||
409 filteredColor != fEffectColor || 409 filteredColor != fEffectColor ||
410 flags != fEffectFlags) { 410 flags != fEffectFlags ||
411 !fCachedGeometryProcessor->viewMatrix().cheapEqualTo(fViewMatrix)) {
411 GrColor color = fPaint.getColor(); 412 GrColor color = fPaint.getColor();
412 if (fUseLCDText) { 413 if (fUseLCDText) {
413 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol or); 414 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol or);
414 fCachedGeometryProcessor.reset(GrDistanceFieldLCDTextureEffect::Crea te(color, 415 fCachedGeometryProcessor.reset(GrDistanceFieldLCDTextureEffect::Crea te(color,
416 fViewMatrix,
415 fCurrTexture, 417 fCurrTexture,
416 params, 418 params,
417 fGammaTexture, 419 fGammaTexture,
418 gammaParams, 420 gammaParams,
419 colorNoPreMul, 421 colorNoPreMul,
420 flags)); 422 flags));
421 } else { 423 } else {
422 flags |= kColorAttr_DistanceFieldEffectFlag; 424 flags |= kColorAttr_DistanceFieldEffectFlag;
423 bool opaque = GrColorIsOpaque(color); 425 bool opaque = GrColorIsOpaque(color);
424 #ifdef SK_GAMMA_APPLY_TO_A8 426 #ifdef SK_GAMMA_APPLY_TO_A8
425 U8CPU lum = SkColorSpaceLuminance::computeLuminance(fDevicePropertie s.gamma(), 427 U8CPU lum = SkColorSpaceLuminance::computeLuminance(fDevicePropertie s.gamma(),
426 filteredColor); 428 filteredColor);
427 fCachedGeometryProcessor.reset(GrDistanceFieldTextureEffect::Create( color, 429 fCachedGeometryProcessor.reset(GrDistanceFieldTextureEffect::Create( color,
430 fViewMatrix,
428 fCurrTexture, 431 fCurrTexture,
429 params, 432 params,
430 fGammaTexture, 433 fGammaTexture,
431 gammaParams, 434 gammaParams,
432 lum/255.f, 435 lum/255.f,
433 flags, 436 flags,
434 opaque)); 437 opaque));
435 #else 438 #else
436 fCachedGeometryProcessor.reset(GrDistanceFieldNoGammaTextureEffect:: Create(color, 439 fCachedGeometryProcessor.reset(GrDistanceFieldNoGammaTextureEffect:: Create(color,
440 fViewMatrix,
437 fCurrTexture, 441 fCurrTexture,
438 params, 442 params,
439 flags, 443 flags,
440 opaque)); 444 opaque));
441 #endif 445 #endif
442 } 446 }
443 fEffectTextureUniqueID = textureUniqueID; 447 fEffectTextureUniqueID = textureUniqueID;
444 fEffectColor = filteredColor; 448 fEffectColor = filteredColor;
445 fEffectFlags = flags; 449 fEffectFlags = flags;
446 } 450 }
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 return true; 630 return true;
627 } 631 }
628 632
629 void GrDistanceFieldTextContext::flush() { 633 void GrDistanceFieldTextContext::flush() {
630 if (NULL == fDrawTarget) { 634 if (NULL == fDrawTarget) {
631 return; 635 return;
632 } 636 }
633 637
634 if (fCurrVertex > 0) { 638 if (fCurrVertex > 0) {
635 GrDrawState drawState; 639 GrDrawState drawState;
636 drawState.setFromPaint(fPaint, fViewMatrix, fContext->getRenderTarget()) ; 640 drawState.setFromPaint(fPaint, fContext->getRenderTarget());
637 641
638 // setup our sampler state for our text texture/atlas 642 // setup our sampler state for our text texture/atlas
639 SkASSERT(SkIsAlign4(fCurrVertex)); 643 SkASSERT(SkIsAlign4(fCurrVertex));
640 644
641 // get our current color 645 // get our current color
642 SkColor filteredColor; 646 SkColor filteredColor;
643 SkColorFilter* colorFilter = fSkPaint.getColorFilter(); 647 SkColorFilter* colorFilter = fSkPaint.getColorFilter();
644 if (colorFilter) { 648 if (colorFilter) {
645 filteredColor = colorFilter->filterColor(fSkPaint.getColor()); 649 filteredColor = colorFilter->filterColor(fSkPaint.getColor());
646 } else { 650 } else {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 683 }
680 } 684 }
681 685
682 inline void GrDistanceFieldTextContext::finish() { 686 inline void GrDistanceFieldTextContext::finish() {
683 this->flush(); 687 this->flush();
684 fTotalVertexCount = 0; 688 fTotalVertexCount = 0;
685 689
686 GrTextContext::finish(); 690 GrTextContext::finish();
687 } 691 }
688 692
OLDNEW
« no previous file with comments | « src/gpu/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698