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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "cc/software_renderer.h" | 7 #include "cc/software_renderer.h" |
8 | 8 |
9 #include "cc/debug_border_draw_quad.h" | 9 #include "cc/debug_border_draw_quad.h" |
10 #include "cc/render_pass_draw_quad.h" | 10 #include "cc/render_pass_draw_quad.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 341 |
342 void SoftwareRenderer::drawUnsupportedQuad(const DrawingFrame& frame, const Draw
Quad* quad) | 342 void SoftwareRenderer::drawUnsupportedQuad(const DrawingFrame& frame, const Draw
Quad* quad) |
343 { | 343 { |
344 m_skCurrentPaint.setColor(SK_ColorMAGENTA); | 344 m_skCurrentPaint.setColor(SK_ColorMAGENTA); |
345 m_skCurrentPaint.setAlpha(quad->opacity() * 255); | 345 m_skCurrentPaint.setAlpha(quad->opacity() * 255); |
346 m_skCurrentCanvas->drawRect(toSkRect(quadVertexRect()), m_skCurrentPaint); | 346 m_skCurrentCanvas->drawRect(toSkRect(quadVertexRect()), m_skCurrentPaint); |
347 } | 347 } |
348 | 348 |
349 bool SoftwareRenderer::swapBuffers() | 349 bool SoftwareRenderer::swapBuffers() |
350 { | 350 { |
351 if (Proxy::hasImplThread()) | 351 if (m_client->hasImplThread()) |
352 m_client->onSwapBuffersComplete(); | 352 m_client->onSwapBuffersComplete(); |
353 return true; | 353 return true; |
354 } | 354 } |
355 | 355 |
356 void SoftwareRenderer::getFramebufferPixels(void *pixels, const gfx::Rect& rect) | 356 void SoftwareRenderer::getFramebufferPixels(void *pixels, const gfx::Rect& rect) |
357 { | 357 { |
358 SkBitmap fullBitmap = m_outputDevice->lock(false)->getSkBitmap(); | 358 SkBitmap fullBitmap = m_outputDevice->lock(false)->getSkBitmap(); |
359 SkBitmap subsetBitmap; | 359 SkBitmap subsetBitmap; |
360 SkIRect invertRect = SkIRect::MakeXYWH(rect.x(), viewportSize().height() - r
ect.bottom(), rect.width(), rect.height()); | 360 SkIRect invertRect = SkIRect::MakeXYWH(rect.x(), viewportSize().height() - r
ect.bottom(), rect.width(), rect.height()); |
361 fullBitmap.extractSubset(&subsetBitmap, invertRect); | 361 fullBitmap.extractSubset(&subsetBitmap, invertRect); |
362 subsetBitmap.copyPixelsTo(pixels, rect.width() * rect.height() * 4, rect.wid
th() * 4); | 362 subsetBitmap.copyPixelsTo(pixels, rect.width() * rect.height() * 4, rect.wid
th() * 4); |
363 m_outputDevice->unlock(); | 363 m_outputDevice->unlock(); |
364 } | 364 } |
365 | 365 |
366 void SoftwareRenderer::setVisible(bool visible) | 366 void SoftwareRenderer::setVisible(bool visible) |
367 { | 367 { |
368 if (m_visible == visible) | 368 if (m_visible == visible) |
369 return; | 369 return; |
370 m_visible = visible; | 370 m_visible = visible; |
371 } | 371 } |
372 | 372 |
373 } // namespace cc | 373 } // namespace cc |
OLD | NEW |