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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/LoggingCanvas.cpp

Issue 2889653002: Remove cullRect() from PaintOpBuffer. (Closed)
Patch Set: movecullrect2 rebase-once-and-for-all Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 AutoLogger logger(this); 898 AutoLogger logger(this);
899 logger.LogItem("restore"); 899 logger.LogItem("restore");
900 this->SkCanvas::willRestore(); 900 this->SkCanvas::willRestore();
901 } 901 }
902 902
903 std::unique_ptr<JSONArray> LoggingCanvas::Log() { 903 std::unique_ptr<JSONArray> LoggingCanvas::Log() {
904 return JSONArray::From(log_->Clone()); 904 return JSONArray::From(log_->Clone());
905 } 905 }
906 906
907 #ifndef NDEBUG 907 #ifndef NDEBUG
908 String RecordAsDebugString(const PaintRecord* record) { 908 String RecordAsDebugString(const PaintRecord* record, const SkRect& bounds) {
909 const SkIRect bounds = record->cullRect().roundOut(); 909 const SkIRect enclosing_bounds = bounds.roundOut();
910 LoggingCanvas canvas(bounds.width(), bounds.height()); 910 LoggingCanvas canvas(enclosing_bounds.width(), enclosing_bounds.height());
911 record->playback(&canvas); 911 record->playback(&canvas);
912 std::unique_ptr<JSONObject> record_as_json = JSONObject::Create(); 912 std::unique_ptr<JSONObject> record_as_json = JSONObject::Create();
913 record_as_json->SetObject("cullRect", ObjectForSkRect(record->cullRect())); 913 record_as_json->SetObject("cullRect", ObjectForSkRect(bounds));
914 record_as_json->SetArray("operations", canvas.Log()); 914 record_as_json->SetArray("operations", canvas.Log());
915 return record_as_json->ToPrettyJSONString(); 915 return record_as_json->ToPrettyJSONString();
916 } 916 }
917 917
918 void ShowPaintRecord(const PaintRecord* record) { 918 void ShowPaintRecord(const PaintRecord* record, const SkRect& bounds) {
919 WTFLogAlways("%s\n", RecordAsDebugString(record).Utf8().data()); 919 WTFLogAlways("%s\n", RecordAsDebugString(record, bounds).Utf8().data());
920 } 920 }
921 #endif 921 #endif
922 922
923 } // namespace blink 923 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698