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, const GrTexturePara
ms& params, | 107 GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, const SkIRect* subs
et) { |
108 const SkIRect* subset) { | |
109 if (subset && !SkIRect::MakeWH(fInfo.width(), fInfo.height()).contains(*subs
et)) { | 108 if (subset && !SkIRect::MakeWH(fInfo.width(), fInfo.height()).contains(*subs
et)) { |
110 return nullptr; | 109 return nullptr; |
111 } | 110 } |
112 return this->onGenerateTexture(ctx, params, subset); | 111 return this->onGenerateTexture(ctx, subset); |
113 } | 112 } |
114 | 113 |
115 ////////////////////////////////////////////////////////////////////////////////
///////////// | 114 ////////////////////////////////////////////////////////////////////////////////
///////////// |
116 | 115 |
117 SkData* SkImageGenerator::onRefEncodedData() { | 116 SkData* SkImageGenerator::onRefEncodedData() { |
118 return nullptr; | 117 return nullptr; |
119 } | 118 } |
120 | 119 |
121 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb
, | 120 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb
, |
122 SkPMColor* colors, int* colorCount) { | 121 SkPMColor* colors, int* colorCount) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 if (nullptr == data) { | 214 if (nullptr == data) { |
216 return nullptr; | 215 return nullptr; |
217 } | 216 } |
218 if (gFactory) { | 217 if (gFactory) { |
219 if (SkImageGenerator* generator = gFactory(data)) { | 218 if (SkImageGenerator* generator = gFactory(data)) { |
220 return generator; | 219 return generator; |
221 } | 220 } |
222 } | 221 } |
223 return SkImageGenerator::NewFromEncodedImpl(data); | 222 return SkImageGenerator::NewFromEncodedImpl(data); |
224 } | 223 } |
OLD | NEW |