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

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

Issue 23961003: cc: Remove most methods from RendererClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rendererclient: rebase Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « cc/output/software_renderer.h ('k') | cc/output/software_renderer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 SkScalarNearlyZero(matrix[SkMatrix::kMSkewY]) && 44 SkScalarNearlyZero(matrix[SkMatrix::kMSkewY]) &&
45 SkScalarNearlyZero(matrix[SkMatrix::kMPersp0]) && 45 SkScalarNearlyZero(matrix[SkMatrix::kMPersp0]) &&
46 SkScalarNearlyZero(matrix[SkMatrix::kMPersp1]) && 46 SkScalarNearlyZero(matrix[SkMatrix::kMPersp1]) &&
47 SkScalarNearlyZero(matrix[SkMatrix::kMPersp2] - 1.0f); 47 SkScalarNearlyZero(matrix[SkMatrix::kMPersp2] - 1.0f);
48 } 48 }
49 49
50 } // anonymous namespace 50 } // anonymous namespace
51 51
52 scoped_ptr<SoftwareRenderer> SoftwareRenderer::Create( 52 scoped_ptr<SoftwareRenderer> SoftwareRenderer::Create(
53 RendererClient* client, 53 RendererClient* client,
54 const LayerTreeSettings* settings,
54 OutputSurface* output_surface, 55 OutputSurface* output_surface,
55 ResourceProvider* resource_provider) { 56 ResourceProvider* resource_provider) {
56 return make_scoped_ptr( 57 return make_scoped_ptr(new SoftwareRenderer(
57 new SoftwareRenderer(client, output_surface, resource_provider)); 58 client, settings, output_surface, resource_provider));
58 } 59 }
59 60
60 SoftwareRenderer::SoftwareRenderer(RendererClient* client, 61 SoftwareRenderer::SoftwareRenderer(RendererClient* client,
62 const LayerTreeSettings* settings,
61 OutputSurface* output_surface, 63 OutputSurface* output_surface,
62 ResourceProvider* resource_provider) 64 ResourceProvider* resource_provider)
63 : DirectRenderer(client, output_surface, resource_provider), 65 : DirectRenderer(client, settings, output_surface, resource_provider),
64 visible_(true), 66 visible_(true),
65 is_scissor_enabled_(false), 67 is_scissor_enabled_(false),
66 is_backbuffer_discarded_(false), 68 is_backbuffer_discarded_(false),
67 output_device_(output_surface->software_device()), 69 output_device_(output_surface->software_device()),
68 current_canvas_(NULL) { 70 current_canvas_(NULL) {
69 if (resource_provider_) { 71 if (resource_provider_) {
70 capabilities_.max_texture_size = resource_provider_->max_texture_size(); 72 capabilities_.max_texture_size = resource_provider_->max_texture_size();
71 capabilities_.best_texture_format = 73 capabilities_.best_texture_format =
72 resource_provider_->best_texture_format(); 74 resource_provider_->best_texture_format();
73 } 75 }
74 capabilities_.using_set_visibility = true; 76 capabilities_.using_set_visibility = true;
75 // The updater can access bitmaps while the SoftwareRenderer is using them. 77 // The updater can access bitmaps while the SoftwareRenderer is using them.
76 capabilities_.allow_partial_texture_updates = true; 78 capabilities_.allow_partial_texture_updates = true;
77 capabilities_.using_partial_swap = true; 79 capabilities_.using_partial_swap = true;
78 80
79 capabilities_.using_map_image = Settings().use_map_image; 81 capabilities_.using_map_image = settings_->use_map_image;
80 capabilities_.using_shared_memory_resources = true; 82 capabilities_.using_shared_memory_resources = true;
81 } 83 }
82 84
83 SoftwareRenderer::~SoftwareRenderer() {} 85 SoftwareRenderer::~SoftwareRenderer() {}
84 86
85 const RendererCapabilities& SoftwareRenderer::Capabilities() const { 87 const RendererCapabilities& SoftwareRenderer::Capabilities() const {
86 return capabilities_; 88 return capabilities_;
87 } 89 }
88 90
89 void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) { 91 void SoftwareRenderer::BeginDrawingFrame(DrawingFrame* frame) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // clipRect on the current SkCanvas. This is done by setting clipRect to 130 // clipRect on the current SkCanvas. This is done by setting clipRect to
129 // the viewport's dimensions. 131 // the viewport's dimensions.
130 is_scissor_enabled_ = false; 132 is_scissor_enabled_ = false;
131 SkBaseDevice* device = current_canvas_->getDevice(); 133 SkBaseDevice* device = current_canvas_->getDevice();
132 SetClipRect(gfx::Rect(device->width(), device->height())); 134 SetClipRect(gfx::Rect(device->width(), device->height()));
133 } 135 }
134 136
135 void SoftwareRenderer::Finish() {} 137 void SoftwareRenderer::Finish() {}
136 138
137 void SoftwareRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) { 139 void SoftwareRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) {
138 DCHECK(!client_->ExternalStencilTestEnabled()); 140 DCHECK(!output_surface_->HasExternalStencilTest());
139 current_framebuffer_lock_.reset(); 141 current_framebuffer_lock_.reset();
140 current_canvas_ = root_canvas_; 142 current_canvas_ = root_canvas_;
141 } 143 }
142 144
143 bool SoftwareRenderer::BindFramebufferToTexture( 145 bool SoftwareRenderer::BindFramebufferToTexture(
144 DrawingFrame* frame, 146 DrawingFrame* frame,
145 const ScopedResource* texture, 147 const ScopedResource* texture,
146 gfx::Rect target_rect) { 148 gfx::Rect target_rect) {
147 current_framebuffer_lock_.reset(); 149 current_framebuffer_lock_.reset();
148 current_framebuffer_lock_ = make_scoped_ptr( 150 current_framebuffer_lock_ = make_scoped_ptr(
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 current_canvas_->setMatrix(sk_device_matrix); 223 current_canvas_->setMatrix(sk_device_matrix);
222 224
223 current_paint_.reset(); 225 current_paint_.reset();
224 if (!IsScaleAndIntegerTranslate(sk_device_matrix)) { 226 if (!IsScaleAndIntegerTranslate(sk_device_matrix)) {
225 // TODO(danakj): Until we can enable AA only on exterior edges of the 227 // TODO(danakj): Until we can enable AA only on exterior edges of the
226 // layer, disable AA if any interior edges are present. crbug.com/248175 228 // layer, disable AA if any interior edges are present. crbug.com/248175
227 bool all_four_edges_are_exterior = quad->IsTopEdge() && 229 bool all_four_edges_are_exterior = quad->IsTopEdge() &&
228 quad->IsLeftEdge() && 230 quad->IsLeftEdge() &&
229 quad->IsBottomEdge() && 231 quad->IsBottomEdge() &&
230 quad->IsRightEdge(); 232 quad->IsRightEdge();
231 if (Settings().allow_antialiasing && 233 if (settings_->allow_antialiasing && all_four_edges_are_exterior)
232 all_four_edges_are_exterior)
233 current_paint_.setAntiAlias(true); 234 current_paint_.setAntiAlias(true);
234 current_paint_.setFilterBitmap(true); 235 current_paint_.setFilterBitmap(true);
235 } 236 }
236 237
237 if (quad->ShouldDrawWithBlending()) { 238 if (quad->ShouldDrawWithBlending()) {
238 current_paint_.setAlpha(quad->opacity() * 255); 239 current_paint_.setAlpha(quad->opacity() * 255);
239 current_paint_.setXfermodeMode(SkXfermode::kSrcOver_Mode); 240 current_paint_.setXfermodeMode(SkXfermode::kSrcOver_Mode);
240 } else { 241 } else {
241 current_paint_.setXfermodeMode(SkXfermode::kSrc_Mode); 242 current_paint_.setXfermodeMode(SkXfermode::kSrc_Mode);
242 } 243 }
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 EnsureBackbuffer(); 547 EnsureBackbuffer();
547 else 548 else
548 DiscardBackbuffer(); 549 DiscardBackbuffer();
549 } 550 }
550 551
551 void SoftwareRenderer::SetDiscardBackBufferWhenNotVisible(bool discard) { 552 void SoftwareRenderer::SetDiscardBackBufferWhenNotVisible(bool discard) {
552 // The software renderer always discards the backbuffer when not visible. 553 // The software renderer always discards the backbuffer when not visible.
553 } 554 }
554 555
555 } // namespace cc 556 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/software_renderer.h ('k') | cc/output/software_renderer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698