diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-28 01:45:35 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-28 01:45:35 +0000 |
commit | ca2902e903aba2f9964281dd875de7e4e72c08d8 (patch) | |
tree | fddaf41f587eb6dbe42a9ac4770ffe291edd797b /cc/output | |
parent | 11ba3511e22a3ec614d89220ff347de1b3432b48 (diff) | |
download | chromium_src-ca2902e903aba2f9964281dd875de7e4e72c08d8.zip chromium_src-ca2902e903aba2f9964281dd875de7e4e72c08d8.tar.gz chromium_src-ca2902e903aba2f9964281dd875de7e4e72c08d8.tar.bz2 |
cc: Fix lint errors in cc.
This fixes lint errors for a bunch of files including
occlusion_tracker_unittest.cc and layer_tree_host_unittest_*.cc,
as well as everything remaining under cc/trees/ and cc/output/
R=enne
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/12471012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/output')
24 files changed, 191 insertions, 147 deletions
diff --git a/cc/output/delegating_renderer.h b/cc/output/delegating_renderer.h index 6ce94fb3..a1bac0e 100644 --- a/cc/output/delegating_renderer.h +++ b/cc/output/delegating_renderer.h @@ -15,10 +15,10 @@ namespace cc { class OutputSurface; class ResourceProvider; -class CC_EXPORT DelegatingRenderer : - public Renderer, - public NON_EXPORTED_BASE( - WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback) { +class CC_EXPORT DelegatingRenderer + : public Renderer, + public NON_EXPORTED_BASE( + WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback) { public: static scoped_ptr<DelegatingRenderer> Create( RendererClient* client, @@ -40,7 +40,7 @@ class CC_EXPORT DelegatingRenderer : virtual bool IsContextLost() OVERRIDE; - virtual void SetVisible(bool) OVERRIDE; + virtual void SetVisible(bool visible) OVERRIDE; virtual void SendManagedMemoryStats(size_t bytes_visible, size_t bytes_visible_and_nearby, diff --git a/cc/output/delegating_renderer_unittest.cc b/cc/output/delegating_renderer_unittest.cc index 339e4cb..5357a58 100644 --- a/cc/output/delegating_renderer_unittest.cc +++ b/cc/output/delegating_renderer_unittest.cc @@ -91,7 +91,6 @@ class DelegatingRendererTestResources : public DelegatingRendererTest { LayerTreeHostImpl* host_impl, LayerTreeHostImpl::FrameData* frame, bool result) OVERRIDE { - frame->render_passes.clear(); frame->render_passes_by_id.clear(); diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc index f32c7ef..0789c29 100644 --- a/cc/output/direct_renderer.cc +++ b/cc/output/direct_renderer.cc @@ -4,6 +4,7 @@ #include "cc/output/direct_renderer.h" +#include <utility> #include <vector> #include "base/debug/trace_event.h" diff --git a/cc/output/geometry_binding.cc b/cc/output/geometry_binding.cc index 5c3db34..20bd666 100644 --- a/cc/output/geometry_binding.cc +++ b/cc/output/geometry_binding.cc @@ -37,9 +37,12 @@ GeometryBinding::GeometryBinding(WebKit::WebGraphicsContext3D* context, uint16_t data[6]; }; - COMPILE_ASSERT(sizeof(Quad) == 24 * sizeof(float), struct_is_densely_packed); - COMPILE_ASSERT(sizeof(QuadIndex) == 6 * sizeof(uint16_t), - struct_is_densely_packed); + COMPILE_ASSERT( + sizeof(Quad) == 24 * sizeof(float), // NOLINT(runtime/sizeof) + struct_is_densely_packed); + COMPILE_ASSERT( + sizeof(QuadIndex) == 6 * sizeof(uint16_t), // NOLINT(runtime/sizeof) + struct_is_densely_packed); Quad quad_list[8]; QuadIndex quad_index_list[8]; @@ -86,21 +89,28 @@ void GeometryBinding::PrepareForDraw() { GLC(context_, context_->bindBuffer(GL_ARRAY_BUFFER, quad_vertices_vbo_)); GLC(context_, context_->vertexAttribPointer( - PositionAttribLocation(), 3, GL_FLOAT, false, 6 * sizeof(float), 0)); + PositionAttribLocation(), + 3, + GL_FLOAT, + false, + 6 * sizeof(float), // NOLINT(runtime/sizeof) + 0)); GLC(context_, - context_->vertexAttribPointer(TexCoordAttribLocation(), - 2, - GL_FLOAT, - false, - 6 * sizeof(float), - 3 * sizeof(float))); + context_->vertexAttribPointer( + TexCoordAttribLocation(), + 2, + GL_FLOAT, + false, + 6 * sizeof(float), // NOLINT(runtime/sizeof) + 3 * sizeof(float))); // NOLINT(runtime/sizeof) GLC(context_, - context_->vertexAttribPointer(TriangleIndexAttribLocation(), - 1, - GL_FLOAT, - false, - 6 * sizeof(float), - 5 * sizeof(float))); + context_->vertexAttribPointer( + TriangleIndexAttribLocation(), + 1, + GL_FLOAT, + false, + 6 * sizeof(float), // NOLINT(runtime/sizeof) + 5 * sizeof(float))); // NOLINT(runtime/sizeof) GLC(context_, context_->enableVertexAttribArray(PositionAttribLocation())); GLC(context_, context_->enableVertexAttribArray(TexCoordAttribLocation())); GLC(context_, diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index 0a57dba..4eac4cd 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -4,6 +4,7 @@ #include "cc/output/gl_renderer.h" +#include <algorithm> #include <set> #include <string> #include <vector> @@ -202,7 +203,7 @@ void GLRenderer::DebugGLCall(WebGraphicsContext3D* context, const char* command, const char* file, int line) { - unsigned long error = context->getError(); + unsigned error = context->getError(); if (error != GL_NO_ERROR) LOG(ERROR) << "GL command failed: File: " << file << "\n\tLine " << line << "\n\tcommand: " << command << ", error " @@ -216,8 +217,8 @@ void GLRenderer::SetVisible(bool visible) { EnforceMemoryPolicy(); - // TODO: Replace setVisibilityCHROMIUM() with an extension to explicitly - // manage front/backbuffers + // TODO(jamesr): Replace setVisibilityCHROMIUM() with an extension to + // explicitly manage front/backbuffers // crbug.com/116049 if (capabilities_.using_set_visibility) context_->setVisibilityCHROMIUM(visible); @@ -726,12 +727,13 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, GrTexture* texture = reinterpret_cast<GrTexture*>(filter_bitmap.getTexture()); Context()->bindTexture(GL_TEXTURE_2D, texture->getTextureHandle()); - } else + } else { contents_resource_lock = make_scoped_ptr( new ResourceProvider::ScopedSamplerGL(resource_provider_, contents_texture->id(), GL_TEXTURE_2D, GL_LINEAR)); + } int shader_quad_location = -1; int shader_edge_location = -1; @@ -897,8 +899,8 @@ void GLRenderer::DrawRenderPassQuad(DrawingFrame* frame, } if (shader_mask_sampler_location != -1) { - DCHECK(shader_mask_tex_coord_scale_location != 1); - DCHECK(shader_mask_tex_coord_offset_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)); GLC(Context(), @@ -1498,9 +1500,12 @@ void GLRenderer::FlushTextureQuadCache() { GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE)); } - COMPILE_ASSERT(sizeof(Float4) == 4 * sizeof(float), struct_is_densely_packed); - COMPILE_ASSERT(sizeof(Float16) == 16 * sizeof(float), - struct_is_densely_packed); + COMPILE_ASSERT( + sizeof(Float4) == 4 * sizeof(float), // NOLINT(runtime/sizeof) + struct_is_densely_packed); + COMPILE_ASSERT( + sizeof(Float16) == 16 * sizeof(float), // NOLINT(runtime/sizeof) + struct_is_densely_packed); // Upload the tranforms for both points and uvs. GLC(context_, diff --git a/cc/output/gl_renderer.h b/cc/output/gl_renderer.h index af50f58..f2e2944e 100644 --- a/cc/output/gl_renderer.h +++ b/cc/output/gl_renderer.h @@ -32,16 +32,16 @@ class GeometryBinding; class ScopedEnsureFramebufferAllocation; // Class that handles drawing of composited render layers using GL. -class CC_EXPORT GLRenderer : - public DirectRenderer, - public NON_EXPORTED_BASE( - WebKit::WebGraphicsContext3D:: - WebGraphicsSwapBuffersCompleteCallbackCHROMIUM), - public NON_EXPORTED_BASE( - WebKit::WebGraphicsContext3D:: - WebGraphicsMemoryAllocationChangedCallbackCHROMIUM), - public NON_EXPORTED_BASE( - WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback) { +class CC_EXPORT GLRenderer + : public DirectRenderer, + public NON_EXPORTED_BASE( + WebKit::WebGraphicsContext3D:: + WebGraphicsSwapBuffersCompleteCallbackCHROMIUM), + public NON_EXPORTED_BASE( + WebKit::WebGraphicsContext3D:: + WebGraphicsMemoryAllocationChangedCallbackCHROMIUM), + public NON_EXPORTED_BASE( + WebKit::WebGraphicsContext3D::WebGraphicsContextLostCallback) { public: static scoped_ptr<GLRenderer> Create(RendererClient* client, OutputSurface* output_surface, @@ -364,11 +364,11 @@ class CC_EXPORT GLRenderer : #if DEBUG_GL_CALLS && !defined(NDEBUG) #define GLC(context, x) \ - (x, GLRenderer::DebugGLCall (&* context, #x, __FILE__, __LINE__)) + (x, GLRenderer::DebugGLCall(&* context, #x, __FILE__, __LINE__)) #else #define GLC(context, x) (x) #endif -} +} // namespace cc #endif // CC_OUTPUT_GL_RENDERER_H_ diff --git a/cc/output/gl_renderer_draw_cache.h b/cc/output/gl_renderer_draw_cache.h index 28d4e71..e99cc27 100644 --- a/cc/output/gl_renderer_draw_cache.h +++ b/cc/output/gl_renderer_draw_cache.h @@ -12,10 +12,14 @@ namespace cc { // Collects 4 floats at a time for easy upload to GL. -struct Float4 { float data[4]; }; +struct Float4 { + float data[4]; +}; // Collects 16 floats at a time for easy upload to GL. -struct Float16 { float data[16]; }; +struct Float16 { + float data[16]; +}; // A cache for storing textured quads to be drawn. Stores the minimum required // data to tell if two back to back draws only differ in their transform. Quads diff --git a/cc/output/gl_renderer_pixeltest.cc b/cc/output/gl_renderer_pixeltest.cc index 7715c85..b7cdbd8 100644 --- a/cc/output/gl_renderer_pixeltest.cc +++ b/cc/output/gl_renderer_pixeltest.cc @@ -392,7 +392,7 @@ class GLRendererPixelTestWithBackgroundFilter : public GLRendererPixelTest { false, // is_replica 0, // mask_resource_id filter_pass_content_rect_, // contents_changed_since_last_frame - gfx::RectF(), // mask_uv_rect + gfx::RectF(), // mask_uv_rect WebKit::WebFilterOperations(), // filters skia::RefPtr<SkImageFilter>(), // filter background_filters_); diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc index 2e991c5..673e7cc 100644 --- a/cc/output/gl_renderer_unittest.cc +++ b/cc/output/gl_renderer_unittest.cc @@ -24,8 +24,6 @@ #include "third_party/skia/include/effects/SkColorMatrixFilter.h" #include "ui/gfx/transform.h" -using namespace WebKit; - using testing::_; using testing::AnyNumber; using testing::AtLeast; @@ -34,6 +32,19 @@ using testing::InSequence; using testing::Mock; using testing::Return; using testing::StrictMock; +using WebKit::WebGraphicsMemoryAllocation; +using WebKit::WebGLId; +using WebKit::WebString; +using WebKit::WGC3Dbitfield; +using WebKit::WGC3Dboolean; +using WebKit::WGC3Dchar; +using WebKit::WGC3Denum; +using WebKit::WGC3Dfloat; +using WebKit::WGC3Dint; +using WebKit::WGC3Dintptr; +using WebKit::WGC3Dsizei; +using WebKit::WGC3Dsizeiptr; +using WebKit::WGC3Duint; namespace cc { @@ -85,8 +96,8 @@ namespace { TEST_F(GLRendererShaderPixelTest, AllShadersCompile) { TestShaders(); } #endif -class FrameCountingMemoryAllocationSettingContext : - public TestWebGraphicsContext3D { +class FrameCountingMemoryAllocationSettingContext + : public TestWebGraphicsContext3D { public: FrameCountingMemoryAllocationSettingContext() : frame_(0) {} @@ -327,8 +338,9 @@ TEST_F(GLRendererTest, SuggestBackbufferYesWhenItAlreadyExistsShouldDoNothing) { // Suggest discarding framebuffer when one exists and the renderer is not // visible. // Expected: it is discarded and damage tracker is reset. -TEST_F(GLRendererTest, - SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayerWhileNotVisible) { +TEST_F( + GLRendererTest, + SuggestBackbufferNoShouldDiscardBackbufferAndDamageRootLayerIfNotVisible) { renderer_.SetVisible(false); context()->SetMemoryAllocation(suggest_have_backbuffer_no_); EXPECT_EQ(1, mock_client_.set_full_root_layer_damage_count()); @@ -444,8 +456,7 @@ class ForbidSynchronousCallContext : public TestWebGraphicsContext3D { if (pname == GL_MAX_TEXTURE_SIZE) { // MAX_TEXTURE_SIZE is cached client side, so it's OK to query. *value = 1024; - } - else { + } else { ADD_FAILURE(); } } @@ -596,8 +607,8 @@ TEST(GLRendererTest2, InitializationWithQuicklyLostContextDoesNotAssert) { renderer.Initialize(); } -class ContextThatDoesNotSupportMemoryManagmentExtensions : - public TestWebGraphicsContext3D { +class ContextThatDoesNotSupportMemoryManagmentExtensions + : public TestWebGraphicsContext3D { public: ContextThatDoesNotSupportMemoryManagmentExtensions() {} @@ -610,8 +621,9 @@ class ContextThatDoesNotSupportMemoryManagmentExtensions : virtual WebString getString(WebKit::WGC3Denum name) { return WebString(); } }; -TEST(GLRendererTest2, - InitializationWithoutGpuMemoryManagerExtensionSupportShouldDefaultToNonZeroAllocation) { +TEST( + GLRendererTest2, + InitWithoutGpuMemManagerExtensionSupportShouldDefaultToNonZeroAllocation) { FakeRendererClient mock_client; scoped_ptr<OutputSurface> output_surface( FakeOutputSurface::Create3d(scoped_ptr<WebKit::WebGraphicsContext3D>( @@ -684,8 +696,8 @@ TEST(GLRendererTest2, TransparentBackground) { EXPECT_EQ(1, context->clear_count()); } -class VisibilityChangeIsLastCallTrackingContext : - public TestWebGraphicsContext3D { +class VisibilityChangeIsLastCallTrackingContext + : public TestWebGraphicsContext3D { public: VisibilityChangeIsLastCallTrackingContext() : last_call_was_set_visibility_(0) {} @@ -1333,8 +1345,8 @@ TEST_F(MockOutputSurfaceTestWithPartialSwap, DrawFrameAndSwap) { renderer_.SwapBuffers(); } -class MockOutputSurfaceTestWithSendCompositorFrame : - public MockOutputSurfaceTest { +class MockOutputSurfaceTestWithSendCompositorFrame + : public MockOutputSurfaceTest { public: virtual const LayerTreeSettings& Settings() const OVERRIDE { static LayerTreeSettings fake_settings; diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc index f084788..9abb7f5 100644 --- a/cc/output/output_surface.cc +++ b/cc/output/output_surface.cc @@ -69,7 +69,7 @@ bool OutputSurface::BindToClient( return true; } -void OutputSurface::SendFrameToParentCompositor(CompositorFrame*) { +void OutputSurface::SendFrameToParentCompositor(CompositorFrame* frame) { NOTIMPLEMENTED(); } diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h index bb473e2..e23aaaf 100644 --- a/cc/output/output_surface.h +++ b/cc/output/output_surface.h @@ -5,8 +5,6 @@ #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ #define CC_OUTPUT_OUTPUT_SURFACE_H_ -#define USE_CC_OUTPUT_SURFACE // TODO(danakj): Remove this. - #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "cc/base/cc_export.h" @@ -32,9 +30,9 @@ class OutputSurfaceClient; // surface (on the compositor thread) and go back to step 1. class CC_EXPORT OutputSurface { public: - OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d); + explicit OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d); - OutputSurface(scoped_ptr<cc::SoftwareOutputDevice> software_device); + explicit OutputSurface(scoped_ptr<cc::SoftwareOutputDevice> software_device); OutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d, scoped_ptr<cc::SoftwareOutputDevice> software_device); @@ -70,12 +68,12 @@ class CC_EXPORT OutputSurface { // thread-specific data for the output surface can be initialized, since from // this point on the output surface will only be used on the compositor // thread. - virtual bool BindToClient(OutputSurfaceClient*); + virtual bool BindToClient(OutputSurfaceClient* client); // Sends frame data to the parent compositor. This should only be called when // capabilities().has_parent_compositor. The implementation may destroy or // steal the contents of the CompositorFrame passed in. - virtual void SendFrameToParentCompositor(CompositorFrame*); + virtual void SendFrameToParentCompositor(CompositorFrame* frame); virtual void EnsureBackbuffer(); virtual void DiscardBackbuffer(); diff --git a/cc/output/render_surface_filters.cc b/cc/output/render_surface_filters.cc index 2c51fbc..d2178b8 100644 --- a/cc/output/render_surface_filters.cc +++ b/cc/output/render_surface_filters.cc @@ -4,6 +4,8 @@ #include "cc/output/render_surface_filters.h" +#include <algorithm> + #include "base/logging.h" #include "skia/ext/refptr.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation.h" diff --git a/cc/output/render_surface_filters.h b/cc/output/render_surface_filters.h index e13c11c..494204c 100644 --- a/cc/output/render_surface_filters.h +++ b/cc/output/render_surface_filters.h @@ -35,5 +35,6 @@ class CC_EXPORT RenderSurfaceFilters { DISALLOW_IMPLICIT_CONSTRUCTORS(RenderSurfaceFilters); }; -} +} // namespace cc + #endif // CC_OUTPUT_RENDER_SURFACE_FILTERS_H_ diff --git a/cc/output/render_surface_filters_unittest.cc b/cc/output/render_surface_filters_unittest.cc index f2f02647..b99f70c 100644 --- a/cc/output/render_surface_filters_unittest.cc +++ b/cc/output/render_surface_filters_unittest.cc @@ -8,7 +8,8 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperation.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations.h" -using namespace WebKit; +using WebKit::WebFilterOperation; +using WebKit::WebFilterOperations; namespace cc { namespace { @@ -70,7 +71,7 @@ TEST(RenderSurfaceFiltersTest, TestColorMatrixFiltersCombined) { // Several filters should never combine: blur, drop-shadow. EXPECT_FALSE(IsCombined(WebFilterOperation::createBlurFilter(3.0f))); EXPECT_FALSE(IsCombined(WebFilterOperation::createDropShadowFilter( - WebPoint(2, 2), 3.0f, 0xffffffff))); + gfx::Point(2, 2), 3.0f, 0xffffffff))); // sepia and hue may or may not combine depending on the value. EXPECT_TRUE(IsCombined(WebFilterOperation::createSepiaFilter(0.0f))); diff --git a/cc/output/renderer.h b/cc/output/renderer.h index c4dcf3f..b2dd42c 100644 --- a/cc/output/renderer.h +++ b/cc/output/renderer.h @@ -85,6 +85,6 @@ class CC_EXPORT Renderer { DISALLOW_COPY_AND_ASSIGN(Renderer); }; -} +} // namespace cc #endif // CC_OUTPUT_RENDERER_H_ diff --git a/cc/output/shader.cc b/cc/output/shader.cc index e5f9f0a..f07d099 100644 --- a/cc/output/shader.cc +++ b/cc/output/shader.cc @@ -4,6 +4,8 @@ #include "cc/output/shader.h" +#include <algorithm> + #include "base/basictypes.h" #include "base/logging.h" #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3D.h" @@ -40,7 +42,7 @@ static void GetProgramUniformLocations(WebGraphicsContext3D* context, } } -} +} // namespace VertexShaderPosTex::VertexShaderPosTex() : matrix_location_(-1) {} @@ -64,7 +66,7 @@ void VertexShaderPosTex::Init(WebGraphicsContext3D* context, base_uniform_index); matrix_location_ = locations[0]; - DCHECK(matrix_location_ != -1); + DCHECK_NE(matrix_location_, -1); } std::string VertexShaderPosTex::GetShaderString() const { @@ -77,7 +79,7 @@ std::string VertexShaderPosTex::GetShaderString() const { gl_Position = matrix * a_position; v_texCoord = a_texCoord; } - ); + ); // NOLINT(whitespace/parens) } VertexShaderPosTexYUVStretch::VertexShaderPosTexYUVStretch() @@ -120,7 +122,7 @@ std::string VertexShaderPosTexYUVStretch::GetShaderString() const { gl_Position = matrix * a_position; v_texCoord = a_texCoord * texScale; } - ); + ); // NOLINT(whitespace/parens) } VertexShaderPos::VertexShaderPos() @@ -145,7 +147,7 @@ void VertexShaderPos::Init(WebGraphicsContext3D* context, base_uniform_index); matrix_location_ = locations[0]; - DCHECK(matrix_location_ != -1); + DCHECK_NE(matrix_location_, -1); } std::string VertexShaderPos::GetShaderString() const { @@ -155,7 +157,7 @@ std::string VertexShaderPos::GetShaderString() const { void main() { gl_Position = matrix * a_position; } - ); + ); // NOLINT(whitespace/parens) } VertexShaderPosTexTransform::VertexShaderPosTexTransform() @@ -201,12 +203,12 @@ std::string VertexShaderPosTexTransform::GetShaderString() const { varying vec2 v_texCoord; varying float v_alpha; void main() { - gl_Position = matrix[int(a_index * 0.25)] * a_position; - vec4 texTrans = texTransform[int(a_index * 0.25)]; + gl_Position = matrix[int(a_index * 0.25)] * a_position; // NOLINT + vec4 texTrans = texTransform[int(a_index * 0.25)]; // NOLINT v_texCoord = a_texCoord * texTrans.zw + texTrans.xy; - v_alpha = opacity[int(a_index)]; + v_alpha = opacity[int(a_index)]; // NOLINT } - ); + ); // NOLINT(whitespace/parens) } std::string VertexShaderPosTexTransformFlip::GetShaderString() const { @@ -220,13 +222,13 @@ std::string VertexShaderPosTexTransformFlip::GetShaderString() const { varying vec2 v_texCoord; varying float v_alpha; void main() { - gl_Position = matrix[int(a_index * 0.25)] * a_position; - vec4 texTrans = texTransform[int(a_index * 0.25)]; + gl_Position = matrix[int(a_index * 0.25)] * a_position; // NOLINT + vec4 texTrans = texTransform[int(a_index * 0.25)]; // NOLINT v_texCoord = a_texCoord * texTrans.zw + texTrans.xy; v_texCoord.y = 1.0 - v_texCoord.y; - v_alpha = opacity[int(a_index)]; + v_alpha = opacity[int(a_index)]; // NOLINT } - ); + ); // NOLINT(whitespace/parens) } std::string VertexShaderPosTexIdentity::GetShaderString() const { @@ -237,7 +239,7 @@ std::string VertexShaderPosTexIdentity::GetShaderString() const { gl_Position = a_position; v_texCoord = (a_position.xy + vec2(1.0)) * 0.5; } - ); + ); // NOLINT(whitespace/parens) } VertexShaderQuad::VertexShaderQuad() @@ -291,7 +293,7 @@ std::string VertexShaderQuad::GetShaderString() const { gl_Position = matrix * pos; v_texCoord = (pos.xy + vec2(0.5)) * texScale; } - ); + ); // NOLINT(whitespace/parens) } VertexShaderTile::VertexShaderTile() @@ -344,7 +346,7 @@ std::string VertexShaderTile::GetShaderString() const { gl_Position = matrix * pos; v_texCoord = pos.xy * vertexTexTransform.zw + vertexTexTransform.xy; } - ); + ); // NOLINT(whitespace/parens) } VertexShaderVideoTransform::VertexShaderVideoTransform() @@ -387,7 +389,7 @@ std::string VertexShaderVideoTransform::GetShaderString() const { v_texCoord = vec2(texMatrix * vec4(a_texCoord.x, 1.0 - a_texCoord.y, 0.0, 1.0)); } - ); + ); // NOLINT(whitespace/parens) } FragmentTexAlphaBinding::FragmentTexAlphaBinding() @@ -475,7 +477,7 @@ void FragmentTexOpaqueBinding::Init(WebGraphicsContext3D* context, base_uniform_index); sampler_location_ = locations[0]; - DCHECK(sampler_location_ != -1); + DCHECK_NE(sampler_location_, -1); } FragmentShaderOESImageExternal::FragmentShaderOESImageExternal() @@ -514,7 +516,7 @@ std::string FragmentShaderOESImageExternal::GetShaderString() const { vec4 texColor = texture2D(s_texture, v_texCoord); gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w); } - ); + ); // NOLINT(whitespace/parens) } std::string FragmentShaderRGBATexAlpha::GetShaderString() const { @@ -527,7 +529,7 @@ std::string FragmentShaderRGBATexAlpha::GetShaderString() const { vec4 texColor = texture2D(s_texture, v_texCoord); gl_FragColor = texColor * alpha; } - ); + ); // NOLINT(whitespace/parens) } std::string FragmentShaderRGBATexColorMatrixAlpha::GetShaderString() const { @@ -547,7 +549,7 @@ std::string FragmentShaderRGBATexColorMatrixAlpha::GetShaderString() const { texColor = clamp(texColor, 0.0, 1.0); gl_FragColor = texColor * alpha; } - ); + ); // NOLINT(whitespace/parens) } std::string FragmentShaderRGBATexVaryingAlpha::GetShaderString() const { @@ -560,7 +562,7 @@ std::string FragmentShaderRGBATexVaryingAlpha::GetShaderString() const { vec4 texColor = texture2D(s_texture, v_texCoord); gl_FragColor = texColor * v_alpha; } - ); + ); // NOLINT(whitespace/parens) } std::string FragmentShaderRGBATexRectVaryingAlpha::GetShaderString() const { @@ -574,7 +576,7 @@ std::string FragmentShaderRGBATexRectVaryingAlpha::GetShaderString() const { vec4 texColor = texture2DRect(s_texture, v_texCoord); gl_FragColor = texColor * v_alpha; } - ); + ); // NOLINT(whitespace/parens) } std::string FragmentShaderRGBATexOpaque::GetShaderString() const { @@ -586,7 +588,7 @@ std::string FragmentShaderRGBATexOpaque::GetShaderString() const { vec4 texColor = texture2D(s_texture, v_texCoord); gl_FragColor = vec4(texColor.rgb, 1.0); } - ); + ); // NOLINT(whitespace/parens) } std::string FragmentShaderRGBATex::GetShaderString() const { @@ -597,7 +599,7 @@ std::string FragmentShaderRGBATex::GetShaderString() const { void main() { gl_FragColor = texture2D(s_texture, v_texCoord); } - ); + ); // NOLINT(whitespace/parens) } std::string FragmentShaderRGBATexSwizzleAlpha::GetShaderString() const { @@ -611,7 +613,7 @@ std::string FragmentShaderRGBATexSwizzleAlpha::GetShaderString() const { gl_FragColor = vec4(texColor.z, texColor.y, texColor.x, texColor.w) * alpha; } - ); + ); // NOLINT(whitespace/parens) } std::string FragmentShaderRGBATexSwizzleOpaque::GetShaderString() const { @@ -623,7 +625,7 @@ std::string FragmentShaderRGBATexSwizzleOpaque::GetShaderString() const { vec4 texColor = texture2D(s_texture, v_texCoord); gl_FragColor = vec4(texColor.z, texColor.y, texColor.x, 1.0); } - ); + ); // NOLINT(whitespace/parens) } FragmentShaderRGBATexAlphaAA::FragmentShaderRGBATexAlphaAA() @@ -679,7 +681,7 @@ std::string FragmentShaderRGBATexAlphaAA::GetShaderString() const { gl_FragColor = texColor * alpha * min(min(a0, a2) * min(a1, a3), min(a4, a6) * min(a5, a7)); } - ); + ); // NOLINT(whitespace/parens) } FragmentTexClampAlphaAABinding::FragmentTexClampAlphaAABinding() @@ -741,7 +743,7 @@ std::string FragmentShaderRGBATexClampAlphaAA::GetShaderString() const { gl_FragColor = texColor * alpha * min(min(a0, a2) * min(a1, a3), min(a4, a6) * min(a5, a7)); } - ); + ); // NOLINT(whitespace/parens) } std::string FragmentShaderRGBATexClampSwizzleAlphaAA::GetShaderString() const { @@ -768,7 +770,7 @@ std::string FragmentShaderRGBATexClampSwizzleAlphaAA::GetShaderString() const { gl_FragColor = vec4(texColor.z, texColor.y, texColor.x, texColor.w) * alpha * min(min(a0, a2) * min(a1, a3), min(a4, a6) * min(a5, a7)); } - ); + ); // NOLINT(whitespace/parens) } FragmentShaderRGBATexAlphaMask::FragmentShaderRGBATexAlphaMask() @@ -827,7 +829,7 @@ std::string FragmentShaderRGBATexAlphaMask::GetShaderString() const { gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha * maskColor.w; } - ); + ); // NOLINT(whitespace/parens) } FragmentShaderRGBATexAlphaMaskAA::FragmentShaderRGBATexAlphaMaskAA() @@ -900,10 +902,11 @@ std::string FragmentShaderRGBATexAlphaMaskAA::GetShaderString() const { alpha * maskColor.w * min(min(a0, a2) * min(a1, a3), min(a4, a6) * min(a5, a7)); } - ); + ); // NOLINT(whitespace/parens) } -FragmentShaderRGBATexAlphaMaskColorMatrixAA::FragmentShaderRGBATexAlphaMaskColorMatrixAA() +FragmentShaderRGBATexAlphaMaskColorMatrixAA:: + FragmentShaderRGBATexAlphaMaskColorMatrixAA() : sampler_location_(-1) , mask_sampler_location_(-1) , alpha_location_(-1) @@ -951,7 +954,8 @@ void FragmentShaderRGBATexAlphaMaskColorMatrixAA::Init( color_matrix_location_ != -1 && color_offset_location_ != -1); } -std::string FragmentShaderRGBATexAlphaMaskColorMatrixAA::GetShaderString() const { +std::string FragmentShaderRGBATexAlphaMaskColorMatrixAA::GetShaderString() + const { return SHADER( precision mediump float; varying vec2 v_texCoord; @@ -988,10 +992,11 @@ std::string FragmentShaderRGBATexAlphaMaskColorMatrixAA::GetShaderString() const alpha * maskColor.w * min(min(a0, a2) * min(a1, a3), min(a4, a6) * min(a5, a7)); } - ); + ); // NOLINT(whitespace/parens) } -FragmentShaderRGBATexAlphaColorMatrixAA::FragmentShaderRGBATexAlphaColorMatrixAA() +FragmentShaderRGBATexAlphaColorMatrixAA:: + FragmentShaderRGBATexAlphaColorMatrixAA() : sampler_location_(-1) , alpha_location_(-1) , edge_location_(-1) @@ -1057,10 +1062,11 @@ std::string FragmentShaderRGBATexAlphaColorMatrixAA::GetShaderString() const { gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha * min(min(a0, a2) * min(a1, a3), min(a4, a6) * min(a5, a7)); } - ); + ); // NOLINT(whitespace/parens) } -FragmentShaderRGBATexAlphaMaskColorMatrix::FragmentShaderRGBATexAlphaMaskColorMatrix() +FragmentShaderRGBATexAlphaMaskColorMatrix:: + FragmentShaderRGBATexAlphaMaskColorMatrix() : sampler_location_(-1) , mask_sampler_location_(-1) , alpha_location_(-1) @@ -1126,7 +1132,7 @@ std::string FragmentShaderRGBATexAlphaMaskColorMatrix::GetShaderString() const { gl_FragColor = vec4(texColor.x, texColor.y, texColor.z, texColor.w) * alpha * maskColor.w; } - ); + ); // NOLINT(whitespace/parens) } FragmentShaderYUVVideo::FragmentShaderYUVVideo() @@ -1189,9 +1195,9 @@ std::string FragmentShaderYUVVideo::GetShaderString() const { float v_unsigned = texture2D(v_texture, v_texCoord).x; vec3 yuv = vec3(y_raw, u_unsigned, v_unsigned) + yuv_adj; vec3 rgb = yuv_matrix * yuv; - gl_FragColor = vec4(rgb, float(1)) * alpha; + gl_FragColor = vec4(rgb, float(1)) * alpha; // NOLINT } - ); + ); // NOLINT(whitespace/parens) } FragmentShaderColor::FragmentShaderColor() @@ -1216,7 +1222,7 @@ void FragmentShaderColor::Init(WebGraphicsContext3D* context, base_uniform_index); color_location_ = locations[0]; - DCHECK(color_location_ != -1); + DCHECK_NE(color_location_, -1); } std::string FragmentShaderColor::GetShaderString() const { @@ -1226,7 +1232,7 @@ std::string FragmentShaderColor::GetShaderString() const { void main() { gl_FragColor = color; } - ); + ); // NOLINT(whitespace/parens) } FragmentShaderColorAA::FragmentShaderColorAA() @@ -1275,7 +1281,7 @@ std::string FragmentShaderColorAA::GetShaderString() const { gl_FragColor = color * min(min(a0, a2) * min(a1, a3), min(a4, a6) * min(a5, a7)); } - ); + ); // NOLINT(whitespace/parens) } FragmentShaderCheckerboard::FragmentShaderCheckerboard() @@ -1332,7 +1338,7 @@ std::string FragmentShaderCheckerboard::GetShaderString() const { float picker = abs(coord.x - coord.y); gl_FragColor = mix(color1, color2, picker) * alpha; } - ); + ); // NOLINT(whitespace/parens) } } // namespace cc diff --git a/cc/output/shader.h b/cc/output/shader.h index bf98e69..228fc6d 100644 --- a/cc/output/shader.h +++ b/cc/output/shader.h @@ -195,7 +195,7 @@ class FragmentTexAlphaBinding { }; class FragmentTexColorMatrixAlphaBinding { -public: + public: FragmentTexColorMatrixAlphaBinding(); void Init(WebKit::WebGraphicsContext3D*, @@ -209,7 +209,7 @@ public: int fragment_tex_transform_location() const { return -1; } int sampler_location() const { return sampler_location_; } -private: + private: int sampler_location_; int alpha_location_; int color_matrix_location_; @@ -245,8 +245,9 @@ class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding { std::string GetShaderString() const; }; -class FragmentShaderRGBATexColorMatrixAlpha : public FragmentTexColorMatrixAlphaBinding { -public: +class FragmentShaderRGBATexColorMatrixAlpha + : public FragmentTexColorMatrixAlphaBinding { + public: std::string GetShaderString() const; }; @@ -339,15 +340,15 @@ class FragmentTexClampAlphaAABinding { DISALLOW_COPY_AND_ASSIGN(FragmentTexClampAlphaAABinding); }; -class FragmentShaderRGBATexClampAlphaAA : - public FragmentTexClampAlphaAABinding { +class FragmentShaderRGBATexClampAlphaAA + : public FragmentTexClampAlphaAABinding { public: std::string GetShaderString() const; }; // Swizzles the red and blue component of sampled texel. -class FragmentShaderRGBATexClampSwizzleAlphaAA : - public FragmentTexClampAlphaAABinding { +class FragmentShaderRGBATexClampSwizzleAlphaAA + : public FragmentTexClampAlphaAABinding { public: std::string GetShaderString() const; }; @@ -413,7 +414,7 @@ class FragmentShaderRGBATexAlphaMaskAA { }; class FragmentShaderRGBATexAlphaMaskColorMatrixAA { -public: + public: FragmentShaderRGBATexAlphaMaskColorMatrixAA(); std::string GetShaderString() const; @@ -434,7 +435,7 @@ public: int color_matrix_location() const { return color_matrix_location_; } int color_offset_location() const { return color_offset_location_; } -private: + private: int sampler_location_; int mask_sampler_location_; int alpha_location_; @@ -446,7 +447,7 @@ private: }; class FragmentShaderRGBATexAlphaColorMatrixAA { -public: + public: FragmentShaderRGBATexAlphaColorMatrixAA(); std::string GetShaderString() const; @@ -460,7 +461,7 @@ public: int color_matrix_location() const { return color_matrix_location_; } int color_offset_location() const { return color_offset_location_; } -private: + private: int sampler_location_; int alpha_location_; int edge_location_; @@ -469,7 +470,7 @@ private: }; class FragmentShaderRGBATexAlphaMaskColorMatrix { -public: + public: FragmentShaderRGBATexAlphaMaskColorMatrix(); std::string GetShaderString() const; @@ -489,7 +490,7 @@ public: int color_matrix_location() const { return color_matrix_location_; } int color_offset_location() const { return color_offset_location_; } -private: + private: int sampler_location_; int mask_sampler_location_; int alpha_location_; @@ -586,6 +587,6 @@ class FragmentShaderCheckerboard { DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); }; -} // namespace cc +} // namespace cc #endif // CC_OUTPUT_SHADER_H_ diff --git a/cc/output/software_frame_data.cc b/cc/output/software_frame_data.cc index ffecc3b..11feaa6 100644 --- a/cc/output/software_frame_data.cc +++ b/cc/output/software_frame_data.cc @@ -5,11 +5,11 @@ #include "cc/output/software_frame_data.h" namespace cc { - + SoftwareFrameData::SoftwareFrameData() : content_dib(TransportDIB::DefaultHandleValue()) { } - + SoftwareFrameData::~SoftwareFrameData() {} - + } // namespace cc diff --git a/cc/output/software_output_device.h b/cc/output/software_output_device.h index 1e55598..f9566f8 100644 --- a/cc/output/software_output_device.h +++ b/cc/output/software_output_device.h @@ -52,4 +52,4 @@ class CC_EXPORT SoftwareOutputDevice { } // namespace cc -#endif // CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ +#endif // CC_OUTPUT_SOFTWARE_OUTPUT_DEVICE_H_ diff --git a/cc/output/software_renderer.h b/cc/output/software_renderer.h index 64d4378..2c4732a 100644 --- a/cc/output/software_renderer.h +++ b/cc/output/software_renderer.h @@ -99,6 +99,6 @@ class CC_EXPORT SoftwareRenderer : public DirectRenderer { DISALLOW_COPY_AND_ASSIGN(SoftwareRenderer); }; -} +} // namespace cc #endif // CC_OUTPUT_SOFTWARE_RENDERER_H_ diff --git a/cc/output/software_renderer_unittest.cc b/cc/output/software_renderer_unittest.cc index e324fe9..bdef48f 100644 --- a/cc/output/software_renderer_unittest.cc +++ b/cc/output/software_renderer_unittest.cc @@ -19,8 +19,6 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using namespace WebKit; - namespace cc { namespace { diff --git a/cc/output/texture_copier.cc b/cc/output/texture_copier.cc index 5a8a41d..a32fb65 100644 --- a/cc/output/texture_copier.cc +++ b/cc/output/texture_copier.cc @@ -58,7 +58,8 @@ void AcceleratedTextureCopier::CopyTexture(Parameters parameters) { #if defined(OS_ANDROID) // Clear destination to improve performance on tiling GPUs. - // TODO: Use EXT_discard_framebuffer or skip clearing if it isn't available. + // TODO(epenner): Use EXT_discard_framebuffer or skip clearing if it isn't + // available. GLC(context_, context_->clear(GL_COLOR_BUFFER_BIT)); #endif @@ -74,7 +75,7 @@ void AcceleratedTextureCopier::CopyTexture(Parameters parameters) { if (!blit_program_->initialized()) blit_program_->Initialize(context_, using_bind_uniforms_); - // TODO: Use EXT_framebuffer_blit if available. + // TODO(danakj): Use EXT_framebuffer_blit if available. GLC(context_, context_->useProgram(blit_program_->program())); const int kPositionAttribute = 0; diff --git a/cc/output/texture_copier.h b/cc/output/texture_copier.h index 8500310..ad037ba 100644 --- a/cc/output/texture_copier.h +++ b/cc/output/texture_copier.h @@ -64,6 +64,6 @@ class CC_EXPORT AcceleratedTextureCopier : public TextureCopier { DISALLOW_COPY_AND_ASSIGN(AcceleratedTextureCopier); }; -} +} // namespace cc #endif // CC_OUTPUT_TEXTURE_COPIER_H_ diff --git a/cc/output/texture_copier_unittest.cc b/cc/output/texture_copier_unittest.cc index 4069bbf..671821e 100644 --- a/cc/output/texture_copier_unittest.cc +++ b/cc/output/texture_copier_unittest.cc @@ -9,10 +9,13 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/khronos/GLES2/gl2.h" -using namespace WebKit; using testing::InSequence; using testing::Test; using testing::_; +using WebKit::WebGLId; +using WebKit::WGC3Denum; +using WebKit::WGC3Dint; +using WebKit::WGC3Dsizei; namespace cc { namespace { @@ -36,7 +39,8 @@ TEST(TextureCopierTest, TestDrawArraysCopy) { EXPECT_CALL(*mock_context, disable(GL_SCISSOR_TEST)); - // Here we check just some essential properties of copyTexture() to avoid mirroring the full implementation. + // Here we check just some essential properties of copyTexture() to avoid + // mirroring the full implementation. EXPECT_CALL(*mock_context, bindFramebuffer(GL_FRAMEBUFFER, _)); // Make sure linear filtering is disabled during the copy. @@ -51,7 +55,8 @@ TEST(TextureCopierTest, TestDrawArraysCopy) { EXPECT_CALL(*mock_context, drawArrays(_, _, _)); - // Linear filtering, default framebuffer and scissor test should be restored. + // Linear filtering, default framebuffer and scissor test should be + // restored. EXPECT_CALL(*mock_context, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); EXPECT_CALL(*mock_context, |