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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 #ifdef NDEBUG | 400 #ifdef NDEBUG |
401 current_paint_.setColor(SK_ColorWHITE); | 401 current_paint_.setColor(SK_ColorWHITE); |
402 #else | 402 #else |
403 current_paint_.setColor(SK_ColorMAGENTA); | 403 current_paint_.setColor(SK_ColorMAGENTA); |
404 #endif | 404 #endif |
405 current_paint_.setAlpha(quad->opacity() * 255); | 405 current_paint_.setAlpha(quad->opacity() * 255); |
406 current_canvas_->drawRect(gfx::RectFToSkRect(QuadVertexRect()), | 406 current_canvas_->drawRect(gfx::RectFToSkRect(QuadVertexRect()), |
407 current_paint_); | 407 current_paint_); |
408 } | 408 } |
409 | 409 |
| 410 void SoftwareRenderer::CopyCurrentRenderPassToBitmap(DrawingFrame* frame, |
| 411 SkBitmap* bitmap) { |
| 412 gfx::Size render_pass_size = frame->current_render_pass->output_rect.size(); |
| 413 bitmap->setConfig(SkBitmap::kARGB_8888_Config, |
| 414 render_pass_size.width(), |
| 415 render_pass_size.height()); |
| 416 current_canvas_->readPixels(bitmap, 0, 0); |
| 417 } |
| 418 |
410 void SoftwareRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { | 419 void SoftwareRenderer::GetFramebufferPixels(void* pixels, gfx::Rect rect) { |
411 TRACE_EVENT0("cc", "SoftwareRenderer::GetFramebufferPixels"); | 420 TRACE_EVENT0("cc", "SoftwareRenderer::GetFramebufferPixels"); |
412 SkBitmap subset_bitmap; | 421 SkBitmap subset_bitmap; |
413 output_device_->CopyToBitmap(rect, &subset_bitmap); | 422 output_device_->CopyToBitmap(rect, &subset_bitmap); |
414 subset_bitmap.copyPixelsTo(pixels, | 423 subset_bitmap.copyPixelsTo(pixels, |
415 4 * rect.width() * rect.height(), | 424 4 * rect.width() * rect.height(), |
416 4 * rect.width()); | 425 4 * rect.width()); |
417 } | 426 } |
418 | 427 |
419 void SoftwareRenderer::SetVisible(bool visible) { | 428 void SoftwareRenderer::SetVisible(bool visible) { |
420 if (visible_ == visible) | 429 if (visible_ == visible) |
421 return; | 430 return; |
422 visible_ = visible; | 431 visible_ = visible; |
423 } | 432 } |
424 | 433 |
425 } // namespace cc | 434 } // namespace cc |
OLD | NEW |