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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { |
452 SkPaint background_paint; | 452 SkPaint background_paint; |
453 background_paint.setColor(quad->background_color); | 453 background_paint.setColor(quad->background_color); |
454 current_canvas_->drawRect(quad_rect, background_paint); | 454 current_canvas_->drawRect(quad_rect, background_paint); |
455 } | 455 } |
| 456 current_paint_.setFilterQuality( |
| 457 quad->nearest_neighbor ? kNone_SkFilterQuality : kLow_SkFilterQuality); |
456 SkShader::TileMode tile_mode = WrapModeToTileMode(lock.wrap_mode()); | 458 SkShader::TileMode tile_mode = WrapModeToTileMode(lock.wrap_mode()); |
457 if (tile_mode != SkShader::kClamp_TileMode) { | 459 if (tile_mode != SkShader::kClamp_TileMode) { |
458 SkMatrix matrix; | 460 SkMatrix matrix; |
459 matrix.setRectToRect(sk_uv_rect, quad_rect, SkMatrix::kFill_ScaleToFit); | 461 matrix.setRectToRect(sk_uv_rect, quad_rect, SkMatrix::kFill_ScaleToFit); |
460 skia::RefPtr<SkShader> shader = skia::AdoptRef( | 462 skia::RefPtr<SkShader> shader = skia::AdoptRef( |
461 SkShader::CreateBitmapShader(*bitmap, tile_mode, tile_mode, &matrix)); | 463 SkShader::CreateBitmapShader(*bitmap, tile_mode, tile_mode, &matrix)); |
462 SkPaint paint; | 464 SkPaint paint; |
463 paint.setStyle(SkPaint::kFill_Style); | 465 paint.setStyle(SkPaint::kFill_Style); |
464 paint.setShader(shader.get()); | 466 paint.setShader(shader.get()); |
465 current_canvas_->drawRect(quad_rect, paint); | 467 current_canvas_->drawRect(quad_rect, paint); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 } | 651 } |
650 | 652 |
651 void SoftwareRenderer::DidChangeVisibility() { | 653 void SoftwareRenderer::DidChangeVisibility() { |
652 if (visible()) | 654 if (visible()) |
653 EnsureBackbuffer(); | 655 EnsureBackbuffer(); |
654 else | 656 else |
655 DiscardBackbuffer(); | 657 DiscardBackbuffer(); |
656 } | 658 } |
657 | 659 |
658 } // namespace cc | 660 } // namespace cc |
OLD | NEW |