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

Unified Diff: ui/views/view.cc

Issue 1470123002: Split ClipTransformRecorder into {Clip,Transform}Recorder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initialize transformed to false. Created 5 years, 1 month 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 | « ui/views/mus/native_widget_mus.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/view.cc
diff --git a/ui/views/view.cc b/ui/views/view.cc
index 438966142cafd32a7cd52d9240323db58afbe492..e6fbb2ec7965051d9fd8e20a3ec95bb5b28b2f70 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -20,13 +20,14 @@
#include "ui/base/cursor/cursor.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/ime/input_method.h"
-#include "ui/compositor/clip_transform_recorder.h"
+#include "ui/compositor/clip_recorder.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/dip_util.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animator.h"
#include "ui/compositor/paint_context.h"
#include "ui/compositor/paint_recorder.h"
+#include "ui/compositor/transform_recorder.h"
#include "ui/events/event_target_iterator.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/point3_f.h"
@@ -778,8 +779,10 @@ void View::Paint(const ui::PaintContext& parent_context) {
// If the view is backed by a layer, it should paint with itself as the origin
// rather than relative to its parent.
- ui::ClipTransformRecorder clip_transform_recorder(context);
- if (!layer()) {
+ bool paint_relative_to_parent = !layer();
+
+ ui::ClipRecorder clip_recorder(context);
+ if (paint_relative_to_parent) {
// Set the clip rect to the bounds of this View. Note that the X (or left)
// position we pass to ClipRect takes into consideration whether or not the
// View uses a right-to-left layout so that we paint the View in its
@@ -789,8 +792,11 @@ void View::Paint(const ui::PaintContext& parent_context) {
if (parent_)
clip_rect_in_parent.set_x(
parent_->GetMirroredXForRect(clip_rect_in_parent));
- clip_transform_recorder.ClipRect(clip_rect_in_parent);
+ clip_recorder.ClipRect(clip_rect_in_parent);
+ }
+ ui::TransformRecorder transform_recorder(context);
+ if (paint_relative_to_parent) {
// Translate the graphics such that 0,0 corresponds to where
// this View is located relative to its parent.
gfx::Transform transform_from_parent;
@@ -798,7 +804,7 @@ void View::Paint(const ui::PaintContext& parent_context) {
transform_from_parent.Translate(offset_from_parent.x(),
offset_from_parent.y());
transform_from_parent.PreconcatTransform(GetTransform());
- clip_transform_recorder.Transform(transform_from_parent);
+ transform_recorder.Transform(transform_from_parent);
}
if (is_invalidated || !paint_cache_.UseCache(context)) {
« no previous file with comments | « ui/views/mus/native_widget_mus.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698