Chromium Code Reviews| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 gfx::RectFToSkRect(quad->tex_coord_rect), | 340 gfx::RectFToSkRect(quad->tex_coord_rect), |
| 341 gfx::RectFToSkRect(QuadVertexRect()), | 341 gfx::RectFToSkRect(QuadVertexRect()), |
| 342 SkMatrix::kFill_ScaleToFit); | 342 SkMatrix::kFill_ScaleToFit); |
| 343 current_canvas_->concat(content_matrix); | 343 current_canvas_->concat(content_matrix); |
| 344 | 344 |
| 345 // TODO(aelias): This isn't correct in all cases. We should detect these | 345 // TODO(aelias): This isn't correct in all cases. We should detect these |
| 346 // cases and fall back to a persistent bitmap backing | 346 // cases and fall back to a persistent bitmap backing |
| 347 // (http://crbug.com/280374). | 347 // (http://crbug.com/280374). |
| 348 skia::RefPtr<SkDrawFilter> opacity_filter = | 348 skia::RefPtr<SkDrawFilter> opacity_filter = |
| 349 skia::AdoptRef(new skia::OpacityDrawFilter( | 349 skia::AdoptRef(new skia::OpacityDrawFilter( |
| 350 quad->opacity(), frame->disable_picture_quad_image_filtering)); | 350 quad->opacity(), frame->disable_picture_quad_image_filtering || |
| 351 quad->nearest_neighbor)); | |
| 351 DCHECK(!current_canvas_->getDrawFilter()); | 352 DCHECK(!current_canvas_->getDrawFilter()); |
| 352 current_canvas_->setDrawFilter(opacity_filter.get()); | 353 current_canvas_->setDrawFilter(opacity_filter.get()); |
| 353 | 354 |
| 354 TRACE_EVENT0("cc", | 355 TRACE_EVENT0("cc", |
| 355 "SoftwareRenderer::DrawPictureQuad"); | 356 "SoftwareRenderer::DrawPictureQuad"); |
| 356 | 357 |
| 357 quad->raster_source->PlaybackToSharedCanvas( | 358 quad->raster_source->PlaybackToSharedCanvas( |
| 358 current_canvas_, quad->content_rect, quad->contents_scale); | 359 current_canvas_, quad->content_rect, quad->contents_scale); |
| 359 | 360 |
| 360 current_canvas_->setDrawFilter(NULL); | 361 current_canvas_->setDrawFilter(NULL); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 current_canvas_->drawBitmapRectToRect(*bitmap, | 424 current_canvas_->drawBitmapRectToRect(*bitmap, |
| 424 &sk_uv_rect, | 425 &sk_uv_rect, |
| 425 quad_rect, | 426 quad_rect, |
| 426 ¤t_paint_); | 427 ¤t_paint_); |
| 427 } | 428 } |
| 428 | 429 |
| 429 if (needs_layer) | 430 if (needs_layer) |
| 430 current_canvas_->restore(); | 431 current_canvas_->restore(); |
| 431 } | 432 } |
| 432 | 433 |
| 433 void SoftwareRenderer::DrawTileQuad(const DrawingFrame* frame, | 434 void SoftwareRenderer::DrawTileQuad(const DrawingFrame* frame, |
|
danakj
2014/12/10 21:11:45
shouldn't we be using nearest_neighbour in here so
jackhou1
2014/12/11 08:38:12
Done.
| |
| 434 const TileDrawQuad* quad) { | 435 const TileDrawQuad* quad) { |
| 435 // |resource_provider_| can be NULL in resourceless software draws, which | 436 // |resource_provider_| can be NULL in resourceless software draws, which |
| 436 // should never produce tile quads in the first place. | 437 // should never produce tile quads in the first place. |
| 437 DCHECK(resource_provider_); | 438 DCHECK(resource_provider_); |
| 438 DCHECK(IsSoftwareResource(quad->resource_id)); | 439 DCHECK(IsSoftwareResource(quad->resource_id)); |
| 439 | 440 |
| 440 ResourceProvider::ScopedReadLockSoftware lock(resource_provider_, | 441 ResourceProvider::ScopedReadLockSoftware lock(resource_provider_, |
| 441 quad->resource_id); | 442 quad->resource_id); |
| 442 if (!lock.valid()) | 443 if (!lock.valid()) |
| 443 return; | 444 return; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 } | 605 } |
| 605 | 606 |
| 606 void SoftwareRenderer::DidChangeVisibility() { | 607 void SoftwareRenderer::DidChangeVisibility() { |
| 607 if (visible()) | 608 if (visible()) |
| 608 EnsureBackbuffer(); | 609 EnsureBackbuffer(); |
| 609 else | 610 else |
| 610 DiscardBackbuffer(); | 611 DiscardBackbuffer(); |
| 611 } | 612 } |
| 612 | 613 |
| 613 } // namespace cc | 614 } // namespace cc |
| OLD | NEW |