[core] add raster-resampling property (#12176)

* update style-code for raster-resampling

* implement user-defined raster-resampling

* invert filter condition

* raster-resampling -> raster-resampling-mode for darwin language conventions
This commit is contained in:
Molly Lloyd
2018-06-21 14:37:17 -07:00
committed by GitHub
parent eb70b89849
commit e1af62e87d
24 changed files with 341 additions and 6 deletions

View File

@@ -123,13 +123,15 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
);
};
const gl::TextureFilter filter = evaluated.get<RasterResampling>() == RasterResamplingType::Nearest ? gl::TextureFilter::Nearest : gl::TextureFilter::Linear;
if (RenderImageSource* imageSource = source->as<RenderImageSource>()) {
if (imageSource->isEnabled() && imageSource->isLoaded() && !imageSource->bucket->needsUpload()) {
RasterBucket& bucket = *imageSource->bucket;
assert(bucket.texture);
parameters.context.bindTexture(*bucket.texture, 0, gl::TextureFilter::Linear);
parameters.context.bindTexture(*bucket.texture, 1, gl::TextureFilter::Linear);
parameters.context.bindTexture(*bucket.texture, 0, filter);
parameters.context.bindTexture(*bucket.texture, 1, filter);
for (auto matrix_ : imageSource->matrices) {
draw(matrix_,
@@ -147,8 +149,8 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
continue;
assert(bucket.texture);
parameters.context.bindTexture(*bucket.texture, 0, gl::TextureFilter::Linear);
parameters.context.bindTexture(*bucket.texture, 1, gl::TextureFilter::Linear);
parameters.context.bindTexture(*bucket.texture, 0, filter);
parameters.context.bindTexture(*bucket.texture, 1, filter);
if (bucket.vertexBuffer && bucket.indexBuffer && !bucket.segments.empty()) {
// Draw only the parts of the tile that aren't drawn by another tile in the layer.