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

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

Issue 2690583002: Make cc/paint have concrete types (Closed)
Patch Set: PaintRecord as typedef, fixup playback calls Created 3 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 | « ash/common/shelf/shelf_button.cc ('k') | cc/paint/BUILD.gn » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/painted_overlay_scrollbar_layer.h" 5 #include "cc/layers/painted_overlay_scrollbar_layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return false; 133 return false;
134 134
135 gfx::Rect paint_rect = OriginThumbRectForPainting(); 135 gfx::Rect paint_rect = OriginThumbRectForPainting();
136 aperture_ = scrollbar_->NinePatchThumbAperture(); 136 aperture_ = scrollbar_->NinePatchThumbAperture();
137 137
138 DCHECK(!paint_rect.size().IsEmpty()); 138 DCHECK(!paint_rect.size().IsEmpty());
139 DCHECK(paint_rect.origin().IsOrigin()); 139 DCHECK(paint_rect.origin().IsOrigin());
140 140
141 SkBitmap skbitmap; 141 SkBitmap skbitmap;
142 skbitmap.allocN32Pixels(paint_rect.width(), paint_rect.height()); 142 skbitmap.allocN32Pixels(paint_rect.width(), paint_rect.height());
143 SkCanvas skcanvas(skbitmap); 143 PaintCanvas canvas(skbitmap);
144 144
145 SkRect content_skrect = RectToSkRect(paint_rect); 145 SkRect content_skrect = RectToSkRect(paint_rect);
146 SkPaint paint; 146 PaintFlags flags;
147 paint.setAntiAlias(false); 147 flags.setAntiAlias(false);
148 paint.setBlendMode(SkBlendMode::kClear); 148 flags.setBlendMode(SkBlendMode::kClear);
149 skcanvas.drawRect(content_skrect, paint); 149 canvas.drawRect(content_skrect, flags);
150 skcanvas.clipRect(content_skrect); 150 canvas.clipRect(content_skrect);
151 151
152 scrollbar_->PaintPart(&skcanvas, THUMB, paint_rect); 152 scrollbar_->PaintPart(&canvas, THUMB, paint_rect);
153 // Make sure that the pixels are no longer mutable to unavoid unnecessary 153 // Make sure that the pixels are no longer mutable to unavoid unnecessary
154 // allocation and copying. 154 // allocation and copying.
155 skbitmap.setImmutable(); 155 skbitmap.setImmutable();
156 156
157 thumb_resource_ = ScopedUIResource::Create( 157 thumb_resource_ = ScopedUIResource::Create(
158 layer_tree_host()->GetUIResourceManager(), UIResourceBitmap(skbitmap)); 158 layer_tree_host()->GetUIResourceManager(), UIResourceBitmap(skbitmap));
159 159
160 SetNeedsPushProperties(); 160 SetNeedsPushProperties();
161 161
162 return true; 162 return true;
163 } 163 }
164 164
165 } // namespace cc 165 } // namespace cc
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_button.cc ('k') | cc/paint/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698