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

Unified Diff: cc/output/software_renderer.cc

Issue 14417014: cc: Add tile-free software compositing mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to 199251 Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/output/software_renderer.h ('k') | cc/resources/picture_pile_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/software_renderer.cc
diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc
index 0e96c573ddec618e268f01cc50e3b899d3556f8a..7dd4a71b142f9529538b4bdacdf3a5b5aa359d4c 100644
--- a/cc/output/software_renderer.cc
+++ b/cc/output/software_renderer.cc
@@ -12,6 +12,7 @@
#include "cc/output/output_surface.h"
#include "cc/output/software_output_device.h"
#include "cc/quads/debug_border_draw_quad.h"
+#include "cc/quads/picture_draw_quad.h"
#include "cc/quads/render_pass_draw_quad.h"
#include "cc/quads/solid_color_draw_quad.h"
#include "cc/quads/texture_draw_quad.h"
@@ -71,8 +72,11 @@ SoftwareRenderer::SoftwareRenderer(RendererClient* client,
output_surface_(output_surface),
output_device_(output_surface->software_device()),
current_canvas_(NULL) {
- capabilities_.max_texture_size = resource_provider_->max_texture_size();
- capabilities_.best_texture_format = resource_provider_->best_texture_format();
+ if (resource_provider_) {
+ capabilities_.max_texture_size = resource_provider_->max_texture_size();
+ capabilities_.best_texture_format =
+ resource_provider_->best_texture_format();
+ }
capabilities_.using_set_visibility = true;
// The updater can access bitmaps while the SoftwareRenderer is using them.
capabilities_.allow_partial_texture_updates = true;
@@ -244,6 +248,9 @@ void SoftwareRenderer::DoDrawQuad(DrawingFrame* frame, const DrawQuad* quad) {
case DrawQuad::DEBUG_BORDER:
DrawDebugBorderQuad(frame, DebugBorderDrawQuad::MaterialCast(quad));
break;
+ case DrawQuad::PICTURE_CONTENT:
+ DrawPictureQuad(frame, PictureDrawQuad::MaterialCast(quad));
+ break;
case DrawQuad::SOLID_COLOR:
DrawSolidColorQuad(frame, SolidColorDrawQuad::MaterialCast(quad));
break;
@@ -283,6 +290,38 @@ void SoftwareRenderer::DrawDebugBorderQuad(const DrawingFrame* frame,
4, transformed_vertices, current_paint_);
}
+void SoftwareRenderer::DrawPictureQuad(const DrawingFrame* frame,
+ const PictureDrawQuad* quad) {
+ SkMatrix content_matrix;
+ content_matrix.setRectToRect(
+ gfx::RectFToSkRect(quad->tex_coord_rect),
+ gfx::RectFToSkRect(QuadVertexRect()),
+ SkMatrix::kFill_ScaleToFit);
+ current_canvas_->concat(content_matrix);
+
+ if (quad->ShouldDrawWithBlending()) {
+ TRACE_EVENT0("cc", "SoftwareRenderer::DrawPictureQuad with blending");
+ SkBitmap temp_bitmap;
+ temp_bitmap.setConfig(SkBitmap::kARGB_8888_Config,
+ quad->texture_size.width(),
+ quad->texture_size.height());
+ temp_bitmap.allocPixels();
+ SkDevice temp_device(temp_bitmap);
+ SkCanvas temp_canvas(&temp_device);
+
+ quad->picture_pile->Raster(
+ &temp_canvas, quad->content_rect, quad->contents_scale, NULL);
+
+ current_paint_.setFilterBitmap(true);
+ current_canvas_->drawBitmap(temp_bitmap, 0, 0, &current_paint_);
+ } else {
+ TRACE_EVENT0("cc",
+ "SoftwareRenderer::DrawPictureQuad direct from PicturePile");
+ quad->picture_pile->Raster(
+ current_canvas_, quad->content_rect, quad->contents_scale, NULL);
+ }
+}
+
void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame* frame,
const SolidColorDrawQuad* quad) {
current_paint_.setColor(quad->color);
@@ -316,6 +355,7 @@ void SoftwareRenderer::DrawTextureQuad(const DrawingFrame* frame,
void SoftwareRenderer::DrawTileQuad(const DrawingFrame* frame,
const TileDrawQuad* quad) {
+ DCHECK(!output_surface_->ForcedDrawToSoftwareDevice());
DCHECK(IsSoftwareResource(quad->resource_id));
ResourceProvider::ScopedReadLockSoftware lock(resource_provider_,
quad->resource_id);
« no previous file with comments | « cc/output/software_renderer.h ('k') | cc/resources/picture_pile_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698