OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/resources/picture.h" | 5 #include "cc/resources/picture.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "cc/debug/rendering_stats.h" | 9 #include "cc/debug/rendering_stats.h" |
10 #include "cc/layers/content_layer_client.h" | 10 #include "cc/layers/content_layer_client.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 canvas->clipRect(gfx::RectToSkRect(content_rect)); | 200 canvas->clipRect(gfx::RectToSkRect(content_rect)); |
201 canvas->scale(contents_scale, contents_scale); | 201 canvas->scale(contents_scale, contents_scale); |
202 canvas->translate(layer_rect_.x(), layer_rect_.y()); | 202 canvas->translate(layer_rect_.x(), layer_rect_.y()); |
203 // Pictures by default have LCD text enabled. | 203 // Pictures by default have LCD text enabled. |
204 if (!enable_lcd_text) | 204 if (!enable_lcd_text) |
205 canvas->setDrawFilter(&disable_lcd_text_filter); | 205 canvas->setDrawFilter(&disable_lcd_text_filter); |
206 canvas->drawPicture(*picture_); | 206 canvas->drawPicture(*picture_); |
207 canvas->restore(); | 207 canvas->restore(); |
208 } | 208 } |
209 | 209 |
210 void Picture::GatherPixelRefs(const gfx::Rect& layer_rect, | 210 void Picture::GatherPixelRefs(gfx::Rect layer_rect, |
211 std::list<skia::LazyPixelRef*>& pixel_ref_list) { | 211 std::list<skia::LazyPixelRef*>& pixel_ref_list) { |
212 DCHECK(picture_); | 212 DCHECK(picture_); |
213 SkData* pixel_refs = SkPictureUtils::GatherPixelRefs( | 213 SkData* pixel_refs = SkPictureUtils::GatherPixelRefs( |
214 picture_.get(), SkRect::MakeXYWH(layer_rect.x(), | 214 picture_.get(), SkRect::MakeXYWH(layer_rect.x(), |
215 layer_rect.y(), | 215 layer_rect.y(), |
216 layer_rect.width(), | 216 layer_rect.width(), |
217 layer_rect.height())); | 217 layer_rect.height())); |
218 if (!pixel_refs) | 218 if (!pixel_refs) |
219 return; | 219 return; |
220 | 220 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 256 |
257 // Encode the picture as base64. | 257 // Encode the picture as base64. |
258 size_t serialized_size = stream.bytesWritten(); | 258 size_t serialized_size = stream.bytesWritten(); |
259 scoped_ptr<char[]> serialized_picture(new char[serialized_size]); | 259 scoped_ptr<char[]> serialized_picture(new char[serialized_size]); |
260 stream.copyTo(serialized_picture.get()); | 260 stream.copyTo(serialized_picture.get()); |
261 base::Base64Encode(std::string(serialized_picture.get(), serialized_size), | 261 base::Base64Encode(std::string(serialized_picture.get(), serialized_size), |
262 output); | 262 output); |
263 } | 263 } |
264 | 264 |
265 } // namespace cc | 265 } // namespace cc |
OLD | NEW |