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

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

Issue 1013463003: Update from https://crrev.com/320931 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « cc/output/renderer_pixeltest.cc.rej ('k') | cc/output/swap_promise.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/trace_event/trace_event.h" 7 #include "base/trace_event/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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 !IsScaleAndIntegerTranslate(sk_device_matrix)) { 259 !IsScaleAndIntegerTranslate(sk_device_matrix)) {
260 // TODO(danakj): Until we can enable AA only on exterior edges of the 260 // TODO(danakj): Until we can enable AA only on exterior edges of the
261 // layer, disable AA if any interior edges are present. crbug.com/248175 261 // layer, disable AA if any interior edges are present. crbug.com/248175
262 bool all_four_edges_are_exterior = quad->IsTopEdge() && 262 bool all_four_edges_are_exterior = quad->IsTopEdge() &&
263 quad->IsLeftEdge() && 263 quad->IsLeftEdge() &&
264 quad->IsBottomEdge() && 264 quad->IsBottomEdge() &&
265 quad->IsRightEdge(); 265 quad->IsRightEdge();
266 if (settings_->allow_antialiasing && 266 if (settings_->allow_antialiasing &&
267 (settings_->force_antialiasing || all_four_edges_are_exterior)) 267 (settings_->force_antialiasing || all_four_edges_are_exterior))
268 current_paint_.setAntiAlias(true); 268 current_paint_.setAntiAlias(true);
269 current_paint_.setFilterLevel(SkPaint::kLow_FilterLevel); 269 current_paint_.setFilterQuality(kLow_SkFilterQuality);
270 } 270 }
271 271
272 if (quad->ShouldDrawWithBlending() || 272 if (quad->ShouldDrawWithBlending() ||
273 quad->shared_quad_state->blend_mode != SkXfermode::kSrcOver_Mode) { 273 quad->shared_quad_state->blend_mode != SkXfermode::kSrcOver_Mode) {
274 current_paint_.setAlpha(quad->opacity() * 255); 274 current_paint_.setAlpha(quad->opacity() * 255);
275 current_paint_.setXfermodeMode(quad->shared_quad_state->blend_mode); 275 current_paint_.setXfermodeMode(quad->shared_quad_state->blend_mode);
276 } else { 276 } else {
277 current_paint_.setXfermodeMode(SkXfermode::kSrc_Mode); 277 current_paint_.setXfermodeMode(SkXfermode::kSrc_Mode);
278 } 278 }
279 279
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 if (!lock.valid()) 480 if (!lock.valid())
481 return; 481 return;
482 DCHECK_EQ(GL_CLAMP_TO_EDGE, lock.wrap_mode()); 482 DCHECK_EQ(GL_CLAMP_TO_EDGE, lock.wrap_mode());
483 483
484 gfx::RectF visible_tex_coord_rect = MathUtil::ScaleRectProportional( 484 gfx::RectF visible_tex_coord_rect = MathUtil::ScaleRectProportional(
485 quad->tex_coord_rect, quad->rect, quad->visible_rect); 485 quad->tex_coord_rect, quad->rect, quad->visible_rect);
486 gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional( 486 gfx::RectF visible_quad_vertex_rect = MathUtil::ScaleRectProportional(
487 QuadVertexRect(), quad->rect, quad->visible_rect); 487 QuadVertexRect(), quad->rect, quad->visible_rect);
488 488
489 SkRect uv_rect = gfx::RectFToSkRect(visible_tex_coord_rect); 489 SkRect uv_rect = gfx::RectFToSkRect(visible_tex_coord_rect);
490 current_paint_.setFilterLevel(quad->nearest_neighbor 490 current_paint_.setFilterQuality(
491 ? SkPaint::kNone_FilterLevel 491 quad->nearest_neighbor ? kNone_SkFilterQuality : kLow_SkFilterQuality);
492 : SkPaint::kLow_FilterLevel);
493 current_canvas_->drawBitmapRectToRect( 492 current_canvas_->drawBitmapRectToRect(
494 *lock.sk_bitmap(), 493 *lock.sk_bitmap(),
495 &uv_rect, 494 &uv_rect,
496 gfx::RectFToSkRect(visible_quad_vertex_rect), 495 gfx::RectFToSkRect(visible_quad_vertex_rect),
497 &current_paint_); 496 &current_paint_);
498 } 497 }
499 498
500 void SoftwareRenderer::DrawRenderPassQuad(const DrawingFrame* frame, 499 void SoftwareRenderer::DrawRenderPassQuad(const DrawingFrame* frame,
501 const RenderPassDrawQuad* quad) { 500 const RenderPassDrawQuad* quad) {
502 ScopedResource* content_texture = 501 ScopedResource* content_texture =
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 } 643 }
645 644
646 void SoftwareRenderer::DidChangeVisibility() { 645 void SoftwareRenderer::DidChangeVisibility() {
647 if (visible()) 646 if (visible())
648 EnsureBackbuffer(); 647 EnsureBackbuffer();
649 else 648 else
650 DiscardBackbuffer(); 649 DiscardBackbuffer();
651 } 650 }
652 651
653 } // namespace cc 652 } // namespace cc
OLDNEW
« no previous file with comments | « cc/output/renderer_pixeltest.cc.rej ('k') | cc/output/swap_promise.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698