| OLD | NEW |
| 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/gfx/canvas.h" | 5 #include "ui/gfx/canvas.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
| 13 #include "third_party/skia/include/effects/SkGradientShader.h" | 13 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 14 #include "ui/gfx/font_list.h" | 14 #include "ui/gfx/font_list.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/rect_conversions.h" | 16 #include "ui/gfx/geometry/rect_conversions.h" |
| 17 #include "ui/gfx/geometry/safe_integer_conversions.h" | 17 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 18 #include "ui/gfx/geometry/size_conversions.h" | 18 #include "ui/gfx/geometry/size_conversions.h" |
| 19 #include "ui/gfx/scoped_canvas.h" | 19 #include "ui/gfx/scoped_canvas.h" |
| 20 #include "ui/gfx/skia_util.h" | 20 #include "ui/gfx/skia_util.h" |
| 21 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
| 22 | 22 |
| 23 #if defined(OS_WIN) | |
| 24 #include "ui/gfx/canvas_skia_paint.h" | |
| 25 #endif | |
| 26 | |
| 27 namespace gfx { | 23 namespace gfx { |
| 28 | 24 |
| 29 Canvas::Canvas(const Size& size, float image_scale, bool is_opaque) | 25 Canvas::Canvas(const Size& size, float image_scale, bool is_opaque) |
| 30 : image_scale_(image_scale), | 26 : image_scale_(image_scale), |
| 31 canvas_(NULL) { | 27 canvas_(NULL) { |
| 32 Size pixel_size = ToCeiledSize(ScaleSize(size, image_scale)); | 28 Size pixel_size = ToCeiledSize(ScaleSize(size, image_scale)); |
| 33 owned_canvas_ = skia::AdoptRef(skia::CreatePlatformCanvas(pixel_size.width(), | 29 owned_canvas_ = skia::AdoptRef(skia::CreatePlatformCanvas(pixel_size.width(), |
| 34 pixel_size.height(), | 30 pixel_size.height(), |
| 35 is_opaque)); | 31 is_opaque)); |
| 36 canvas_ = owned_canvas_.get(); | 32 canvas_ = owned_canvas_.get(); |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 // by the paint). | 629 // by the paint). |
| 634 SkPaint p(paint); | 630 SkPaint p(paint); |
| 635 p.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); | 631 p.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); |
| 636 p.setShader(shader.get()); | 632 p.setShader(shader.get()); |
| 637 | 633 |
| 638 // The rect will be filled by the bitmap. | 634 // The rect will be filled by the bitmap. |
| 639 canvas_->drawRect(dest_rect, p); | 635 canvas_->drawRect(dest_rect, p); |
| 640 } | 636 } |
| 641 | 637 |
| 642 } // namespace gfx | 638 } // namespace gfx |
| OLD | NEW |