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

Unified Diff: src/codec/SkCodec.cpp

Issue 2335203002: Implement Fill() for incomplete decodes to RGBA_F16 (Closed)
Patch Set: Fix win builds Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkBmpStandardCodec.cpp ('k') | src/codec/SkCodecPriv.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkCodec.cpp
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index b076954adcbcef936a9d859a49b4af6b60ebb070..6f298700b712c6a4b0f39c5ccd1761048d1384e1 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -11,6 +11,7 @@
#include "SkColorSpace.h"
#include "SkData.h"
#include "SkGifCodec.h"
+#include "SkHalf.h"
#include "SkIcoCodec.h"
#include "SkJpegCodec.h"
#ifdef SK_HAS_PNG_LIBRARY
@@ -353,8 +354,24 @@ int SkCodec::onOutputScanline(int inputScanline) const {
}
}
+uint64_t SkCodec::onGetFillValue(const SkImageInfo& dstInfo) const {
+ switch (dstInfo.colorType()) {
+ case kRGBA_F16_SkColorType: {
+ static constexpr uint64_t transparentColor = 0;
+ static constexpr uint64_t opaqueColor = ((uint64_t) SK_Half1) << 48;
+ return (kOpaque_SkAlphaType == fSrcInfo.alphaType()) ? opaqueColor : transparentColor;
+ }
+ default: {
+ // This not only handles the kN32 case, but also k565, kGray8, kIndex8, since
+ // the low bits are zeros.
+ return (kOpaque_SkAlphaType == fSrcInfo.alphaType()) ?
+ SK_ColorBLACK : SK_ColorTRANSPARENT;
+ }
+ }
+}
+
static void fill_proc(const SkImageInfo& info, void* dst, size_t rowBytes,
- uint32_t colorOrIndex, SkCodec::ZeroInitialized zeroInit, SkSampler* sampler) {
+ uint64_t colorOrIndex, SkCodec::ZeroInitialized zeroInit, SkSampler* sampler) {
if (sampler) {
sampler->fill(info, dst, rowBytes, colorOrIndex, zeroInit);
} else {
@@ -366,7 +383,7 @@ void SkCodec::fillIncompleteImage(const SkImageInfo& info, void* dst, size_t row
ZeroInitialized zeroInit, int linesRequested, int linesDecoded) {
void* fillDst;
- const uint32_t fillValue = this->getFillValue(info.colorType());
+ const uint64_t fillValue = this->getFillValue(info);
const int linesRemaining = linesRequested - linesDecoded;
SkSampler* sampler = this->getSampler(false);
« no previous file with comments | « src/codec/SkBmpStandardCodec.cpp ('k') | src/codec/SkCodecPriv.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698