Reland "transform gradient colors without skcms"
This reverts commite66e6b6eb3
. Reason for revert: reverted the wrong CL!! Original change's description: > Revert "transform gradient colors without skcms" > > This reverts commitb27a9cf2f4
. > > Reason for revert: <INSERT REASONING HERE> > > Original change's description: > > transform gradient colors without skcms > > > > This use of skcms kind of sticks out as odd now. > > We can do all this using plain old SkConvertPixels. > > > > Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel > > Change-Id: Id416058717359a413fcae63d2ae5c91040440a87 > > Reviewed-on: https://skia-review.googlesource.com/c/161583 > > Auto-Submit: Mike Klein <mtklein@google.com> > > Commit-Queue: Brian Osman <brianosman@google.com> > > Reviewed-by: Brian Osman <brianosman@google.com> > > TBR=mtklein@google.com,brianosman@google.com > > Change-Id: Ic6f722fe07aabe67984ee2090c08076290a3cc67 > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel > Reviewed-on: https://skia-review.googlesource.com/c/161563 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Brian Salomon <bsalomon@google.com> TBR=mtklein@google.com,bsalomon@google.com,brianosman@google.com Change-Id: I36ece7a5d455f648778fb7532ce15941cf9144b2 No-Presubmit: true No-Tree-Checks: true No-Try: true Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel Reviewed-on: https://skia-review.googlesource.com/c/161624 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
8d5b41b553
commit
5dfcf1300a
@ -9,6 +9,7 @@
|
|||||||
#include "Sk4fLinearGradient.h"
|
#include "Sk4fLinearGradient.h"
|
||||||
#include "SkColorSpacePriv.h"
|
#include "SkColorSpacePriv.h"
|
||||||
#include "SkColorSpaceXformer.h"
|
#include "SkColorSpaceXformer.h"
|
||||||
|
#include "SkConvertPixels.h"
|
||||||
#include "SkFlattenablePriv.h"
|
#include "SkFlattenablePriv.h"
|
||||||
#include "SkFloatBits.h"
|
#include "SkFloatBits.h"
|
||||||
#include "SkGradientShaderPriv.h"
|
#include "SkGradientShaderPriv.h"
|
||||||
@ -21,7 +22,6 @@
|
|||||||
#include "SkTwoPointConicalGradient.h"
|
#include "SkTwoPointConicalGradient.h"
|
||||||
#include "SkWriteBuffer.h"
|
#include "SkWriteBuffer.h"
|
||||||
#include "../../jumper/SkJumper.h"
|
#include "../../jumper/SkJumper.h"
|
||||||
#include "../../third_party/skcms/skcms.h"
|
|
||||||
|
|
||||||
enum GradientSerializationFlags {
|
enum GradientSerializationFlags {
|
||||||
// Bits 29:31 used for various boolean flags
|
// Bits 29:31 used for various boolean flags
|
||||||
@ -460,29 +460,16 @@ SkGradientShaderBase::AutoXformColors::AutoXformColors(const SkGradientShaderBas
|
|||||||
|
|
||||||
SkColor4fXformer::SkColor4fXformer(const SkColor4f* colors, int colorCount,
|
SkColor4fXformer::SkColor4fXformer(const SkColor4f* colors, int colorCount,
|
||||||
SkColorSpace* src, SkColorSpace* dst) {
|
SkColorSpace* src, SkColorSpace* dst) {
|
||||||
// Transform all of the colors to destination color space
|
|
||||||
fColors = colors;
|
fColors = colors;
|
||||||
|
|
||||||
// Treat null destinations as sRGB.
|
|
||||||
if (!dst) {
|
|
||||||
dst = sk_srgb_singleton();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Treat null sources as sRGB.
|
|
||||||
if (!src) {
|
|
||||||
src = sk_srgb_singleton();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SkColorSpace::Equals(src, dst)) {
|
if (!SkColorSpace::Equals(src, dst)) {
|
||||||
skcms_ICCProfile srcProfile, dstProfile;
|
|
||||||
src->toProfile(&srcProfile);
|
|
||||||
dst->toProfile(&dstProfile);
|
|
||||||
fStorage.reset(colorCount);
|
fStorage.reset(colorCount);
|
||||||
const skcms_PixelFormat rgba_f32 = skcms_PixelFormat_RGBA_ffff;
|
|
||||||
const skcms_AlphaFormat unpremul = skcms_AlphaFormat_Unpremul;
|
auto info = SkImageInfo::Make(colorCount,1, kRGBA_F32_SkColorType, kUnpremul_SkAlphaType);
|
||||||
SkAssertResult(skcms_Transform(colors, rgba_f32, unpremul, &srcProfile,
|
|
||||||
fStorage.begin(), rgba_f32, unpremul, &dstProfile,
|
SkConvertPixels(info.makeColorSpace(sk_ref_sp(dst)), fStorage.begin(), info.minRowBytes(),
|
||||||
colorCount));
|
info.makeColorSpace(sk_ref_sp(src)), fColors , info.minRowBytes());
|
||||||
|
|
||||||
fColors = fStorage.begin();
|
fColors = fStorage.begin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user