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

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

Issue 1862133002: Add whitelist parameter to refEncodedData (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix comments Created 4 years, 8 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 | « include/core/SkImageGenerator.h ('k') | src/core/SkImageCacherator.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 "SkCodecImageGenerator.h" 8 #include "SkCodecImageGenerator.h"
9 9
10 SkImageGenerator* SkCodecImageGenerator::NewFromEncodedCodec(SkData* data) { 10 SkImageGenerator* SkCodecImageGenerator::NewFromEncodedCodec(SkData* data) {
(...skipping 21 matching lines...) Expand all
32 return SkImageInfo::Make(info.width(), info.height(), info.colorType(), alph aType, profileType); 32 return SkImageInfo::Make(info.width(), info.height(), info.colorType(), alph aType, profileType);
33 } 33 }
34 34
35 SkCodecImageGenerator::SkCodecImageGenerator(SkCodec* codec, SkData* data) 35 SkCodecImageGenerator::SkCodecImageGenerator(SkCodec* codec, SkData* data)
36 : INHERITED(fix_info(*codec)) 36 : INHERITED(fix_info(*codec))
37 , fCodec(codec) 37 , fCodec(codec)
38 , fData(SkRef(data)) 38 , fData(SkRef(data))
39 {} 39 {}
40 40
41 SkData* SkCodecImageGenerator::onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) { 41 SkData* SkCodecImageGenerator::onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) {
42 #ifndef SK_SUPPORT_LEGACY_REFENCODEDDATA_NOCTX
43 if (whitelist && !whitelist->includes(fCodec->getEncodedFormat())) {
44 return nullptr;
45 }
46 #endif
42 return SkRef(fData.get()); 47 return SkRef(fData.get());
43 } 48 }
44 49
45 bool SkCodecImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, s ize_t rowBytes, 50 bool SkCodecImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, s ize_t rowBytes,
46 SkPMColor ctable[], int* ctableCount) { 51 SkPMColor ctable[], int* ctableCount) {
47 52
48 SkCodec::Result result = fCodec->getPixels(info, pixels, rowBytes, nullptr, ctable, 53 SkCodec::Result result = fCodec->getPixels(info, pixels, rowBytes, nullptr, ctable,
49 ctableCount); 54 ctableCount);
50 switch (result) { 55 switch (result) {
51 case SkCodec::kSuccess: 56 case SkCodec::kSuccess:
(...skipping 13 matching lines...) Expand all
65 SkCodec::Result result = fCodec->getYUV8Planes(sizeInfo, planes); 70 SkCodec::Result result = fCodec->getYUV8Planes(sizeInfo, planes);
66 71
67 switch (result) { 72 switch (result) {
68 case SkCodec::kSuccess: 73 case SkCodec::kSuccess:
69 case SkCodec::kIncompleteInput: 74 case SkCodec::kIncompleteInput:
70 return true; 75 return true;
71 default: 76 default:
72 return false; 77 return false;
73 } 78 }
74 } 79 }
OLDNEW
« no previous file with comments | « include/core/SkImageGenerator.h ('k') | src/core/SkImageCacherator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698