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

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

Issue 1083683003: Speculative revert by sheriff (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed an unrelated commit that had accidentally slipped in. Created 5 years, 8 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/test/fake_content_layer_client.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 2014 The Chromium Authors. All rights reserved. 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 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/drawing_display_item.h" 5 #include "cc/resources/drawing_display_item.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event_argument.h" 10 #include "base/trace_event/trace_event_argument.h"
(...skipping 16 matching lines...) Expand all
27 void DrawingDisplayItem::Raster(SkCanvas* canvas, 27 void DrawingDisplayItem::Raster(SkCanvas* canvas,
28 SkDrawPictureCallback* callback) const { 28 SkDrawPictureCallback* callback) const {
29 canvas->save(); 29 canvas->save();
30 if (callback) 30 if (callback)
31 picture_->playback(canvas, callback); 31 picture_->playback(canvas, callback);
32 else 32 else
33 canvas->drawPicture(picture_.get()); 33 canvas->drawPicture(picture_.get());
34 canvas->restore(); 34 canvas->restore();
35 } 35 }
36 36
37 void DrawingDisplayItem::RasterForTracing(SkCanvas* canvas) const {
38 canvas->save();
39 // The picture debugger in about:tracing doesn't drill down into |drawPicture|
40 // operations. Calling |playback()| rather than |drawPicture()| causes the
41 // skia operations in |picture_| to appear individually in the picture
42 // produced for tracing rather than being hidden inside a drawPicture
43 // operation.
44 picture_->playback(canvas);
45 canvas->restore();
46 }
47
37 bool DrawingDisplayItem::IsSuitableForGpuRasterization() const { 48 bool DrawingDisplayItem::IsSuitableForGpuRasterization() const {
38 return picture_->suitableForGpuRasterization(NULL); 49 return picture_->suitableForGpuRasterization(NULL);
39 } 50 }
40 51
41 int DrawingDisplayItem::ApproximateOpCount() const { 52 int DrawingDisplayItem::ApproximateOpCount() const {
42 return picture_->approximateOpCount(); 53 return picture_->approximateOpCount();
43 } 54 }
44 55
45 size_t DrawingDisplayItem::PictureMemoryUsage() const { 56 size_t DrawingDisplayItem::PictureMemoryUsage() const {
46 DCHECK(picture_); 57 DCHECK(picture_);
47 return SkPictureUtils::ApproximateBytesUsed(picture_.get()); 58 return SkPictureUtils::ApproximateBytesUsed(picture_.get());
48 } 59 }
49 60
50 void DrawingDisplayItem::AsValueInto( 61 void DrawingDisplayItem::AsValueInto(
51 base::trace_event::TracedValue* array) const { 62 base::trace_event::TracedValue* array) const {
52 array->BeginDictionary(); 63 array->BeginDictionary();
53 array->SetString("name", "DrawingDisplayItem"); 64 array->SetString("name", "DrawingDisplayItem");
54 array->SetString( 65 array->SetString(
55 "cullRect", 66 "cullRect",
56 base::StringPrintf("[%f,%f,%f,%f]", picture_->cullRect().x(), 67 base::StringPrintf("[%f,%f,%f,%f]", picture_->cullRect().x(),
57 picture_->cullRect().y(), picture_->cullRect().width(), 68 picture_->cullRect().y(), picture_->cullRect().width(),
58 picture_->cullRect().height())); 69 picture_->cullRect().height()));
59 std::string b64_picture; 70 std::string b64_picture;
60 PictureDebugUtil::SerializeAsBase64(picture_.get(), &b64_picture); 71 PictureDebugUtil::SerializeAsBase64(picture_.get(), &b64_picture);
61 array->SetString("skp64", b64_picture); 72 array->SetString("skp64", b64_picture);
62 array->EndDictionary(); 73 array->EndDictionary();
63 } 74 }
64 75
65 } // namespace cc 76 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/drawing_display_item.h ('k') | cc/test/fake_content_layer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698