| 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 263 } |
| 264 | 264 |
| 265 current_canvas_->resetMatrix(); | 265 current_canvas_->resetMatrix(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void SoftwareRenderer::DrawDebugBorderQuad(const DrawingFrame& frame, | 268 void SoftwareRenderer::DrawDebugBorderQuad(const DrawingFrame& frame, |
| 269 const DebugBorderDrawQuad* quad) { | 269 const DebugBorderDrawQuad* quad) { |
| 270 // We need to apply the matrix manually to have pixel-sized stroke width. | 270 // We need to apply the matrix manually to have pixel-sized stroke width. |
| 271 SkPoint vertices[4]; | 271 SkPoint vertices[4]; |
| 272 gfx::RectFToSkRect(QuadVertexRect()).toQuad(vertices); | 272 gfx::RectFToSkRect(QuadVertexRect()).toQuad(vertices); |
| 273 SkPoint transformedVertices[4]; | 273 SkPoint transformed_vertices[4]; |
| 274 current_canvas_->getTotalMatrix().mapPoints(transformedVertices, vertices, 4); | 274 current_canvas_->getTotalMatrix().mapPoints(transformed_vertices, |
| 275 vertices, |
| 276 4); |
| 275 current_canvas_->resetMatrix(); | 277 current_canvas_->resetMatrix(); |
| 276 | 278 |
| 277 current_paint_.setColor(quad->color); | 279 current_paint_.setColor(quad->color); |
| 278 current_paint_.setAlpha(quad->opacity() * SkColorGetA(quad->color)); | 280 current_paint_.setAlpha(quad->opacity() * SkColorGetA(quad->color)); |
| 279 current_paint_.setStyle(SkPaint::kStroke_Style); | 281 current_paint_.setStyle(SkPaint::kStroke_Style); |
| 280 current_paint_.setStrokeWidth(quad->width); | 282 current_paint_.setStrokeWidth(quad->width); |
| 281 current_canvas_->drawPoints(SkCanvas::kPolygon_PointMode, | 283 current_canvas_->drawPoints(SkCanvas::kPolygon_PointMode, |
| 282 4, transformedVertices, current_paint_); | 284 4, transformed_vertices, current_paint_); |
| 283 } | 285 } |
| 284 | 286 |
| 285 void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame& frame, | 287 void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame& frame, |
| 286 const SolidColorDrawQuad* quad) { | 288 const SolidColorDrawQuad* quad) { |
| 287 current_paint_.setColor(quad->color); | 289 current_paint_.setColor(quad->color); |
| 288 current_paint_.setAlpha(quad->opacity() * SkColorGetA(quad->color)); | 290 current_paint_.setAlpha(quad->opacity() * SkColorGetA(quad->color)); |
| 289 current_canvas_->drawRect(gfx::RectFToSkRect(QuadVertexRect()), | 291 current_canvas_->drawRect(gfx::RectFToSkRect(QuadVertexRect()), |
| 290 current_paint_); | 292 current_paint_); |
| 291 } | 293 } |
| 292 | 294 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 4 * rect.width()); | 411 4 * rect.width()); |
| 410 } | 412 } |
| 411 | 413 |
| 412 void SoftwareRenderer::SetVisible(bool visible) { | 414 void SoftwareRenderer::SetVisible(bool visible) { |
| 413 if (visible_ == visible) | 415 if (visible_ == visible) |
| 414 return; | 416 return; |
| 415 visible_ = visible; | 417 visible_ = visible; |
| 416 } | 418 } |
| 417 | 419 |
| 418 } // namespace cc | 420 } // namespace cc |
| OLD | NEW |