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

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

Issue 532003003: Adding support for blending in cc::SoftwareRenderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 skia::RefPtr<SkShader> shader; 503 skia::RefPtr<SkShader> shader;
504 if (filter_bitmap.isNull()) { 504 if (filter_bitmap.isNull()) {
505 shader = skia::AdoptRef(SkShader::CreateBitmapShader( 505 shader = skia::AdoptRef(SkShader::CreateBitmapShader(
506 *content, content_tile_mode, content_tile_mode, &content_mat)); 506 *content, content_tile_mode, content_tile_mode, &content_mat));
507 } else { 507 } else {
508 shader = skia::AdoptRef(SkShader::CreateBitmapShader( 508 shader = skia::AdoptRef(SkShader::CreateBitmapShader(
509 filter_bitmap, content_tile_mode, content_tile_mode, &content_mat)); 509 filter_bitmap, content_tile_mode, content_tile_mode, &content_mat));
510 } 510 }
511 current_paint_.setShader(shader.get()); 511 current_paint_.setShader(shader.get());
512 512
513 if (quad->shared_quad_state->blend_mode != SkXfermode::kSrcOver_Mode)
514 current_paint_.setXfermodeMode(quad->shared_quad_state->blend_mode);
Erik Dahlström (inactive) 2014/09/05 09:19:23 It's a little confusing that xfermode is set in Do
rosca 2014/09/05 09:35:31 Indeed, DoDrawQuad would be the right place where
enne (OOO) 2014/09/05 17:49:08 It seems like maybe the owning layer shouldn't hav
rosca 2014/09/05 20:52:27 I'll do it with another patch, including some unit
enne (OOO) 2014/09/05 21:03:04 DrawProperties doesn't seem like the right place f
rosca 2014/09/06 00:25:47 Now, all the blending layers get their own render
515
513 if (quad->mask_resource_id) { 516 if (quad->mask_resource_id) {
514 ResourceProvider::ScopedReadLockSoftware mask_lock(resource_provider_, 517 ResourceProvider::ScopedReadLockSoftware mask_lock(resource_provider_,
515 quad->mask_resource_id); 518 quad->mask_resource_id);
516 if (!lock.valid()) 519 if (!lock.valid())
517 return; 520 return;
518 SkShader::TileMode mask_tile_mode = WrapModeToTileMode( 521 SkShader::TileMode mask_tile_mode = WrapModeToTileMode(
519 mask_lock.wrap_mode()); 522 mask_lock.wrap_mode());
520 523
521 const SkBitmap* mask = mask_lock.sk_bitmap(); 524 const SkBitmap* mask = mask_lock.sk_bitmap();
522 525
(...skipping 15 matching lines...) Expand all
538 541
539 SkLayerRasterizer::Builder builder; 542 SkLayerRasterizer::Builder builder;
540 builder.addLayer(mask_paint); 543 builder.addLayer(mask_paint);
541 544
542 skia::RefPtr<SkLayerRasterizer> mask_rasterizer = 545 skia::RefPtr<SkLayerRasterizer> mask_rasterizer =
543 skia::AdoptRef(builder.detachRasterizer()); 546 skia::AdoptRef(builder.detachRasterizer());
544 547
545 current_paint_.setRasterizer(mask_rasterizer.get()); 548 current_paint_.setRasterizer(mask_rasterizer.get());
546 current_canvas_->drawRect(dest_visible_rect, current_paint_); 549 current_canvas_->drawRect(dest_visible_rect, current_paint_);
547 } else { 550 } else {
548 // TODO(skaslev): Apply background filters and blend with content 551 // TODO(skaslev): Apply background filters
549 current_canvas_->drawRect(dest_visible_rect, current_paint_); 552 current_canvas_->drawRect(dest_visible_rect, current_paint_);
550 } 553 }
551 } 554 }
552 555
553 void SoftwareRenderer::DrawUnsupportedQuad(const DrawingFrame* frame, 556 void SoftwareRenderer::DrawUnsupportedQuad(const DrawingFrame* frame,
554 const DrawQuad* quad) { 557 const DrawQuad* quad) {
555 #ifdef NDEBUG 558 #ifdef NDEBUG
556 current_paint_.setColor(SK_ColorWHITE); 559 current_paint_.setColor(SK_ColorWHITE);
557 #else 560 #else
558 current_paint_.setColor(SK_ColorMAGENTA); 561 current_paint_.setColor(SK_ColorMAGENTA);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 603 }
601 604
602 void SoftwareRenderer::DidChangeVisibility() { 605 void SoftwareRenderer::DidChangeVisibility() {
603 if (visible()) 606 if (visible())
604 EnsureBackbuffer(); 607 EnsureBackbuffer();
605 else 608 else
606 DiscardBackbuffer(); 609 DiscardBackbuffer();
607 } 610 }
608 611
609 } // namespace cc 612 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/trees/layer_tree_host_pixeltest_blending.cc » ('j') | cc/trees/layer_tree_host_pixeltest_blending.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698