OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkImageGenerator.h" | 8 #include "SkImageGenerator.h" |
9 #include "SkNextID.h" | 9 #include "SkNextID.h" |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // In order to maintain compatibility with clients that implemented the orig
inal | 97 // In order to maintain compatibility with clients that implemented the orig
inal |
98 // onGetYUV8Planes interface, we assume that the color space is JPEG. | 98 // onGetYUV8Planes interface, we assume that the color space is JPEG. |
99 // TODO(rileya): remove this and the old onGetYUV8Planes once clients switch
over to | 99 // TODO(rileya): remove this and the old onGetYUV8Planes once clients switch
over to |
100 // the new interface. | 100 // the new interface. |
101 if (colorSpace) { | 101 if (colorSpace) { |
102 *colorSpace = kJPEG_SkYUVColorSpace; | 102 *colorSpace = kJPEG_SkYUVColorSpace; |
103 } | 103 } |
104 return this->onGetYUV8Planes(sizes, planes, rowBytes); | 104 return this->onGetYUV8Planes(sizes, planes, rowBytes); |
105 } | 105 } |
106 | 106 |
107 GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, SkImageUsageType us
age, | 107 GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, const GrTexturePara
ms& params, |
108 const SkIRect* subset) { | 108 const SkIRect* subset) { |
109 if (subset && !SkIRect::MakeWH(fInfo.width(), fInfo.height()).contains(*subs
et)) { | 109 if (subset && !SkIRect::MakeWH(fInfo.width(), fInfo.height()).contains(*subs
et)) { |
110 return nullptr; | 110 return nullptr; |
111 } | 111 } |
112 return this->onGenerateTexture(ctx, usage, subset); | 112 return this->onGenerateTexture(ctx, params, subset); |
113 } | 113 } |
114 | 114 |
115 ////////////////////////////////////////////////////////////////////////////////
///////////// | 115 ////////////////////////////////////////////////////////////////////////////////
///////////// |
116 | 116 |
117 SkData* SkImageGenerator::onRefEncodedData() { | 117 SkData* SkImageGenerator::onRefEncodedData() { |
118 return nullptr; | 118 return nullptr; |
119 } | 119 } |
120 | 120 |
121 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb
, | 121 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb
, |
122 SkPMColor* colors, int* colorCount) { | 122 SkPMColor* colors, int* colorCount) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 if (nullptr == data) { | 215 if (nullptr == data) { |
216 return nullptr; | 216 return nullptr; |
217 } | 217 } |
218 if (gFactory) { | 218 if (gFactory) { |
219 if (SkImageGenerator* generator = gFactory(data)) { | 219 if (SkImageGenerator* generator = gFactory(data)) { |
220 return generator; | 220 return generator; |
221 } | 221 } |
222 } | 222 } |
223 return SkImageGenerator::NewFromEncodedImpl(data); | 223 return SkImageGenerator::NewFromEncodedImpl(data); |
224 } | 224 } |
OLD | NEW |