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

Unified Diff: ui/gfx/canvas.cc

Issue 557953004: Makes GetClipBounds() return the enclosing rect (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | ui/gfx/canvas_unittest.cc » ('j') | ui/gfx/canvas_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/canvas.cc
diff --git a/ui/gfx/canvas.cc b/ui/gfx/canvas.cc
index e8d6a9166fb1136c5d94fca30912b80f137a01be..6ea067eb696ca04b86a44bf4ce2473a22a810bd5 100644
--- a/ui/gfx/canvas.cc
+++ b/ui/gfx/canvas.cc
@@ -12,6 +12,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "ui/gfx/font_list.h"
+#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size_conversions.h"
#include "ui/gfx/skia_util.h"
@@ -209,9 +210,12 @@ bool Canvas::IsClipEmpty() const {
bool Canvas::GetClipBounds(Rect* bounds) {
SkRect out;
- bool has_non_empty_clip = canvas_->getClipBounds(&out);
- bounds->SetRect(out.left(), out.top(), out.width(), out.height());
- return has_non_empty_clip;
+ if (canvas_->getClipBounds(&out)) {
+ *bounds = ToEnclosingRect(SkRectToRectF(out));
+ return true;
+ }
+ *bounds = gfx::Rect();
+ return false;
}
void Canvas::Translate(const Vector2d& offset) {
« no previous file with comments | « no previous file | ui/gfx/canvas_unittest.cc » ('j') | ui/gfx/canvas_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698