Lines Matching +full:test +full:. +full:rgb
2 * Copyright 2015 Google Inc.
5 * found in the LICENSE file.
8 #include "SkAndroidCodec.h"
9 #include "SkCodec.h"
10 #include "SkCodecPriv.h"
11 #include "SkRawAdapterCodec.h"
12 #include "SkSampledCodec.h"
13 #include "SkWebpAdapterCodec.h"
21 * Loads the gamut as a set of three points (triangle).
23 static void load_gamut(SkPoint rgb[], const SkMatrix44& xyz) { in load_gamut() argument
26 // gx, gy, bx, and gy are calulcated similarly. in load_gamut()
27 float rSum = xyz.get(0, 0) + xyz.get(1, 0) + xyz.get(2, 0); in load_gamut()
28 float gSum = xyz.get(0, 1) + xyz.get(1, 1) + xyz.get(2, 1); in load_gamut()
29 float bSum = xyz.get(0, 2) + xyz.get(1, 2) + xyz.get(2, 2); in load_gamut()
30 rgb[0].fX = xyz.get(0, 0) / rSum; in load_gamut()
31 rgb[0].fY = xyz.get(1, 0) / rSum; in load_gamut()
32 rgb[1].fX = xyz.get(0, 1) / gSum; in load_gamut()
33 rgb[1].fY = xyz.get(1, 1) / gSum; in load_gamut()
34 rgb[2].fX = xyz.get(0, 2) / bSum; in load_gamut()
35 rgb[2].fY = xyz.get(1, 2) / bSum; in load_gamut()
39 * Calculates the area of the triangular gamut.
45 return 0.5f * SkTAbs(a.fX*b.fY + b.fX*c.fY - a.fX*c.fY - c.fX*b.fY - b.fX*a.fY); in calculate_area()
51 // Determine if the source image has a gamut that is wider than sRGB. If so, we in is_wide_gamut()
52 // will use P3 as the output color space to avoid clipping the gamut. in is_wide_gamut()
55 SkPoint rgb[3]; in is_wide_gamut() local
56 load_gamut(rgb, *toXYZD50); in is_wide_gamut()
57 return calculate_area(rgb) > kSRGB_D50_GamutArea; in is_wide_gamut()
88 return new SkSampledCodec(codec.release()); in NewFromStream()
91 return new SkWebpAdapterCodec((SkWebpCodec*) codec.release()); in NewFromStream()
95 return new SkRawAdapterCodec((SkRawCodec*)codec.release()); in NewFromStream()
111 bool highPrecision = fCodec->getEncodedInfo().bitsPerComponent() > 8; in computeOutputColorType()
118 // Fall through to kGray_8. Before kGray_8_SkColorType existed, in computeOutputColorType()
120 // grayscale decode. in computeOutputColorType()
122 if (kGray_8_SkColorType == this->getInfo().colorType()) { in computeOutputColorType()
127 if (kOpaque_SkAlphaType == this->getInfo().alphaType()) { in computeOutputColorType()
137 // F16 is the Android default for high precision images. in computeOutputColorType()
142 if (kOpaque_SkAlphaType == this->getInfo().alphaType()) { in computeOutputAlphaType()
153 // If |prefColorSpace| is supported, choose it. in computeOutputColorSpace()
159 SkColorSpace* encodedSpace = fCodec->getInfo().colorSpace(); in computeOutputColorSpace()
161 // Leave the pixels in the encoded color space. Color space conversion in computeOutputColorSpace()
162 // will be handled after decode time. in computeOutputColorSpace()
174 // Note that |prefColorSpace| is ignored, F16 is always linear sRGB. in computeOutputColorSpace()
177 // Note that |prefColorSpace| is ignored, 565 is always sRGB. in computeOutputColorSpace()
180 // Color correction not supported for kGray. in computeOutputColorSpace()
190 // Fast path for when we are not scaling. in getSampledDimensions()
192 return fInfo.dimensions(); in getSampledDimensions()
199 if (!desiredSubset || !is_valid_subset(*desiredSubset, fInfo.dimensions())) { in getSupportedSubset()
211 // We require that the input subset is a subset that is supported by SkAndroidCodec. in getSampledSubsetDimensions()
212 // We test this by calling getSupportedSubset() and verifying that no modifications in getSampledSubsetDimensions()
213 // are made to the subset. in getSampledSubsetDimensions()
219 // If the subset is the entire image, for consistency, use getSampledDimensions(). in getSampledSubsetDimensions()
220 if (fInfo.dimensions() == subset.size()) { in getSampledSubsetDimensions()
225 // want the same implementation. in getSampledSubsetDimensions()
226 return {get_scaled_dimension(subset.width(), sampleSize), in getSampledSubsetDimensions()
227 get_scaled_dimension(subset.height(), sampleSize)}; in getSampledSubsetDimensions()
235 if (rowBytes < info.minRowBytes()) { in getAndroidPixels()
243 if (!is_valid_subset(*options->fSubset, fInfo.dimensions())) { in getAndroidPixels()
247 if (SkIRect::MakeSize(fInfo.dimensions()) == *options->fSubset) { in getAndroidPixels()
248 // The caller wants the whole thing, rather than a subset. Modify in getAndroidPixels()
250 // a subset. in getAndroidPixels()
252 defaultOptions.fSubset = nullptr; in getAndroidPixels()