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

Side by Side Diff: cc/layers/layer_impl.cc

Issue 17335011: cc: Allow output readback/copy requests to specify a sub-rect to copy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copy-subrect: 3 patches in one Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/output/copy_output_request.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/layers/layer_impl.h" 5 #include "cc/layers/layer_impl.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "cc/animation/animation_registrar.h" 9 #include "cc/animation/animation_registrar.h"
10 #include "cc/animation/scrollbar_animation_controller.h" 10 #include "cc/animation/scrollbar_animation_controller.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void LayerImpl::PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests) { 106 void LayerImpl::PassCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests) {
107 if (requests->empty()) 107 if (requests->empty())
108 return; 108 return;
109 109
110 copy_requests_.insert_and_take(copy_requests_.end(), *requests); 110 copy_requests_.insert_and_take(copy_requests_.end(), *requests);
111 requests->clear(); 111 requests->clear();
112 112
113 NoteLayerPropertyChangedForSubtree(); 113 NoteLayerPropertyChangedForSubtree();
114 } 114 }
115 115
116 void LayerImpl::TakeCopyRequests(ScopedPtrVector<CopyOutputRequest>* requests) { 116 void LayerImpl::TakeCopyRequestsAndTransformToTarget(
117 ScopedPtrVector<CopyOutputRequest>* requests) {
117 if (copy_requests_.empty()) 118 if (copy_requests_.empty())
118 return; 119 return;
119 120
120 requests->insert_and_take(requests->end(), copy_requests_); 121 requests->insert_and_take(requests->end(), copy_requests_);
121 copy_requests_.clear(); 122 copy_requests_.clear();
123
124 for (size_t i = 0; i < requests->size(); ++i) {
125 CopyOutputRequest* request = requests->at(i);
126 if (!request->has_area())
127 continue;
128
129 gfx::Rect request_in_layer_space = request->area();
130 gfx::Rect request_in_content_space =
131 LayerRectToContentRect(request_in_layer_space);
132 request->set_area(
133 MathUtil::MapClippedRect(draw_properties_.target_space_transform,
134 request_in_content_space));
135 }
122 } 136 }
123 137
124 void LayerImpl::CreateRenderSurface() { 138 void LayerImpl::CreateRenderSurface() {
125 DCHECK(!draw_properties_.render_surface); 139 DCHECK(!draw_properties_.render_surface);
126 draw_properties_.render_surface = 140 draw_properties_.render_surface =
127 make_scoped_ptr(new RenderSurfaceImpl(this)); 141 make_scoped_ptr(new RenderSurfaceImpl(this));
128 draw_properties_.render_target = this; 142 draw_properties_.render_target = this;
129 } 143 }
130 144
131 void LayerImpl::ClearRenderSurface() { 145 void LayerImpl::ClearRenderSurface() {
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 1182
1169 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; } 1183 size_t LayerImpl::GPUMemoryUsageInBytes() const { return 0; }
1170 1184
1171 scoped_ptr<base::Value> LayerImpl::AsValue() const { 1185 scoped_ptr<base::Value> LayerImpl::AsValue() const {
1172 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 1186 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
1173 AsValueInto(state.get()); 1187 AsValueInto(state.get());
1174 return state.PassAs<base::Value>(); 1188 return state.PassAs<base::Value>();
1175 } 1189 }
1176 1190
1177 } // namespace cc 1191 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/output/copy_output_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698