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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 void SoftwareRenderer::drawUnsupportedQuad(const DrawingFrame& frame, const Draw
Quad* quad) | 333 void SoftwareRenderer::drawUnsupportedQuad(const DrawingFrame& frame, const Draw
Quad* quad) |
334 { | 334 { |
335 m_skCurrentPaint.setColor(SK_ColorMAGENTA); | 335 m_skCurrentPaint.setColor(SK_ColorMAGENTA); |
336 m_skCurrentPaint.setAlpha(quad->opacity() * 255); | 336 m_skCurrentPaint.setAlpha(quad->opacity() * 255); |
337 m_skCurrentCanvas->drawRect(toSkRect(quadVertexRect()), m_skCurrentPaint); | 337 m_skCurrentCanvas->drawRect(toSkRect(quadVertexRect()), m_skCurrentPaint); |
338 } | 338 } |
339 | 339 |
340 bool SoftwareRenderer::swapBuffers() | 340 bool SoftwareRenderer::swapBuffers() |
341 { | 341 { |
342 if (Proxy::hasImplThread()) | 342 if (m_client->hasImplThread()) |
343 m_client->onSwapBuffersComplete(); | 343 m_client->onSwapBuffersComplete(); |
344 return true; | 344 return true; |
345 } | 345 } |
346 | 346 |
347 void SoftwareRenderer::getFramebufferPixels(void *pixels, const gfx::Rect& rect) | 347 void SoftwareRenderer::getFramebufferPixels(void *pixels, const gfx::Rect& rect) |
348 { | 348 { |
349 SkBitmap fullBitmap = m_outputDevice->lock(false)->getSkBitmap(); | 349 SkBitmap fullBitmap = m_outputDevice->lock(false)->getSkBitmap(); |
350 SkBitmap subsetBitmap; | 350 SkBitmap subsetBitmap; |
351 SkIRect invertRect = SkIRect::MakeXYWH(rect.x(), viewportSize().height() - r
ect.bottom(), rect.width(), rect.height()); | 351 SkIRect invertRect = SkIRect::MakeXYWH(rect.x(), viewportSize().height() - r
ect.bottom(), rect.width(), rect.height()); |
352 fullBitmap.extractSubset(&subsetBitmap, invertRect); | 352 fullBitmap.extractSubset(&subsetBitmap, invertRect); |
353 subsetBitmap.copyPixelsTo(pixels, rect.width() * rect.height() * 4, rect.wid
th() * 4); | 353 subsetBitmap.copyPixelsTo(pixels, rect.width() * rect.height() * 4, rect.wid
th() * 4); |
354 m_outputDevice->unlock(); | 354 m_outputDevice->unlock(); |
355 } | 355 } |
356 | 356 |
357 void SoftwareRenderer::setVisible(bool visible) | 357 void SoftwareRenderer::setVisible(bool visible) |
358 { | 358 { |
359 if (m_visible == visible) | 359 if (m_visible == visible) |
360 return; | 360 return; |
361 m_visible = visible; | 361 m_visible = visible; |
362 } | 362 } |
363 | 363 |
364 } | 364 } |
OLD | NEW |