| 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/core/SkPath.h" | 13 #include "third_party/skia/include/core/SkPath.h" |
| 14 #include "third_party/skia/include/core/SkRefCnt.h" | 14 #include "third_party/skia/include/core/SkRefCnt.h" |
| 15 #include "third_party/skia/include/core/SkSurface.h" | 15 #include "third_party/skia/include/core/SkSurface.h" |
| 16 #include "third_party/skia/include/effects/SkGradientShader.h" | 16 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 17 #include "ui/gfx/font_list.h" | 17 #include "ui/gfx/font_list.h" |
| 18 #include "ui/gfx/geometry/insets_f.h" | 18 #include "ui/gfx/geometry/insets_f.h" |
| 19 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
| 20 #include "ui/gfx/geometry/rect_conversions.h" | 20 #include "ui/gfx/geometry/rect_conversions.h" |
| 21 #include "ui/gfx/geometry/rect_f.h" | 21 #include "ui/gfx/geometry/rect_f.h" |
| 22 #include "ui/gfx/geometry/safe_integer_conversions.h" | 22 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 23 #include "ui/gfx/geometry/size_conversions.h" | 23 #include "ui/gfx/geometry/size_conversions.h" |
| 24 #include "ui/gfx/scoped_canvas.h" | 24 #include "ui/gfx/scoped_canvas.h" |
| 25 #include "ui/gfx/skia_paint_util.h" |
| 25 #include "ui/gfx/skia_util.h" | 26 #include "ui/gfx/skia_util.h" |
| 26 #include "ui/gfx/transform.h" | 27 #include "ui/gfx/transform.h" |
| 27 | 28 |
| 28 namespace gfx { | 29 namespace gfx { |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 32 sk_sp<SkSurface> CreateSurface(const Size& size, bool is_opaque) { | 33 sk_sp<SkSurface> CreateSurface(const Size& size, bool is_opaque) { |
| 33 // SkSurface cannot be zero-sized, but clients of Canvas sometimes request | 34 // SkSurface cannot be zero-sized, but clients of Canvas sometimes request |
| 34 // that (and then later resize). | 35 // that (and then later resize). |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 p.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); | 593 p.setFilterQuality(filter ? kLow_SkFilterQuality : kNone_SkFilterQuality); |
| 593 p.setShader(CreateImageRepShaderForScale( | 594 p.setShader(CreateImageRepShaderForScale( |
| 594 image_rep, SkShader::kRepeat_TileMode, shader_scale, | 595 image_rep, SkShader::kRepeat_TileMode, shader_scale, |
| 595 remove_image_scale ? image_rep.scale() : 1.f)); | 596 remove_image_scale ? image_rep.scale() : 1.f)); |
| 596 | 597 |
| 597 // The rect will be filled by the bitmap. | 598 // The rect will be filled by the bitmap. |
| 598 canvas_->drawRect(dest_rect, p); | 599 canvas_->drawRect(dest_rect, p); |
| 599 } | 600 } |
| 600 | 601 |
| 601 } // namespace gfx | 602 } // namespace gfx |
| OLD | NEW |