diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-12 18:30:16 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-12 18:30:16 +0000 |
commit | 8f8e0862019eaf9b3ab2ef31e24b50f410e671e0 (patch) | |
tree | d2a379fe3a60cd4fe0dcc0d686f383eeb7b6dd13 | |
parent | c17daa111277cf68c2d21c9cd656052d892c99ae (diff) | |
download | chromium_src-8f8e0862019eaf9b3ab2ef31e24b50f410e671e0.zip chromium_src-8f8e0862019eaf9b3ab2ef31e24b50f410e671e0.tar.gz chromium_src-8f8e0862019eaf9b3ab2ef31e24b50f410e671e0.tar.bz2 |
cc: Don't flip render passes when rendering them.
Position all render passes with row 0 on the bottom consistently,
not just the root.
R=enne
BUG=247789
Depends on: https://codereview.chromium.org/16634015/
Review URL: https://chromiumcodereview.appspot.com/16667004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205879 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/output/direct_renderer.cc | 26 | ||||
-rw-r--r-- | cc/output/direct_renderer.h | 7 | ||||
-rw-r--r-- | cc/output/gl_renderer.cc | 134 | ||||
-rw-r--r-- | cc/output/gl_renderer.h | 19 | ||||
-rw-r--r-- | cc/output/render_surface_filters.cc | 2 | ||||
-rw-r--r-- | cc/output/renderer_pixeltest.cc | 10 | ||||
-rw-r--r-- | cc/output/shader.cc | 24 | ||||
-rw-r--r-- | cc/output/shader.h | 14 | ||||
-rw-r--r-- | cc/output/software_renderer.cc | 3 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_pixeltest_filters.cc | 2 |
10 files changed, 134 insertions, 107 deletions
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc index e144f2f..b513420 100644 --- a/cc/output/direct_renderer.cc +++ b/cc/output/direct_renderer.cc @@ -58,8 +58,7 @@ namespace cc { DirectRenderer::DrawingFrame::DrawingFrame() : root_render_pass(NULL), current_render_pass(NULL), - current_texture(NULL), - flipped_y(false) {} + current_texture(NULL) {} DirectRenderer::DrawingFrame::~DrawingFrame() {} @@ -82,8 +81,9 @@ void DirectRenderer::QuadRectTransform(gfx::Transform* quad_rect_transform, void DirectRenderer::InitializeViewport(DrawingFrame* frame, gfx::Rect draw_rect, gfx::Rect viewport_rect, - gfx::Size surface_size, - bool flip_y) { + gfx::Size surface_size) { + bool flip_y = FlippedFramebuffer(); + DCHECK_GE(viewport_rect.x(), 0); DCHECK_GE(viewport_rect.y(), 0); DCHECK_LE(viewport_rect.right(), surface_size.width()); @@ -109,19 +109,17 @@ void DirectRenderer::InitializeViewport(DrawingFrame* frame, window_rect.height()); SetDrawViewport(window_rect); - frame->flipped_y = flip_y; - current_draw_rect_ = draw_rect; current_viewport_rect_ = viewport_rect; current_surface_size_ = surface_size; } gfx::Rect DirectRenderer::MoveFromDrawToWindowSpace( - const gfx::RectF& draw_rect, bool flip_y) const { + const gfx::RectF& draw_rect) const { gfx::Rect window_rect = gfx::ToEnclosingRect(draw_rect); window_rect -= current_draw_rect_.OffsetFromOrigin(); window_rect += current_viewport_rect_.OffsetFromOrigin(); - if (flip_y) + if (FlippedFramebuffer()) window_rect.set_y(current_surface_size_.height() - window_rect.bottom()); return window_rect; } @@ -259,8 +257,7 @@ void DirectRenderer::SetScissorStateForQuad(const DrawingFrame* frame, const DrawQuad& quad) { if (quad.isClipped()) { gfx::RectF quad_scissor_rect = quad.clipRect(); - SetScissorTestRect( - MoveFromDrawToWindowSpace(quad_scissor_rect, frame->flipped_y)); + SetScissorTestRect(MoveFromDrawToWindowSpace(quad_scissor_rect)); } else { EnsureScissorTestDisabled(); } @@ -282,8 +279,7 @@ void DirectRenderer::SetScissorStateForQuadWithRenderPassScissor( } *should_skip_quad = false; - SetScissorTestRect( - MoveFromDrawToWindowSpace(quad_scissor_rect, frame->flipped_y)); + SetScissorTestRect(MoveFromDrawToWindowSpace(quad_scissor_rect)); } void DirectRenderer::FinishDrawingQuadList() {} @@ -300,8 +296,7 @@ void DirectRenderer::DrawRenderPass(DrawingFrame* frame, if (using_scissor_as_optimization) { render_pass_scissor = ComputeScissorRectForRenderPass(frame); - SetScissorTestRect( - MoveFromDrawToWindowSpace(render_pass_scissor, frame->flipped_y)); + SetScissorTestRect(MoveFromDrawToWindowSpace(render_pass_scissor)); } if (frame->current_render_pass != frame->root_render_pass || @@ -347,8 +342,7 @@ bool DirectRenderer::UseRenderPass(DrawingFrame* frame, InitializeViewport(frame, render_pass->output_rect, client_->DeviceViewport(), - output_surface_->SurfaceSize(), - FlippedFramebuffer()); + output_surface_->SurfaceSize()); return true; } diff --git a/cc/output/direct_renderer.h b/cc/output/direct_renderer.h index 864ce91..f20b2a4 100644 --- a/cc/output/direct_renderer.h +++ b/cc/output/direct_renderer.h @@ -44,7 +44,6 @@ class CC_EXPORT DirectRenderer : public Renderer { gfx::Transform projection_matrix; gfx::Transform window_matrix; - bool flipped_y; }; void SetEnlargePassTextureAmountForTesting(gfx::Vector2d amount); @@ -83,10 +82,8 @@ class CC_EXPORT DirectRenderer : public Renderer { void InitializeViewport(DrawingFrame* frame, gfx::Rect draw_rect, gfx::Rect viewport_rect, - gfx::Size surface_size, - bool flip_y); - gfx::Rect MoveFromDrawToWindowSpace(const gfx::RectF& draw_rect, - bool flip_y) const; + gfx::Size surface_size); + gfx::Rect MoveFromDrawToWindowSpace(const gfx::RectF& draw_rect) const; static gfx::RectF ComputeScissorRectForRenderPass(const DrawingFrame* frame); void SetScissorStateForQuad(const DrawingFrame* frame, const DrawQuad& quad); diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 1a19d28..6ae5cb2 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -508,7 +508,7 @@ static SkBitmap ApplyImageFilter(GLRenderer* renderer, source_texture_resource->size().height(); backend_texture_description.fConfig = kSkia8888_GrPixelConfig; backend_texture_description.fTextureHandle = lock.texture_id(); - backend_texture_description.fOrigin = kTopLeft_GrSurfaceOrigin; + backend_texture_description.fOrigin = kBottomLeft_GrSurfaceOrigin; skia::RefPtr<GrTexture> texture = skia::AdoptRef(offscreen_contexts->GrContext()->wrapBackendTexture( backend_texture_description)); @@ -529,7 +529,7 @@ static SkBitmap ApplyImageFilter(GLRenderer* renderer, desc.fWidth = source.width(); desc.fHeight = source.height(); desc.fConfig = kSkia8888_GrPixelConfig; - desc.fOrigin = kTopLeft_GrSurfaceOrigin; + desc.fOrigin = kBottomLeft_GrSurfaceOrigin; GrAutoScratchTexture scratch_texture( offscreen_contexts->GrContext(), desc, GrContext::kExact_ScratchTexMatch); skia::RefPtr<GrTexture> backing_store = @@ -650,10 +650,17 @@ scoped_ptr<ScopedResource> GLRenderer::DrawBackgroundFilters( Context()->clear(GL_COLOR_BUFFER_BIT); #endif + // The filtered_deveice_background_texture is oriented the same as the frame + // buffer. The transform we are copying with has a vertical flip, as well as + // the |device_to_framebuffer_transform|, which cancel each other out. So do + // not flip the contents in the shader to maintain orientation. + bool flip_vertically = false; + CopyTextureToFramebuffer(frame, filtered_device_background_texture_id, device_rect, - device_to_framebuffer_transform); + device_to_framebuffer_transform, + flip_vertically); } UseRenderPass(frame, target_render_pass); @@ -727,8 +734,17 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, DCHECK(background_texture->size() == quad->rect.size()); ResourceProvider::ScopedReadLockGL lock(resource_provider_, background_texture->id()); - CopyTextureToFramebuffer( - frame, lock.texture_id(), quad->rect, quad->quadTransform()); + + // The background_texture is oriented the same as the frame buffer. The + // transform we are copying with has a vertical flip, so flip the contents + // in the shader to maintain orientation + bool flip_vertically = true; + + CopyTextureToFramebuffer(frame, + lock.texture_id(), + quad->rect, + quad->quadTransform(), + flip_vertically); } bool clipped = false; @@ -785,7 +801,6 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, int shader_color_matrix_location = -1; int shader_color_offset_location = -1; int shader_tex_transform_location = -1; - int shader_tex_scale_location = -1; if (use_aa && mask_texture_id && !use_color_matrix) { const RenderPassMaskProgramAA* program = @@ -804,7 +819,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, program->fragment_shader().mask_tex_coord_offset_location(); shader_matrix_location = program->vertex_shader().matrix_location(); shader_alpha_location = program->fragment_shader().alpha_location(); - shader_tex_scale_location = program->vertex_shader().tex_scale_location(); + shader_tex_transform_location = + program->vertex_shader().tex_transform_location(); } else if (!use_aa && mask_texture_id && !use_color_matrix) { const RenderPassMaskProgram* program = GetRenderPassMaskProgram(tex_coord_precision); @@ -833,7 +849,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, shader_edge_location = program->fragment_shader().edge_location(); shader_matrix_location = program->vertex_shader().matrix_location(); shader_alpha_location = program->fragment_shader().alpha_location(); - shader_tex_scale_location = program->vertex_shader().tex_scale_location(); + shader_tex_transform_location = + program->vertex_shader().tex_transform_location(); } else if (use_aa && mask_texture_id && use_color_matrix) { const RenderPassMaskColorMatrixProgramAA* program = GetRenderPassMaskColorMatrixProgramAA(tex_coord_precision); @@ -843,7 +860,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, shader_matrix_location = program->vertex_shader().matrix_location(); shader_quad_location = program->vertex_shader().quad_location(); - shader_tex_scale_location = program->vertex_shader().tex_scale_location(); + shader_tex_transform_location = + program->vertex_shader().tex_transform_location(); shader_edge_location = program->fragment_shader().edge_location(); shader_alpha_location = program->fragment_shader().alpha_location(); shader_mask_sampler_location = @@ -865,7 +883,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, shader_matrix_location = program->vertex_shader().matrix_location(); shader_quad_location = program->vertex_shader().quad_location(); - shader_tex_scale_location = program->vertex_shader().tex_scale_location(); + shader_tex_transform_location = + program->vertex_shader().tex_transform_location(); shader_edge_location = program->fragment_shader().edge_location(); shader_alpha_location = program->fragment_shader().alpha_location(); shader_color_matrix_location = @@ -927,34 +946,36 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, DCHECK_LE(tex_scale_x, 1.0f); DCHECK_LE(tex_scale_y, 1.0f); - if (shader_tex_transform_location != -1) { - GLC(Context(), - Context()->uniform4f(shader_tex_transform_location, - 0.0f, - 0.0f, - tex_scale_x, - tex_scale_y)); - } else if (shader_tex_scale_location != -1) { - GLC(Context(), - Context()->uniform2f( - shader_tex_scale_location, tex_scale_x, tex_scale_y)); - } else { - DCHECK(IsContextLost()); - } + DCHECK(shader_tex_transform_location != -1 || IsContextLost()); + // Flip the content vertically in the shader, as the RenderPass input + // texture is already oriented the same way as the framebuffer, but the + // projection transform does a flip. + GLC(Context(), Context()->uniform4f(shader_tex_transform_location, + 0.0f, + tex_scale_y, + tex_scale_x, + -tex_scale_y)); if (shader_mask_sampler_location != -1) { DCHECK_NE(shader_mask_tex_coord_scale_location, 1); DCHECK_NE(shader_mask_tex_coord_offset_location, 1); GLC(Context(), Context()->activeTexture(GL_TEXTURE1)); GLC(Context(), Context()->uniform1i(shader_mask_sampler_location, 1)); + + float mask_tex_scale_x = quad->mask_uv_rect.width() / tex_scale_x; + float mask_tex_scale_y = quad->mask_uv_rect.height() / tex_scale_y; + + // Mask textures are oriented vertically flipped relative to the framebuffer + // and the RenderPass contents texture, so we flip the tex coords from the + // RenderPass texture to find the mask texture coords. GLC(Context(), Context()->uniform2f(shader_mask_tex_coord_offset_location, quad->mask_uv_rect.x(), - quad->mask_uv_rect.y())); + quad->mask_uv_rect.y() + mask_tex_scale_y)); GLC(Context(), Context()->uniform2f(shader_mask_tex_coord_scale_location, - quad->mask_uv_rect.width() / tex_scale_x, - quad->mask_uv_rect.height() / tex_scale_y)); + mask_tex_scale_x, + -mask_tex_scale_y)); resource_provider_->BindForSampling( quad->mask_resource_id, GL_TEXTURE_2D, GL_LINEAR); GLC(Context(), Context()->activeTexture(GL_TEXTURE0)); @@ -1882,7 +1903,6 @@ void GLRenderer::CopyCurrentRenderPassToBitmap( DrawingFrame* frame, scoped_ptr<CopyOutputRequest> request) { GetFramebufferPixelsAsync(frame->current_render_pass->output_rect, - frame->flipped_y, request.Pass()); } @@ -1946,24 +1966,37 @@ void GLRenderer::DrawQuadGeometry(const DrawingFrame* frame, void GLRenderer::CopyTextureToFramebuffer(const DrawingFrame* frame, int texture_id, gfx::Rect rect, - const gfx::Transform& draw_matrix) { + const gfx::Transform& draw_matrix, + bool flip_vertically) { TexCoordPrecision tex_coord_precision = TexCoordPrecisionRequired( context_, &highp_threshold_cache_, highp_threshold_min_, rect.bottom_right()); + const RenderPassProgram* program = GetRenderPassProgram(tex_coord_precision); + SetUseProgram(program->program()); - GLC(Context(), Context()->bindTexture(GL_TEXTURE_2D, texture_id)); + GLC(Context(), Context()->uniform1i( + program->fragment_shader().sampler_location(), 0)); - SetUseProgram(program->program()); - GLC(Context(), - Context()->uniform1i(program->fragment_shader().sampler_location(), 0)); - GLC(Context(), - Context()->uniform4f(program->vertex_shader().tex_transform_location(), - 0.0f, - 0.0f, - 1.0f, - 1.0f)); - SetShaderOpacity(1, program->fragment_shader().alpha_location()); + if (flip_vertically) { + GLC(Context(), Context()->uniform4f( + program->vertex_shader().tex_transform_location(), + 0.f, + 1.f, + 1.f, + -1.f)); + } else { + GLC(Context(), Context()->uniform4f( + program->vertex_shader().tex_transform_location(), + 0.f, + 0.f, + 1.f, + 1.f)); + } + + SetShaderOpacity(1.f, program->fragment_shader().alpha_location()); + + GLC(Context(), Context()->bindTexture(GL_TEXTURE_2D, texture_id)); DrawQuadGeometry( frame, draw_matrix, rect, program->vertex_shader().matrix_location()); } @@ -2098,7 +2131,6 @@ void GLRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { // This function assumes that it is reading the root frame buffer. DCHECK(!current_framebuffer_lock_); - bool flipped_y = FlippedFramebuffer(); scoped_ptr<PendingAsyncReadPixels> pending_read(new PendingAsyncReadPixels); pending_async_read_pixels_.insert(pending_async_read_pixels_.begin(), @@ -2107,12 +2139,11 @@ void GLRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { // This is a syncronous call since the callback is null. DoGetFramebufferPixels(static_cast<uint8*>(pixels), rect, - flipped_y, AsyncGetFramebufferPixelsCleanupCallback()); } void GLRenderer::GetFramebufferPixelsAsync( - gfx::Rect rect, bool flipped_y, scoped_ptr<CopyOutputRequest> request) { + gfx::Rect rect, scoped_ptr<CopyOutputRequest> request) { DCHECK(!request->IsEmpty()); if (request->IsEmpty()) return; @@ -2140,15 +2171,14 @@ void GLRenderer::GetFramebufferPixelsAsync( pending_read.Pass()); // This is an asyncronous call since the callback is not null. - DoGetFramebufferPixels(pixels, rect, flipped_y, cleanup_callback); + DoGetFramebufferPixels(pixels, rect, cleanup_callback); } void GLRenderer::DoGetFramebufferPixels( uint8* dest_pixels, gfx::Rect rect, - bool flipped_y, const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback) { - gfx::Rect window_rect = MoveFromDrawToWindowSpace(rect, flipped_y); + gfx::Rect window_rect = MoveFromDrawToWindowSpace(rect); DCHECK_LE(window_rect.right(), current_surface_size_.width()); DCHECK_LE(window_rect.bottom(), current_surface_size_.height()); @@ -2241,8 +2271,7 @@ void GLRenderer::DoGetFramebufferPixels( cleanup_callback, buffer, dest_pixels, - rect.size(), - flipped_y); + rect.size()); // Save the finished_callback so it can be cancelled. pending_async_read_pixels_.front()->finished_read_pixels_callback.Reset( finished_callback); @@ -2268,8 +2297,7 @@ void GLRenderer::FinishedReadback( const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback, unsigned source_buffer, uint8* dest_pixels, - gfx::Size size, - bool flipped_y) { + gfx::Size size) { DCHECK(!pending_async_read_pixels_.empty()); PendingAsyncReadPixels* current_read = pending_async_read_pixels_.back(); @@ -2291,8 +2319,7 @@ void GLRenderer::FinishedReadback( size_t total_bytes = num_rows * row_bytes; for (size_t dest_y = 0; dest_y < total_bytes; dest_y += row_bytes) { // Flip Y axis. - size_t src_y = flipped_y ? total_bytes - dest_y - row_bytes - : dest_y; + size_t src_y = total_bytes - dest_y - row_bytes; // Swizzle OpenGL -> Skia byte order. for (size_t x = 0; x < row_bytes; x += 4) { dest_pixels[dest_y + x + SK_R32_SHIFT/8] = src_pixels[src_y + x + 0]; @@ -2392,8 +2419,7 @@ bool GLRenderer::BindFramebufferToTexture(DrawingFrame* frame, InitializeViewport(frame, target_rect, gfx::Rect(target_rect.size()), - target_rect.size(), - false); + target_rect.size()); return true; } diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h index 12eb8f7..e5d80f1 100644 --- a/cc/output/gl_renderer.h +++ b/cc/output/gl_renderer.h @@ -95,7 +95,6 @@ class CC_EXPORT GLRenderer } void GetFramebufferPixelsAsync(gfx::Rect rect, - bool flipped_y, scoped_ptr<CopyOutputRequest> request); bool GetFramebufferTexture(ScopedResource* resource, gfx::Rect device_rect); void ReleaseRenderPassTextures(); @@ -170,7 +169,8 @@ class CC_EXPORT GLRenderer void CopyTextureToFramebuffer(const DrawingFrame* frame, int texture_id, gfx::Rect rect, - const gfx::Transform& draw_matrix); + const gfx::Transform& draw_matrix, + bool flip_vertically); // Check if quad needs antialiasing and if so, inflate the quad and // fill edge array for fragment shader. local_quad is set to @@ -198,14 +198,12 @@ class CC_EXPORT GLRenderer void DoGetFramebufferPixels( uint8* pixels, gfx::Rect rect, - bool flipped_y, const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback); void FinishedReadback( const AsyncGetFramebufferPixelsCleanupCallback& cleanup_callback, unsigned source_buffer, uint8_t* dest_pixels, - gfx::Size size, - bool flipped_y); + gfx::Size size); void PassOnSkBitmap( scoped_ptr<SkBitmap> bitmap, scoped_ptr<SkAutoLockPixels> lock, @@ -265,17 +263,18 @@ class CC_EXPORT GLRenderer FragmentShaderRGBATexAlpha> RenderPassProgram; typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexAlphaMask> RenderPassMaskProgram; - typedef ProgramBinding<VertexShaderQuadTex, FragmentShaderRGBATexAlphaAA> - RenderPassProgramAA; - typedef ProgramBinding<VertexShaderQuadTex, FragmentShaderRGBATexAlphaMaskAA> + typedef ProgramBinding<VertexShaderQuadTexTransform, + FragmentShaderRGBATexAlphaAA> RenderPassProgramAA; + typedef ProgramBinding<VertexShaderQuadTexTransform, + FragmentShaderRGBATexAlphaMaskAA> RenderPassMaskProgramAA; typedef ProgramBinding<VertexShaderPosTexTransform, FragmentShaderRGBATexColorMatrixAlpha> RenderPassColorMatrixProgram; - typedef ProgramBinding<VertexShaderQuadTex, + typedef ProgramBinding<VertexShaderQuadTexTransform, FragmentShaderRGBATexAlphaMaskColorMatrixAA> RenderPassMaskColorMatrixProgramAA; - typedef ProgramBinding<VertexShaderQuadTex, + typedef ProgramBinding<VertexShaderQuadTexTransform, FragmentShaderRGBATexAlphaColorMatrixAA> RenderPassColorMatrixProgramAA; typedef ProgramBinding<VertexShaderPosTexTransform, diff --git a/cc/output/render_surface_filters.cc b/cc/output/render_surface_filters.cc index 22bf013..4d7855f 100644 --- a/cc/output/render_surface_filters.cc +++ b/cc/output/render_surface_filters.cc @@ -420,7 +420,7 @@ SkBitmap RenderSurfaceFilters::Apply(const WebKit::WebFilterOperations& filters, canvas->saveLayer(NULL, &paint); canvas->drawBitmap(state.Source(), op.dropShadowOffset().x, - -op.dropShadowOffset().y); + op.dropShadowOffset().y); canvas->restore(); canvas->drawBitmap(state.Source(), 0, 0); break; diff --git a/cc/output/renderer_pixeltest.cc b/cc/output/renderer_pixeltest.cc index 680814f..4d3eb30 100644 --- a/cc/output/renderer_pixeltest.cc +++ b/cc/output/renderer_pixeltest.cc @@ -654,10 +654,18 @@ TYPED_TEST(RendererPixelTest, EnlargedRenderPassTextureWithAntiAliasing) { this->renderer_->SetEnlargePassTextureAmountForTesting(gfx::Vector2d(50, 75)); +#if defined(OS_WIN) + // Windows has 1 pixel off by one in GL mode: crbug.com/225027 + // In software mode, any pixel can be off by one. + FuzzyPixelComparator comparator(true, 100.f, 0.f, 1.f, 1, 0); +#else + FuzzyForSoftwareOnlyPixelComparator<TypeParam> comparator(true); +#endif + EXPECT_TRUE(this->RunPixelTest( &pass_list, base::FilePath(FILE_PATH_LITERAL("blue_yellow_anti_aliasing.png")), - FuzzyForSoftwareOnlyPixelComparator<TypeParam>(true))); + comparator)); } template <typename RendererType> diff --git a/cc/output/shader.cc b/cc/output/shader.cc index 3181a37..161ee90 100644 --- a/cc/output/shader.cc +++ b/cc/output/shader.cc @@ -384,19 +384,19 @@ std::string VertexShaderQuad::GetShaderString() const { #endif } -VertexShaderQuadTex::VertexShaderQuadTex() +VertexShaderQuadTexTransform::VertexShaderQuadTexTransform() : matrix_location_(-1), quad_location_(-1), - tex_scale_location_(-1) {} + tex_transform_location_(-1) {} -void VertexShaderQuadTex::Init(WebGraphicsContext3D* context, - unsigned program, - bool using_bind_uniform, - int* base_uniform_index) { +void VertexShaderQuadTexTransform::Init(WebGraphicsContext3D* context, + unsigned program, + bool using_bind_uniform, + int* base_uniform_index) { static const char* shader_uniforms[] = { "matrix", "quad", - "texScale", + "texTrans", }; int locations[3]; @@ -411,25 +411,25 @@ void VertexShaderQuadTex::Init(WebGraphicsContext3D* context, matrix_location_ = locations[0]; quad_location_ = locations[1]; - tex_scale_location_ = locations[2]; + tex_transform_location_ = locations[2]; DCHECK_NE(matrix_location_, -1); DCHECK_NE(quad_location_, -1); - DCHECK_NE(tex_scale_location_, -1); + DCHECK_NE(tex_transform_location_, -1); } -std::string VertexShaderQuadTex::GetShaderString() const { +std::string VertexShaderQuadTexTransform::GetShaderString() const { return VERTEX_SHADER( attribute TexCoordPrecision vec4 a_position; attribute float a_index; uniform mat4 matrix; uniform TexCoordPrecision vec2 quad[4]; - uniform TexCoordPrecision vec2 texScale; + uniform TexCoordPrecision vec4 texTrans; varying TexCoordPrecision vec2 v_texCoord; void main() { vec2 pos = quad[int(a_index)]; // NOLINT gl_Position = matrix * vec4( pos.x, pos.y, a_position.z, a_position.w); - v_texCoord = (pos.xy + vec2(0.5)) * texScale; + v_texCoord = (pos.xy + vec2(0.5)) * texTrans.zw + texTrans.xy; } ); // NOLINT(whitespace/parens) } diff --git a/cc/output/shader.h b/cc/output/shader.h index 7200f35..d8a039c 100644 --- a/cc/output/shader.h +++ b/cc/output/shader.h @@ -133,7 +133,11 @@ class VertexShaderPosTexTransform { class VertexShaderPosTexTransformFlip : public VertexShaderPosTexTransform { public: + VertexShaderPosTexTransformFlip() {} std::string GetShaderString() const; + + private: + DISALLOW_COPY_AND_ASSIGN(VertexShaderPosTexTransformFlip); }; class VertexShaderQuad { @@ -156,9 +160,9 @@ class VertexShaderQuad { DISALLOW_COPY_AND_ASSIGN(VertexShaderQuad); }; -class VertexShaderQuadTex { +class VertexShaderQuadTexTransform { public: - VertexShaderQuadTex(); + VertexShaderQuadTexTransform(); void Init(WebKit::WebGraphicsContext3D* context, unsigned program, @@ -168,14 +172,14 @@ class VertexShaderQuadTex { int matrix_location() const { return matrix_location_; } int quad_location() const { return quad_location_; } - int tex_scale_location() const { return tex_scale_location_; } + int tex_transform_location() const { return tex_transform_location_; } private: int matrix_location_; int quad_location_; - int tex_scale_location_; + int tex_transform_location_; - DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTex); + DISALLOW_COPY_AND_ASSIGN(VertexShaderQuadTexTransform); }; class VertexShaderTile { diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc index e982ff3..1082086 100644 --- a/cc/output/software_renderer.cc +++ b/cc/output/software_renderer.cc @@ -147,8 +147,7 @@ bool SoftwareRenderer::BindFramebufferToTexture( InitializeViewport(frame, target_rect, gfx::Rect(target_rect.size()), - target_rect.size(), - FlippedFramebuffer()); + target_rect.size()); return true; } diff --git a/cc/trees/layer_tree_host_pixeltest_filters.cc b/cc/trees/layer_tree_host_pixeltest_filters.cc index 5383bfd1..3c7e346 100644 --- a/cc/trees/layer_tree_host_pixeltest_filters.cc +++ b/cc/trees/layer_tree_host_pixeltest_filters.cc @@ -60,7 +60,7 @@ TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlurOutsets) { "background_filter_blur_outsets.png"))); } -TEST_F(LayerTreeHostFiltersPixelTest, DISABLED_BackgroundFilterBlurOffAxis) { +TEST_F(LayerTreeHostFiltersPixelTest, BackgroundFilterBlurOffAxis) { scoped_refptr<SolidColorLayer> background = CreateSolidColorLayer( gfx::Rect(200, 200), SK_ColorWHITE); |