comparison src/modules/image/ImageData.cpp @ 1420:2a5ef265e040 image-CompressedData

Added support for DXT1/3/5 and BC5/7 compressed textures via love.image.CompressedData. Some internals are still iffy. - added a new CompressedData type to love.image - added love.image.isCompressed(file or data) - love.graphics.newImage automatically tests for compression when loading a file - added love.graphics.isSupported strings for DXT, BC5, and BC7 Compressed textures meant to be used on the GPU offer huge performance gains when - loading the texture from a file - loading the texture from RAM to VRAM - loading mipmaps - rendering
author Alex Szpakowski <slime73@gmail.com>
date Thu, 04 Apr 2013 19:09:18 -0300
parents d46820870f0a
children 377f9dad7a2d
comparison
equal deleted inserted replaced
1419:edd946442f86 1420:2a5ef265e040
37 ImageData::~ImageData() 37 ImageData::~ImageData()
38 { 38 {
39 delete mutex; 39 delete mutex;
40 } 40 }
41 41
42 int ImageData::getSize() const
43 {
44 return getWidth()*getHeight()*sizeof(pixel);
45 }
46
42 void *ImageData::getData() const 47 void *ImageData::getData() const
43 { 48 {
44 return data; 49 return data;
45 } 50 }
46 51
47 int ImageData::getSize() const 52 bool ImageData::inside(int x, int y) const
48 { 53 {
49 return getWidth()*getHeight()*sizeof(pixel); 54 return x >= 0 && x < getWidth() && y >= 0 && y < getHeight();
50 } 55 }
51 56
52 int ImageData::getWidth() const 57 int ImageData::getWidth() const
53 { 58 {
54 return width; 59 return width;
55 } 60 }
56 61
57 int ImageData::getHeight() const 62 int ImageData::getHeight() const
58 { 63 {
59 return height; 64 return height;
60 }
61
62 bool ImageData::inside(int x, int y) const
63 {
64 return x >= 0 && x < getWidth() && y >= 0 && y < getHeight();
65 } 65 }
66 66
67 void ImageData::setPixel(int x, int y, pixel c) 67 void ImageData::setPixel(int x, int y, pixel c)
68 { 68 {
69 if (!inside(x, y)) 69 if (!inside(x, y))