mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
fix ccview resize
This commit is contained in:
+5
-2
@@ -698,12 +698,15 @@ class Game extends EventTarget {
|
||||
this._gfxDevice = new cc.WebGLGFXDevice();
|
||||
}
|
||||
|
||||
const nativeWidth = parseInt(screen.width * window.devicePixelRatio);
|
||||
const nativeHeight = parseInt(screen.height * window.devicePixelRatio);
|
||||
|
||||
this._gfxDevice.initialize({
|
||||
canvasElm: localCanvas,
|
||||
debug: true,
|
||||
devicePixelRatio: window.devicePixelRatio,
|
||||
nativeWidth: screen.width * window.devicePixelRatio,
|
||||
nativeHeight: screen.height * window.devicePixelRatio,
|
||||
nativeWidth,
|
||||
nativeHeight,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -219,8 +219,6 @@ class View extends EventTarget {
|
||||
if (width > 0)
|
||||
view.setDesignResolutionSize(width, height, view._resolutionPolicy);
|
||||
|
||||
// cc.director.root.resize(cc.winSize.width, cc.winSize.height);
|
||||
|
||||
view._resizing = false;
|
||||
|
||||
view.emit('canvas-resize');
|
||||
@@ -559,6 +557,9 @@ class View extends EventTarget {
|
||||
// canvas.width = width * this._devicePixelRatio;
|
||||
// canvas.height = height * this._devicePixelRatio;
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
|
||||
canvas.style.width = width + 'px';
|
||||
canvas.style.height = height + 'px';
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ export abstract class RenderPipeline {
|
||||
if (width * this._shadingScale > this._shadingWidth ||
|
||||
height * this._shadingScale > this._shadingHeight) {
|
||||
this._shadingScale = Math.min(this._shadingWidth / width, this._shadingHeight / height);
|
||||
console.info('SHADING_SCALE: ' + this._shadingScale);
|
||||
console.info('SHADING_SCALE: ' + this._shadingScale.toFixed(4));
|
||||
}
|
||||
|
||||
for (const flow of this._flows) {
|
||||
@@ -365,7 +365,7 @@ export abstract class RenderPipeline {
|
||||
console.info('USE_SMAA: ' + this._useSMAA);
|
||||
console.info('CC_USE_HDR: ' + this._isHDR);
|
||||
console.info('SHADING_SIZE: ' + this._shadingWidth + ' x ' + this._shadingHeight);
|
||||
console.info('SHADING_SCALE: ' + this._shadingScale.toFixed(2));
|
||||
console.info('SHADING_SCALE: ' + this._shadingScale.toFixed(4));
|
||||
console.info('SHADING_COLOR_FORMAT: ' + GFXFormatInfos[this._colorFmt].name);
|
||||
console.info('SHADING_DEPTH_FORMAT: ' + GFXFormatInfos[this._depthStencilFmt].name);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user