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

Unified Diff: ui/gfx/paint_vector_icon.cc

Issue 2261593002: Use ScopedRTLFlipCanvas more pervasively for RTL flipping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix namespace Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu.cc ('k') | ui/gfx/scoped_canvas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/paint_vector_icon.cc
diff --git a/ui/gfx/paint_vector_icon.cc b/ui/gfx/paint_vector_icon.cc
index 5db76e25af63cf5749df5c0ee6eda37b6c17f025..eeca3f406925e366fdd0d661e6b154266e60bea8 100644
--- a/ui/gfx/paint_vector_icon.cc
+++ b/ui/gfx/paint_vector_icon.cc
@@ -17,6 +17,7 @@
#include "third_party/skia/include/core/SkXfermode.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/image/canvas_image_source.h"
+#include "ui/gfx/scoped_canvas.h"
#include "ui/gfx/vector_icon_types.h"
#include "ui/gfx/vector_icons.h"
@@ -82,7 +83,6 @@ void PaintPath(Canvas* canvas,
const PathElement* path_elements,
size_t dip_size,
SkColor color) {
- canvas->Save();
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
@@ -293,10 +293,8 @@ void PaintPath(Canvas* canvas,
}
}
- if (flips_in_rtl && base::i18n::IsRTL()) {
- canvas->Scale(-1, 1);
- canvas->Translate(gfx::Vector2d(-static_cast<int>(canvas_size), 0));
- }
+ gfx::ScopedRTLFlipCanvas scoped_rtl_flip_canvas(
+ canvas, static_cast<int>(canvas_size), flips_in_rtl);
if (dip_size != canvas_size) {
SkScalar scale = SkIntToScalar(dip_size) / SkIntToScalar(canvas_size);
@@ -309,7 +307,6 @@ void PaintPath(Canvas* canvas,
DCHECK_EQ(paints.size(), paths.size());
for (size_t i = 0; i < paths.size(); ++i)
canvas->DrawPath(paths[i], paints[i]);
- canvas->Restore();
}
class VectorIconSource : public CanvasImageSource {
« no previous file with comments | « chrome/browser/ui/views/toolbar/app_menu.cc ('k') | ui/gfx/scoped_canvas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698