Let region decoders query the type and color space
authorMatt Sarett <msarett@google.com>
Fri, 14 Apr 2017 13:23:45 +0000 (09:23 -0400)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Fri, 14 Apr 2017 13:59:35 +0000 (13:59 +0000)
b/36905374, b/32984164
Test: CtsGraphicsTestCases

Written by: romainguy@

Change-Id: Ief4bba6ec3cd3446224199d05f06ffcffaaa72b5
Reviewed-on: https://skia-review.googlesource.com/13472
Reviewed-by: Matt Sarett <msarett@google.com>
Reviewed-by: Derek Sollenberger <djsollen@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>

include/android/SkBitmapRegionDecoder.h
src/android/SkBitmapRegionCodec.h

index 841bf8d..df0c370 100644 (file)
@@ -71,6 +71,12 @@ public:
 
     virtual SkEncodedImageFormat getEncodedFormat() = 0;
 
+    virtual SkColorType computeOutputColorType(SkColorType requestedColorType) = 0;
+
+    virtual sk_sp<SkColorSpace> computeOutputColorSpace(SkColorType outputColorType,
+            sk_sp<SkColorSpace> prefColorSpace = nullptr) = 0;
+
+
     int width() const { return fWidth; }
     int height() const { return fHeight; }
 
index baaecc9..a7cfe33 100644 (file)
@@ -32,6 +32,15 @@ public:
 
     SkEncodedImageFormat getEncodedFormat() override { return fCodec->getEncodedFormat(); }
 
+    SkColorType computeOutputColorType(SkColorType requestedColorType) override {
+        return fCodec->computeOutputColorType(requestedColorType);
+    }
+
+    sk_sp<SkColorSpace> computeOutputColorSpace(SkColorType outputColorType,
+            sk_sp<SkColorSpace> prefColorSpace = nullptr) override {
+        return fCodec->computeOutputColorSpace(outputColorType, prefColorSpace);
+    }
+
 private:
 
     std::unique_ptr<SkAndroidCodec> fCodec;