Skip to content

Commit fa8edd4

Browse files
authored
Merge pull request #3464 from 1scaR1/develop
Enable support of retina displays
2 parents cef6134 + 7d04cbc commit fa8edd4

File tree

2 files changed

+3
-33
lines changed

2 files changed

+3
-33
lines changed

cocos2d/core/platform/CCConfig.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -165,23 +165,6 @@ cc.TEXTURE_ATLAS_USE_VAO = 0;
165165
*/
166166
cc.TEXTURE_NPOT_SUPPORT = 0;
167167

168-
/**
169-
* <p>
170-
* If enabled, cocos2d supports retina display.<br/>
171-
* For performance reasons, it's recommended disable it in games without retina display support, like iPad only games.<br/>
172-
* <br/>
173-
* To enable set it to 1. Use 0 to disable it. Enabled by default.<br/>
174-
* <br/>
175-
* This value governs only the PNG, GIF, BMP, images.<br/>
176-
* This value DOES NOT govern the PVR (PVR.GZ, PVR.CCZ) files. If NPOT PVR is loaded, then it will create an NPOT texture ignoring this value.<br/>
177-
* To modify it, in Web engine please refer to CCConfig.js, in JSB please refer to CCConfig.h
178-
* </p>
179-
* @constant
180-
* @type {Number}
181-
* @deprecated This value will be removed in 1.1 and NPOT textures will be loaded by default if the device supports it.
182-
*/
183-
cc.RETINA_DISPLAY_SUPPORT = 1;
184-
185168
/**
186169
* <p>
187170
* It's the suffix that will be appended to the files in order to load "retina display" images.<br/>
@@ -262,13 +245,6 @@ cc.LABELATLAS_DEBUG_DRAW = 0;
262245

263246
cc.DRAWNODE_TOTAL_VERTICES = 20000;
264247

265-
/**
266-
* Whether or not support retina display
267-
* @constant
268-
* @type {Number}
269-
*/
270-
cc.IS_RETINA_DISPLAY_SUPPORTED = 0;
271-
272248
/**
273249
* Default engine
274250
* @constant

cocos2d/core/platform/CCMacro.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,8 @@ cc.FLT_EPSILON = 0.0000001192092896;
244244
* @return {Number}
245245
* @function
246246
*/
247-
cc.contentScaleFactor = cc.IS_RETINA_DISPLAY_SUPPORTED ? function () {
247+
cc.contentScaleFactor = function () {
248248
return cc.director._contentScaleFactor;
249-
} : function () {
250-
return 1;
251249
};
252250

253251
/**
@@ -312,12 +310,10 @@ cc._sizePixelsToPointsOut = function (sizeInPixels, outSize) {
312310
* @return {cc.Rect}
313311
* @function
314312
*/
315-
cc.rectPixelsToPoints = cc.IS_RETINA_DISPLAY_SUPPORTED ? function (pixel) {
313+
cc.rectPixelsToPoints = function (pixel) {
316314
var scale = cc.contentScaleFactor();
317315
return cc.rect(pixel.x / scale, pixel.y / scale,
318316
pixel.width / scale, pixel.height / scale);
319-
} : function (p) {
320-
return p;
321317
};
322318

323319
/**
@@ -326,12 +322,10 @@ cc.rectPixelsToPoints = cc.IS_RETINA_DISPLAY_SUPPORTED ? function (pixel) {
326322
* @return {cc.Rect}
327323
* @function
328324
*/
329-
cc.rectPointsToPixels = cc.IS_RETINA_DISPLAY_SUPPORTED ? function (point) {
325+
cc.rectPointsToPixels = function (point) {
330326
var scale = cc.contentScaleFactor();
331327
return cc.rect(point.x * scale, point.y * scale,
332328
point.width * scale, point.height * scale);
333-
} : function (p) {
334-
return p;
335329
};
336330

337331
//some gl constant variable

0 commit comments

Comments
 (0)