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

Side by Side Diff: ui/native_theme/common_theme.cc

Issue 1124223010: ui: Eliminate allocating gfx::Canvas on the heap for every view. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/native_theme/common_theme.h" 5 #include "ui/native_theme/common_theme.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "ui/base/resource/resource_bundle.h" 9 #include "ui/base/resource/resource_bundle.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 } 214 }
215 canvas->drawRect(gfx::RectToSkRect(rect), paint); 215 canvas->drawRect(gfx::RectToSkRect(rect), paint);
216 } 216 }
217 217
218 // static 218 // static
219 scoped_ptr<gfx::Canvas> CommonThemeCreateCanvas(SkCanvas* sk_canvas) { 219 scoped_ptr<gfx::Canvas> CommonThemeCreateCanvas(SkCanvas* sk_canvas) {
220 // TODO(pkotwicz): Do something better and don't infer device 220 // TODO(pkotwicz): Do something better and don't infer device
221 // scale factor from canvas scale. 221 // scale factor from canvas scale.
222 SkMatrix m = sk_canvas->getTotalMatrix(); 222 SkMatrix m = sk_canvas->getTotalMatrix();
223 float device_scale = static_cast<float>(SkScalarAbs(m.getScaleX())); 223 float device_scale = static_cast<float>(SkScalarAbs(m.getScaleX()));
224 return make_scoped_ptr( 224 return make_scoped_ptr(new gfx::Canvas(sk_canvas, device_scale));
225 gfx::Canvas::CreateCanvasWithoutScaling(sk_canvas, device_scale));
226 } 225 }
227 226
228 } // namespace ui 227 } // namespace ui
OLDNEW
« ui/compositor/paint_recorder.cc ('K') | « ui/gfx/render_text_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698