• wasm的 surface.makeSurface


    wasm的 surface.makeSurface js中:
      

    CanvasKit.Surface.prototype.makeSurface = function(imageInfo) {
        CanvasKit.setCurrentContext(this._context);
        var s = this._makeSurface(imageInfo);
        s._context = this._context;
        return s;
      };

     
      
    c++中  
     

     .function("_makeSurface", optional_override([](SkSurface& self, SimpleImageInfo sii)->sk_sp<SkSurface> {
                return self.makeSurface(toSkImageInfo(sii));
            }), allow_raw_pointers())
            
            
    
    SkImageInfo toSkImageInfo(const SimpleImageInfo& sii) {
        return SkImageInfo::Make(sii.width, sii.height, sii.colorType, sii.alphaType,
                                 sii.colorSpace ? sii.colorSpace : SkColorSpace::MakeSRGB());
    } 

    实现类中:

    sk_sp<SkSurface> SkSurface::makeSurface(const SkImageInfo& info) {
        return asSB(this)->onNewSurface(info);
    }


    最终到gpu中:

    sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrRecordingContext* rContext,
                                                 const SkSurfaceCharacterization& c,
                                                 SkBudgeted budgeted) {
        if (!rContext || !c.isValid()) {
            return nullptr;
        }
    
        if (c.usesGLFBO0()) {
            // If we are making the surface we will never use FBO0.
            return nullptr;
        }
    
        if (c.vulkanSecondaryCBCompatible()) {
            return nullptr;
        }
    
        auto device = rContext->priv().createDevice(budgeted, c.imageInfo(), SkBackingFit::kExact,
                                                    c.sampleCount(), GrMipmapped(c.isMipMapped()),
                                                    c.isProtected(), c.origin(), c.surfaceProps(),
                                                    skgpu::BaseDevice::InitContents::kClear);
        if (!device) {
            return nullptr;
        }
    
        sk_sp<SkSurface> result = sk_make_sp<SkSurface_Gpu>(std::move(device));
    #ifdef SK_DEBUG
        if (result) {
            SkASSERT(result->isCompatible(c));
        }
    #endif
    
        return result;
    }
  • 相关阅读:
    驱动开发环境安装
    FireMonkey下的异形窗体拖动(句柄转换)
    Microsoft Win32 Programmer's Reference.chm
    Qt 访问网络的 HttpClient(封装QNetworkAccessManager,且有服务端)
    JBPM4 安装和配置
    DDD:谈谈数据模型、领域模型、视图模型和命令模型
    多个文件目录下Makefile的写法
    .NET程序集1
    Ajax初步理解
    Kemaswill 机器学习 数据挖掘 推荐系统 Ranking SVM 简介
  • 原文地址:https://www.cnblogs.com/bigben0123/p/16599521.html
Copyright © 2020-2023  润新知