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

Side by Side Diff: src/core/SkPaint.cpp

Issue 1189223002: Remove gamma field from SkDeviceProperties (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cleanup DistanceAdjustTable Created 5 years, 6 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/SkDeviceProperties.h ('k') | src/gpu/GrAtlasTextContext.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkPaint.h" 8 #include "SkPaint.h"
9 #include "SkAnnotation.h" 9 #include "SkAnnotation.h"
10 #include "SkAutoKern.h" 10 #include "SkAutoKern.h"
(...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 if (paint.getFlags() & SkPaint::kGenA8FromLCD_Flag) { 1456 if (paint.getFlags() & SkPaint::kGenA8FromLCD_Flag) {
1457 flags |= SkScalerContext::kGenA8FromLCD_Flag; 1457 flags |= SkScalerContext::kGenA8FromLCD_Flag;
1458 } 1458 }
1459 rec->fFlags = SkToU16(flags); 1459 rec->fFlags = SkToU16(flags);
1460 1460
1461 // these modify fFlags, so do them after assigning fFlags 1461 // these modify fFlags, so do them after assigning fFlags
1462 rec->setHinting(computeHinting(paint)); 1462 rec->setHinting(computeHinting(paint));
1463 1463
1464 rec->setLuminanceColor(paint.computeLuminanceColor()); 1464 rec->setLuminanceColor(paint.computeLuminanceColor());
1465 1465
1466 if (NULL == deviceProperties) { 1466 //For now always set the paint gamma equal to the device gamma.
1467 rec->setDeviceGamma(SK_GAMMA_EXPONENT); 1467 //The math in SkMaskGamma can handle them being different,
1468 rec->setPaintGamma(SK_GAMMA_EXPONENT); 1468 //but it requires superluminous masks when
1469 } else { 1469 //Ex : deviceGamma(x) < paintGamma(x) and x is sufficiently large.
1470 rec->setDeviceGamma(deviceProperties->gamma()); 1470 rec->setDeviceGamma(SK_GAMMA_EXPONENT);
1471 1471 rec->setPaintGamma(SK_GAMMA_EXPONENT);
1472 //For now always set the paint gamma equal to the device gamma.
1473 //The math in SkMaskGamma can handle them being different,
1474 //but it requires superluminous masks when
1475 //Ex : deviceGamma(x) < paintGamma(x) and x is sufficiently large.
1476 rec->setPaintGamma(deviceProperties->gamma());
1477 }
1478 1472
1479 #ifdef SK_GAMMA_CONTRAST 1473 #ifdef SK_GAMMA_CONTRAST
1480 rec->setContrast(SK_GAMMA_CONTRAST); 1474 rec->setContrast(SK_GAMMA_CONTRAST);
1481 #else 1475 #else
1482 /** 1476 /**
1483 * A value of 0.5 for SK_GAMMA_CONTRAST appears to be a good compromise. 1477 * A value of 0.5 for SK_GAMMA_CONTRAST appears to be a good compromise.
1484 * With lower values small text appears washed out (though correctly so). 1478 * With lower values small text appears washed out (though correctly so).
1485 * With higher values lcd fringing is worse and the smoothing effect of 1479 * With higher values lcd fringing is worse and the smoothing effect of
1486 * partial coverage is diminished. 1480 * partial coverage is diminished.
1487 */ 1481 */
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
2426 } 2420 }
2427 2421
2428 uint32_t SkPaint::getHash() const { 2422 uint32_t SkPaint::getHash() const {
2429 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields, 2423 // We're going to hash 10 pointers and 7 32-bit values, finishing up with fB itfields,
2430 // so fBitfields should be 10 pointers and 6 32-bit values from the start. 2424 // so fBitfields should be 10 pointers and 6 32-bit values from the start.
2431 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * sizeof(uint32_t), 2425 SK_COMPILE_ASSERT(offsetof(SkPaint, fBitfields) == 10 * sizeof(void*) + 6 * sizeof(uint32_t),
2432 SkPaint_notPackedTightly); 2426 SkPaint_notPackedTightly);
2433 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this), 2427 return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(this),
2434 offsetof(SkPaint, fBitfields) + sizeof(fBitfields )); 2428 offsetof(SkPaint, fBitfields) + sizeof(fBitfields ));
2435 } 2429 }
OLDNEW
« no previous file with comments | « src/core/SkDeviceProperties.h ('k') | src/gpu/GrAtlasTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698