OLD | NEW |
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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 // (http://crbug.com/280374). | 382 // (http://crbug.com/280374). |
383 skia::RefPtr<SkDrawFilter> opacity_filter = | 383 skia::RefPtr<SkDrawFilter> opacity_filter = |
384 skia::AdoptRef(new skia::OpacityDrawFilter( | 384 skia::AdoptRef(new skia::OpacityDrawFilter( |
385 quad->opacity(), frame->disable_picture_quad_image_filtering)); | 385 quad->opacity(), frame->disable_picture_quad_image_filtering)); |
386 DCHECK(!current_canvas_->getDrawFilter()); | 386 DCHECK(!current_canvas_->getDrawFilter()); |
387 current_canvas_->setDrawFilter(opacity_filter.get()); | 387 current_canvas_->setDrawFilter(opacity_filter.get()); |
388 | 388 |
389 TRACE_EVENT0("cc", | 389 TRACE_EVENT0("cc", |
390 "SoftwareRenderer::DrawPictureQuad"); | 390 "SoftwareRenderer::DrawPictureQuad"); |
391 | 391 |
392 // Create and run on-demand raster task for tile. | 392 if (client_->UseTaskGraphRunnerForOnDemandRaster()) { |
393 scoped_refptr<Task> on_demand_raster_task( | 393 // Create and run on-demand raster task for tile. |
394 new OnDemandRasterTaskImpl(quad->picture_pile, | 394 scoped_refptr<Task> on_demand_raster_task( |
395 current_canvas_, | 395 new OnDemandRasterTaskImpl(quad->picture_pile, |
396 quad->content_rect, | 396 current_canvas_, |
397 quad->contents_scale)); | 397 quad->content_rect, |
398 RunOnDemandRasterTask(on_demand_raster_task.get()); | 398 quad->contents_scale)); |
| 399 RunOnDemandRasterTask(on_demand_raster_task.get()); |
| 400 } else { |
| 401 quad->picture_pile->RasterDirect( |
| 402 current_canvas_, quad->content_rect, quad->contents_scale, NULL); |
| 403 } |
399 | 404 |
400 current_canvas_->setDrawFilter(NULL); | 405 current_canvas_->setDrawFilter(NULL); |
401 } | 406 } |
402 | 407 |
403 void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame* frame, | 408 void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame* frame, |
404 const SolidColorDrawQuad* quad) { | 409 const SolidColorDrawQuad* quad) { |
405 gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional( | 410 gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional( |
406 QuadVertexRect(), quad->rect, quad->visible_rect); | 411 QuadVertexRect(), quad->rect, quad->visible_rect); |
407 current_paint_.setColor(quad->color); | 412 current_paint_.setColor(quad->color); |
408 current_paint_.setAlpha(quad->opacity() * SkColorGetA(quad->color)); | 413 current_paint_.setAlpha(quad->opacity() * SkColorGetA(quad->color)); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 } | 650 } |
646 | 651 |
647 void SoftwareRenderer::DidChangeVisibility() { | 652 void SoftwareRenderer::DidChangeVisibility() { |
648 if (visible()) | 653 if (visible()) |
649 EnsureBackbuffer(); | 654 EnsureBackbuffer(); |
650 else | 655 else |
651 DiscardBackbuffer(); | 656 DiscardBackbuffer(); |
652 } | 657 } |
653 | 658 |
654 } // namespace cc | 659 } // namespace cc |
OLD | NEW |