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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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/layers/layer.cc ('k') | cc/layers/painted_scrollbar_layer_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_scrollbar_layer.h" 5 #include "cc/layers/painted_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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 UIResourceBitmap PaintedScrollbarLayer::RasterizeScrollbarPart( 257 UIResourceBitmap PaintedScrollbarLayer::RasterizeScrollbarPart(
258 const gfx::Rect& layer_rect, 258 const gfx::Rect& layer_rect,
259 const gfx::Rect& content_rect, 259 const gfx::Rect& content_rect,
260 ScrollbarPart part) { 260 ScrollbarPart part) {
261 DCHECK(!content_rect.size().IsEmpty()); 261 DCHECK(!content_rect.size().IsEmpty());
262 DCHECK(!layer_rect.size().IsEmpty()); 262 DCHECK(!layer_rect.size().IsEmpty());
263 263
264 SkBitmap skbitmap; 264 SkBitmap skbitmap;
265 skbitmap.allocN32Pixels(content_rect.width(), content_rect.height()); 265 skbitmap.allocN32Pixels(content_rect.width(), content_rect.height());
266 SkCanvas skcanvas(skbitmap); 266 CdlCanvas canvas(skbitmap);
267 267
268 float scale_x = 268 float scale_x =
269 content_rect.width() / static_cast<float>(layer_rect.width()); 269 content_rect.width() / static_cast<float>(layer_rect.width());
270 float scale_y = 270 float scale_y =
271 content_rect.height() / static_cast<float>(layer_rect.height()); 271 content_rect.height() / static_cast<float>(layer_rect.height());
272 272
273 skcanvas.scale(SkFloatToScalar(scale_x), 273 canvas.scale(SkFloatToScalar(scale_x), SkFloatToScalar(scale_y));
274 SkFloatToScalar(scale_y)); 274 canvas.translate(SkFloatToScalar(-layer_rect.x()),
275 skcanvas.translate(SkFloatToScalar(-layer_rect.x()), 275 SkFloatToScalar(-layer_rect.y()));
276 SkFloatToScalar(-layer_rect.y()));
277 276
278 SkRect layer_skrect = RectToSkRect(layer_rect); 277 SkRect layer_skrect = RectToSkRect(layer_rect);
279 SkPaint paint; 278 CdlPaint paint;
280 paint.setAntiAlias(false); 279 paint.setAntiAlias(false);
281 paint.setBlendMode(SkBlendMode::kClear); 280 paint.setBlendMode(SkBlendMode::kClear);
282 skcanvas.drawRect(layer_skrect, paint); 281 canvas.drawRect(layer_skrect, paint);
283 skcanvas.clipRect(layer_skrect); 282 canvas.clipRect(layer_skrect);
284 283
285 scrollbar_->PaintPart(&skcanvas, part, layer_rect); 284 scrollbar_->PaintPart(&canvas, part, layer_rect);
286 // Make sure that the pixels are no longer mutable to unavoid unnecessary 285 // Make sure that the pixels are no longer mutable to unavoid unnecessary
287 // allocation and copying. 286 // allocation and copying.
288 skbitmap.setImmutable(); 287 skbitmap.setImmutable();
289 288
290 return UIResourceBitmap(skbitmap); 289 return UIResourceBitmap(skbitmap);
291 } 290 }
292 291
293 } // namespace cc 292 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.cc ('k') | cc/layers/painted_scrollbar_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698