| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 current_paint_.reset(); | 283 current_paint_.reset(); |
| 284 if (!IsScaleAndIntegerTranslate(sk_device_matrix)) { | 284 if (!IsScaleAndIntegerTranslate(sk_device_matrix)) { |
| 285 // TODO(danakj): Until we can enable AA only on exterior edges of the | 285 // TODO(danakj): Until we can enable AA only on exterior edges of the |
| 286 // layer, disable AA if any interior edges are present. crbug.com/248175 | 286 // layer, disable AA if any interior edges are present. crbug.com/248175 |
| 287 bool all_four_edges_are_exterior = quad->IsTopEdge() && | 287 bool all_four_edges_are_exterior = quad->IsTopEdge() && |
| 288 quad->IsLeftEdge() && | 288 quad->IsLeftEdge() && |
| 289 quad->IsBottomEdge() && | 289 quad->IsBottomEdge() && |
| 290 quad->IsRightEdge(); | 290 quad->IsRightEdge(); |
| 291 if (settings_->allow_antialiasing && all_four_edges_are_exterior) | 291 if (settings_->allow_antialiasing && all_four_edges_are_exterior) |
| 292 current_paint_.setAntiAlias(true); | 292 current_paint_.setAntiAlias(true); |
| 293 current_paint_.setFilterBitmap(true); | 293 current_paint_.setFilterLevel(SkPaint::kLow_FilterLevel); |
| 294 } | 294 } |
| 295 | 295 |
| 296 if (quad->ShouldDrawWithBlending()) { | 296 if (quad->ShouldDrawWithBlending()) { |
| 297 current_paint_.setAlpha(quad->opacity() * 255); | 297 current_paint_.setAlpha(quad->opacity() * 255); |
| 298 current_paint_.setXfermodeMode(SkXfermode::kSrcOver_Mode); | 298 current_paint_.setXfermodeMode(SkXfermode::kSrcOver_Mode); |
| 299 } else { | 299 } else { |
| 300 current_paint_.setXfermodeMode(SkXfermode::kSrc_Mode); | 300 current_paint_.setXfermodeMode(SkXfermode::kSrc_Mode); |
| 301 } | 301 } |
| 302 | 302 |
| 303 switch (quad->material) { | 303 switch (quad->material) { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 if (!lock.valid()) | 481 if (!lock.valid()) |
| 482 return; | 482 return; |
| 483 DCHECK_EQ(GL_CLAMP_TO_EDGE, lock.wrap_mode()); | 483 DCHECK_EQ(GL_CLAMP_TO_EDGE, lock.wrap_mode()); |
| 484 | 484 |
| 485 gfx::RectF visible_tex_coord_rect = MathUtil::ScaleRectProportional( | 485 gfx::RectF visible_tex_coord_rect = MathUtil::ScaleRectProportional( |
| 486 quad->tex_coord_rect, quad->rect, quad->visible_rect); | 486 quad->tex_coord_rect, quad->rect, quad->visible_rect); |
| 487 gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional( | 487 gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional( |
| 488 QuadVertexRect(), quad->rect, quad->visible_rect); | 488 QuadVertexRect(), quad->rect, quad->visible_rect); |
| 489 | 489 |
| 490 SkRect uv_rect = gfx::RectFToSkRect(visible_tex_coord_rect); | 490 SkRect uv_rect = gfx::RectFToSkRect(visible_tex_coord_rect); |
| 491 current_paint_.setFilterBitmap(true); | 491 current_paint_.setFilterLevel(SkPaint::kLow_FilterLevel); |
| 492 current_canvas_->drawBitmapRectToRect( | 492 current_canvas_->drawBitmapRectToRect( |
| 493 *lock.sk_bitmap(), | 493 *lock.sk_bitmap(), |
| 494 &uv_rect, | 494 &uv_rect, |
| 495 gfx::RectFToSkRect(visible_quad_vertex_rect), | 495 gfx::RectFToSkRect(visible_quad_vertex_rect), |
| 496 ¤t_paint_); | 496 ¤t_paint_); |
| 497 } | 497 } |
| 498 | 498 |
| 499 void SoftwareRenderer::DrawRenderPassQuad(const DrawingFrame* frame, | 499 void SoftwareRenderer::DrawRenderPassQuad(const DrawingFrame* frame, |
| 500 const RenderPassDrawQuad* quad) { | 500 const RenderPassDrawQuad* quad) { |
| 501 ScopedResource* content_texture = | 501 ScopedResource* content_texture = |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 } | 655 } |
| 656 | 656 |
| 657 void SoftwareRenderer::DidChangeVisibility() { | 657 void SoftwareRenderer::DidChangeVisibility() { |
| 658 if (visible()) | 658 if (visible()) |
| 659 EnsureBackbuffer(); | 659 EnsureBackbuffer(); |
| 660 else | 660 else |
| 661 DiscardBackbuffer(); | 661 DiscardBackbuffer(); |
| 662 } | 662 } |
| 663 | 663 |
| 664 } // namespace cc | 664 } // namespace cc |
| OLD | NEW |