Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: cc/layers/content_layer.cc

Issue 643583003: [C++11 Allowed Features] Declares a type-safe null pointer converting from NULL to nullptr in src/… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: foramted. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/layers/content_layer.h" 5 #include "cc/layers/content_layer.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "cc/layers/content_layer_client.h" 10 #include "cc/layers/content_layer_client.h"
(...skipping 26 matching lines...) Expand all
37 37
38 ContentLayer::ContentLayer(ContentLayerClient* client) 38 ContentLayer::ContentLayer(ContentLayerClient* client)
39 : TiledLayer(), 39 : TiledLayer(),
40 client_(client), 40 client_(client),
41 can_use_lcd_text_last_frame_(can_use_lcd_text()) { 41 can_use_lcd_text_last_frame_(can_use_lcd_text()) {
42 } 42 }
43 43
44 ContentLayer::~ContentLayer() {} 44 ContentLayer::~ContentLayer() {}
45 45
46 void ContentLayer::ClearClient() { 46 void ContentLayer::ClearClient() {
47 client_ = NULL; 47 client_ = nullptr;
48 UpdateDrawsContent(HasDrawableContent()); 48 UpdateDrawsContent(HasDrawableContent());
49 } 49 }
50 50
51 bool ContentLayer::HasDrawableContent() const { 51 bool ContentLayer::HasDrawableContent() const {
52 return client_ && TiledLayer::HasDrawableContent(); 52 return client_ && TiledLayer::HasDrawableContent();
53 } 53 }
54 54
55 void ContentLayer::SetLayerTreeHost(LayerTreeHost* host) { 55 void ContentLayer::SetLayerTreeHost(LayerTreeHost* host) {
56 TiledLayer::SetLayerTreeHost(host); 56 TiledLayer::SetLayerTreeHost(host);
57 57
58 if (!updater_.get()) 58 if (!updater_.get())
59 return; 59 return;
60 60
61 if (host) { 61 if (host) {
62 updater_->set_rendering_stats_instrumentation( 62 updater_->set_rendering_stats_instrumentation(
63 host->rendering_stats_instrumentation()); 63 host->rendering_stats_instrumentation());
64 } else { 64 } else {
65 updater_->set_rendering_stats_instrumentation(NULL); 65 updater_->set_rendering_stats_instrumentation(nullptr);
66 } 66 }
67 } 67 }
68 68
69 void ContentLayer::SetTexturePriorities( 69 void ContentLayer::SetTexturePriorities(
70 const PriorityCalculator& priority_calc) { 70 const PriorityCalculator& priority_calc) {
71 // Update the tile data before creating all the layer's tiles. 71 // Update the tile data before creating all the layer's tiles.
72 UpdateTileSizeAndTilingOption(); 72 UpdateTileSizeAndTilingOption();
73 73
74 TiledLayer::SetTexturePriorities(priority_calc); 74 TiledLayer::SetTexturePriorities(priority_calc);
75 } 75 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 } 140 }
141 141
142 skia::RefPtr<SkPicture> ContentLayer::GetPicture() const { 142 skia::RefPtr<SkPicture> ContentLayer::GetPicture() const {
143 if (!DrawsContent()) 143 if (!DrawsContent())
144 return skia::RefPtr<SkPicture>(); 144 return skia::RefPtr<SkPicture>();
145 145
146 int width = bounds().width(); 146 int width = bounds().width();
147 int height = bounds().height(); 147 int height = bounds().height();
148 148
149 SkPictureRecorder recorder; 149 SkPictureRecorder recorder;
150 SkCanvas* canvas = recorder.beginRecording(width, height, NULL, 0); 150 SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0);
151 client_->PaintContents(canvas, 151 client_->PaintContents(canvas,
152 gfx::Rect(width, height), 152 gfx::Rect(width, height),
153 ContentLayerClient::GRAPHICS_CONTEXT_ENABLED); 153 ContentLayerClient::GRAPHICS_CONTEXT_ENABLED);
154 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording()); 154 skia::RefPtr<SkPicture> picture = skia::AdoptRef(recorder.endRecording());
155 return picture; 155 return picture;
156 } 156 }
157 157
158 void ContentLayer::OnOutputSurfaceCreated() { 158 void ContentLayer::OnOutputSurfaceCreated() {
159 SetTextureFormat( 159 SetTextureFormat(
160 layer_tree_host()->GetRendererCapabilities().best_texture_format); 160 layer_tree_host()->GetRendererCapabilities().best_texture_format);
161 TiledLayer::OnOutputSurfaceCreated(); 161 TiledLayer::OnOutputSurfaceCreated();
162 } 162 }
163 163
164 } // namespace cc 164 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698