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

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

Issue 583773004: Revert of introduce Props to surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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/core/SkSurfacePriv.h ('k') | src/gpu/GrLayerHoister.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 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 "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 GrTextureParams gammaParams(SkShader::kClamp_TileMode, GrTextureParams::kNon e_FilterMode); 124 GrTextureParams gammaParams(SkShader::kClamp_TileMode, GrTextureParams::kNon e_FilterMode);
125 125
126 uint32_t textureUniqueID = fCurrTexture->getUniqueID(); 126 uint32_t textureUniqueID = fCurrTexture->getUniqueID();
127 127
128 // set up any flags 128 // set up any flags
129 uint32_t flags = 0; 129 uint32_t flags = 0;
130 flags |= fTextMatrix.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0; 130 flags |= fTextMatrix.isSimilarity() ? kSimilarity_DistanceFieldEffectFlag : 0;
131 flags |= fUseLCDText ? kUseLCD_DistanceFieldEffectFlag : 0; 131 flags |= fUseLCDText ? kUseLCD_DistanceFieldEffectFlag : 0;
132 flags |= fUseLCDText && fTextMatrix.rectStaysRect() ? 132 flags |= fUseLCDText && fTextMatrix.rectStaysRect() ?
133 kRectToRect_DistanceFieldEffectFlag : 0; 133 kRectToRect_DistanceFieldEffectFlag : 0;
134 bool useBGR = SkPixelGeometryIsBGR(fDeviceProperties.fPixelGeometry); 134 bool useBGR = SkDeviceProperties::Geometry::kBGR_Layout ==
135 fDeviceProperties.fGeometry.getLayout();
135 flags |= fUseLCDText && useBGR ? kBGR_DistanceFieldEffectFlag : 0; 136 flags |= fUseLCDText && useBGR ? kBGR_DistanceFieldEffectFlag : 0;
136 137
137 // see if we need to create a new effect 138 // see if we need to create a new effect
138 if (textureUniqueID != fEffectTextureUniqueID || 139 if (textureUniqueID != fEffectTextureUniqueID ||
139 filteredColor != fEffectColor || 140 filteredColor != fEffectColor ||
140 flags != fEffectFlags) { 141 flags != fEffectFlags) {
141 if (fUseLCDText) { 142 if (fUseLCDText) {
142 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol or); 143 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredCol or);
143 fCachedEffect.reset(GrDistanceFieldLCDTextureEffect::Create(fCurrTex ture, 144 fCachedEffect.reset(GrDistanceFieldLCDTextureEffect::Create(fCurrTex ture,
144 params, 145 params,
145 fGammaTe xture, 146 fGammaTe xture,
146 gammaPar ams, 147 gammaPar ams,
147 colorNoP reMul, 148 colorNoP reMul,
148 flags)); 149 flags));
149 } else { 150 } else {
150 #ifdef SK_GAMMA_APPLY_TO_A8 151 #ifdef SK_GAMMA_APPLY_TO_A8
151 U8CPU lum = SkColorSpaceLuminance::computeLuminance(fDevicePropertie s.getGamma(), 152 U8CPU lum = SkColorSpaceLuminance::computeLuminance(fDevicePropertie s.fGamma,
152 filteredColor); 153 filteredColor);
153 fCachedEffect.reset(GrDistanceFieldTextureEffect::Create(fCurrTextur e, 154 fCachedEffect.reset(GrDistanceFieldTextureEffect::Create(fCurrTextur e,
154 params, 155 params,
155 fGammaTextu re, 156 fGammaTextu re,
156 gammaParams , 157 gammaParams ,
157 lum/255.f, 158 lum/255.f,
158 flags)); 159 flags));
159 #else 160 #else
160 fCachedEffect.reset(GrDistanceFieldTextureEffect::Create(fCurrTextur e, 161 fCachedEffect.reset(GrDistanceFieldTextureEffect::Create(fCurrTextur e,
161 params, fla gs)); 162 params, fla gs));
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 GrTexture** gammaTexture) { 495 GrTexture** gammaTexture) {
495 if (NULL == *gammaTexture) { 496 if (NULL == *gammaTexture) {
496 int width, height; 497 int width, height;
497 size_t size; 498 size_t size;
498 499
499 #ifdef SK_GAMMA_CONTRAST 500 #ifdef SK_GAMMA_CONTRAST
500 SkScalar contrast = SK_GAMMA_CONTRAST; 501 SkScalar contrast = SK_GAMMA_CONTRAST;
501 #else 502 #else
502 SkScalar contrast = 0.5f; 503 SkScalar contrast = 0.5f;
503 #endif 504 #endif
504 SkScalar paintGamma = deviceProperties.getGamma(); 505 SkScalar paintGamma = deviceProperties.fGamma;
505 SkScalar deviceGamma = deviceProperties.getGamma(); 506 SkScalar deviceGamma = deviceProperties.fGamma;
506 507
507 size = SkScalerContext::GetGammaLUTSize(contrast, paintGamma, deviceGamm a, 508 size = SkScalerContext::GetGammaLUTSize(contrast, paintGamma, deviceGamm a,
508 &width, &height); 509 &width, &height);
509 510
510 SkAutoTArray<uint8_t> data((int)size); 511 SkAutoTArray<uint8_t> data((int)size);
511 SkScalerContext::GetGammaLUTData(contrast, paintGamma, deviceGamma, data .get()); 512 SkScalerContext::GetGammaLUTData(contrast, paintGamma, deviceGamma, data .get());
512 513
513 // TODO: Update this to use the cache rather than directly creating a te xture. 514 // TODO: Update this to use the cache rather than directly creating a te xture.
514 GrTextureDesc desc; 515 GrTextureDesc desc;
515 desc.fFlags = kDynamicUpdate_GrTextureFlagBit; 516 desc.fFlags = kDynamicUpdate_GrTextureFlagBit;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 SkScalarToFixed(x) - (glyph.fAdvanceX >> a lignShift), 664 SkScalarToFixed(x) - (glyph.fAdvanceX >> a lignShift),
664 SkScalarToFixed(y) - (glyph.fAdvanceY >> a lignShift), 665 SkScalarToFixed(y) - (glyph.fAdvanceY >> a lignShift),
665 fontScaler); 666 fontScaler);
666 } 667 }
667 pos += scalarsPerPosition; 668 pos += scalarsPerPosition;
668 } 669 }
669 } 670 }
670 671
671 this->finish(); 672 this->finish();
672 } 673 }
OLDNEW
« no previous file with comments | « src/core/SkSurfacePriv.h ('k') | src/gpu/GrLayerHoister.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698