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

Side by Side Diff: cc/output/software_renderer.cc

Issue 638353002: [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: Formating. 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/output/software_renderer.h" 5 #include "cc/output/software_renderer.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/base/math_util.h" 8 #include "cc/base/math_util.h"
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/compositor_frame_ack.h" 10 #include "cc/output/compositor_frame_ack.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 } 71 }
72 72
73 SoftwareRenderer::SoftwareRenderer(RendererClient* client, 73 SoftwareRenderer::SoftwareRenderer(RendererClient* client,
74 const LayerTreeSettings* settings, 74 const LayerTreeSettings* settings,
75 OutputSurface* output_surface, 75 OutputSurface* output_surface,
76 ResourceProvider* resource_provider) 76 ResourceProvider* resource_provider)
77 : DirectRenderer(client, settings, output_surface, resource_provider), 77 : DirectRenderer(client, settings, output_surface, resource_provider),
78 is_scissor_enabled_(false), 78 is_scissor_enabled_(false),
79 is_backbuffer_discarded_(false), 79 is_backbuffer_discarded_(false),
80 output_device_(output_surface->software_device()), 80 output_device_(output_surface->software_device()),
81 current_canvas_(NULL) { 81 current_canvas_(nullptr) {
82 if (resource_provider_) { 82 if (resource_provider_) {
83 capabilities_.max_texture_size = resource_provider_->max_texture_size(); 83 capabilities_.max_texture_size = resource_provider_->max_texture_size();
84 capabilities_.best_texture_format = 84 capabilities_.best_texture_format =
85 resource_provider_->best_texture_format(); 85 resource_provider_->best_texture_format();
86 } 86 }
87 // The updater can access bitmaps while the SoftwareRenderer is using them. 87 // The updater can access bitmaps while the SoftwareRenderer is using them.
88 capabilities_.allow_partial_texture_updates = true; 88 capabilities_.allow_partial_texture_updates = true;
89 capabilities_.using_partial_swap = true; 89 capabilities_.using_partial_swap = true;
90 90
91 capabilities_.using_shared_memory_resources = true; 91 capabilities_.using_shared_memory_resources = true;
92 92
93 capabilities_.allow_rasterize_on_demand = true; 93 capabilities_.allow_rasterize_on_demand = true;
94 } 94 }
95 95
96 SoftwareRenderer::~SoftwareRenderer() {} 96 SoftwareRenderer::~SoftwareRenderer() {}
97 97
98 const RendererCapabilitiesImpl& SoftwareRenderer::Capabilities() const { 98 const RendererCapabilitiesImpl& SoftwareRenderer::Capabilities() const {
99 return capabilities_; 99 return capabilities_;
100 } 100 }
101 101
102 void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) { 102 void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) {
103 TRACE_EVENT0("cc", "SoftwareRenderer::BeginDrawingFrame"); 103 TRACE_EVENT0("cc", "SoftwareRenderer::BeginDrawingFrame");
104 root_canvas_ = output_device_->BeginPaint( 104 root_canvas_ = output_device_->BeginPaint(
105 gfx::ToEnclosingRect(frame->root_damage_rect)); 105 gfx::ToEnclosingRect(frame->root_damage_rect));
106 } 106 }
107 107
108 void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) { 108 void SoftwareRenderer::FinishDrawingFrame(DrawingFrame* frame) {
109 TRACE_EVENT0("cc", "SoftwareRenderer::FinishDrawingFrame"); 109 TRACE_EVENT0("cc", "SoftwareRenderer::FinishDrawingFrame");
110 current_framebuffer_lock_ = nullptr; 110 current_framebuffer_lock_ = nullptr;
111 current_canvas_ = NULL; 111 current_canvas_ = nullptr;
112 root_canvas_ = NULL; 112 root_canvas_ = nullptr;
113 113
114 current_frame_data_.reset(new SoftwareFrameData); 114 current_frame_data_.reset(new SoftwareFrameData);
115 output_device_->EndPaint(current_frame_data_.get()); 115 output_device_->EndPaint(current_frame_data_.get());
116 } 116 }
117 117
118 void SoftwareRenderer::SwapBuffers(const CompositorFrameMetadata& metadata) { 118 void SoftwareRenderer::SwapBuffers(const CompositorFrameMetadata& metadata) {
119 TRACE_EVENT0("cc,benchmark", "SoftwareRenderer::SwapBuffers"); 119 TRACE_EVENT0("cc,benchmark", "SoftwareRenderer::SwapBuffers");
120 CompositorFrame compositor_frame; 120 CompositorFrame compositor_frame;
121 compositor_frame.metadata = metadata; 121 compositor_frame.metadata = metadata;
122 compositor_frame.software_frame_data = current_frame_data_.Pass(); 122 compositor_frame.software_frame_data = current_frame_data_.Pass();
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 skia::RefPtr<SkDrawFilter> opacity_filter = 342 skia::RefPtr<SkDrawFilter> opacity_filter =
343 skia::AdoptRef(new skia::OpacityDrawFilter( 343 skia::AdoptRef(new skia::OpacityDrawFilter(
344 quad->opacity(), frame->disable_picture_quad_image_filtering)); 344 quad->opacity(), frame->disable_picture_quad_image_filtering));
345 DCHECK(!current_canvas_->getDrawFilter()); 345 DCHECK(!current_canvas_->getDrawFilter());
346 current_canvas_->setDrawFilter(opacity_filter.get()); 346 current_canvas_->setDrawFilter(opacity_filter.get());
347 347
348 TRACE_EVENT0("cc", 348 TRACE_EVENT0("cc",
349 "SoftwareRenderer::DrawPictureQuad"); 349 "SoftwareRenderer::DrawPictureQuad");
350 350
351 quad->picture_pile->RasterDirect( 351 quad->picture_pile->RasterDirect(
352 current_canvas_, quad->content_rect, quad->contents_scale, NULL); 352 current_canvas_, quad->content_rect, quad->contents_scale, nullptr);
353 353
354 current_canvas_->setDrawFilter(NULL); 354 current_canvas_->setDrawFilter(nullptr);
355 } 355 }
356 356
357 void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame* frame, 357 void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame* frame,
358 const SolidColorDrawQuad* quad) { 358 const SolidColorDrawQuad* quad) {
359 gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional( 359 gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional(
360 QuadVertexRect(), quad->rect, quad->visible_rect); 360 QuadVertexRect(), quad->rect, quad->visible_rect);
361 current_paint_.setColor(quad->color); 361 current_paint_.setColor(quad->color);
362 current_paint_.setAlpha(quad->opacity() * SkColorGetA(quad->color)); 362 current_paint_.setAlpha(quad->opacity() * SkColorGetA(quad->color));
363 current_canvas_->drawRect(gfx::RectFToSkRect(visible_quad_vertex_rect), 363 current_canvas_->drawRect(gfx::RectFToSkRect(visible_quad_vertex_rect),
364 current_paint_); 364 current_paint_);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 quad_rect, 419 quad_rect,
420 &current_paint_); 420 &current_paint_);
421 } 421 }
422 422
423 if (needs_layer) 423 if (needs_layer)
424 current_canvas_->restore(); 424 current_canvas_->restore();
425 } 425 }
426 426
427 void SoftwareRenderer::DrawTileQuad(const DrawingFrame* frame, 427 void SoftwareRenderer::DrawTileQuad(const DrawingFrame* frame,
428 const TileDrawQuad* quad) { 428 const TileDrawQuad* quad) {
429 // |resource_provider_| can be NULL in resourceless software draws, which 429 // |resource_provider_| can be nullptr in resourceless software draws, which
danakj 2014/10/10 17:28:45 just use null
430 // should never produce tile quads in the first place. 430 // should never produce tile quads in the first place.
431 DCHECK(resource_provider_); 431 DCHECK(resource_provider_);
432 DCHECK(IsSoftwareResource(quad->resource_id)); 432 DCHECK(IsSoftwareResource(quad->resource_id));
433 433
434 ResourceProvider::ScopedReadLockSoftware lock(resource_provider_, 434 ResourceProvider::ScopedReadLockSoftware lock(resource_provider_,
435 quad->resource_id); 435 quad->resource_id);
436 if (!lock.valid()) 436 if (!lock.valid())
437 return; 437 return;
438 DCHECK_EQ(GL_CLAMP_TO_EDGE, lock.wrap_mode()); 438 DCHECK_EQ(GL_CLAMP_TO_EDGE, lock.wrap_mode());
439 439
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 } 598 }
599 599
600 void SoftwareRenderer::DidChangeVisibility() { 600 void SoftwareRenderer::DidChangeVisibility() {
601 if (visible()) 601 if (visible())
602 EnsureBackbuffer(); 602 EnsureBackbuffer();
603 else 603 else
604 DiscardBackbuffer(); 604 DiscardBackbuffer();
605 } 605 }
606 606
607 } // namespace cc 607 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698