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/render_pass_draw_quad.h" | 9 #include "cc/render_pass_draw_quad.h" |
10 #include "cc/solid_color_draw_quad.h" | 10 #include "cc/solid_color_draw_quad.h" |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return true; | 130 return true; |
131 } | 131 } |
132 | 132 |
133 void SoftwareRenderer::setScissorTestRect(const gfx::Rect& scissorRect) | 133 void SoftwareRenderer::setScissorTestRect(const gfx::Rect& scissorRect) |
134 { | 134 { |
135 m_skCurrentCanvas->clipRect(gfx::RectToSkRect(scissorRect), SkRegion::kRepla
ce_Op); | 135 m_skCurrentCanvas->clipRect(gfx::RectToSkRect(scissorRect), SkRegion::kRepla
ce_Op); |
136 } | 136 } |
137 | 137 |
138 void SoftwareRenderer::clearFramebuffer(DrawingFrame& frame) | 138 void SoftwareRenderer::clearFramebuffer(DrawingFrame& frame) |
139 { | 139 { |
140 if (frame.currentRenderPass->hasTransparentBackground()) { | 140 if (frame.currentRenderPass->has_transparent_background) { |
141 m_skCurrentCanvas->clear(SkColorSetARGB(0, 0, 0, 0)); | 141 m_skCurrentCanvas->clear(SkColorSetARGB(0, 0, 0, 0)); |
142 } else { | 142 } else { |
143 #ifndef NDEBUG | 143 #ifndef NDEBUG |
144 // On DEBUG builds, opaque render passes are cleared to blue to easily s
ee regions that were not drawn on the screen. | 144 // On DEBUG builds, opaque render passes are cleared to blue to easily s
ee regions that were not drawn on the screen. |
145 m_skCurrentCanvas->clear(SkColorSetARGB(255, 0, 0, 255)); | 145 m_skCurrentCanvas->clear(SkColorSetARGB(255, 0, 0, 255)); |
146 #endif | 146 #endif |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 void SoftwareRenderer::setDrawViewportSize(const gfx::Size& viewportSize) | 150 void SoftwareRenderer::setDrawViewportSize(const gfx::Size& viewportSize) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 SkMatrix contentMat; | 289 SkMatrix contentMat; |
290 contentMat.setRectToRect(contentRect, destRect, SkMatrix::kFill_ScaleToFit); | 290 contentMat.setRectToRect(contentRect, destRect, SkMatrix::kFill_ScaleToFit); |
291 | 291 |
292 SkAutoTUnref<SkShader> shader(SkShader::CreateBitmapShader(*content, | 292 SkAutoTUnref<SkShader> shader(SkShader::CreateBitmapShader(*content, |
293 SkShader::kClamp_
TileMode, | 293 SkShader::kClamp_
TileMode, |
294 SkShader::kClamp_
TileMode)); | 294 SkShader::kClamp_
TileMode)); |
295 shader->setLocalMatrix(contentMat); | 295 shader->setLocalMatrix(contentMat); |
296 m_skCurrentPaint.setShader(shader); | 296 m_skCurrentPaint.setShader(shader); |
297 | 297 |
298 SkImageFilter* filter = renderPass->filter(); | 298 SkImageFilter* filter = renderPass->filter; |
299 if (filter) | 299 if (filter) |
300 m_skCurrentPaint.setImageFilter(filter); | 300 m_skCurrentPaint.setImageFilter(filter); |
301 | 301 |
302 if (quad->mask_resource_id) { | 302 if (quad->mask_resource_id) { |
303 ResourceProvider::ScopedReadLockSoftware maskLock(m_resourceProvider, qu
ad->mask_resource_id); | 303 ResourceProvider::ScopedReadLockSoftware maskLock(m_resourceProvider, qu
ad->mask_resource_id); |
304 | 304 |
305 const SkBitmap* mask = maskLock.skBitmap(); | 305 const SkBitmap* mask = maskLock.skBitmap(); |
306 | 306 |
307 SkRect maskRect = SkRect::MakeXYWH( | 307 SkRect maskRect = SkRect::MakeXYWH( |
308 quad->mask_tex_coord_offset_x * mask->width(), | 308 quad->mask_tex_coord_offset_x * mask->width(), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 } | 358 } |
359 | 359 |
360 void SoftwareRenderer::setVisible(bool visible) | 360 void SoftwareRenderer::setVisible(bool visible) |
361 { | 361 { |
362 if (m_visible == visible) | 362 if (m_visible == visible) |
363 return; | 363 return; |
364 m_visible = visible; | 364 m_visible = visible; |
365 } | 365 } |
366 | 366 |
367 } // namespace cc | 367 } // namespace cc |
OLD | NEW |