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

Side by Side Diff: ui/gfx/canvas.cc

Issue 275693003: Use the scale factor in the image in the DrawImageIntHelper function in case we are not drawing in … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698