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

Unified Diff: cc/output/software_renderer.cc

Issue 22867046: Optimize alpha software PictureDrawQuads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add DCHECK for xfermode Created 7 years, 4 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
Index: cc/output/software_renderer.cc
diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc
index ed5c18b330ec877b9308eb2ff62b34c8ad45f79a..f12a628b885ffd9f6ea2266a895bc413c2c72e83 100644
--- a/cc/output/software_renderer.cc
+++ b/cc/output/software_renderer.cc
@@ -19,6 +19,7 @@
#include "cc/quads/solid_color_draw_quad.h"
#include "cc/quads/texture_draw_quad.h"
#include "cc/quads/tile_draw_quad.h"
+#include "skia/ext/alpha_proxy_canvas.h"
#include "third_party/skia/include/core/SkBitmapDevice.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -298,8 +299,8 @@ void SoftwareRenderer::DrawDebugBorderQuad(const DrawingFrame* frame,
current_paint_.setAlpha(quad->opacity() * SkColorGetA(quad->color));
current_paint_.setStyle(SkPaint::kStroke_Style);
current_paint_.setStrokeWidth(quad->width);
- current_canvas_->drawPoints(SkCanvas::kPolygon_PointMode,
- 4, transformed_vertices, current_paint_);
+ current_canvas_->drawPoints(
+ SkCanvas::kPolygon_PointMode, 4, transformed_vertices, current_paint_);
}
void SoftwareRenderer::DrawPictureQuad(const DrawingFrame* frame,
@@ -311,27 +312,10 @@ void SoftwareRenderer::DrawPictureQuad(const DrawingFrame* frame,
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();
- SkBitmapDevice temp_device(temp_bitmap);
- SkCanvas temp_canvas(&temp_device);
-
- quad->picture_pile->RasterToBitmap(
- &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->RasterDirect(
- current_canvas_, quad->content_rect, quad->contents_scale, NULL);
- }
+ TRACE_EVENT0("cc", "SoftwareRenderer::DrawPictureQuad");
+ skia::AlphaProxyCanvas proxy_canvas(current_canvas_, quad->opacity(), false);
+ quad->picture_pile->RasterDirect(
+ &proxy_canvas, quad->content_rect, quad->contents_scale, NULL);
}
void SoftwareRenderer::DrawSolidColorQuad(const DrawingFrame* frame,

Powered by Google App Engine
This is Rietveld 408576698