summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/gfx/transform.cc8
-rw-r--r--ui/gfx/transform.h8
-rw-r--r--views/view.cc9
3 files changed, 15 insertions, 10 deletions
diff --git a/ui/gfx/transform.cc b/ui/gfx/transform.cc
index 03e2873..bfd137a 100644
--- a/ui/gfx/transform.cc
+++ b/ui/gfx/transform.cc
@@ -70,7 +70,7 @@ bool Transform::HasChange() const {
return !matrix_.isIdentity();
}
-bool Transform::TransformPoint(gfx::Point* point) {
+bool Transform::TransformPoint(gfx::Point* point) const {
SkPoint skp;
matrix_.mapXY(SkIntToScalar(point->x()), SkIntToScalar(point->y()), &skp);
point->SetPoint(static_cast<int>(std::floor(skp.fX)),
@@ -78,7 +78,7 @@ bool Transform::TransformPoint(gfx::Point* point) {
return true;
}
-bool Transform::TransformPointReverse(gfx::Point* point) {
+bool Transform::TransformPointReverse(gfx::Point* point) const {
SkMatrix inverse;
// TODO(sad): Try to avoid trying to invert the matrix.
if (matrix_.invert(&inverse)) {
@@ -91,7 +91,7 @@ bool Transform::TransformPointReverse(gfx::Point* point) {
return false;
}
-bool Transform::TransformRect(gfx::Rect* rect) {
+bool Transform::TransformRect(gfx::Rect* rect) const {
SkRect src = gfx::RectToSkRect(*rect);
if (!matrix_.mapRect(&src))
return false;
@@ -99,7 +99,7 @@ bool Transform::TransformRect(gfx::Rect* rect) {
return true;
}
-bool Transform::TransformRectReverse(gfx::Rect* rect) {
+bool Transform::TransformRectReverse(gfx::Rect* rect) const {
SkMatrix inverse;
if (!matrix_.invert(&inverse))
return false;
diff --git a/ui/gfx/transform.h b/ui/gfx/transform.h
index 3fdfc32..aa5a675 100644
--- a/ui/gfx/transform.h
+++ b/ui/gfx/transform.h
@@ -71,19 +71,19 @@ class Transform {
// Applies the transformation on the point. Returns true if the point is
// transformed successfully.
- bool TransformPoint(gfx::Point* point);
+ bool TransformPoint(gfx::Point* point) const;
// Applies the reverse transformation on the point. Returns true if the point
// is transformed successfully.
- bool TransformPointReverse(gfx::Point* point);
+ bool TransformPointReverse(gfx::Point* point) const;
// Applies transformation on the rectangle. Returns true if the rectangle is
// transformed successfully.
- bool TransformRect(gfx::Rect* rect);
+ bool TransformRect(gfx::Rect* rect) const;
// Applies the reverse transformation on the rectangle. Returns true if the
// rectangle is transformed successfully.
- bool TransformRectReverse(gfx::Rect* rect);
+ bool TransformRectReverse(gfx::Rect* rect) const;
// Returns the underlying matrix.
const SkMatrix& matrix() const { return matrix_; }
diff --git a/views/view.cc b/views/view.cc
index 10132d3..f0af615 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -1195,9 +1195,14 @@ void View::PaintToTexture(const gfx::Rect& dirty_region) {
// Forward to all children as a descendant may be dirty and have a texture.
for (int i = child_count() - 1; i >= 0; --i) {
View* child_view = GetChildViewAt(i);
- gfx::Rect child_dirty_rect(child_view->bounds().Intersect(dirty_region));
+
+ gfx::Rect child_dirty_rect = dirty_region;
+ child_dirty_rect.Offset(-child_view->GetMirroredX(), -child_view->y());
+ child_view->GetTransform().TransformRectReverse(&child_dirty_rect);
+ child_dirty_rect = gfx::Rect(gfx::Point(), child_view->size()).Intersect(
+ child_dirty_rect);
+
if (!child_dirty_rect.IsEmpty()) {
- child_dirty_rect.Offset(-child_view->x(), -child_view->y());
GetChildViewAt(i)->PaintToTexture(child_dirty_rect);
}
}