Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: cc/output/software_renderer.cc

Issue 22796028: Updating Chromium to Skia SkBaseDevice/SkBitmapDevice split (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added TODOs Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "cc/output/compositor_frame_metadata.h" 11 #include "cc/output/compositor_frame_metadata.h"
12 #include "cc/output/copy_output_request.h" 12 #include "cc/output/copy_output_request.h"
13 #include "cc/output/output_surface.h" 13 #include "cc/output/output_surface.h"
14 #include "cc/output/software_output_device.h" 14 #include "cc/output/software_output_device.h"
15 #include "cc/quads/checkerboard_draw_quad.h" 15 #include "cc/quads/checkerboard_draw_quad.h"
16 #include "cc/quads/debug_border_draw_quad.h" 16 #include "cc/quads/debug_border_draw_quad.h"
17 #include "cc/quads/picture_draw_quad.h" 17 #include "cc/quads/picture_draw_quad.h"
18 #include "cc/quads/render_pass_draw_quad.h" 18 #include "cc/quads/render_pass_draw_quad.h"
19 #include "cc/quads/solid_color_draw_quad.h" 19 #include "cc/quads/solid_color_draw_quad.h"
20 #include "cc/quads/texture_draw_quad.h" 20 #include "cc/quads/texture_draw_quad.h"
21 #include "cc/quads/tile_draw_quad.h" 21 #include "cc/quads/tile_draw_quad.h"
22 #include "third_party/skia/include/core/SkBitmapDevice.h"
22 #include "third_party/skia/include/core/SkCanvas.h" 23 #include "third_party/skia/include/core/SkCanvas.h"
23 #include "third_party/skia/include/core/SkColor.h" 24 #include "third_party/skia/include/core/SkColor.h"
24 #include "third_party/skia/include/core/SkDevice.h"
25 #include "third_party/skia/include/core/SkMatrix.h" 25 #include "third_party/skia/include/core/SkMatrix.h"
26 #include "third_party/skia/include/core/SkShader.h" 26 #include "third_party/skia/include/core/SkShader.h"
27 #include "third_party/skia/include/effects/SkLayerRasterizer.h" 27 #include "third_party/skia/include/effects/SkLayerRasterizer.h"
28 #include "ui/gfx/rect_conversions.h" 28 #include "ui/gfx/rect_conversions.h"
29 #include "ui/gfx/skia_util.h" 29 #include "ui/gfx/skia_util.h"
30 #include "ui/gfx/transform.h" 30 #include "ui/gfx/transform.h"
31 31
32 namespace cc { 32 namespace cc {
33 33
34 namespace { 34 namespace {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 is_scissor_enabled_ = true; 121 is_scissor_enabled_ = true;
122 SetClipRect(scissor_rect_); 122 SetClipRect(scissor_rect_);
123 } 123 }
124 124
125 void SoftwareRenderer::EnsureScissorTestDisabled() { 125 void SoftwareRenderer::EnsureScissorTestDisabled() {
126 // There is no explicit notion of enabling/disabling scissoring in software 126 // There is no explicit notion of enabling/disabling scissoring in software
127 // rendering, but the underlying effect we want is to clear any existing 127 // rendering, but the underlying effect we want is to clear any existing
128 // clipRect on the current SkCanvas. This is done by setting clipRect to 128 // clipRect on the current SkCanvas. This is done by setting clipRect to
129 // the viewport's dimensions. 129 // the viewport's dimensions.
130 is_scissor_enabled_ = false; 130 is_scissor_enabled_ = false;
131 SkDevice* device = current_canvas_->getDevice(); 131 SkBaseDevice* device = current_canvas_->getDevice();
132 SetClipRect(gfx::Rect(device->width(), device->height())); 132 SetClipRect(gfx::Rect(device->width(), device->height()));
133 } 133 }
134 134
135 void SoftwareRenderer::Finish() {} 135 void SoftwareRenderer::Finish() {}
136 136
137 void SoftwareRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) { 137 void SoftwareRenderer::BindFramebufferToOutputSurface(DrawingFrame* frame) {
138 DCHECK(!client_->ExternalStencilTestEnabled()); 138 DCHECK(!client_->ExternalStencilTestEnabled());
139 current_framebuffer_lock_.reset(); 139 current_framebuffer_lock_.reset();
140 current_canvas_ = root_canvas_; 140 current_canvas_ = root_canvas_;
141 } 141 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 SkMatrix::kFill_ScaleToFit); 311 SkMatrix::kFill_ScaleToFit);
312 current_canvas_->concat(content_matrix); 312 current_canvas_->concat(content_matrix);
313 313
314 if (quad->ShouldDrawWithBlending()) { 314 if (quad->ShouldDrawWithBlending()) {
315 TRACE_EVENT0("cc", "SoftwareRenderer::DrawPictureQuad with blending"); 315 TRACE_EVENT0("cc", "SoftwareRenderer::DrawPictureQuad with blending");
316 SkBitmap temp_bitmap; 316 SkBitmap temp_bitmap;
317 temp_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 317 temp_bitmap.setConfig(SkBitmap::kARGB_8888_Config,
318 quad->texture_size.width(), 318 quad->texture_size.width(),
319 quad->texture_size.height()); 319 quad->texture_size.height());
320 temp_bitmap.allocPixels(); 320 temp_bitmap.allocPixels();
321 SkDevice temp_device(temp_bitmap); 321 SkBitmapDevice temp_device(temp_bitmap);
322 SkCanvas temp_canvas(&temp_device); 322 SkCanvas temp_canvas(&temp_device);
323 323
324 quad->picture_pile->RasterToBitmap( 324 quad->picture_pile->RasterToBitmap(
325 &temp_canvas, quad->content_rect, quad->contents_scale, NULL); 325 &temp_canvas, quad->content_rect, quad->contents_scale, NULL);
326 326
327 current_paint_.setFilterBitmap(true); 327 current_paint_.setFilterBitmap(true);
328 current_canvas_->drawBitmap(temp_bitmap, 0, 0, &current_paint_); 328 current_canvas_->drawBitmap(temp_bitmap, 0, 0, &current_paint_);
329 } else { 329 } else {
330 TRACE_EVENT0("cc", 330 TRACE_EVENT0("cc",
331 "SoftwareRenderer::DrawPictureQuad direct from PicturePile"); 331 "SoftwareRenderer::DrawPictureQuad direct from PicturePile");
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 EnsureBackbuffer(); 537 EnsureBackbuffer();
538 else 538 else
539 DiscardBackbuffer(); 539 DiscardBackbuffer();
540 } 540 }
541 541
542 void SoftwareRenderer::SetDiscardBackBufferWhenNotVisible(bool discard) { 542 void SoftwareRenderer::SetDiscardBackBufferWhenNotVisible(bool discard) {
543 // The software renderer always discards the backbuffer when not visible. 543 // The software renderer always discards the backbuffer when not visible.
544 } 544 }
545 545
546 } // namespace cc 546 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/software_output_device.cc ('k') | cc/resources/bitmap_skpicture_content_layer_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698