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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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 21 matching lines...) Expand all
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/skia/ImagePixelLocker.h" 35 #include "platform/graphics/skia/ImagePixelLocker.h"
36 #include "platform/graphics/skia/SkiaUtils.h" 36 #include "platform/graphics/skia/SkiaUtils.h"
37 #include "platform/image-encoders/PNGImageEncoder.h" 37 #include "platform/image-encoders/PNGImageEncoder.h"
38 #include "third_party/skia/include/core/SkImage.h" 38 #include "third_party/skia/include/core/SkImage.h"
39 #include "third_party/skia/include/core/SkImageInfo.h" 39 #include "third_party/skia/include/core/SkImageInfo.h"
40 #include "third_party/skia/include/core/SkPaint.h" 40 #include "third_party/skia/include/core/SkPaint.h"
41 #include "third_party/skia/include/core/SkPath.h" 41 #include "third_party/skia/include/core/SkPath.h"
42 #include "third_party/skia/include/core/SkPicture.h" 42 #include "skia/ext/cdl_picture.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 863 matching lines...) Expand 10 before | Expand all | Expand 10 after
916 AutoLogger logger(this); 916 AutoLogger logger(this);
917 logger.logItem("restore"); 917 logger.logItem("restore");
918 this->SkCanvas::willRestore(); 918 this->SkCanvas::willRestore();
919 } 919 }
920 920
921 std::unique_ptr<JSONArray> LoggingCanvas::log() { 921 std::unique_ptr<JSONArray> LoggingCanvas::log() {
922 return JSONArray::from(m_log->clone()); 922 return JSONArray::from(m_log->clone());
923 } 923 }
924 924
925 #ifndef NDEBUG 925 #ifndef NDEBUG
926 String pictureAsDebugString(const SkPicture* picture) { 926 String pictureAsDebugString(const CdlPicture* picture) {
927 const SkIRect bounds = picture->cullRect().roundOut(); 927 const SkIRect bounds = picture->cullRect().roundOut();
928 LoggingCanvas canvas(bounds.width(), bounds.height()); 928 LoggingCanvas canvas(bounds.width(), bounds.height());
929 picture->playback(&canvas); 929 picture->playback(&canvas);
930 std::unique_ptr<JSONObject> pictureAsJSON = JSONObject::create(); 930 std::unique_ptr<JSONObject> pictureAsJSON = JSONObject::create();
931 pictureAsJSON->setObject("cullRect", objectForSkRect(picture->cullRect())); 931 pictureAsJSON->setObject("cullRect", objectForSkRect(picture->cullRect()));
932 pictureAsJSON->setArray("operations", canvas.log()); 932 pictureAsJSON->setArray("operations", canvas.log());
933 return pictureAsJSON->toPrettyJSONString(); 933 return pictureAsJSON->toPrettyJSONString();
934 } 934 }
935 935
936 void showSkPicture(const SkPicture* picture) { 936 void showSkPicture(const CdlPicture* picture) {
937 WTFLogAlways("%s\n", pictureAsDebugString(picture).utf8().data()); 937 WTFLogAlways("%s\n", pictureAsDebugString(picture).utf8().data());
938 } 938 }
939 #endif 939 #endif
940 940
941 } // namespace blink 941 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698