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

Unified Diff: cc/resources/display_item_list.cc

Issue 997173003: Revert of Raster into an SkP before rendering a DisplayList. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/resources/display_item_list.h ('k') | cc/resources/display_list_recording_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/resources/display_item_list.cc
diff --git a/cc/resources/display_item_list.cc b/cc/resources/display_item_list.cc
index 48f8c66dd32bba9808e4dc7d3ddb5b93685cbd5c..ac6ab57d18536cfb15d648f1dd259f1fcca257d6 100644
--- a/cc/resources/display_item_list.cc
+++ b/cc/resources/display_item_list.cc
@@ -10,12 +10,8 @@
#include "base/trace_event/trace_event_argument.h"
#include "cc/base/math_util.h"
#include "cc/debug/picture_debug_util.h"
-#include "cc/debug/traced_picture.h"
-#include "cc/debug/traced_value.h"
#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkDrawPictureCallback.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"
-#include "third_party/skia/include/utils/SkPictureUtils.h"
#include "ui/gfx/skia_util.h"
namespace cc {
@@ -34,46 +30,12 @@
void DisplayItemList::Raster(SkCanvas* canvas,
SkDrawPictureCallback* callback,
float contents_scale) const {
- if (!picture_) {
- canvas->save();
- canvas->scale(contents_scale, contents_scale);
- for (size_t i = 0; i < items_.size(); ++i) {
- items_[i]->Raster(canvas, callback);
- }
- canvas->restore();
- } else {
- DCHECK(picture_);
-
- canvas->save();
- canvas->scale(contents_scale, contents_scale);
- if (callback) {
- // If we have a callback, we need to call |draw()|, |drawPicture()|
- // doesn't take a callback. This is used by |AnalysisCanvas| to early
- // out.
- picture_->playback(canvas, callback);
- } else {
- // Prefer to call |drawPicture()| on the canvas since it could place the
- // entire picture on the canvas instead of parsing the skia operations.
- canvas->drawPicture(picture_.get());
- }
- canvas->restore();
+ canvas->save();
+ canvas->scale(contents_scale, contents_scale);
+ for (size_t i = 0; i < items_.size(); ++i) {
+ items_[i]->Raster(canvas, callback);
}
-}
-
-void DisplayItemList::CreateAndCacheSkPicture() {
- // Convert to an SkPicture for faster rasterization. Code is identical to
- // that in Picture::Record.
- SkRTreeFactory factory;
- SkPictureRecorder recorder;
- skia::RefPtr<SkCanvas> canvas;
- canvas = skia::SharePtr(recorder.beginRecording(
- layer_rect_.width(), layer_rect_.height(), &factory));
- canvas->translate(-layer_rect_.x(), -layer_rect_.y());
- canvas->clipRect(gfx::RectToSkRect(layer_rect_));
- for (size_t i = 0; i < items_.size(); ++i)
- items_[i]->Raster(canvas.get(), NULL);
- picture_ = skia::AdoptRef(recorder.endRecording());
- DCHECK(picture_);
+ canvas->restore();
}
void DisplayItemList::AppendItem(scoped_ptr<DisplayItem> item) {
@@ -99,9 +61,6 @@
for (const auto& item : items_) {
total_size += item->PictureMemoryUsage();
}
-
- if (picture_)
- total_size += SkPictureUtils::ApproximateBytesUsed(picture_.get());
return total_size;
}
« no previous file with comments | « cc/resources/display_item_list.h ('k') | cc/resources/display_list_recording_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698