diff options
34 files changed, 309 insertions, 126 deletions
diff --git a/cc/blink/web_external_texture_layer_impl.cc b/cc/blink/web_external_texture_layer_impl.cc index 85aac10..30e0ce6 100644 --- a/cc/blink/web_external_texture_layer_impl.cc +++ b/cc/blink/web_external_texture_layer_impl.cc @@ -62,6 +62,11 @@ void WebExternalTextureLayerImpl::setRateLimitContext(bool rate_limit) { static_cast<TextureLayer*>(layer_->layer())->SetRateLimitContext(rate_limit); } +void WebExternalTextureLayerImpl::setNearestNeighbor(bool nearest_neighbor) { + static_cast<TextureLayer*>(layer_->layer()) + ->SetNearestNeighbor(nearest_neighbor); +} + bool WebExternalTextureLayerImpl::PrepareTextureMailbox( cc::TextureMailbox* mailbox, scoped_ptr<cc::SingleReleaseCallback>* release_callback, @@ -85,6 +90,7 @@ bool WebExternalTextureLayerImpl::PrepareTextureMailbox( cc::TextureMailbox(name, GL_TEXTURE_2D, client_mailbox.syncPoint); } mailbox->set_allow_overlay(client_mailbox.allowOverlay); + mailbox->set_nearest_neighbor(client_mailbox.nearestNeighbor); if (mailbox->IsValid()) { *release_callback = cc::SingleReleaseCallback::Create( diff --git a/cc/blink/web_external_texture_layer_impl.h b/cc/blink/web_external_texture_layer_impl.h index 853b1a0..1a10520 100644 --- a/cc/blink/web_external_texture_layer_impl.h +++ b/cc/blink/web_external_texture_layer_impl.h @@ -43,6 +43,7 @@ class WebExternalTextureLayerImpl virtual void setPremultipliedAlpha(bool premultiplied); virtual void setBlendBackgroundColor(bool blend); virtual void setRateLimitContext(bool rate_limit); + virtual void setNearestNeighbor(bool nearest_neighbor); // TextureLayerClient implementation. bool PrepareTextureMailbox( diff --git a/cc/layers/delegated_frame_provider_unittest.cc b/cc/layers/delegated_frame_provider_unittest.cc index 454bf7d..fe8117e 100644 --- a/cc/layers/delegated_frame_provider_unittest.cc +++ b/cc/layers/delegated_frame_provider_unittest.cc @@ -59,6 +59,7 @@ class DelegatedFrameProviderTest gfx::PointF(1.f, 1.f), SK_ColorTRANSPARENT, vertex_opacity, + false, false); } diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc index ea9e713..0038b49 100644 --- a/cc/layers/heads_up_display_layer_impl.cc +++ b/cc/layers/heads_up_display_layer_impl.cc @@ -149,6 +149,7 @@ void HeadsUpDisplayLayerImpl::AppendQuads( gfx::PointF uv_bottom_right(1.f, 1.f); const float vertex_opacity[] = { 1.f, 1.f, 1.f, 1.f }; bool flipped = false; + bool nearest_neighbor = false; TextureDrawQuad* quad = render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); quad->SetNew(shared_quad_state, @@ -161,7 +162,8 @@ void HeadsUpDisplayLayerImpl::AppendQuads( uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); } void HeadsUpDisplayLayerImpl::UpdateHudTexture( diff --git a/cc/layers/nine_patch_layer_impl.cc b/cc/layers/nine_patch_layer_impl.cc index 0dd2b6f..82ba480 100644 --- a/cc/layers/nine_patch_layer_impl.cc +++ b/cc/layers/nine_patch_layer_impl.cc @@ -102,6 +102,7 @@ void NinePatchLayerImpl::AppendQuads( return; static const bool flipped = false; + static const bool nearest_neighbor = false; static const bool premultiplied_alpha = true; DCHECK(!bounds().IsEmpty()); @@ -228,7 +229,8 @@ void NinePatchLayerImpl::AppendQuads( uv_top_left.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); } visible_rect = @@ -247,7 +249,8 @@ void NinePatchLayerImpl::AppendQuads( uv_top_right.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); } visible_rect = @@ -266,7 +269,8 @@ void NinePatchLayerImpl::AppendQuads( uv_bottom_left.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); } visible_rect = @@ -285,7 +289,8 @@ void NinePatchLayerImpl::AppendQuads( uv_bottom_right.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); } visible_rect = occlusion_in_content_space.GetUnoccludedContentRect(layer_top); @@ -303,7 +308,8 @@ void NinePatchLayerImpl::AppendQuads( uv_top.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); } visible_rect = @@ -322,7 +328,8 @@ void NinePatchLayerImpl::AppendQuads( uv_left.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); } visible_rect = @@ -341,7 +348,8 @@ void NinePatchLayerImpl::AppendQuads( uv_right.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); } visible_rect = @@ -360,7 +368,8 @@ void NinePatchLayerImpl::AppendQuads( uv_bottom.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); } if (fill_center_) { @@ -380,7 +389,8 @@ void NinePatchLayerImpl::AppendQuads( uv_center.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); } } } diff --git a/cc/layers/painted_scrollbar_layer_impl.cc b/cc/layers/painted_scrollbar_layer_impl.cc index ea48086..152f14d 100644 --- a/cc/layers/painted_scrollbar_layer_impl.cc +++ b/cc/layers/painted_scrollbar_layer_impl.cc @@ -73,6 +73,7 @@ void PaintedScrollbarLayerImpl::AppendQuads( AppendQuadsData* append_quads_data) { bool premultipled_alpha = true; bool flipped = false; + bool nearest_neighbor = false; gfx::PointF uv_top_left(0.f, 0.f); gfx::PointF uv_bottom_right(1.f, 1.f); gfx::Rect bounds_rect(bounds()); @@ -109,7 +110,8 @@ void PaintedScrollbarLayerImpl::AppendQuads( uv_bottom_right, SK_ColorTRANSPARENT, opacity, - flipped); + flipped, + nearest_neighbor); } gfx::Rect track_quad_rect = content_bounds_rect; @@ -130,7 +132,8 @@ void PaintedScrollbarLayerImpl::AppendQuads( uv_bottom_right, SK_ColorTRANSPARENT, opacity, - flipped); + flipped, + nearest_neighbor); } } diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc index d53cfbe..cf1149b 100644 --- a/cc/layers/texture_layer.cc +++ b/cc/layers/texture_layer.cc @@ -27,6 +27,7 @@ TextureLayer::TextureLayer(TextureLayerClient* client) : Layer(), client_(client), flipped_(true), + nearest_neighbor_(false), uv_top_left_(0.f, 0.f), uv_bottom_right_(1.f, 1.f), premultiplied_alpha_(true), @@ -65,6 +66,13 @@ void TextureLayer::SetFlipped(bool flipped) { SetNeedsCommit(); } +void TextureLayer::SetNearestNeighbor(bool nearest_neighbor) { + if (nearest_neighbor_ == nearest_neighbor) + return; + nearest_neighbor_ = nearest_neighbor; + SetNeedsCommit(); +} + void TextureLayer::SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right) { if (uv_top_left_ == top_left && uv_bottom_right_ == bottom_right) @@ -238,6 +246,7 @@ void TextureLayer::PushPropertiesTo(LayerImpl* layer) { TextureLayerImpl* texture_layer = static_cast<TextureLayerImpl*>(layer); texture_layer->SetFlipped(flipped_); + texture_layer->SetNearestNeighbor(nearest_neighbor_); texture_layer->SetUVTopLeft(uv_top_left_); texture_layer->SetUVBottomRight(uv_bottom_right_); texture_layer->SetVertexOpacity(vertex_opacity_); diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h index fa52a8c..15c9aa0 100644 --- a/cc/layers/texture_layer.h +++ b/cc/layers/texture_layer.h @@ -100,6 +100,10 @@ class CC_EXPORT TextureLayer : public Layer { // true. void SetFlipped(bool flipped); + // Sets whether this texture should use nearest neighbor interpolation as + // opposed to bilinear. Defaults to false. + void SetNearestNeighbor(bool nearest_neighbor); + // Sets a UV transform to be used at draw time. Defaults to (0, 0) and (1, 1). void SetUV(const gfx::PointF& top_left, const gfx::PointF& bottom_right); @@ -156,6 +160,7 @@ class CC_EXPORT TextureLayer : public Layer { TextureLayerClient* client_; bool flipped_; + bool nearest_neighbor_; gfx::PointF uv_top_left_; gfx::PointF uv_bottom_right_; // [bottom left, top left, top right, bottom right] diff --git a/cc/layers/texture_layer_impl.cc b/cc/layers/texture_layer_impl.cc index bcde7cd..b174348 100644 --- a/cc/layers/texture_layer_impl.cc +++ b/cc/layers/texture_layer_impl.cc @@ -23,6 +23,7 @@ TextureLayerImpl::TextureLayerImpl(LayerTreeImpl* tree_impl, int id) premultiplied_alpha_(true), blend_background_color_(false), flipped_(true), + nearest_neighbor_(false), uv_top_left_(0.f, 0.f), uv_bottom_right_(1.f, 1.f), own_mailbox_(false), @@ -62,6 +63,7 @@ void TextureLayerImpl::PushPropertiesTo(LayerImpl* layer) { texture_layer->SetVertexOpacity(vertex_opacity_); texture_layer->SetPremultipliedAlpha(premultiplied_alpha_); texture_layer->SetBlendBackgroundColor(blend_background_color_); + texture_layer->SetNearestNeighbor(nearest_neighbor_); if (own_mailbox_) { texture_layer->SetTextureMailbox(texture_mailbox_, release_callback_.Pass()); @@ -176,7 +178,8 @@ void TextureLayerImpl::AppendQuads(RenderPass* render_pass, uv_bottom_right_, bg_color, vertex_opacity_, - flipped_); + flipped_, + nearest_neighbor_); } SimpleEnclosedRegion TextureLayerImpl::VisibleContentOpaqueRegion() const { @@ -211,6 +214,11 @@ void TextureLayerImpl::SetFlipped(bool flipped) { SetNeedsPushProperties(); } +void TextureLayerImpl::SetNearestNeighbor(bool nearest_neighbor) { + nearest_neighbor_ = nearest_neighbor; + SetNeedsPushProperties(); +} + void TextureLayerImpl::SetUVTopLeft(const gfx::PointF top_left) { uv_top_left_ = top_left; SetNeedsPushProperties(); diff --git a/cc/layers/texture_layer_impl.h b/cc/layers/texture_layer_impl.h index 6d38ae1..64de268 100644 --- a/cc/layers/texture_layer_impl.h +++ b/cc/layers/texture_layer_impl.h @@ -41,6 +41,7 @@ class CC_EXPORT TextureLayerImpl : public LayerImpl { void SetPremultipliedAlpha(bool premultiplied_alpha); void SetBlendBackgroundColor(bool blend); void SetFlipped(bool flipped); + void SetNearestNeighbor(bool nearest_neighbor); void SetUVTopLeft(const gfx::PointF top_left); void SetUVBottomRight(const gfx::PointF bottom_right); @@ -63,6 +64,7 @@ class CC_EXPORT TextureLayerImpl : public LayerImpl { bool premultiplied_alpha_; bool blend_background_color_; bool flipped_; + bool nearest_neighbor_; gfx::PointF uv_top_left_; gfx::PointF uv_bottom_right_; float vertex_opacity_[4]; diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index f2ee269..4e2f675 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc @@ -205,6 +205,7 @@ TEST_F(TextureLayerTest, CheckPropertyChangeCausesCorrectBehavior) { // Test properties that should call SetNeedsCommit. All properties need to // be set to new values in order for SetNeedsCommit to be called. EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetFlipped(false)); + EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetNearestNeighbor(true)); EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetUV( gfx::PointF(0.25f, 0.25f), gfx::PointF(0.75f, 0.75f))); EXPECT_SET_NEEDS_COMMIT(1, test_layer->SetVertexOpacity( diff --git a/cc/layers/ui_resource_layer_impl.cc b/cc/layers/ui_resource_layer_impl.cc index 35d242be..c7653e7 100644 --- a/cc/layers/ui_resource_layer_impl.cc +++ b/cc/layers/ui_resource_layer_impl.cc @@ -112,6 +112,7 @@ void UIResourceLayerImpl::AppendQuads( return; static const bool flipped = false; + static const bool nearest_neighbor = false; static const bool premultiplied_alpha = true; DCHECK(!bounds().IsEmpty()); @@ -138,7 +139,8 @@ void UIResourceLayerImpl::AppendQuads( uv_bottom_right_, SK_ColorTRANSPARENT, vertex_opacity_, - flipped); + flipped, + nearest_neighbor); } const char* UIResourceLayerImpl::LayerTypeAsString() const { diff --git a/cc/layers/video_layer_impl.cc b/cc/layers/video_layer_impl.cc index a7e1bde..8401bd2 100644 --- a/cc/layers/video_layer_impl.cc +++ b/cc/layers/video_layer_impl.cc @@ -200,6 +200,7 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass, gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; bool flipped = false; + bool nearest_neighbor = false; TextureDrawQuad* texture_quad = render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); texture_quad->SetNew(shared_quad_state, @@ -212,7 +213,8 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass, uv_bottom_right, SK_ColorTRANSPARENT, opacity, - flipped); + flipped, + nearest_neighbor); break; } case VideoFrameExternalResources::YUV_RESOURCE: { @@ -249,6 +251,7 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass, gfx::PointF uv_bottom_right(tex_width_scale, tex_height_scale); float opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; bool flipped = false; + bool nearest_neighbor = false; TextureDrawQuad* texture_quad = render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); texture_quad->SetNew(shared_quad_state, @@ -261,7 +264,8 @@ void VideoLayerImpl::AppendQuads(RenderPass* render_pass, uv_bottom_right, SK_ColorTRANSPARENT, opacity, - flipped); + flipped, + nearest_neighbor); break; } case VideoFrameExternalResources::STREAM_TEXTURE_RESOURCE: { diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 27f40eb..a32778a 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -2054,8 +2054,10 @@ void GLRenderer::FlushTextureQuadCache() { GLC(gl_, gl_->Uniform1i(draw_cache_.sampler_location, 0)); // Assume the current active textures is 0. - ResourceProvider::ScopedReadLockGL locked_quad(resource_provider_, - draw_cache_.resource_id); + ResourceProvider::ScopedSamplerGL locked_quad( + resource_provider_, + draw_cache_.resource_id, + draw_cache_.nearest_neighbor ? GL_NEAREST : GL_LINEAR); DCHECK_EQ(GL_TEXTURE0, GetActiveTextureUnit(gl_)); GLC(gl_, gl_->BindTexture(GL_TEXTURE_2D, locked_quad.texture_id())); @@ -2133,12 +2135,14 @@ void GLRenderer::EnqueueTextureQuad(const DrawingFrame* frame, if (draw_cache_.program_id != binding.program_id || draw_cache_.resource_id != resource_id || draw_cache_.needs_blending != quad->ShouldDrawWithBlending() || + draw_cache_.nearest_neighbor != quad->nearest_neighbor || draw_cache_.background_color != quad->background_color || draw_cache_.matrix_data.size() >= 8) { FlushTextureQuadCache(); draw_cache_.program_id = binding.program_id; draw_cache_.resource_id = resource_id; draw_cache_.needs_blending = quad->ShouldDrawWithBlending(); + draw_cache_.nearest_neighbor = quad->nearest_neighbor; draw_cache_.background_color = quad->background_color; draw_cache_.uv_xform_location = binding.tex_transform_location; diff --git a/cc/output/gl_renderer_draw_cache.cc b/cc/output/gl_renderer_draw_cache.cc index a0004f2..91581f4 100644 --- a/cc/output/gl_renderer_draw_cache.cc +++ b/cc/output/gl_renderer_draw_cache.cc @@ -10,6 +10,7 @@ TexturedQuadDrawCache::TexturedQuadDrawCache() : program_id(-1), resource_id(-1), needs_blending(false), + nearest_neighbor(false), background_color(0), uv_xform_location(-1), background_color_location(-1), diff --git a/cc/output/gl_renderer_draw_cache.h b/cc/output/gl_renderer_draw_cache.h index f828418..a16c8a5 100644 --- a/cc/output/gl_renderer_draw_cache.h +++ b/cc/output/gl_renderer_draw_cache.h @@ -33,6 +33,7 @@ struct TexturedQuadDrawCache { int program_id; int resource_id; bool needs_blending; + bool nearest_neighbor; SkColor background_color; // Information about the program binding that is required to draw. diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc index 33c6f4a..bb7451d 100644 --- a/cc/output/overlay_unittest.cc +++ b/cc/output/overlay_unittest.cc @@ -152,6 +152,7 @@ TextureDrawQuad* CreateCandidateQuadAt(ResourceProvider* resource_provider, ResourceProvider::ResourceId resource_id = CreateResource(resource_provider); bool premultiplied_alpha = false; bool flipped = false; + bool nearest_neighbor = false; float vertex_opacity[4] = {1.0f, 1.0f, 1.0f, 1.0f}; TextureDrawQuad* overlay_quad = @@ -166,7 +167,8 @@ TextureDrawQuad* CreateCandidateQuadAt(ResourceProvider* resource_provider, kUVBottomRight, SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); return overlay_quad; } diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc index 0c2bc3d..53b5b98 100644 --- a/cc/output/renderer_pixeltest.cc +++ b/cc/output/renderer_pixeltest.cc @@ -152,7 +152,8 @@ void CreateTestTextureDrawQuad(const gfx::Rect& rect, gfx::PointF(1.0f, 1.0f), // uv_bottom_right background_color, vertex_opacity, - false); // flipped + false, // flipped + false); // nearest_neighbor } typedef ::testing::Types<GLRenderer, @@ -2296,7 +2297,8 @@ TYPED_TEST(RendererPixelTest, WrapModeRepeat) { this->device_viewport_size_.height() / texture_rect.height()), SK_ColorWHITE, vertex_opacity, - false); // flipped + false, // flipped + false); // nearest_neighbor RenderPassList pass_list; pass_list.push_back(pass.Pass()); diff --git a/cc/quads/draw_quad_unittest.cc b/cc/quads/draw_quad_unittest.cc index 5755ea8..95c646b 100644 --- a/cc/quads/draw_quad_unittest.cc +++ b/cc/quads/draw_quad_unittest.cc @@ -332,6 +332,14 @@ void CompareDrawQuad(DrawQuad* quad, } \ SETUP_AND_COPY_QUAD_ALL(Type, quad_all); +#define CREATE_QUAD_10_NEW(Type, a, b, c, d, e, f, g, h, i, j) \ + Type* quad_new = render_pass->CreateAndAppendDrawQuad<Type>(); \ + { \ + QUAD_DATA quad_new->SetNew( \ + shared_state, quad_rect, a, b, c, d, e, f, g, h, i, j); \ + } \ + SETUP_AND_COPY_QUAD_NEW(Type, quad_new); + #define CREATE_QUAD_ALL_RP(Type, a, b, c, d, e, f, g, copy_a) \ Type* quad_all = render_pass->CreateAndAppendDrawQuad<Type>(); \ { \ @@ -541,18 +549,20 @@ TEST(DrawQuadTest, CopyTextureDrawQuad) { gfx::PointF uv_bottom_right(51.5f, 260.f); const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f }; bool flipped = true; + bool nearest_neighbor = true; CREATE_SHARED_STATE(); - CREATE_QUAD_9_NEW(TextureDrawQuad, - opaque_rect, - visible_rect, - resource_id, - premultiplied_alpha, - uv_top_left, - uv_bottom_right, - SK_ColorTRANSPARENT, - vertex_opacity, - flipped); + CREATE_QUAD_10_NEW(TextureDrawQuad, + opaque_rect, + visible_rect, + resource_id, + premultiplied_alpha, + uv_top_left, + uv_bottom_right, + SK_ColorTRANSPARENT, + vertex_opacity, + flipped, + nearest_neighbor); EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material); EXPECT_RECT_EQ(visible_rect, copy_quad->visible_rect); EXPECT_RECT_EQ(opaque_rect, copy_quad->opaque_rect); @@ -562,15 +572,17 @@ TEST(DrawQuadTest, CopyTextureDrawQuad) { EXPECT_EQ(uv_bottom_right, copy_quad->uv_bottom_right); EXPECT_FLOAT_ARRAY_EQ(vertex_opacity, copy_quad->vertex_opacity, 4); EXPECT_EQ(flipped, copy_quad->flipped); + EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); - CREATE_QUAD_7_ALL(TextureDrawQuad, + CREATE_QUAD_8_ALL(TextureDrawQuad, resource_id, premultiplied_alpha, uv_top_left, uv_bottom_right, SK_ColorTRANSPARENT, vertex_opacity, - flipped); + flipped, + nearest_neighbor); EXPECT_EQ(DrawQuad::TEXTURE_CONTENT, copy_quad->material); EXPECT_EQ(resource_id, copy_quad->resource_id); EXPECT_EQ(premultiplied_alpha, copy_quad->premultiplied_alpha); @@ -578,6 +590,7 @@ TEST(DrawQuadTest, CopyTextureDrawQuad) { EXPECT_EQ(uv_bottom_right, copy_quad->uv_bottom_right); EXPECT_FLOAT_ARRAY_EQ(vertex_opacity, copy_quad->vertex_opacity, 4); EXPECT_EQ(flipped, copy_quad->flipped); + EXPECT_EQ(nearest_neighbor, copy_quad->nearest_neighbor); } TEST(DrawQuadTest, CopyTileDrawQuad) { @@ -832,18 +845,20 @@ TEST_F(DrawQuadIteratorTest, TextureDrawQuad) { gfx::PointF uv_bottom_right(51.5f, 260.f); const float vertex_opacity[] = { 1.0f, 1.0f, 1.0f, 1.0f }; bool flipped = true; + bool nearest_neighbor = true; CREATE_SHARED_STATE(); - CREATE_QUAD_9_NEW(TextureDrawQuad, - opaque_rect, - visible_rect, - resource_id, - premultiplied_alpha, - uv_top_left, - uv_bottom_right, - SK_ColorTRANSPARENT, - vertex_opacity, - flipped); + CREATE_QUAD_10_NEW(TextureDrawQuad, + opaque_rect, + visible_rect, + resource_id, + premultiplied_alpha, + uv_top_left, + uv_bottom_right, + SK_ColorTRANSPARENT, + vertex_opacity, + flipped, + nearest_neighbor); EXPECT_EQ(resource_id, quad_new->resource_id); EXPECT_EQ(1, IterateAndCount(quad_new)); EXPECT_EQ(resource_id + 1, quad_new->resource_id); diff --git a/cc/quads/texture_draw_quad.cc b/cc/quads/texture_draw_quad.cc index 9ff9744..d430c72 100644 --- a/cc/quads/texture_draw_quad.cc +++ b/cc/quads/texture_draw_quad.cc @@ -16,7 +16,8 @@ TextureDrawQuad::TextureDrawQuad() : resource_id(0), premultiplied_alpha(false), background_color(SK_ColorTRANSPARENT), - flipped(false) { + flipped(false), + nearest_neighbor(false) { this->vertex_opacity[0] = 0.f; this->vertex_opacity[1] = 0.f; this->vertex_opacity[2] = 0.f; @@ -33,7 +34,8 @@ void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, const gfx::PointF& uv_bottom_right, SkColor background_color, const float vertex_opacity[4], - bool flipped) { + bool flipped, + bool nearest_neighbor) { bool needs_blending = vertex_opacity[0] != 1.0f || vertex_opacity[1] != 1.0f || vertex_opacity[2] != 1.0f || vertex_opacity[3] != 1.0f; DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, @@ -48,18 +50,22 @@ void TextureDrawQuad::SetNew(const SharedQuadState* shared_quad_state, this->vertex_opacity[2] = vertex_opacity[2]; this->vertex_opacity[3] = vertex_opacity[3]; this->flipped = flipped; + this->nearest_neighbor = nearest_neighbor; } void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, const gfx::Rect& opaque_rect, - const gfx::Rect& visible_rect, bool needs_blending, - unsigned resource_id, bool premultiplied_alpha, + const gfx::Rect& visible_rect, + bool needs_blending, + unsigned resource_id, + bool premultiplied_alpha, const gfx::PointF& uv_top_left, const gfx::PointF& uv_bottom_right, SkColor background_color, const float vertex_opacity[4], - bool flipped) { + bool flipped, + bool nearest_neighbor) { DrawQuad::SetAll(shared_quad_state, DrawQuad::TEXTURE_CONTENT, rect, opaque_rect, visible_rect, needs_blending); this->resource_id = resource_id; @@ -72,6 +78,7 @@ void TextureDrawQuad::SetAll(const SharedQuadState* shared_quad_state, this->vertex_opacity[2] = vertex_opacity[2]; this->vertex_opacity[3] = vertex_opacity[3]; this->flipped = flipped; + this->nearest_neighbor = nearest_neighbor; } void TextureDrawQuad::IterateResources( @@ -103,6 +110,7 @@ void TextureDrawQuad::ExtendValue(base::debug::TracedValue* value) const { value->EndArray(); value->SetBoolean("flipped", flipped); + value->SetBoolean("nearest_neighbor", nearest_neighbor); } } // namespace cc diff --git a/cc/quads/texture_draw_quad.h b/cc/quads/texture_draw_quad.h index 9137d51..990b276 100644 --- a/cc/quads/texture_draw_quad.h +++ b/cc/quads/texture_draw_quad.h @@ -26,7 +26,8 @@ class CC_EXPORT TextureDrawQuad : public DrawQuad { const gfx::PointF& uv_bottom_right, SkColor background_color, const float vertex_opacity[4], - bool flipped); + bool flipped, + bool nearest_neighbor); void SetAll(const SharedQuadState* shared_quad_state, const gfx::Rect& rect, @@ -39,7 +40,8 @@ class CC_EXPORT TextureDrawQuad : public DrawQuad { const gfx::PointF& uv_bottom_right, SkColor background_color, const float vertex_opacity[4], - bool flipped); + bool flipped, + bool nearest_neighbor); unsigned resource_id; bool premultiplied_alpha; @@ -48,6 +50,7 @@ class CC_EXPORT TextureDrawQuad : public DrawQuad { SkColor background_color; float vertex_opacity[4]; bool flipped; + bool nearest_neighbor; void IterateResources(const ResourceIteratorCallback& callback) override; diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc index fe7cc00..c0e8f1b 100644 --- a/cc/resources/resource_provider.cc +++ b/cc/resources/resource_provider.cc @@ -615,7 +615,7 @@ ResourceProvider::ResourceId ResourceProvider::CreateResourceFromTextureMailbox( gfx::Size(), Resource::External, mailbox.target(), - GL_LINEAR, + mailbox.nearest_neighbor() ? GL_NEAREST : GL_LINEAR, 0, GL_CLAMP_TO_EDGE, TextureHintImmutable, diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc index 34b604a..2c8ed58 100644 --- a/cc/resources/resource_provider_unittest.cc +++ b/cc/resources/resource_provider_unittest.cc @@ -2603,89 +2603,156 @@ TEST_P(ResourceProviderTest, TextureMailbox_SharedMemory) { EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner); } -TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D) { - // Mailboxing is only supported for GL textures. - if (GetParam() != ResourceProvider::GLTexture) - return; +class ResourceProviderTestTextureMailboxGLFilters + : public ResourceProviderTest { + public: + static void RunTest(TestSharedBitmapManager* shared_bitmap_manager, + TestGpuMemoryBufferManager* gpu_memory_buffer_manager, + BlockingTaskRunner* main_thread_task_runner, + bool mailbox_nearest_neighbor, + GLenum sampler_filter) { + scoped_ptr<TextureStateTrackingContext> context_owned( + new TextureStateTrackingContext); + TextureStateTrackingContext* context = context_owned.get(); - scoped_ptr<TextureStateTrackingContext> context_owned( - new TextureStateTrackingContext); - TextureStateTrackingContext* context = context_owned.get(); + FakeOutputSurfaceClient output_surface_client; + scoped_ptr<OutputSurface> output_surface( + FakeOutputSurface::Create3d(context_owned.Pass())); + CHECK(output_surface->BindToClient(&output_surface_client)); - FakeOutputSurfaceClient output_surface_client; - scoped_ptr<OutputSurface> output_surface( - FakeOutputSurface::Create3d(context_owned.Pass())); - CHECK(output_surface->BindToClient(&output_surface_client)); + scoped_ptr<ResourceProvider> resource_provider( + ResourceProvider::Create(output_surface.get(), + shared_bitmap_manager, + gpu_memory_buffer_manager, + main_thread_task_runner, + 0, + false, + 1)); - scoped_ptr<ResourceProvider> resource_provider( - ResourceProvider::Create(output_surface.get(), - shared_bitmap_manager_.get(), - gpu_memory_buffer_manager_.get(), - main_thread_task_runner_.get(), - 0, - false, - 1)); + unsigned texture_id = 1; + uint32 sync_point = 30; + unsigned target = GL_TEXTURE_2D; - unsigned texture_id = 1; - uint32 sync_point = 30; - unsigned target = GL_TEXTURE_2D; + EXPECT_CALL(*context, bindTexture(_, _)).Times(0); + EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); + EXPECT_CALL(*context, insertSyncPoint()).Times(0); + EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); + EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); - EXPECT_CALL(*context, bindTexture(_, _)).Times(0); - EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); - EXPECT_CALL(*context, insertSyncPoint()).Times(0); - EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); - EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); + gpu::Mailbox gpu_mailbox; + memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); + uint32 release_sync_point = 0; + bool lost_resource = false; + BlockingTaskRunner* mailbox_task_runner = NULL; + scoped_ptr<SingleReleaseCallbackImpl> callback = + SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, + &release_sync_point, + &lost_resource, + &mailbox_task_runner)); - gpu::Mailbox gpu_mailbox; - memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); - uint32 release_sync_point = 0; - bool lost_resource = false; - BlockingTaskRunner* main_thread_task_runner = NULL; - scoped_ptr<SingleReleaseCallbackImpl> callback = - SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, - &release_sync_point, - &lost_resource, - &main_thread_task_runner)); + TextureMailbox mailbox(gpu_mailbox, target, sync_point); + mailbox.set_nearest_neighbor(mailbox_nearest_neighbor); - TextureMailbox mailbox(gpu_mailbox, target, sync_point); + ResourceProvider::ResourceId id = + resource_provider->CreateResourceFromTextureMailbox(mailbox, + callback.Pass()); + EXPECT_NE(0u, id); - ResourceProvider::ResourceId id = - resource_provider->CreateResourceFromTextureMailbox( - mailbox, callback.Pass()); - EXPECT_NE(0u, id); + Mock::VerifyAndClearExpectations(context); - Mock::VerifyAndClearExpectations(context); + { + // Mailbox sync point WaitSyncPoint before using the texture. + EXPECT_CALL(*context, waitSyncPoint(sync_point)); + resource_provider->WaitSyncPointIfNeeded(id); + Mock::VerifyAndClearExpectations(context); - { - // Mailbox sync point WaitSyncPoint before using the texture. - EXPECT_CALL(*context, waitSyncPoint(sync_point)); - resource_provider->WaitSyncPointIfNeeded(id); - Mock::VerifyAndClearExpectations(context); + // Using the texture does a consume of the mailbox. + EXPECT_CALL(*context, bindTexture(target, texture_id)).Times(2); + EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _)); - // Using the texture does a consume of the mailbox. - EXPECT_CALL(*context, bindTexture(target, texture_id)); - EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _)); + EXPECT_CALL(*context, insertSyncPoint()).Times(0); + EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); - EXPECT_CALL(*context, insertSyncPoint()).Times(0); - EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); + // The sampler will reset these if |mailbox_nearest_neighbor| does not + // match |sampler_filter|. + if (mailbox_nearest_neighbor != (sampler_filter == GL_NEAREST)) { + EXPECT_CALL(*context, texParameteri( + GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, sampler_filter)); + EXPECT_CALL(*context, texParameteri( + GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, sampler_filter)); + } - ResourceProvider::ScopedReadLockGL lock(resource_provider.get(), id); - Mock::VerifyAndClearExpectations(context); + ResourceProvider::ScopedSamplerGL lock( + resource_provider.get(), id, sampler_filter); + Mock::VerifyAndClearExpectations(context); - // When done with it, a sync point should be inserted, but no produce is - // necessary. - EXPECT_CALL(*context, bindTexture(_, _)).Times(0); - EXPECT_CALL(*context, insertSyncPoint()); - EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); + // When done with it, a sync point should be inserted, but no produce is + // necessary. + EXPECT_CALL(*context, bindTexture(_, _)).Times(0); + EXPECT_CALL(*context, insertSyncPoint()); + EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); - EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); - EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); + EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); + EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); + } + + resource_provider->DeleteResource(id); + EXPECT_EQ(0u, release_sync_point); + EXPECT_FALSE(lost_resource); + EXPECT_EQ(main_thread_task_runner, mailbox_task_runner); } +}; - resource_provider->DeleteResource(id); - EXPECT_EQ(0u, release_sync_point); - EXPECT_FALSE(lost_resource); - EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner); +TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToLinear) { + // Mailboxing is only supported for GL textures. + if (GetParam() != ResourceProvider::GLTexture) + return; + + ResourceProviderTestTextureMailboxGLFilters::RunTest( + shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), + main_thread_task_runner_.get(), + false, + GL_LINEAR); +} + +TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_NearestToNearest) { + // Mailboxing is only supported for GL textures. + if (GetParam() != ResourceProvider::GLTexture) + return; + + ResourceProviderTestTextureMailboxGLFilters::RunTest( + shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), + main_thread_task_runner_.get(), + true, + GL_NEAREST); +} + +TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_NearestToLinear) { + // Mailboxing is only supported for GL textures. + if (GetParam() != ResourceProvider::GLTexture) + return; + + ResourceProviderTestTextureMailboxGLFilters::RunTest( + shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), + main_thread_task_runner_.get(), + true, + GL_LINEAR); +} + +TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToNearest) { + // Mailboxing is only supported for GL textures. + if (GetParam() != ResourceProvider::GLTexture) + return; + + ResourceProviderTestTextureMailboxGLFilters::RunTest( + shared_bitmap_manager_.get(), + gpu_memory_buffer_manager_.get(), + main_thread_task_runner_.get(), + false, + GL_NEAREST); } TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) { diff --git a/cc/resources/texture_mailbox.cc b/cc/resources/texture_mailbox.cc index 92736f4..07cbec0 100644 --- a/cc/resources/texture_mailbox.cc +++ b/cc/resources/texture_mailbox.cc @@ -14,20 +14,23 @@ TextureMailbox::TextureMailbox() : shared_memory_(NULL) {} TextureMailbox::TextureMailbox(const gpu::MailboxHolder& mailbox_holder) : mailbox_holder_(mailbox_holder), shared_memory_(NULL), - allow_overlay_(false) {} + allow_overlay_(false), + nearest_neighbor_(false) {} TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, uint32 target, uint32 sync_point) : mailbox_holder_(mailbox, target, sync_point), shared_memory_(NULL), - allow_overlay_(false) {} + allow_overlay_(false), + nearest_neighbor_(false) {} TextureMailbox::TextureMailbox(base::SharedMemory* shared_memory, const gfx::Size& size) : shared_memory_(shared_memory), shared_memory_size_(size), - allow_overlay_(false) { + allow_overlay_(false), + nearest_neighbor_(false) { // If an embedder of cc gives an invalid TextureMailbox, we should crash // here to identify the offender. CHECK(SharedBitmap::VerifySizeInBytes(shared_memory_size_)); diff --git a/cc/resources/texture_mailbox.h b/cc/resources/texture_mailbox.h index 4a0b76a..9bf41e1 100644 --- a/cc/resources/texture_mailbox.h +++ b/cc/resources/texture_mailbox.h @@ -41,6 +41,10 @@ class CC_EXPORT TextureMailbox { bool allow_overlay() const { return allow_overlay_; } void set_allow_overlay(bool allow_overlay) { allow_overlay_ = allow_overlay; } + bool nearest_neighbor() const { return nearest_neighbor_; } + void set_nearest_neighbor(bool nearest_neighbor) { + nearest_neighbor_ = nearest_neighbor; + } base::SharedMemory* shared_memory() const { return shared_memory_; } gfx::Size shared_memory_size() const { return shared_memory_size_; } @@ -51,6 +55,7 @@ class CC_EXPORT TextureMailbox { base::SharedMemory* shared_memory_; gfx::Size shared_memory_size_; bool allow_overlay_; + bool nearest_neighbor_; }; } // namespace cc diff --git a/cc/surfaces/surface_aggregator_unittest.cc b/cc/surfaces/surface_aggregator_unittest.cc index 1daff52..3e48311 100644 --- a/cc/surfaces/surface_aggregator_unittest.cc +++ b/cc/surfaces/surface_aggregator_unittest.cc @@ -1275,6 +1275,7 @@ void SubmitFrameWithResources(ResourceProvider::ResourceId* resource_ids, SkColor background_color = SK_ColorGREEN; const float vertex_opacity[4] = {0.f, 0.f, 1.f, 1.f}; bool flipped = false; + bool nearest_neighbor = false; quad->SetAll(sqs, rect, opaque_rect, @@ -1286,7 +1287,8 @@ void SubmitFrameWithResources(ResourceProvider::ResourceId* resource_ids, uv_bottom_right, background_color, vertex_opacity, - flipped); + flipped, + nearest_neighbor); quad->shared_quad_state = sqs; } diff --git a/cc/test/render_pass_test_common.cc b/cc/test/render_pass_test_common.cc index a667dce..b79fc1f 100644 --- a/cc/test/render_pass_test_common.cc +++ b/cc/test/render_pass_test_common.cc @@ -171,6 +171,7 @@ void TestRenderPass::AppendOneOfEveryQuadType( gfx::PointF(1.f, 1.f), SK_ColorTRANSPARENT, vertex_opacity, + false, false); TextureDrawQuad* mailbox_texture_quad = @@ -185,6 +186,7 @@ void TestRenderPass::AppendOneOfEveryQuadType( gfx::PointF(1.f, 1.f), SK_ColorTRANSPARENT, vertex_opacity, + false, false); TileDrawQuad* scaled_tile_quad = diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 7ca82e35..566fb57 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -667,6 +667,7 @@ static void AppendQuadsToFillScreen( overhang_resource_scaled_size.height()), screen_background_color, vertex_opacity, + false, false); } } diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc index 3aabeff..a504b2f 100644 --- a/cc/trees/layer_tree_host_unittest_delegated.cc +++ b/cc/trees/layer_tree_host_unittest_delegated.cc @@ -113,6 +113,7 @@ class LayerTreeHostDelegatedTest : public LayerTreeTest { SkColor background_color = 0; float vertex_opacity[4] = {1.f, 1.f, 1.f, 1.f}; bool flipped = false; + bool nearest_neighbor = false; TextureDrawQuad* invalid_draw_quad = root_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); @@ -126,7 +127,8 @@ class LayerTreeHostDelegatedTest : public LayerTreeTest { uv_bottom_right, background_color, vertex_opacity, - flipped); + flipped, + nearest_neighbor); frame->render_pass_list.push_back(root_pass.Pass()); return frame.Pass(); @@ -162,6 +164,7 @@ class LayerTreeHostDelegatedTest : public LayerTreeTest { gfx::PointF(1.f, 1.f), SK_ColorTRANSPARENT, vertex_opacity, + false, false); } diff --git a/content/common/cc_messages.h b/content/common/cc_messages.h index 0c14ddf..21bc4c7 100644 --- a/content/common/cc_messages.h +++ b/content/common/cc_messages.h @@ -213,6 +213,7 @@ IPC_STRUCT_TRAITS_BEGIN(cc::TextureDrawQuad) IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[2]) IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[3]) IPC_STRUCT_TRAITS_MEMBER(flipped) + IPC_STRUCT_TRAITS_MEMBER(nearest_neighbor) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(cc::TileDrawQuad) diff --git a/content/common/cc_messages_unittest.cc b/content/common/cc_messages_unittest.cc index cc1fdf0..ef16091 100644 --- a/content/common/cc_messages_unittest.cc +++ b/content/common/cc_messages_unittest.cc @@ -186,6 +186,7 @@ class CCMessagesTest : public testing::Test { EXPECT_EQ(a->vertex_opacity[2], b->vertex_opacity[2]); EXPECT_EQ(a->vertex_opacity[3], b->vertex_opacity[3]); EXPECT_EQ(a->flipped, b->flipped); + EXPECT_EQ(a->nearest_neighbor, b->nearest_neighbor); } void Compare(const TileDrawQuad* a, const TileDrawQuad* b) { @@ -251,6 +252,7 @@ TEST_F(CCMessagesTest, AllQuads) { bool arbitrary_bool1 = true; bool arbitrary_bool2 = false; bool arbitrary_bool3 = true; + bool arbitrary_bool4 = true; int arbitrary_context_id1 = 12; int arbitrary_context_id2 = 57; int arbitrary_context_id3 = -503; @@ -440,7 +442,8 @@ TEST_F(CCMessagesTest, AllQuads) { arbitrary_pointf2, arbitrary_color, arbitrary_float_array, - arbitrary_bool3); + arbitrary_bool3, + arbitrary_bool4); pass_cmp->CopyFromAndAppendDrawQuad(texture_in, texture_in->shared_quad_state); diff --git a/mojo/converters/surfaces/surfaces_type_converters.cc b/mojo/converters/surfaces/surfaces_type_converters.cc index a8e5911..1a6ab99 100644 --- a/mojo/converters/surfaces/surfaces_type_converters.cc +++ b/mojo/converters/surfaces/surfaces_type_converters.cc @@ -140,7 +140,8 @@ bool ConvertDrawQuad(const QuadPtr& input, texture_quad_state->uv_bottom_right.To<gfx::PointF>(), texture_quad_state->background_color.To<SkColor>(), &texture_quad_state->vertex_opacity.storage()[0], - texture_quad_state->flipped); + texture_quad_state->flipped, + texture_quad_state->nearest_neighbor); break; } case MATERIAL_TILED_CONTENT: { diff --git a/mojo/converters/surfaces/tests/surface_unittest.cc b/mojo/converters/surfaces/tests/surface_unittest.cc index 4b1fd21..cdfb9cb 100644 --- a/mojo/converters/surfaces/tests/surface_unittest.cc +++ b/mojo/converters/surfaces/tests/surface_unittest.cc @@ -108,6 +108,7 @@ TEST_F(SurfaceLibQuadTest, TextureQuad) { SkColor background_color = SK_ColorYELLOW; float vertex_opacity[4] = {0.1f, 0.5f, 0.4f, 0.8f}; bool flipped = false; + bool nearest_neighbor = false; texture_quad->SetAll(sqs, rect, opaque_rect, @@ -119,7 +120,8 @@ TEST_F(SurfaceLibQuadTest, TextureQuad) { uv_bottom_right, background_color, vertex_opacity, - flipped); + flipped, + nearest_neighbor); QuadPtr mojo_quad = Quad::From<cc::DrawQuad>(*texture_quad); ASSERT_FALSE(mojo_quad.is_null()); @@ -267,6 +269,7 @@ TEST(SurfaceLibTest, RenderPass) { SkColor background_color = SK_ColorYELLOW; float vertex_opacity[4] = {0.1f, 0.5f, 0.4f, 0.8f}; bool flipped = false; + bool nearest_neighbor = false; texture_quad->SetAll(sqs, rect, opaque_rect, @@ -278,7 +281,8 @@ TEST(SurfaceLibTest, RenderPass) { uv_bottom_right, background_color, vertex_opacity, - flipped); + flipped, + nearest_neighbor); PassPtr mojo_pass = Pass::From(*pass); ASSERT_FALSE(mojo_pass.is_null()); diff --git a/mojo/services/public/interfaces/surfaces/quads.mojom b/mojo/services/public/interfaces/surfaces/quads.mojom index d635239..61115f7 100644 --- a/mojo/services/public/interfaces/surfaces/quads.mojom +++ b/mojo/services/public/interfaces/surfaces/quads.mojom @@ -64,6 +64,7 @@ struct TextureQuadState { Color background_color; array<float, 4> vertex_opacity; bool flipped; + bool nearest_neighbor; }; struct TileQuadState { |
