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/trace_event/trace_event.h" | 7 #include "base/trace_event/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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 quad->uv_bottom_right), | 431 quad->uv_bottom_right), |
432 bitmap->width(), | 432 bitmap->width(), |
433 bitmap->height()); | 433 bitmap->height()); |
434 gfx::RectF visible_uv_rect = | 434 gfx::RectF visible_uv_rect = |
435 MathUtil::ScaleRectProportional(uv_rect, quad->rect, quad->visible_rect); | 435 MathUtil::ScaleRectProportional(uv_rect, quad->rect, quad->visible_rect); |
436 SkRect sk_uv_rect = gfx::RectFToSkRect(visible_uv_rect); | 436 SkRect sk_uv_rect = gfx::RectFToSkRect(visible_uv_rect); |
437 gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional( | 437 gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional( |
438 QuadVertexRect(), quad->rect, quad->visible_rect); | 438 QuadVertexRect(), quad->rect, quad->visible_rect); |
439 SkRect quad_rect = gfx::RectFToSkRect(visible_quad_vertex_rect); | 439 SkRect quad_rect = gfx::RectFToSkRect(visible_quad_vertex_rect); |
440 | 440 |
441 if (quad->flipped) | 441 if (quad->y_flipped) |
442 current_canvas_->scale(1, -1); | 442 current_canvas_->scale(1, -1); |
443 | 443 |
444 bool blend_background = quad->background_color != SK_ColorTRANSPARENT && | 444 bool blend_background = quad->background_color != SK_ColorTRANSPARENT && |
445 !bitmap->isOpaque(); | 445 !bitmap->isOpaque(); |
446 bool needs_layer = blend_background && (current_paint_.getAlpha() != 0xFF); | 446 bool needs_layer = blend_background && (current_paint_.getAlpha() != 0xFF); |
447 if (needs_layer) { | 447 if (needs_layer) { |
448 current_canvas_->saveLayerAlpha(&quad_rect, current_paint_.getAlpha()); | 448 current_canvas_->saveLayerAlpha(&quad_rect, current_paint_.getAlpha()); |
449 current_paint_.setAlpha(0xFF); | 449 current_paint_.setAlpha(0xFF); |
450 } | 450 } |
451 if (blend_background) { | 451 if (blend_background) { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 } | 649 } |
650 | 650 |
651 void SoftwareRenderer::DidChangeVisibility() { | 651 void SoftwareRenderer::DidChangeVisibility() { |
652 if (visible()) | 652 if (visible()) |
653 EnsureBackbuffer(); | 653 EnsureBackbuffer(); |
654 else | 654 else |
655 DiscardBackbuffer(); | 655 DiscardBackbuffer(); |
656 } | 656 } |
657 | 657 |
658 } // namespace cc | 658 } // namespace cc |
OLD | NEW |