javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/qt/library/graphics/qt/imageloaderimpl.cpp
changeset 80 d6dafc5d983f
parent 49 35baca0e7a2e
equal deleted inserted replaced
78:71ad690e91f5 80:d6dafc5d983f
    14 #include "graphics.h"
    14 #include "graphics.h"
    15 #include "gfxlog.h"
    15 #include "gfxlog.h"
    16 
    16 
    17 namespace Java { namespace GFX {
    17 namespace Java { namespace GFX {
    18 
    18 
    19 ImageloaderImpl::ImageloaderImpl()
    19 ImageloaderImpl::ImageloaderImpl(TImageType aType)
    20 : mBufferData(new bufferData), loadSizeWidth(-1), loadSizeHeight(-1)
    20 : mBufferData(new bufferData), loadSizeWidth(-1), loadSizeHeight(-1), mResultImageType(aType)
    21 {
    21 {
    22     GFX_LOG_FUNC_CALL();
    22     GFX_LOG_FUNC_CALL();
    23     mBufferData->buffer = NULL;
    23     mBufferData->buffer = NULL;
    24     mBufferData->allocation = 0;
    24     mBufferData->allocation = 0;
    25     mBufferData->capacity = 0;
    25     mBufferData->capacity = 0;
    98     if(image.isNull())
    98     if(image.isNull())
    99     {
    99     {
   100         throwError(imgReader);
   100         throwError(imgReader);
   101     }
   101     }
   102     
   102     
   103     Image* img = GraphicsFactory::createImage(image);
   103     Image* img = GraphicsFactory::createImage(image, mResultImageType);
   104 
   104 
   105     // cleanup, release buffer
   105     // cleanup, release buffer
   106     resetData();
   106     resetData();
   107     
   107     
   108     return img;
   108     return img;
   129     if(image.isNull())
   129     if(image.isNull())
   130     {
   130     {
   131         throwError(imgReader);
   131         throwError(imgReader);
   132     }
   132     }
   133 
   133 
   134     return GraphicsFactory::createImage(image);
   134     return GraphicsFactory::createImage(image, mResultImageType);
   135 }
   135 }
   136 
   136 
   137 void ImageloaderImpl::setLoadSize(int aWidth, int aHeight)
   137 void ImageloaderImpl::setLoadSize(int aWidth, int aHeight)
   138 {
   138 {
   139     loadSizeWidth = aWidth;
   139     loadSizeWidth = aWidth;
   140     loadSizeHeight = aHeight;
   140     loadSizeHeight = aHeight;
   141 }
   141 }
       
   142 
       
   143 void ImageloaderImpl::setResultImageType(TImageType aType)
       
   144     {
       
   145     Q_ASSERT((aType == EImage) || (aType == EPixmap));
       
   146     mResultImageType = aType;
       
   147     }
       
   148 
   142 
   149 
   143 // Private
   150 // Private
   144 void ImageloaderImpl::growBuffer(const int aNewSize)
   151 void ImageloaderImpl::growBuffer(const int aNewSize)
   145 {
   152 {
   146     GFX_LOG_FUNC_CALL();
   153     GFX_LOG_FUNC_CALL();