OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "ImageSlide.h" | 8 #include "ImageSlide.h" |
9 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 fImage = SkImage::MakeFromEncoded(encoded); | 40 fImage = SkImage::MakeFromEncoded(encoded); |
41 fImage->asLegacyBitmap(&fOriginalBitmap, SkImage::kRO_LegacyBitmapMode); | 41 fImage->asLegacyBitmap(&fOriginalBitmap, SkImage::kRO_LegacyBitmapMode); |
42 | 42 |
43 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded.get())); | 43 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded.get())); |
44 sk_sp<SkColorSpace> srcSpace = sk_ref_sp(codec->getColorSpace()); | 44 sk_sp<SkColorSpace> srcSpace = sk_ref_sp(codec->getColorSpace()); |
45 sk_sp<SkColorSpace> dstSpace = SkColorSpace::NewNamed(SkColorSpace::kAdobeRG
B_Named); | 45 sk_sp<SkColorSpace> dstSpace = SkColorSpace::NewNamed(SkColorSpace::kAdobeRG
B_Named); |
46 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpace,
dstSpace); | 46 std::unique_ptr<SkColorSpaceXform> xform = SkColorSpaceXform::New(srcSpace,
dstSpace); |
47 fOriginalBitmap.deepCopyTo(&fXformedBitmap); | 47 fOriginalBitmap.deepCopyTo(&fXformedBitmap); |
48 uint32_t* row = (uint32_t*) fXformedBitmap.getPixels(); | 48 uint32_t* row = (uint32_t*) fXformedBitmap.getPixels(); |
49 for (int y = 0; y < fXformedBitmap.height(); y++) { | 49 for (int y = 0; y < fXformedBitmap.height(); y++) { |
50 xform->xform_RGB1_8888(row, row, fXformedBitmap.width()); | 50 xform->applyTo8888(row, row, fXformedBitmap.width()); |
51 row = SkTAddOffset<uint32_t>(row, fXformedBitmap.rowBytes()); | 51 row = SkTAddOffset<uint32_t>(row, fXformedBitmap.rowBytes()); |
52 } | 52 } |
53 fXformedBitmap.notifyPixelsChanged(); // This is needed for the deepCopy | 53 fXformedBitmap.notifyPixelsChanged(); // This is needed for the deepCopy |
54 } | 54 } |
55 | 55 |
56 void ImageSlide::unload() { | 56 void ImageSlide::unload() { |
57 fImage.reset(nullptr); | 57 fImage.reset(nullptr); |
58 } | 58 } |
OLD | NEW |