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

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

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: Clean up comments, fix mac build Created 3 years, 11 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 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "platform/graphics/LoggingCanvas.h" 31 #include "platform/graphics/LoggingCanvas.h"
32 32
33 #include "platform/geometry/IntSize.h" 33 #include "platform/geometry/IntSize.h"
34 #include "platform/graphics/ImageBuffer.h" 34 #include "platform/graphics/ImageBuffer.h"
35 #include "platform/graphics/paint/PaintRecord.h"
35 #include "platform/graphics/skia/ImagePixelLocker.h" 36 #include "platform/graphics/skia/ImagePixelLocker.h"
36 #include "platform/graphics/skia/SkiaUtils.h" 37 #include "platform/graphics/skia/SkiaUtils.h"
37 #include "platform/image-encoders/PNGImageEncoder.h" 38 #include "platform/image-encoders/PNGImageEncoder.h"
38 #include "third_party/skia/include/core/SkImage.h" 39 #include "third_party/skia/include/core/SkImage.h"
39 #include "third_party/skia/include/core/SkImageInfo.h" 40 #include "third_party/skia/include/core/SkImageInfo.h"
40 #include "third_party/skia/include/core/SkPaint.h" 41 #include "third_party/skia/include/core/SkPaint.h"
41 #include "third_party/skia/include/core/SkPath.h" 42 #include "third_party/skia/include/core/SkPath.h"
42 #include "third_party/skia/include/core/SkPicture.h"
43 #include "third_party/skia/include/core/SkRRect.h" 43 #include "third_party/skia/include/core/SkRRect.h"
44 #include "third_party/skia/include/core/SkRect.h" 44 #include "third_party/skia/include/core/SkRect.h"
45 #include "wtf/HexNumber.h" 45 #include "wtf/HexNumber.h"
46 #include "wtf/text/Base64.h" 46 #include "wtf/text/Base64.h"
47 #include "wtf/text/TextEncoding.h" 47 #include "wtf/text/TextEncoding.h"
48 48
49 namespace blink { 49 namespace blink {
50 50
51 namespace { 51 namespace {
52 52
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 AutoLogger logger(this); 908 AutoLogger logger(this);
909 logger.logItem("restore"); 909 logger.logItem("restore");
910 this->SkCanvas::willRestore(); 910 this->SkCanvas::willRestore();
911 } 911 }
912 912
913 std::unique_ptr<JSONArray> LoggingCanvas::log() { 913 std::unique_ptr<JSONArray> LoggingCanvas::log() {
914 return JSONArray::from(m_log->clone()); 914 return JSONArray::from(m_log->clone());
915 } 915 }
916 916
917 #ifndef NDEBUG 917 #ifndef NDEBUG
918 String pictureAsDebugString(const SkPicture* picture) { 918 String pictureAsDebugString(const PaintRecord* picture) {
919 const SkIRect bounds = picture->cullRect().roundOut(); 919 const SkIRect bounds = picture->cullRect().roundOut();
920 LoggingCanvas canvas(bounds.width(), bounds.height()); 920 LoggingCanvas canvas(bounds.width(), bounds.height());
921 picture->playback(&canvas); 921 picture->playback(&canvas);
922 std::unique_ptr<JSONObject> pictureAsJSON = JSONObject::create(); 922 std::unique_ptr<JSONObject> pictureAsJSON = JSONObject::create();
923 pictureAsJSON->setObject("cullRect", objectForSkRect(picture->cullRect())); 923 pictureAsJSON->setObject("cullRect", objectForSkRect(picture->cullRect()));
924 pictureAsJSON->setArray("operations", canvas.log()); 924 pictureAsJSON->setArray("operations", canvas.log());
925 return pictureAsJSON->toPrettyJSONString(); 925 return pictureAsJSON->toPrettyJSONString();
926 } 926 }
927 927
928 void showSkPicture(const SkPicture* picture) { 928 void showSkPicture(const PaintRecord* picture) {
929 WTFLogAlways("%s\n", pictureAsDebugString(picture).utf8().data()); 929 WTFLogAlways("%s\n", pictureAsDebugString(picture).utf8().data());
930 } 930 }
931 #endif 931 #endif
932 932
933 } // namespace blink 933 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698