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" |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 SkMatrix shader_scale; | 642 SkMatrix shader_scale; |
643 shader_scale.setScale(SkFloatToScalar(user_scale_x), | 643 shader_scale.setScale(SkFloatToScalar(user_scale_x), |
644 SkFloatToScalar(user_scale_y)); | 644 SkFloatToScalar(user_scale_y)); |
645 shader_scale.preTranslate(SkIntToScalar(-src_x), SkIntToScalar(-src_y)); | 645 shader_scale.preTranslate(SkIntToScalar(-src_x), SkIntToScalar(-src_y)); |
646 shader_scale.postTranslate(SkIntToScalar(dest_x), SkIntToScalar(dest_y)); | 646 shader_scale.postTranslate(SkIntToScalar(dest_x), SkIntToScalar(dest_y)); |
647 | 647 |
648 skia::RefPtr<SkShader> shader = CreateImageRepShaderForScale( | 648 skia::RefPtr<SkShader> shader = CreateImageRepShaderForScale( |
649 image_rep, | 649 image_rep, |
650 SkShader::kRepeat_TileMode, | 650 SkShader::kRepeat_TileMode, |
651 shader_scale, | 651 shader_scale, |
652 pixel ? 1.0f : image_scale); | 652 pixel ? 1.0f : image_rep.scale()); |
653 | 653 |
654 // Set up our paint to use the shader & release our reference (now just owned | 654 // Set up our paint to use the shader & release our reference (now just owned |
655 // by the paint). | 655 // by the paint). |
656 SkPaint p(paint); | 656 SkPaint p(paint); |
657 p.setFilterBitmap(filter); | 657 p.setFilterBitmap(filter); |
658 p.setShader(shader.get()); | 658 p.setShader(shader.get()); |
659 | 659 |
660 // The rect will be filled by the bitmap. | 660 // The rect will be filled by the bitmap. |
661 canvas_->drawRect(dest_rect, p); | 661 canvas_->drawRect(dest_rect, p); |
662 } | 662 } |
663 | 663 |
664 } // namespace gfx | 664 } // namespace gfx |
OLD | NEW |