diff options
author | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-14 16:20:32 +0000 |
---|---|---|
committer | enne@chromium.org <enne@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-14 16:20:32 +0000 |
commit | 8c406cda313dc0bd1a92d0e2fb8dfd068338c8b6 (patch) | |
tree | 92f449e82578d4fe42e106dd6b3b30815d39b516 /cc | |
parent | 86896381fe3b52d9b71080c3fe63da536b6f098e (diff) | |
download | chromium_src-8c406cda313dc0bd1a92d0e2fb8dfd068338c8b6.zip chromium_src-8c406cda313dc0bd1a92d0e2fb8dfd068338c8b6.tar.gz chromium_src-8c406cda313dc0bd1a92d0e2fb8dfd068338c8b6.tar.bz2 |
cc: Fix style errors in impl-side painting classes
R=jamesr@chromium.org
BUG=none
Review URL: https://chromiumcodereview.appspot.com/12819002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188094 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/picture_image_layer.cc | 6 | ||||
-rw-r--r-- | cc/picture_image_layer.h | 2 | ||||
-rw-r--r-- | cc/picture_layer.cc | 4 | ||||
-rw-r--r-- | cc/picture_layer.h | 6 | ||||
-rw-r--r-- | cc/picture_layer_impl.cc | 70 | ||||
-rw-r--r-- | cc/picture_layer_impl.h | 15 | ||||
-rw-r--r-- | cc/picture_layer_impl_unittest.cc | 66 | ||||
-rw-r--r-- | cc/picture_pile.cc | 4 | ||||
-rw-r--r-- | cc/test/fake_picture_layer_tiling_client.cc | 3 |
9 files changed, 94 insertions, 82 deletions
diff --git a/cc/picture_image_layer.cc b/cc/picture_image_layer.cc index 1435818..9586bee 100644 --- a/cc/picture_image_layer.cc +++ b/cc/picture_image_layer.cc @@ -16,7 +16,7 @@ scoped_refptr<PictureImageLayer> PictureImageLayer::Create() { PictureImageLayer::PictureImageLayer() : PictureLayer(this) {} PictureImageLayer::~PictureImageLayer() { - clearClient(); + ClearClient(); } scoped_ptr<LayerImpl> PictureImageLayer::CreateLayerImpl( @@ -28,8 +28,8 @@ bool PictureImageLayer::DrawsContent() const { return !bitmap_.isNull() && PictureLayer::DrawsContent(); } -void PictureImageLayer::setBitmap(const SkBitmap& bitmap) { - // setBitmap() currently gets called whenever there is any +void PictureImageLayer::SetBitmap(const SkBitmap& bitmap) { + // SetBitmap() currently gets called whenever there is any // style change that affects the layer even if that change doesn't // affect the actual contents of the image (e.g. a CSS animation). // With this check in place we avoid unecessary texture uploads. diff --git a/cc/picture_image_layer.h b/cc/picture_image_layer.h index 3e02313..6a26c7a 100644 --- a/cc/picture_image_layer.h +++ b/cc/picture_image_layer.h @@ -17,7 +17,7 @@ class CC_EXPORT PictureImageLayer : public PictureLayer, ContentLayerClient { public: static scoped_refptr<PictureImageLayer> Create(); - void setBitmap(const SkBitmap& image); + void SetBitmap(const SkBitmap& image); // Layer implementation. virtual scoped_ptr<LayerImpl> CreateLayerImpl( diff --git a/cc/picture_layer.cc b/cc/picture_layer.cc index 10fd3e6..80b3200 100644 --- a/cc/picture_layer.cc +++ b/cc/picture_layer.cc @@ -29,8 +29,8 @@ bool PictureLayer::DrawsContent() const { return Layer::DrawsContent() && client_; } -scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* treeImpl) { - return PictureLayerImpl::Create(treeImpl, id()).PassAs<LayerImpl>(); +scoped_ptr<LayerImpl> PictureLayer::CreateLayerImpl(LayerTreeImpl* tree_impl) { + return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); } void PictureLayer::PushPropertiesTo(LayerImpl* base_layer) { diff --git a/cc/picture_layer.h b/cc/picture_layer.h index b13a95f..7585545 100644 --- a/cc/picture_layer.h +++ b/cc/picture_layer.h @@ -21,15 +21,15 @@ class CC_EXPORT PictureLayer : public ContentsScalingLayer { public: static scoped_refptr<PictureLayer> Create(ContentLayerClient* client); - void clearClient() { client_ = 0; } + void ClearClient() { client_ = NULL; } // Implement Layer interface virtual bool DrawsContent() const OVERRIDE; virtual scoped_ptr<LayerImpl> CreateLayerImpl( - LayerTreeImpl* treeImpl) OVERRIDE; + LayerTreeImpl* tree_impl) OVERRIDE; virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; - virtual void SetNeedsDisplayRect(const gfx::RectF& layerRect) OVERRIDE; + virtual void SetNeedsDisplayRect(const gfx::RectF& layer_rect) OVERRIDE; virtual void Update( ResourceUpdateQueue* queue, const OcclusionTracker* occlusion, diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc index b0b824a2..ba91b2e 100644 --- a/cc/picture_layer_impl.cc +++ b/cc/picture_layer_impl.cc @@ -25,8 +25,8 @@ const float kMaxScaleRatioDuringPinch = 2.0f; namespace cc { -PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* treeImpl, int id) - : LayerImpl(treeImpl, id), +PictureLayerImpl::PictureLayerImpl(LayerTreeImpl* tree_impl, int id) + : LayerImpl(tree_impl, id), pile_(PicturePileImpl::Create()), last_content_scale_(0), ideal_contents_scale_(0), @@ -48,8 +48,8 @@ const char* PictureLayerImpl::LayerTypeAsString() const { } scoped_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( - LayerTreeImpl* treeImpl) { - return PictureLayerImpl::Create(treeImpl, id()).PassAs<LayerImpl>(); + LayerTreeImpl* tree_impl) { + return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); } void PictureLayerImpl::CreateTilingSet() { @@ -59,7 +59,8 @@ void PictureLayerImpl::CreateTilingSet() { tilings_->SetLayerBounds(bounds()); } -void PictureLayerImpl::TransferTilingSet(scoped_ptr<PictureLayerTilingSet> tilings) { +void PictureLayerImpl::TransferTilingSet( + scoped_ptr<PictureLayerTilingSet> tilings) { DCHECK(layer_tree_impl()->IsActiveTree()); tilings->SetClient(this); tilings_ = tilings.Pass(); @@ -95,13 +96,13 @@ void PictureLayerImpl::AppendQuads(QuadSink* quadSink, draw_transform(), gfx::QuadF(rect), clipped); - bool isAxisAlignedInTarget = !clipped && target_quad.IsRectilinear(); + bool is_axis_aligned_in_target = !clipped && target_quad.IsRectilinear(); - bool isPixelAligned = isAxisAlignedInTarget && - draw_transform().IsIdentityOrIntegerTranslation(); + bool is_pixel_aligned = is_axis_aligned_in_target && + draw_transform().IsIdentityOrIntegerTranslation(); PictureLayerTiling::LayerDeviceAlignment layerDeviceAlignment = - isPixelAligned ? PictureLayerTiling::LayerAlignedToDevice - : PictureLayerTiling::LayerNotAlignedToDevice; + is_pixel_aligned ? PictureLayerTiling::LayerAlignedToDevice + : PictureLayerTiling::LayerNotAlignedToDevice; if (ShowDebugBorders()) { for (PictureLayerTilingSet::Iterator iter(tilings_.get(), @@ -238,14 +239,15 @@ void PictureLayerImpl::UpdateTilePriorities() { gfx::Transform current_screen_space_transform = screen_space_transform(); gfx::Rect viewport_in_content_space; - gfx::Transform screenToLayer(gfx::Transform::kSkipInitialization); - if (screen_space_transform().GetInverse(&screenToLayer)) { + gfx::Transform screen_to_layer(gfx::Transform::kSkipInitialization); + if (screen_space_transform().GetInverse(&screen_to_layer)) { gfx::Rect device_viewport(layer_tree_impl()->device_viewport_size()); viewport_in_content_space = gfx::ToEnclosingRect( - MathUtil::projectClippedRect(screenToLayer, device_viewport)); + MathUtil::projectClippedRect(screen_to_layer, device_viewport)); } - WhichTree tree = layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; + WhichTree tree = + layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; bool store_screen_space_quads_on_tiles = layer_tree_impl()->debug_state().traceAllRenderedFrames; tilings_->UpdateTilePriorities( @@ -349,7 +351,7 @@ void PictureLayerImpl::UpdatePile(Tile* tile) { } gfx::Size PictureLayerImpl::CalculateTileSize( - gfx::Size /* current_tile_size */, + gfx::Size current_tile_size, gfx::Size content_bounds) { if (is_mask_) { int max_size = layer_tree_impl()->MaxTextureSize(); @@ -383,10 +385,11 @@ gfx::Size PictureLayerImpl::CalculateTileSize( // we should avoid power-of-two textures. This helps reduce the number // of different textures sizes to help recycling, and also keeps all // textures multiple-of-eight, which is preferred on some drivers (IMG). - bool avoidPow2 = layer_tree_impl()->rendererCapabilities().avoid_pow2_textures; - int roundUpTo = avoidPow2 ? 56 : 64; - width = RoundUp(width, roundUpTo); - height = RoundUp(height, roundUpTo); + bool avoid_pow2 = + layer_tree_impl()->rendererCapabilities().avoid_pow2_textures; + int round_up_to = avoid_pow2 ? 56 : 64; + width = RoundUp(width, round_up_to); + height = RoundUp(height, round_up_to); return gfx::Size(width, height); } @@ -472,11 +475,12 @@ void PictureLayerImpl::SetIsMask(bool is_mask) { ResourceProvider::ResourceId PictureLayerImpl::ContentsResourceId() const { gfx::Rect content_rect(content_bounds()); float scale = contents_scale_x(); - for (PictureLayerTilingSet::Iterator iter(tilings_.get(), - scale, - content_rect, - ideal_contents_scale_, - PictureLayerTiling::LayerDeviceAlignmentUnknown); + for (PictureLayerTilingSet::Iterator + iter(tilings_.get(), + scale, + content_rect, + ideal_contents_scale_, + PictureLayerTiling::LayerDeviceAlignmentUnknown); iter; ++iter) { // Mask resource not ready yet. @@ -532,10 +536,11 @@ bool PictureLayerImpl::AreVisibleResourcesReady() const { if (tiling->contents_scale() < min_acceptable_scale) continue; - for (PictureLayerTiling::Iterator iter(tiling, - contents_scale_x(), - rect, - PictureLayerTiling::LayerDeviceAlignmentUnknown); + for (PictureLayerTiling::Iterator + iter(tiling, + contents_scale_x(), + rect, + PictureLayerTiling::LayerDeviceAlignmentUnknown); iter; ++iter) { if (should_force_uploads && iter) @@ -702,7 +707,8 @@ void PictureLayerImpl::CalculateRasterContentsScale( *raster_contents_scale, 1.f * ideal_page_scale_ * ideal_device_scale_); } - float low_res_factor = layer_tree_impl()->settings().lowResContentsScaleFactor; + float low_res_factor = + layer_tree_impl()->settings().lowResContentsScaleFactor; *low_res_raster_contents_scale = std::max( *raster_contents_scale * low_res_factor, MinimumContentsScale()); @@ -735,7 +741,8 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer( std::max(twin_raster_contents_scale, twin->ideal_contents_scale_)); } - float low_res_factor = layer_tree_impl()->settings().lowResContentsScaleFactor; + float low_res_factor = + layer_tree_impl()->settings().lowResContentsScaleFactor; float min_acceptable_low_res_scale = low_res_factor * min_acceptable_high_res_scale; @@ -804,7 +811,8 @@ float PictureLayerImpl::MinimumContentsScale() const { } void PictureLayerImpl::GetDebugBorderProperties( - SkColor* color, float* width) const { + SkColor* color, + float* width) const { *color = DebugColors::TiledContentLayerBorderColor(); *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); } diff --git a/cc/picture_layer_impl.h b/cc/picture_layer_impl.h index 16d6a1e..5fb24ee 100644 --- a/cc/picture_layer_impl.h +++ b/cc/picture_layer_impl.h @@ -20,17 +20,16 @@ class QuadSink; class CC_EXPORT PictureLayerImpl : public LayerImpl, public PictureLayerTilingClient { -public: - static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* treeImpl, int id) - { - return make_scoped_ptr(new PictureLayerImpl(treeImpl, id)); + public: + static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { + return make_scoped_ptr(new PictureLayerImpl(tree_impl, id)); } virtual ~PictureLayerImpl(); // LayerImpl overrides. virtual const char* LayerTypeAsString() const OVERRIDE; - virtual scoped_ptr<LayerImpl> CreateLayerImpl( - LayerTreeImpl* treeImpl) OVERRIDE; + virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) + OVERRIDE; virtual void PushPropertiesTo(LayerImpl* layer) OVERRIDE; virtual void AppendQuads(QuadSink* quad_sink, AppendQuadsData* append_quads_data) OVERRIDE; @@ -70,8 +69,8 @@ public: virtual scoped_ptr<base::Value> AsValue() const OVERRIDE; -protected: - PictureLayerImpl(LayerTreeImpl* treeImpl, int id); + protected: + PictureLayerImpl(LayerTreeImpl* tree_impl, int id); PictureLayerTiling* AddTiling(float contents_scale); void RemoveTiling(float contents_scale); void SyncFromActiveLayer(const PictureLayerImpl* other); diff --git a/cc/picture_layer_impl_unittest.cc b/cc/picture_layer_impl_unittest.cc index 823a7c9..527f7c0 100644 --- a/cc/picture_layer_impl_unittest.cc +++ b/cc/picture_layer_impl_unittest.cc @@ -20,11 +20,11 @@ namespace { class TestablePictureLayerImpl : public PictureLayerImpl { public: static scoped_ptr<TestablePictureLayerImpl> Create( - LayerTreeImpl* treeImpl, + LayerTreeImpl* tree_impl, int id, scoped_refptr<PicturePileImpl> pile) { - return make_scoped_ptr(new TestablePictureLayerImpl(treeImpl, id, pile)); + return make_scoped_ptr(new TestablePictureLayerImpl(tree_impl, id, pile)); } PictureLayerTilingSet& tilings() { return *tilings_; } @@ -32,7 +32,7 @@ class TestablePictureLayerImpl : public PictureLayerImpl { virtual gfx::Size CalculateTileSize( gfx::Size current_tile_size, - gfx::Size /* content_bounds */) OVERRIDE { + gfx::Size content_bounds) OVERRIDE { if (current_tile_size.IsEmpty()) return gfx::Size(100, 100); return current_tile_size; @@ -43,10 +43,10 @@ class TestablePictureLayerImpl : public PictureLayerImpl { private: TestablePictureLayerImpl( - LayerTreeImpl* treeImpl, + LayerTreeImpl* tree_impl, int id, scoped_refptr<PicturePileImpl> pile) - : PictureLayerImpl(treeImpl, id) { + : PictureLayerImpl(tree_impl, id) { pile_ = pile; SetBounds(pile_->size()); CreateTilingSet(); @@ -134,7 +134,7 @@ class TestablePicturePileImpl : public PicturePileImpl { class MockCanvas : public SkCanvas { public: - explicit MockCanvas(SkDevice* device) : SkCanvas(device) { } + explicit MockCanvas(SkDevice* device) : SkCanvas(device) {} virtual void drawRect(const SkRect& rect, const SkPaint& paint) { // Capture calls before SkCanvas quickReject kicks in @@ -193,11 +193,13 @@ class PictureLayerImplTest : public testing::Test { static void VerifyAllTilesExistAndHavePile( const PictureLayerTiling* tiling, PicturePileImpl* pile) { - for (PictureLayerTiling::Iterator iter(tiling, - tiling->contents_scale(), - tiling->ContentRect(), - PictureLayerTiling::LayerDeviceAlignmentUnknown); - iter; ++iter) { + for (PictureLayerTiling::Iterator + iter(tiling, + tiling->contents_scale(), + tiling->ContentRect(), + PictureLayerTiling::LayerDeviceAlignmentUnknown); + iter; + ++iter) { EXPECT_TRUE(*iter); EXPECT_EQ(pile, iter->picture_pile()); } @@ -338,11 +340,13 @@ TEST_F(PictureLayerImplTest, clonePartialInvalidation) { gfx::Rect content_invalidation = gfx::ToEnclosingRect(gfx::ScaleRect( layer_invalidation, tiling->contents_scale())); - for (PictureLayerTiling::Iterator iter(tiling, - tiling->contents_scale(), - tiling->ContentRect(), - PictureLayerTiling::LayerDeviceAlignmentUnknown); - iter; ++iter) { + for (PictureLayerTiling::Iterator + iter(tiling, + tiling->contents_scale(), + tiling->ContentRect(), + PictureLayerTiling::LayerDeviceAlignmentUnknown); + iter; + ++iter) { EXPECT_TRUE(*iter); EXPECT_FALSE(iter.geometry_rect().IsEmpty()); if (iter.geometry_rect().Intersects(content_invalidation)) @@ -399,11 +403,13 @@ TEST_F(PictureLayerImplTest, noInvalidationBoundsChange) { gfx::Rect active_content_bounds = gfx::ToEnclosingRect(gfx::ScaleRect( gfx::Rect(active_layer_bounds), tiling->contents_scale())); - for (PictureLayerTiling::Iterator iter(tiling, - tiling->contents_scale(), - tiling->ContentRect(), - PictureLayerTiling::LayerDeviceAlignmentUnknown); - iter; ++iter) { + for (PictureLayerTiling::Iterator + iter(tiling, + tiling->contents_scale(), + tiling->ContentRect(), + PictureLayerTiling::LayerDeviceAlignmentUnknown); + iter; + ++iter) { EXPECT_TRUE(*iter); EXPECT_FALSE(iter.geometry_rect().IsEmpty()); if (iter.geometry_rect().right() >= active_content_bounds.width() || @@ -449,16 +455,17 @@ TEST_F(PictureLayerImplTest, addTilesFromNewRecording) { for (size_t i = 0; i < tilings.num_tilings(); ++i) { const PictureLayerTiling* tiling = tilings.tiling_at(i); - for (PictureLayerTiling::Iterator iter(tiling, - tiling->contents_scale(), - tiling->ContentRect(), - PictureLayerTiling::LayerDeviceAlignmentUnknown); - iter; ++iter) { + for (PictureLayerTiling::Iterator + iter(tiling, + tiling->contents_scale(), + tiling->ContentRect(), + PictureLayerTiling::LayerDeviceAlignmentUnknown); + iter; + ++iter) { EXPECT_FALSE(iter.full_tile_geometry_rect().IsEmpty()); // Ensure there is a recording for this tile. - gfx::Rect layer_rect = gfx::ToEnclosingRect( - gfx::ScaleRect( - iter.full_tile_geometry_rect(), 1.f / tiling->contents_scale())); + gfx::Rect layer_rect = gfx::ToEnclosingRect(gfx::ScaleRect( + iter.full_tile_geometry_rect(), 1.f / tiling->contents_scale())); layer_rect.Intersect(gfx::Rect(layer_bounds)); bool in_pending = pending_pile->recorded_region().Contains(layer_rect); @@ -695,7 +702,6 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) { used_tilings.clear(); active_layer_->CleanUpTilingsOnActiveLayer(used_tilings); ASSERT_EQ(2u, active_layer_->tilings().num_tilings()); - } } // namespace diff --git a/cc/picture_pile.cc b/cc/picture_pile.cc index 91fc557..c69b7b8 100644 --- a/cc/picture_pile.cc +++ b/cc/picture_pile.cc @@ -111,8 +111,8 @@ void PicturePile::Update( } class FullyContainedPredicate { -public: - FullyContainedPredicate(gfx::Rect rect) : layer_rect_(rect) { } + public: + FullyContainedPredicate(gfx::Rect rect) : layer_rect_(rect) {} bool operator()(const scoped_refptr<Picture>& picture) { return layer_rect_.Contains(picture->LayerRect()); } diff --git a/cc/test/fake_picture_layer_tiling_client.cc b/cc/test/fake_picture_layer_tiling_client.cc index b0e6c8b..86610ae 100644 --- a/cc/test/fake_picture_layer_tiling_client.cc +++ b/cc/test/fake_picture_layer_tiling_client.cc @@ -6,8 +6,7 @@ namespace cc { -class FakeInfinitePicturePileImpl : public PicturePileImpl -{ +class FakeInfinitePicturePileImpl : public PicturePileImpl { public: FakeInfinitePicturePileImpl() { gfx::Size size(std::numeric_limits<int>::max(), |