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

Side by Side Diff: ui/compositor/clip_transform_recorder.cc

Issue 1473453002: Fix clip/transform pairing to follow LIFO order. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
« 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/compositor/clip_transform_recorder.h" 5 #include "ui/compositor/clip_transform_recorder.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "cc/playback/clip_display_item.h" 8 #include "cc/playback/clip_display_item.h"
9 #include "cc/playback/clip_path_display_item.h" 9 #include "cc/playback/clip_path_display_item.h"
10 #include "cc/playback/display_item_list.h" 10 #include "cc/playback/display_item_list.h"
11 #include "cc/playback/transform_display_item.h" 11 #include "cc/playback/transform_display_item.h"
12 #include "ui/compositor/paint_context.h" 12 #include "ui/compositor/paint_context.h"
13 #include "ui/gfx/canvas.h" 13 #include "ui/gfx/canvas.h"
14 #include "ui/gfx/path.h" 14 #include "ui/gfx/path.h"
15 15
16 namespace ui { 16 namespace ui {
17 17
18 ClipTransformRecorder::ClipTransformRecorder(const PaintContext& context) 18 ClipTransformRecorder::ClipTransformRecorder(const PaintContext& context)
19 : context_(context), num_closers_(0) { 19 : context_(context), num_closers_(0) {
20 } 20 }
21 21
22 ClipTransformRecorder::~ClipTransformRecorder() { 22 ClipTransformRecorder::~ClipTransformRecorder() {
23 for (size_t i = 0; i < num_closers_; ++i) { 23 for (size_t i = num_closers_; i > 0; --i) {
24 switch (closers_[i]) { 24 switch (closers_[i - 1]) {
25 case CLIP_RECT: 25 case CLIP_RECT:
26 context_.list_->CreateAndAppendItem<cc::EndClipDisplayItem>(); 26 context_.list_->CreateAndAppendItem<cc::EndClipDisplayItem>();
27 break; 27 break;
28 case CLIP_PATH: 28 case CLIP_PATH:
29 context_.list_->CreateAndAppendItem<cc::EndClipPathDisplayItem>(); 29 context_.list_->CreateAndAppendItem<cc::EndClipPathDisplayItem>();
30 break; 30 break;
31 case TRANSFORM: 31 case TRANSFORM:
32 context_.list_->CreateAndAppendItem<cc::EndTransformDisplayItem>(); 32 context_.list_->CreateAndAppendItem<cc::EndTransformDisplayItem>();
33 break; 33 break;
34 } 34 }
(...skipping 25 matching lines...) Expand all
60 } 60 }
61 61
62 void ClipTransformRecorder::Transform(const gfx::Transform& transform) { 62 void ClipTransformRecorder::Transform(const gfx::Transform& transform) {
63 auto* item = context_.list_->CreateAndAppendItem<cc::TransformDisplayItem>(); 63 auto* item = context_.list_->CreateAndAppendItem<cc::TransformDisplayItem>();
64 item->SetNew(transform); 64 item->SetNew(transform);
65 DCHECK_LT(num_closers_, arraysize(closers_)); 65 DCHECK_LT(num_closers_, arraysize(closers_));
66 closers_[num_closers_++] = TRANSFORM; 66 closers_[num_closers_++] = TRANSFORM;
67 } 67 }
68 68
69 } // namespace ui 69 } // namespace ui
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