| 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/software_renderer.h" | 5 #include "cc/software_renderer.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "cc/debug_border_draw_quad.h" | 8 #include "cc/debug_border_draw_quad.h" |
| 9 #include "cc/math_util.h" | 9 #include "cc/math_util.h" |
| 10 #include "cc/render_pass_draw_quad.h" | 10 #include "cc/render_pass_draw_quad.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 void SoftwareRenderer::drawTextureQuad(const DrawingFrame& frame, const TextureD
rawQuad* quad) | 252 void SoftwareRenderer::drawTextureQuad(const DrawingFrame& frame, const TextureD
rawQuad* quad) |
| 253 { | 253 { |
| 254 if (!isSoftwareResource(quad->resource_id)) { | 254 if (!isSoftwareResource(quad->resource_id)) { |
| 255 drawUnsupportedQuad(frame, quad); | 255 drawUnsupportedQuad(frame, quad); |
| 256 return; | 256 return; |
| 257 } | 257 } |
| 258 | 258 |
| 259 // FIXME: Add support for non-premultiplied alpha. | 259 // FIXME: Add support for non-premultiplied alpha. |
| 260 ResourceProvider::ScopedReadLockSoftware lock(m_resourceProvider, quad->reso
urce_id); | 260 ResourceProvider::ScopedReadLockSoftware lock(m_resourceProvider, quad->reso
urce_id); |
| 261 const SkBitmap* bitmap = lock.skBitmap(); | 261 const SkBitmap* bitmap = lock.skBitmap(); |
| 262 gfx::RectF uvRect = gfx::ScaleRect(quad->uv_rect, bitmap->width(), bitmap->h
eight()); | 262 gfx::RectF uvRect = gfx::ScaleRect(gfx::BoundingRect(quad->uv_top_left, quad
->uv_bottom_right), |
| 263 bitmap->width(), |
| 264 bitmap->height()); |
| 263 SkRect skUvRect = gfx::RectFToSkRect(uvRect); | 265 SkRect skUvRect = gfx::RectFToSkRect(uvRect); |
| 264 if (quad->flipped) | 266 if (quad->flipped) |
| 265 m_skCurrentCanvas->scale(1, -1); | 267 m_skCurrentCanvas->scale(1, -1); |
| 266 m_skCurrentCanvas->drawBitmapRectToRect(*bitmap, &skUvRect, | 268 m_skCurrentCanvas->drawBitmapRectToRect(*bitmap, &skUvRect, |
| 267 gfx::RectFToSkRect(quadVertexRect())
, | 269 gfx::RectFToSkRect(quadVertexRect())
, |
| 268 &m_skCurrentPaint); | 270 &m_skCurrentPaint); |
| 269 } | 271 } |
| 270 | 272 |
| 271 void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQua
d* quad) | 273 void SoftwareRenderer::drawTileQuad(const DrawingFrame& frame, const TileDrawQua
d* quad) |
| 272 { | 274 { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 372 } |
| 371 | 373 |
| 372 void SoftwareRenderer::setVisible(bool visible) | 374 void SoftwareRenderer::setVisible(bool visible) |
| 373 { | 375 { |
| 374 if (m_visible == visible) | 376 if (m_visible == visible) |
| 375 return; | 377 return; |
| 376 m_visible = visible; | 378 m_visible = visible; |
| 377 } | 379 } |
| 378 | 380 |
| 379 } // namespace cc | 381 } // namespace cc |
| OLD | NEW |