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

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

Issue 1487683004: Create an SkCodecImageGenerator (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move to src/codec and codec.gyp Created 4 years, 11 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/SkCodecImageGenerator.h ('k') | tests/CodexTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkCodecImageGenerator.h"
9
10 SkImageGenerator* SkCodecImageGenerator::NewFromEncodedCodec(SkData* data) {
11 SkCodec* codec = SkCodec::NewFromData(data);
12 if (nullptr == codec) {
13 return nullptr;
14 }
15
16 return new SkCodecImageGenerator(codec, data);
17 }
18
19 SkCodecImageGenerator::SkCodecImageGenerator(SkCodec* codec, SkData* data)
20 : INHERITED(codec->getInfo())
21 , fCodec(codec)
22 , fData(SkRef(data))
23 {}
24
25 SkData* SkCodecImageGenerator::onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) {
26 return SkRef(fData.get());
27 }
28
29 bool SkCodecImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, s ize_t rowBytes,
30 SkPMColor ctable[], int* ctableCount) {
31
32 SkCodec::Result result = fCodec->getPixels(info, pixels, rowBytes, nullptr, ctable,
33 ctableCount);
34 switch (result) {
35 case SkCodec::kSuccess:
36 case SkCodec::kIncompleteInput:
37 return true;
38 default:
39 return false;
40 }
41 }
42
43 bool SkCodecImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], s ize_t rowBytes[3],
44 SkYUVColorSpace* colorSpace) {
45 return false;
46 }
OLDNEW
« no previous file with comments | « src/codec/SkCodecImageGenerator.h ('k') | tests/CodexTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698