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

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

Issue 1560403002: Scale scrollbar in use-zoom-for-dsf mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | third_party/WebKit/Source/core/frame/FrameView.cpp » ('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 "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 DCHECK(!layer_rect.size().IsEmpty()); 280 DCHECK(!layer_rect.size().IsEmpty());
281 281
282 SkBitmap skbitmap; 282 SkBitmap skbitmap;
283 skbitmap.allocN32Pixels(content_rect.width(), content_rect.height()); 283 skbitmap.allocN32Pixels(content_rect.width(), content_rect.height());
284 SkCanvas skcanvas(skbitmap); 284 SkCanvas skcanvas(skbitmap);
285 285
286 float scale_x = 286 float scale_x =
287 content_rect.width() / static_cast<float>(layer_rect.width()); 287 content_rect.width() / static_cast<float>(layer_rect.width());
288 float scale_y = 288 float scale_y =
289 content_rect.height() / static_cast<float>(layer_rect.height()); 289 content_rect.height() / static_cast<float>(layer_rect.height());
290 LOG(ERROR) << "scale:" << scale_x << "x" << scale_y
skobes 2016/01/14 00:00:36 remove this :)
291 << ", content rect:" << content_rect.ToString()
292 << ", layer rect:" << layer_Rect.ToString();
290 293
291 skcanvas.scale(SkFloatToScalar(scale_x), 294 skcanvas.scale(SkFloatToScalar(scale_x),
292 SkFloatToScalar(scale_y)); 295 SkFloatToScalar(scale_y));
293 skcanvas.translate(SkFloatToScalar(-layer_rect.x()), 296 skcanvas.translate(SkFloatToScalar(-layer_rect.x()),
294 SkFloatToScalar(-layer_rect.y())); 297 SkFloatToScalar(-layer_rect.y()));
295 298
296 SkRect layer_skrect = RectToSkRect(layer_rect); 299 SkRect layer_skrect = RectToSkRect(layer_rect);
297 SkPaint paint; 300 SkPaint paint;
298 paint.setAntiAlias(false); 301 paint.setAntiAlias(false);
299 paint.setXfermodeMode(SkXfermode::kClear_Mode); 302 paint.setXfermodeMode(SkXfermode::kClear_Mode);
300 skcanvas.drawRect(layer_skrect, paint); 303 skcanvas.drawRect(layer_skrect, paint);
301 skcanvas.clipRect(layer_skrect); 304 skcanvas.clipRect(layer_skrect);
302 305
303 scrollbar_->PaintPart(&skcanvas, part, layer_rect); 306 scrollbar_->PaintPart(&skcanvas, part, layer_rect);
304 // Make sure that the pixels are no longer mutable to unavoid unnecessary 307 // Make sure that the pixels are no longer mutable to unavoid unnecessary
305 // allocation and copying. 308 // allocation and copying.
306 skbitmap.setImmutable(); 309 skbitmap.setImmutable();
307 310
308 return UIResourceBitmap(skbitmap); 311 return UIResourceBitmap(skbitmap);
309 } 312 }
310 313
311 } // namespace cc 314 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698