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

Side by Side Diff: src/gpu/batches/GrAtlasTextBatch.cpp

Issue 1884873006: Rename lots of things from 'sRGB' to 'GammaCorrect', where appropriate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 "GrAtlasTextBatch.h" 8 #include "GrAtlasTextBatch.h"
9 9
10 #include "GrBatchFlushState.h" 10 #include "GrBatchFlushState.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // TODO just use class params 257 // TODO just use class params
258 // TODO trying to figure out why lcd is so whack 258 // TODO trying to figure out why lcd is so whack
259 GrGeometryProcessor* GrAtlasTextBatch::setupDfProcessor(const SkMatrix& viewMatr ix, 259 GrGeometryProcessor* GrAtlasTextBatch::setupDfProcessor(const SkMatrix& viewMatr ix,
260 SkColor filteredColor, 260 SkColor filteredColor,
261 GrColor color, GrTexture * texture) const { 261 GrColor color, GrTexture * texture) const {
262 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_F ilterMode); 262 GrTextureParams params(SkShader::kClamp_TileMode, GrTextureParams::kBilerp_F ilterMode);
263 bool isLCD = this->isLCD(); 263 bool isLCD = this->isLCD();
264 // set up any flags 264 // set up any flags
265 uint32_t flags = viewMatrix.isSimilarity() ? kSimilarity_DistanceFieldEffect Flag : 0; 265 uint32_t flags = viewMatrix.isSimilarity() ? kSimilarity_DistanceFieldEffect Flag : 0;
266 flags |= viewMatrix.isScaleTranslate() ? kScaleOnly_DistanceFieldEffectFlag : 0; 266 flags |= viewMatrix.isScaleTranslate() ? kScaleOnly_DistanceFieldEffectFlag : 0;
267 flags |= fUseSRGBDistanceTable ? kSRGB_DistanceFieldEffectFlag : 0; 267 flags |= fUseGammaCorrectDistanceTable ? kGammaCorrect_DistanceFieldEffectFl ag : 0;
268 268
269 // see if we need to create a new effect 269 // see if we need to create a new effect
270 if (isLCD) { 270 if (isLCD) {
271 flags |= kUseLCD_DistanceFieldEffectFlag; 271 flags |= kUseLCD_DistanceFieldEffectFlag;
272 flags |= fUseBGR ? kBGR_DistanceFieldEffectFlag : 0; 272 flags |= fUseBGR ? kBGR_DistanceFieldEffectFlag : 0;
273 273
274 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredColor); 274 GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredColor);
275 275
276 float redCorrection = fDistanceAdjustTable->getAdjustment( 276 float redCorrection = fDistanceAdjustTable->getAdjustment(
277 GrColorUnpackR(colorNoPreMul) >> kDistanceAdjustLumShift, fUseSRGBDi stanceTable); 277 GrColorUnpackR(colorNoPreMul) >> kDistanceAdjustLumShift,
278 fUseGammaCorrectDistanceTable);
278 float greenCorrection = fDistanceAdjustTable->getAdjustment( 279 float greenCorrection = fDistanceAdjustTable->getAdjustment(
279 GrColorUnpackG(colorNoPreMul) >> kDistanceAdjustLumShift, fUseSRGBDi stanceTable); 280 GrColorUnpackG(colorNoPreMul) >> kDistanceAdjustLumShift,
281 fUseGammaCorrectDistanceTable);
280 float blueCorrection = fDistanceAdjustTable->getAdjustment( 282 float blueCorrection = fDistanceAdjustTable->getAdjustment(
281 GrColorUnpackB(colorNoPreMul) >> kDistanceAdjustLumShift, fUseSRGBDi stanceTable); 283 GrColorUnpackB(colorNoPreMul) >> kDistanceAdjustLumShift,
284 fUseGammaCorrectDistanceTable);
282 GrDistanceFieldLCDTextGeoProc::DistanceAdjust widthAdjust = 285 GrDistanceFieldLCDTextGeoProc::DistanceAdjust widthAdjust =
283 GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(redCorrection, 286 GrDistanceFieldLCDTextGeoProc::DistanceAdjust::Make(redCorrection,
284 greenCorrection, 287 greenCorrection,
285 blueCorrection); 288 blueCorrection);
286 289
287 return GrDistanceFieldLCDTextGeoProc::Create(color, 290 return GrDistanceFieldLCDTextGeoProc::Create(color,
288 viewMatrix, 291 viewMatrix,
289 texture, 292 texture,
290 params, 293 params,
291 widthAdjust, 294 widthAdjust,
292 flags, 295 flags,
293 this->usesLocalCoords()); 296 this->usesLocalCoords());
294 } else { 297 } else {
295 #ifdef SK_GAMMA_APPLY_TO_A8 298 #ifdef SK_GAMMA_APPLY_TO_A8
296 U8CPU lum = SkColorSpaceLuminance::computeLuminance(SK_GAMMA_EXPONENT, f ilteredColor); 299 U8CPU lum = SkColorSpaceLuminance::computeLuminance(SK_GAMMA_EXPONENT, f ilteredColor);
297 float correction = fDistanceAdjustTable->getAdjustment( 300 float correction = fDistanceAdjustTable->getAdjustment(
298 lum >> kDistanceAdjustLumShift, fUseSRGBDistanceTable); 301 lum >> kDistanceAdjustLumShift, fUseGammaCorrectDistanceTable);
299 return GrDistanceFieldA8TextGeoProc::Create(color, 302 return GrDistanceFieldA8TextGeoProc::Create(color,
300 viewMatrix, 303 viewMatrix,
301 texture, 304 texture,
302 params, 305 params,
303 correction, 306 correction,
304 flags, 307 flags,
305 this->usesLocalCoords()); 308 this->usesLocalCoords());
306 #else 309 #else
307 return GrDistanceFieldA8TextGeoProc::Create(color, 310 return GrDistanceFieldA8TextGeoProc::Create(color,
308 viewMatrix, 311 viewMatrix,
309 texture, 312 texture,
310 params, 313 params,
311 flags, 314 flags,
312 this->usesLocalCoords()); 315 this->usesLocalCoords());
313 #endif 316 #endif
314 } 317 }
315 318
316 } 319 }
317 320
318 void GrBlobRegenHelper::flush() { 321 void GrBlobRegenHelper::flush() {
319 fBatch->flush(fTarget, fFlushInfo); 322 fBatch->flush(fTarget, fFlushInfo);
320 } 323 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698