aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-02-09 17:35:29 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-10 01:00:41 +0000
commit1617899b677050d3db63c3770c406e16501f356c (patch)
treee8aaf4b7503803ce8f18d7e49c103bb4109bb367 /src
parente1053eaca2447b79fb878fc7fc54b3767c03bc8b (diff)
add helper to know when a colortype is always opaque
Now that surface creation is more picky about its imageinfo, we need to allow clients to know when they should clean-up their alphatype (like our own gm) Bug: skia: Change-Id: Ic110c75769e0154a8343d7e2160d3351f02cf48f Reviewed-on: https://skia-review.googlesource.com/106320 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkImageInfo.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index b684cdfcf4..0b06334484 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -79,6 +79,19 @@ static SkColorType stored_to_live(unsigned stored) {
return kUnknown_SkColorType;
}
+bool SkColorTypeIsAlwaysOpaque(SkColorType ct) {
+ switch (ct) {
+ case kRGB_565_SkColorType:
+ case kRGB_888x_SkColorType:
+ case kRGB_101010x_SkColorType:
+ case kGray_8_SkColorType:
+ return true;
+ default:
+ break;
+ }
+ return false;
+}
+
///////////////////////////////////////////////////////////////////////////////////////////////////
int SkImageInfo::bytesPerPixel() const { return SkColorTypeBytesPerPixel(fColorType); }