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

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

Issue 2256023002: Flush denorm half floats to zero. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix threshold, clean up tests Created 4 years, 4 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 | « no previous file | src/core/SkColorSpaceXform.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 2008 The Android Open Source Project 2 * Copyright 2008 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 "SkAtomics.h" 8 #include "SkAtomics.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 SkPMColor c = SkSwizzle_BGRA_to_PMColor(addr[0]); 593 SkPMColor c = SkSwizzle_BGRA_to_PMColor(addr[0]);
594 return SkUnPreMultiply::PMColorToColor(c); 594 return SkUnPreMultiply::PMColorToColor(c);
595 } 595 }
596 case kRGBA_8888_SkColorType: { 596 case kRGBA_8888_SkColorType: {
597 uint32_t* addr = this->getAddr32(x, y); 597 uint32_t* addr = this->getAddr32(x, y);
598 SkPMColor c = SkSwizzle_RGBA_to_PMColor(addr[0]); 598 SkPMColor c = SkSwizzle_RGBA_to_PMColor(addr[0]);
599 return SkUnPreMultiply::PMColorToColor(c); 599 return SkUnPreMultiply::PMColorToColor(c);
600 } 600 }
601 case kRGBA_F16_SkColorType: { 601 case kRGBA_F16_SkColorType: {
602 const uint64_t* addr = (const uint64_t*)fPixels + y * (fRowBytes >> 3) + x; 602 const uint64_t* addr = (const uint64_t*)fPixels + y * (fRowBytes >> 3) + x;
603 Sk4f p4 = SkHalfToFloat_finite(addr[0]); 603 Sk4f p4 = SkHalfToFloat_finite_ftz(addr[0]);
604 if (p4[3]) { 604 if (p4[3]) {
605 float inva = 1 / p4[3]; 605 float inva = 1 / p4[3];
606 p4 = p4 * Sk4f(inva, inva, inva, 1); 606 p4 = p4 * Sk4f(inva, inva, inva, 1);
607 } 607 }
608 SkColor c; 608 SkColor c;
609 SkNx_cast<uint8_t>(p4 * Sk4f(255) + Sk4f(0.5f)).store(&c); 609 SkNx_cast<uint8_t>(p4 * Sk4f(255) + Sk4f(0.5f)).store(&c);
610 // p4 is RGBA, but we want BGRA, so we need to swap next 610 // p4 is RGBA, but we want BGRA, so we need to swap next
611 return SkSwizzle_RB(c); 611 return SkSwizzle_RB(c);
612 } 612 }
613 default: 613 default:
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 /////////////////////////////////////////////////////////////////////////////// 1302 ///////////////////////////////////////////////////////////////////////////////
1303 1303
1304 #ifdef SK_DEBUG 1304 #ifdef SK_DEBUG
1305 void SkImageInfo::validate() const { 1305 void SkImageInfo::validate() const {
1306 SkASSERT(fWidth >= 0); 1306 SkASSERT(fWidth >= 0);
1307 SkASSERT(fHeight >= 0); 1307 SkASSERT(fHeight >= 0);
1308 SkASSERT(SkColorTypeIsValid(fColorType)); 1308 SkASSERT(SkColorTypeIsValid(fColorType));
1309 SkASSERT(SkAlphaTypeIsValid(fAlphaType)); 1309 SkASSERT(SkAlphaTypeIsValid(fAlphaType));
1310 } 1310 }
1311 #endif 1311 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkColorSpaceXform.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698