Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: tools/viewer/ImageSlide.cpp

Issue 2147763002: Add capability for SkColorXform to output half floats (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Call swizzle fn Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/ColorSpaceXformTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « tests/ColorSpaceXformTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698