aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkPngPriv.h
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-11-30 15:33:04 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-30 21:06:38 +0000
commitd6cb11ee9df514a3a65b313725d3ac3bfd003e7f (patch)
treef2381b95ecb3fe1368b7021f16783376b8c6ea51 /src/codec/SkPngPriv.h
parent74663e722ea905972e62c59e60cd0cbc97e8435f (diff)
encode kAlpha_8 as grayalpha with sigbits for gray==1
Bug: skia: Change-Id: Ib61e8e0f62af92d8746f5e73469002e7804a8447 Reviewed-on: https://skia-review.googlesource.com/78481 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/codec/SkPngPriv.h')
-rw-r--r--src/codec/SkPngPriv.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/codec/SkPngPriv.h b/src/codec/SkPngPriv.h
new file mode 100644
index 0000000000..3269309075
--- /dev/null
+++ b/src/codec/SkPngPriv.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkPngPriv_DEFINED
+#define SkPngPriv_DEFINED
+
+#include "SkTypes.h"
+
+// We store kAlpha_8 images as GrayAlpha in png. Our private signal is significant bits for gray.
+// If that is set to 1, we assume the gray channel can be ignored, and we output just alpha.
+// We tried 0 at first, but png doesn't like a 0 sigbit for a channel it expects, hence we chose 1.
+
+static constexpr int kGraySigBit_GrayAlphaIsJustAlpha = 1;
+
+#endif