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

Side by Side Diff: src/images/SkDecodingImageGenerator.cpp

Issue 1556333004: take gr-context parameter to refEncoded, indicating a desire for only gpu-specific formats (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update dox 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/image/SkImage_Raster.cpp ('k') | src/ports/SkImageGenerator_skia.cpp » ('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 2013 Google Inc. 2 * Copyright 2013 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 "SkData.h" 8 #include "SkData.h"
9 #include "SkDecodingImageGenerator.h" 9 #include "SkDecodingImageGenerator.h"
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 19 matching lines...) Expand all
30 const int fSampleSize; 30 const int fSampleSize;
31 const bool fDitherImage; 31 const bool fDitherImage;
32 32
33 DecodingImageGenerator(SkData* data, 33 DecodingImageGenerator(SkData* data,
34 SkStreamRewindable* stream, 34 SkStreamRewindable* stream,
35 const SkImageInfo& info, 35 const SkImageInfo& info,
36 int sampleSize, 36 int sampleSize,
37 bool ditherImage); 37 bool ditherImage);
38 38
39 protected: 39 protected:
40 SkData* onRefEncodedData() override; 40 SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) override;
41 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, 41 bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
42 SkPMColor ctable[], int* ctableCount) override; 42 SkPMColor ctable[], int* ctableCount) override;
43 bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3], 43 bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
44 SkYUVColorSpace* colorSpace) override; 44 SkYUVColorSpace* colorSpace) override;
45 45
46 private: 46 private:
47 typedef SkImageGenerator INHERITED; 47 typedef SkImageGenerator INHERITED;
48 }; 48 };
49 49
50 /** 50 /**
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 , fDitherImage(ditherImage) 119 , fDitherImage(ditherImage)
120 { 120 {
121 SkASSERT(stream != nullptr); 121 SkASSERT(stream != nullptr);
122 SkSafeRef(fData); // may be nullptr. 122 SkSafeRef(fData); // may be nullptr.
123 } 123 }
124 124
125 DecodingImageGenerator::~DecodingImageGenerator() { 125 DecodingImageGenerator::~DecodingImageGenerator() {
126 SkSafeUnref(fData); 126 SkSafeUnref(fData);
127 } 127 }
128 128
129 SkData* DecodingImageGenerator::onRefEncodedData() { 129 SkData* DecodingImageGenerator::onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) {
130 // This functionality is used in `gm --serialize` 130 // This functionality is used in `gm --serialize`
131 // Does not encode options. 131 // Does not encode options.
132 if (nullptr == fData) { 132 if (nullptr == fData) {
133 // TODO(halcanary): SkStreamRewindable needs a refData() function 133 // TODO(halcanary): SkStreamRewindable needs a refData() function
134 // which returns a cheap copy of the underlying data. 134 // which returns a cheap copy of the underlying data.
135 if (!fStream->rewind()) { 135 if (!fStream->rewind()) {
136 return nullptr; 136 return nullptr;
137 } 137 }
138 size_t length = fStream->getLength(); 138 size_t length = fStream->getLength();
139 if (length) { 139 if (length) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 SkImageGenerator* SkDecodingImageGenerator::Create( 280 SkImageGenerator* SkDecodingImageGenerator::Create(
281 SkStreamRewindable* stream, 281 SkStreamRewindable* stream,
282 const SkDecodingImageGenerator::Options& opts) { 282 const SkDecodingImageGenerator::Options& opts) {
283 SkASSERT(stream != nullptr); 283 SkASSERT(stream != nullptr);
284 if (stream == nullptr) { 284 if (stream == nullptr) {
285 return nullptr; 285 return nullptr;
286 } 286 }
287 return CreateDecodingImageGenerator(nullptr, stream, opts); 287 return CreateDecodingImageGenerator(nullptr, stream, opts);
288 } 288 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Raster.cpp ('k') | src/ports/SkImageGenerator_skia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698