Drawable Renderer (#1570), PremultipliedImage is RGBA only
This commit is contained in:
@@ -134,15 +134,8 @@ void Texture2D::upload(const PremultipliedImage& image, gfx::UploadPass& uploadP
|
||||
}
|
||||
|
||||
assert(PremultipliedImage::channels == numChannels());
|
||||
if (PremultipliedImage::channels != numChannels()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// note: images are always unsigned bytes
|
||||
assert(PremultipliedImage::channels == getPixelStride());
|
||||
if (PremultipliedImage::channels != getPixelStride()) {
|
||||
return;
|
||||
}
|
||||
|
||||
uploadPass.updateTextureResource(*textureResource, size, &image.data[0], pixelFormat, channelType);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ gfx::AttributeBindingArray UploadPass::buildAttributeBindings(
|
||||
std::shared_ptr<gfx::Texture2D> UploadPass::createTexture2D(const PremultipliedImage& image) {
|
||||
auto tex = std::make_shared<gl::Texture2D>(commandEncoder.context);
|
||||
tex->setSize(image.size)
|
||||
.setFormat(image.channels == 4 ? gfx::TexturePixelType::RGBA : gfx::TexturePixelType::Alpha,
|
||||
.setFormat(gfx::TexturePixelType::RGBA,
|
||||
gfx::TextureChannelDataType::UnsignedByte)
|
||||
.create();
|
||||
tex->upload(image, *this);
|
||||
|
||||
Reference in New Issue
Block a user