Merge pull request #2301 from pandamicro/v1.8-release

Fix supportsNPOT and ignore contentSize in Texture.initWithData
This commit is contained in:
Jare Guo
2018-02-01 15:50:53 +08:00
committed by GitHub
5 changed files with 15 additions and 6 deletions
+2
View File
@@ -64,6 +64,7 @@ if (CC_DEBUG) {
"1509": "Argument target must be non-nullptr", //isScheduled
"1510": "cc.Scheduler: Illegal target which doesn't have uuid or instanceId",
"1511": "cc.Scheduler: pause state of the scheduled task doesn't match the element pause state in Scheduler, the given paused state will be ignored",
"1512": "cc.Scheduler: updateFunc parameter is deprecated in scheduleUpdate function, and will be removed in v2.0",
//Node: 1600
"1600": "getZOrder is deprecated. Please use getLocalZOrder instead.", //getZOrder
"1601": "setZOrder is deprecated. Please use setLocalZOrder instead.", //setZOrder
@@ -239,6 +240,7 @@ if (CC_DEBUG) {
"3115": "Frame Grabber: could not attach texture to framebuffer", //CCGrabber.grab
"3116": "WebGLRenderingContext.CLAMP_TO_EDGE should be used in NPOT textures", //setTexParameters
"3117": "Mimpap texture only works in POT textures", //generateMipmap
"3118": "contentSize parameter is deprecated and ignored for cc.Texture2D initWithData function", // initWithData
//RectWidth: 3300
"3300": "Rect width exceeds maximum margin: %s", //RectWidth
//RectHeight: 3400
+1 -1
View File
@@ -244,7 +244,7 @@ cc.configuration = /** @lends cc.configuration# */{
this._supportsPVRTC = this.checkForGLExtension("GL_IMG_texture_compression_pvrtc");
locValueDict["gl.supports_PVRTC"] = this._supportsPVRTC;
this._supportsNPOT = false; //true;
this._supportsNPOT = true;
locValueDict["gl.supports_NPOT"] = this._supportsNPOT;
this._supportsBGRA8888 = this.checkForGLExtension("GL_IMG_texture_format_BGRA888");
+4
View File
@@ -618,6 +618,10 @@ cc.Scheduler = cc._Class.extend({
}
}
if (updateFunc) {
cc.warnID(1512);
}
var listElement = ListEntry.get(null, null, updateFunc, target, priority, paused, false);
var ppList;
+6 -3
View File
@@ -352,7 +352,7 @@ var Texture2D = cc.Class(/** @lends cc.Texture2D# */{
* @param {Number} pixelFormat
* @param {Number} pixelsWidth
* @param {Number} pixelsHeight
* @param {Size} contentSize
* @param {Size} contentSize contentSize is deprecated and ignored
* @return {Boolean}
*/
initWithData: function (data, pixelFormat, pixelsWidth, pixelsHeight, contentSize) {
@@ -854,14 +854,17 @@ game.once(game.EVENT_RENDERER_INITED, function () {
};
_p.initWithData = function (data, pixelFormat, pixelsWidth, pixelsHeight, contentSize) {
if (contentSize) {
cc.warnID(3118);
}
var opts = _getSharedOptions();
opts.image = data;
opts.format = pixelFormat;
opts.width = pixelsWidth;
opts.height = pixelsHeight;
this.update(opts);
this.width = contentSize.width;
this.height = contentSize.height;
this.width = pixelsWidth;
this.height = pixelsHeight;
this.loaded = true;
this.emit("load");
return true;
@@ -172,7 +172,7 @@ proto.initWithWidthAndHeight = function(width, height, format, depthStencilForma
if (!node._texture)
return false;
locTexture.initWithData(data, node._pixelFormat, powW, powH, cc.size(width, height));
locTexture.initWithData(data, node._pixelFormat, powW, powH);
//free( data );
var oldRBO = gl.getParameter(gl.RENDERBUFFER_BINDING);
@@ -181,7 +181,7 @@ proto.initWithWidthAndHeight = function(width, height, format, depthStencilForma
this._textureCopy = new cc.Texture2D();
if (!this._textureCopy)
return false;
this._textureCopy.initWithData(data, node._pixelFormat, powW, powH, cc.size(width, height));
this._textureCopy.initWithData(data, node._pixelFormat, powW, powH);
}
// generate FBO