void SkWindow::setColorType(SkColorType ct, SkColorProfileType pt) { const SkImageInfo& info = fBitmap.info(); this->resize(SkImageInfo::Make(info.width(), info.height(), ct, kPremul_SkAlphaType, pt)); // Set the global flag that enables or disables "legacy" mode, depending on our format. // With sRGB 32-bit or linear FP 16, we turn on gamma-correct handling of inputs: SkSurfaceProps props = this->getSurfaceProps(); uint32_t flags = (props.flags() & ~SkSurfaceProps::kAllowSRGBInputs_Flag) | (SkColorAndProfileAreGammaCorrect(ct, pt) ? SkSurfaceProps::kAllowSRGBInputs_Flag : 0); this->setSurfaceProps(SkSurfaceProps(flags, props.pixelGeometry())); }
static bool equal(const SkSurfaceProps& a, const SkSurfaceProps& b) { return a.flags() == b.flags() && a.pixelGeometry() == b.pixelGeometry(); }