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" |
| 10 |
| 11 SkImageGenerator::SkImageGenerator(const SkImageInfo& info) |
| 12 : fInfo(info) |
| 13 , fUniqueID(SkNextID::ImageID()) |
| 14 {} |
9 | 15 |
10 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
owBytes, | 16 bool SkImageGenerator::getPixels(const SkImageInfo& info, void* pixels, size_t r
owBytes, |
11 SkPMColor ctable[], int* ctableCount) { | 17 SkPMColor ctable[], int* ctableCount) { |
12 if (kUnknown_SkColorType == info.colorType()) { | 18 if (kUnknown_SkColorType == info.colorType()) { |
13 return false; | 19 return false; |
14 } | 20 } |
15 if (NULL == pixels) { | 21 if (NULL == pixels) { |
16 return false; | 22 return false; |
17 } | 23 } |
18 if (rowBytes < info.minRowBytes()) { | 24 if (rowBytes < info.minRowBytes()) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // 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 |
92 // onGetYUV8Planes interface, we assume that the color space is JPEG. | 98 // onGetYUV8Planes interface, we assume that the color space is JPEG. |
93 // 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 |
94 // the new interface. | 100 // the new interface. |
95 if (colorSpace) { | 101 if (colorSpace) { |
96 *colorSpace = kJPEG_SkYUVColorSpace; | 102 *colorSpace = kJPEG_SkYUVColorSpace; |
97 } | 103 } |
98 return this->onGetYUV8Planes(sizes, planes, rowBytes); | 104 return this->onGetYUV8Planes(sizes, planes, rowBytes); |
99 } | 105 } |
100 | 106 |
| 107 GrTexture* SkImageGenerator::generateTexture(GrContext* ctx, SkImageUsageType us
age) { |
| 108 if (!ctx) { |
| 109 return nullptr; |
| 110 } |
| 111 return this->onGenerateTexture(ctx, usage); |
| 112 } |
| 113 |
101 ////////////////////////////////////////////////////////////////////////////////
///////////// | 114 ////////////////////////////////////////////////////////////////////////////////
///////////// |
102 | 115 |
103 SkData* SkImageGenerator::onRefEncodedData() { | 116 SkData* SkImageGenerator::onRefEncodedData() { |
104 return NULL; | 117 return NULL; |
105 } | 118 } |
106 | 119 |
107 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb
, | 120 bool SkImageGenerator::onGetPixels(const SkImageInfo& info, void* dst, size_t rb
, |
108 SkPMColor* colors, int* colorCount) { | 121 SkPMColor* colors, int* colorCount) { |
109 return false; | 122 return false; |
110 } | 123 } |
(...skipping 16 matching lines...) Expand all Loading... |
127 if (NULL == data) { | 140 if (NULL == data) { |
128 return NULL; | 141 return NULL; |
129 } | 142 } |
130 if (gFactory) { | 143 if (gFactory) { |
131 if (SkImageGenerator* generator = gFactory(data)) { | 144 if (SkImageGenerator* generator = gFactory(data)) { |
132 return generator; | 145 return generator; |
133 } | 146 } |
134 } | 147 } |
135 return SkImageGenerator::NewFromEncodedImpl(data); | 148 return SkImageGenerator::NewFromEncodedImpl(data); |
136 } | 149 } |
OLD | NEW |