Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Functions | Variables
debugger_bindings.cpp File Reference
#include "include/core/SkPicture.h"
#include "include/core/SkString.h"
#include "include/core/SkSurface.h"
#include "include/docs/SkMultiPictureDocument.h"
#include "include/encode/SkPngEncoder.h"
#include "src/base/SkBase64.h"
#include "src/core/SkPicturePriv.h"
#include "src/utils/SkJSONWriter.h"
#include "tools/SkSharingProc.h"
#include "tools/UrlDataManager.h"
#include "tools/debugger/DebugCanvas.h"
#include "tools/debugger/DebugLayerManager.h"
#include "tools/debugger/DrawCommand.h"
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#include <map>
#include <emscripten.h>
#include <emscripten/bind.h>
#include "modules/canvaskit/WasmCommon.h"

Go to the source code of this file.

Classes

struct  ImageInfoNoColorspace
 
class  SkpDebugPlayer
 

Functions

uint32_t MinVersion ()
 
ImageInfoNoColorspace toImageInfoNoColorspace (const SkImageInfo &ii)
 
 EMSCRIPTEN_BINDINGS (my_module)
 

Variables

static constexpr char kMultiMagic [] = "Skia Multi-Picture Doc\n\n"
 

Function Documentation

◆ EMSCRIPTEN_BINDINGS()

EMSCRIPTEN_BINDINGS ( my_module  )

Definition at line 481 of file debugger_bindings.cpp.

481 {
482
483 function("MinVersion", &MinVersion);
484
485 // The main class that the JavaScript in index.html uses
486 class_<SkpDebugPlayer>("SkpDebugPlayer")
487 .constructor<>()
488 .function("changeFrame", &SkpDebugPlayer::changeFrame)
489 .function("deleteCommand", &SkpDebugPlayer::deleteCommand)
490 .function("draw", &SkpDebugPlayer::draw, allow_raw_pointers())
491 .function("drawTo", &SkpDebugPlayer::drawTo, allow_raw_pointers())
492 .function("findCommandByPixel", &SkpDebugPlayer::findCommandByPixel, allow_raw_pointers())
493 .function("getBounds", &SkpDebugPlayer::getBounds)
494 .function("getBoundsForFrame", &SkpDebugPlayer::getBoundsForFrame)
495 .function("getFrameCount", &SkpDebugPlayer::getFrameCount)
496 .function("getImageResource", &SkpDebugPlayer::getImageResource)
497 .function("getImageCount", &SkpDebugPlayer::getImageCount)
498 .function("getImageInfo", &SkpDebugPlayer::getImageInfo)
499 .function("getLayerKeys", &SkpDebugPlayer::getLayerKeys)
500 .function("getLayerSummariesJs", &SkpDebugPlayer::getLayerSummariesJs)
501 .function("getSize", &SkpDebugPlayer::getSize)
502 .function("imageUseInfo", &SkpDebugPlayer::imageUseInfo)
503 .function("imageUseInfoForFrameJs", optional_override([](SkpDebugPlayer& self, const int frame)->JSObject {
504 // -1 as a node id is used throughout the application to mean no layer inspected.
505 return self.imageUseInfo(frame, -1);
506 }))
507 .function("jsonCommandList", &SkpDebugPlayer::jsonCommandList, allow_raw_pointers())
508 .function("lastCommandInfo", &SkpDebugPlayer::lastCommandInfo)
509 .function("loadSkp", &SkpDebugPlayer::loadSkp, allow_raw_pointers())
510 .function("setClipVizColor", &SkpDebugPlayer::setClipVizColor)
511 .function("setCommandVisibility", &SkpDebugPlayer::setCommandVisibility)
512 .function("setGpuOpBounds", &SkpDebugPlayer::setGpuOpBounds)
513 .function("setInspectedLayer", &SkpDebugPlayer::setInspectedLayer)
514 .function("setOriginVisible", &SkpDebugPlayer::setOriginVisible)
515 .function("setOverdrawVis", &SkpDebugPlayer::setOverdrawVis)
516 .function("setAndroidClipViz", &SkpDebugPlayer::setAndroidClipViz);
517
518 // Structs used as arguments or returns to the functions above
519 // TODO(kjlubick) handle this rect like the ones in CanvasKit
520 value_object<SkIRect>("SkIRect")
521 .field("fLeft", &SkIRect::fLeft)
522 .field("fTop", &SkIRect::fTop)
523 .field("fRight", &SkIRect::fRight)
524 .field("fBottom", &SkIRect::fBottom);
525 // emscripten provided the following convenience function for binding vector<T>
526 // https://emscripten.org/docs/api_reference/bind.h.html#_CPPv415register_vectorPKc
527 register_vector<DebugLayerManager::LayerSummary>("VectorLayerSummary");
528 value_object<DebugLayerManager::LayerSummary>("LayerSummary")
530 .field("frameOfLastUpdate", &DebugLayerManager::LayerSummary::frameOfLastUpdate)
533 .field("layerHeight", &DebugLayerManager::LayerSummary::layerHeight);
534
535 value_object<ImageInfoNoColorspace>("ImageInfoNoColorspace")
536 .field("width", &ImageInfoNoColorspace::width)
537 .field("height", &ImageInfoNoColorspace::height)
538 .field("colorType", &ImageInfoNoColorspace::colorType)
539 .field("alphaType", &ImageInfoNoColorspace::alphaType);
540}
emscripten::val JSObject
Definition WasmCommon.h:28
std::string jsonCommandList(sk_sp< SkSurface > surface)
void setCommandVisibility(int index, bool visible)
int findCommandByPixel(SkSurface *surface, int x, int y, int commandIndex)
std::string getImageResource(int index)
void setAndroidClipViz(bool on)
void setOriginVisible(bool on)
JSObject imageUseInfo(int framenumber, int nodeid)
void setOverdrawVis(bool on)
std::string loadSkp(uintptr_t cptr, int length)
void draw(SkSurface *surface)
void changeFrame(int index)
const SkIRect getBoundsForFrame(int32_t frame)
JSArray getLayerSummariesJs()
void drawTo(SkSurface *surface, int32_t index)
void deleteCommand(int index)
void setClipVizColor(JSColor color)
void setGpuOpBounds(bool on)
const SkIRect getBounds()
std::string lastCommandInfo()
int getFrameCount() const
void setInspectedLayer(int nodeId)
ImageInfoNoColorspace getImageInfo(int index)
uint32_t MinVersion()
double frame
Definition examples.cpp:31
Dart_NativeFunction function
Definition fuchsia.cc:51
int32_t fBottom
larger y-axis bounds
Definition SkRect.h:36
int32_t fTop
smaller y-axis bounds
Definition SkRect.h:34
int32_t fLeft
smaller x-axis bounds
Definition SkRect.h:33
int32_t fRight
larger x-axis bounds
Definition SkRect.h:35

◆ MinVersion()

uint32_t MinVersion ( )

Definition at line 53 of file debugger_bindings.cpp.

◆ toImageInfoNoColorspace()

ImageInfoNoColorspace toImageInfoNoColorspace ( const SkImageInfo ii)

Definition at line 63 of file debugger_bindings.cpp.

63 {
64 return (ImageInfoNoColorspace){ii.width(), ii.height(), ii.colorType(), ii.alphaType()};
65}
int width() const
SkAlphaType alphaType() const
SkColorType colorType() const
int height() const

Variable Documentation

◆ kMultiMagic

constexpr char kMultiMagic[] = "Skia Multi-Picture Doc\n\n"
staticconstexpr

Definition at line 51 of file debugger_bindings.cpp.