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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 1105573002: cc: Fix invalid opaque debug quads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | no next file » | 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/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 shared_quad_state, quad_rect, visible_quad_rect, color, width); 345 shared_quad_state, quad_rect, visible_quad_rect, color, width);
346 if (contents_opaque()) { 346 if (contents_opaque()) {
347 // When opaque, draw a second inner border that is thicker than the outer 347 // When opaque, draw a second inner border that is thicker than the outer
348 // border, but more transparent. 348 // border, but more transparent.
349 static const float kFillOpacity = 0.3f; 349 static const float kFillOpacity = 0.3f;
350 SkColor fill_color = SkColorSetA( 350 SkColor fill_color = SkColorSetA(
351 color, static_cast<uint8_t>(SkColorGetA(color) * kFillOpacity)); 351 color, static_cast<uint8_t>(SkColorGetA(color) * kFillOpacity));
352 float fill_width = width * 3; 352 float fill_width = width * 3;
353 gfx::Rect fill_rect = quad_rect; 353 gfx::Rect fill_rect = quad_rect;
354 fill_rect.Inset(fill_width / 2.f, fill_width / 2.f); 354 fill_rect.Inset(fill_width / 2.f, fill_width / 2.f);
355 if (fill_rect.IsEmpty())
356 return;
355 gfx::Rect visible_fill_rect = 357 gfx::Rect visible_fill_rect =
356 gfx::IntersectRects(visible_quad_rect, fill_rect); 358 gfx::IntersectRects(visible_quad_rect, fill_rect);
357 DebugBorderDrawQuad* fill_quad = 359 DebugBorderDrawQuad* fill_quad =
358 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); 360 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>();
359 fill_quad->SetNew(shared_quad_state, fill_rect, visible_fill_rect, 361 fill_quad->SetNew(shared_quad_state, fill_rect, visible_fill_rect,
360 fill_color, fill_width); 362 fill_color, fill_width);
361 } 363 }
362 } 364 }
363 365
364 bool LayerImpl::HasDelegatedContent() const { 366 bool LayerImpl::HasDelegatedContent() const {
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 gfx::Transform scaled_draw_transform = 1618 gfx::Transform scaled_draw_transform =
1617 draw_properties_.target_space_transform; 1619 draw_properties_.target_space_transform;
1618 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); 1620 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale);
1619 gfx::Size scaled_content_bounds = 1621 gfx::Size scaled_content_bounds =
1620 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); 1622 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale));
1621 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, 1623 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform,
1622 gfx::Rect(scaled_content_bounds)); 1624 gfx::Rect(scaled_content_bounds));
1623 } 1625 }
1624 1626
1625 } // namespace cc 1627 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698