zoukankan      html  css  js  c++  java
  • cocos2dx 10.1版本 修复真机上白屏问题

    ########################################################

    10.1 版本修改底层记录 (游戏开发群:主席)

    群号:44727718

    #######################################################

    1. 修改:CCTextureCache.h
        1.)添加:VolatileTexture::addDataTexture(CCTexture2D *tt,const void* data,CCTexture2DPixelFormat pixelFormat,unsigned int pixelsWide,unsigned int pixelsHigh,const CCSize& c             ontentSize)
        让其增加数据备份功能:

    void VolatileTexture::addDataTexture(CCTexture2D *tt,const void* data,CCTexture2DPixelFormat pixelFormat,unsigned int pixelsWide,unsigned int pixelsHigh,const CCSize& contentSize)
    {
    if (isReloading)
    return;

    VolatileTexture *vt = 0;
    std::list<VolatileTexture *>::iterator i = textures.begin();
    while( i != textures.end() )
    {
    VolatileTexture *v = *i++;
    if (v->texture == tt) {
    vt = v;
    break;
    }
    }

    if (!vt)
    vt = new VolatileTexture(tt);

    vt->m_eCashedImageType = kImageData;
    vt->m_PixelFormat = pixelFormat;
    vt->m_TextureSize = contentSize;
    if(vt->m_pTextureData)
    {
    delete[] vt->m_pTextureData;
    vt->m_pTextureData = 0;
    }
    switch(pixelFormat)
    {
    case kCCTexture2DPixelFormat_RGBA8888:
    case kCCTexture2DPixelFormat_RGBA4444:
    case kCCTexture2DPixelFormat_RGB5A1:
    case kCCTexture2DPixelFormat_RGB565:
    case kCCTexture2DPixelFormat_A8:
    vt->m_pTextureData = new char[pixelsWide * pixelsHigh * 4];
    memcpy(vt->m_pTextureData,data,pixelsWide * pixelsHigh * 4);
    break;
    case kCCTexture2DPixelFormat_RGB888:
    vt->m_pTextureData = new char[pixelsWide * pixelsHigh * 3];
    memccpy(vt->m_pTextureData,data,pixelsWide * pixelsHigh * 3);
    break;
    }

    }

      2.)CCTextureCache.cpp 
      

    VolatileTexture::~VolatileTexture()
    {
    //Ambition 添加
    if(this->m_pTextureData)
    {
    delete [] this->m_pTextureData;
    }
    textures.remove(this);
    }

    2.修改:CCTexture2D.h

      1.)cpp文件里 initWithData(const void *data, CCTexture2DPixelFormat pixelFormat, unsigned int pixelsWide, unsigned int pixelsHigh, const CCSize& contentSize)

       

    //Ambition 添加
    #if CC_ENABLE_CACHE_TEXTTURE_DATA
    VolatileTexture::addDataTexture(this,data,pixelFormat,pixelsWide,pixelsHigh,contentSize);
    #endif




  • 相关阅读:
    图像压缩算法
    Haar-like特征来龙去脉
    Haar-like特征来龙去脉
    DSP VLIB实验
    DSP VLIB实验
    “主宰世界”的10种算法短评
    “主宰世界”的10种算法短评
    matlab截取图像
    matlab截取图像
    matlab求取积分
  • 原文地址:https://www.cnblogs.com/GameDeveloper/p/2315966.html
Copyright © 2011-2022 走看看