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

Side by Side Diff: src/codec/SkWebpCodec.cpp

Issue 2390263002: Add SkColorSpaceXform to the public API (Closed)
Patch Set: Remove type on enum Created 4 years, 2 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 | « src/codec/SkPngCodec.cpp ('k') | src/core/SkColorSpaceXform.h » ('j') | 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 2015 Google Inc. 2 * Copyright 2015 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 "SkCodecPriv.h" 8 #include "SkCodecPriv.h"
9 #include "SkColorSpaceXform.h" 9 #include "SkColorSpaceXform.h"
10 #include "SkWebpCodec.h" 10 #include "SkWebpCodec.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 308 }
309 309
310 if (colorXform) { 310 if (colorXform) {
311 SkColorSpaceXform::ColorFormat dstColorFormat = select_xform_format(dstI nfo.colorType()); 311 SkColorSpaceXform::ColorFormat dstColorFormat = select_xform_format(dstI nfo.colorType());
312 SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(), 312 SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
313 this->getInfo().alphaTyp e()); 313 this->getInfo().alphaTyp e());
314 314
315 uint32_t* src = (uint32_t*) config.output.u.RGBA.rgba; 315 uint32_t* src = (uint32_t*) config.output.u.RGBA.rgba;
316 size_t srcRowBytes = config.output.u.RGBA.stride; 316 size_t srcRowBytes = config.output.u.RGBA.stride;
317 for (int y = 0; y < rowsDecoded; y++) { 317 for (int y = 0; y < rowsDecoded; y++) {
318 colorXform->apply(dst, src, dstInfo.width(), dstColorFormat, 318 SkAssertResult(colorXform->apply(dstColorFormat, dst,
319 SkColorSpaceXform::kBGRA_8888_ColorFormat, xformAl phaType); 319 SkColorSpaceXform::kBGRA_8888_Color Format, src,
320 dstInfo.width(), xformAlphaType));
320 dst = SkTAddOffset<void>(dst, rowBytes); 321 dst = SkTAddOffset<void>(dst, rowBytes);
321 src = SkTAddOffset<uint32_t>(src, srcRowBytes); 322 src = SkTAddOffset<uint32_t>(src, srcRowBytes);
322 } 323 }
323 } 324 }
324 325
325 return result; 326 return result;
326 } 327 }
327 328
328 SkWebpCodec::SkWebpCodec(int width, int height, const SkEncodedInfo& info, 329 SkWebpCodec::SkWebpCodec(int width, int height, const SkEncodedInfo& info,
329 sk_sp<SkColorSpace> colorSpace, SkStream* stream, WebPD emuxer* demux, 330 sk_sp<SkColorSpace> colorSpace, SkStream* stream, WebPD emuxer* demux,
330 sk_sp<SkData> data) 331 sk_sp<SkData> data)
331 : INHERITED(width, height, info, stream, std::move(colorSpace)) 332 : INHERITED(width, height, info, stream, std::move(colorSpace))
332 , fDemux(demux) 333 , fDemux(demux)
333 , fData(std::move(data)) 334 , fData(std::move(data))
334 {} 335 {}
OLDNEW
« no previous file with comments | « src/codec/SkPngCodec.cpp ('k') | src/core/SkColorSpaceXform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698