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

Side by Side Diff: cc/resources/drawing_display_item.cc

Issue 1144693002: cc: Move files out of cc/resources/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resources: android Created 5 years, 7 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
« no previous file with comments | « cc/resources/drawing_display_item.h ('k') | cc/resources/eviction_tile_priority_queue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/resources/drawing_display_item.h"
6
7 #include <string>
8
9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event_argument.h"
11 #include "cc/debug/picture_debug_util.h"
12 #include "third_party/skia/include/core/SkCanvas.h"
13 #include "third_party/skia/include/core/SkDrawPictureCallback.h"
14 #include "third_party/skia/include/core/SkMatrix.h"
15 #include "third_party/skia/include/core/SkPicture.h"
16 #include "third_party/skia/include/utils/SkPictureUtils.h"
17
18 namespace cc {
19
20 DrawingDisplayItem::DrawingDisplayItem() {
21 }
22
23 DrawingDisplayItem::~DrawingDisplayItem() {
24 }
25
26 void DrawingDisplayItem::SetNew(skia::RefPtr<SkPicture> picture) {
27 picture_ = picture.Pass();
28 DisplayItem::SetNew(picture_->suitableForGpuRasterization(NULL),
29 picture_->approximateOpCount(),
30 SkPictureUtils::ApproximateBytesUsed(picture_.get()));
31 }
32
33 void DrawingDisplayItem::Raster(SkCanvas* canvas,
34 SkDrawPictureCallback* callback) const {
35 // SkPicture always does a wrapping save/restore on the canvas, so it is not
36 // necessary here.
37 if (callback)
38 picture_->playback(canvas, callback);
39 else
40 canvas->drawPicture(picture_.get());
41 }
42
43 void DrawingDisplayItem::AsValueInto(
44 base::trace_event::TracedValue* array) const {
45 array->BeginDictionary();
46 array->SetString("name", "DrawingDisplayItem");
47 array->SetString(
48 "cullRect",
49 base::StringPrintf("[%f,%f,%f,%f]", picture_->cullRect().x(),
50 picture_->cullRect().y(), picture_->cullRect().width(),
51 picture_->cullRect().height()));
52 std::string b64_picture;
53 PictureDebugUtil::SerializeAsBase64(picture_.get(), &b64_picture);
54 array->SetString("skp64", b64_picture);
55 array->EndDictionary();
56 }
57
58 void DrawingDisplayItem::CloneTo(DrawingDisplayItem* item) const {
59 item->SetNew(picture_);
60 }
61
62 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/drawing_display_item.h ('k') | cc/resources/eviction_tile_priority_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698