チェンジセット 1656: as3/gunyarapaint/trunk

差分発生行の前後
無視リスト:
コミット日時:
2008/10/19 04:45:24 (5 年前)
コミッタ:
tasuku
ログメッセージ:

enhanced error handling with combined layer image > 2880px

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • as3/gunyarapaint/trunk/gunyarapaint/src/gplogplayer.mxml

    r1655 r1656  
    4545    if (debugOekakiId != 0) { 
    4646      parameters['oelogUrl'] = 'http://dic.nicovideo.jp/oelog/' + debugOekakiId; 
     47      if (debugOekakiRefId != 0) { 
     48        parameters['baseImgUrl'] = 'http://dic.nicovideo.jp/oekaki_layers/' + debugOekakiRefId; 
     49        parameters['baseImgInfoUrl'] = 'http://dic.nicovideo.jp/oekaki_info/' + debugOekakiRefId; 
     50      } 
    4751      debugCheckPngUrl = 'http://dic.nicovideo.jp/oekaki/' + debugOekakiId + '.png'; 
    4852      new Com().sendGetUrlRequest(debugCheckPngUrl, function(com:Com):void { debugCheckPng = com.data; }); 
     
    163167  ]]> 
    164168  </mx:Script> 
    165   <mx:Label x="313" y="11" text="ver.2008101802"/> 
     169  <mx:Label x="313" y="11" text="ver.2008101901"/> 
    166170</mx:Application> 
  • as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.as

    r1655 r1656  
    5353    parameters['redirectUrl'] = 'http://dic.dev.nicovideo.jp/' 
    5454    parameters['undoBufferSize'] = 16; 
    55     parameters['canvasWidth'] = 317
    56     parameters['canvasHeight'] = 317
     55    parameters['canvasWidth'] = 500
     56    parameters['canvasHeight'] = 500
    5757    // debug buttons 
    5858    logPlayButton.addEventListener(FlexEvent.BUTTON_DOWN, playLogHandler); 
     
    301301    allEnabled = true; 
    302302    extChangeAlertOnUnload(true); 
    303     Alert.show('投稿時にエラーが発生いたしました。もう1度投稿してみてください!\n以下の情報を不具合報告掲示板に書いていただけると嬉しいです…\n' + e.message + '\n' + e.getStackTrace(), ALERT_TITLE); 
     303    Alert.show(e.message, ALERT_TITLE); 
    304304  } 
    305305} 
  • as3/gunyarapaint/trunk/gunyarapaint/src/gunyarapaint.mxml

    r1655 r1656  
    1212  </mx:Script> 
    1313  <mx:Canvas id="toolCanvas" x="0" y="0" width="685" height="102"> 
    14     <mx:Label id="versionLabel" x="238" y="9" text="ver.2008101802"/> 
     14    <mx:Label id="versionLabel" x="238" y="9" text="ver.2008101901"/> 
    1515    <mx:Label x="28" y="7" text="名前"/> 
    1616    <mx:TextInput id="fromTextInput" x="55" y="3" maxChars="32" fontSize="14" focusThickness="0"/> 
  • as3/gunyarapaint/trunk/gunyarapaint/src/org/libspark/gunyarapaint/entities/GPLayerArray.as

    r1654 r1656  
    1313  import flash.geom.Point; 
    1414  import flash.geom.Rectangle; 
     15  import flash.utils.ByteArray; 
    1516   
    1617  import mx.controls.Alert; 
     
    219220    // レイヤーをそれぞれ縦に連結したBitmapDataと、レイヤ情報が入ったObjectを取得。宗原さまThank you! 
    220221    public function get dataForPost():Object { 
    221       // BitmapData 
    222       var cb:BitmapData = new BitmapData(_width, _height * _a.length); 
    223       var info:Array = new Array(); 
    224       var rect:Rectangle = new Rectangle(0, 0, _width, _height); 
    225       for (var i:uint = 0; i < _a.length; i++) { 
    226         cb.copyPixels(_a[i].bitmapData, rect, new Point(0, _height * i)); 
    227         info.push(_a[i].to_object); 
    228       } 
    229       return { 
    230         'image': PNGEncoder.encode(_combinedBitmapData), 
    231         'layers_image': PNGEncoder.encode(cb), 
    232         'info': { 
    233           'width': _width, 
    234           'height': _height, 
    235           'layer_infos': info 
     222      if (_height * _a.length > 2880) { 
     223        throw new Error('レイヤの枚数を' + Math.floor(2880.0 / _height) + '枚まで減らして再投稿お願いいたします!'); 
     224      } 
     225      try { 
     226        var cb:BitmapData = new BitmapData(_width, _height * _a.length); 
     227        var info:Array = new Array(); 
     228        var rect:Rectangle = new Rectangle(0, 0, _width, _height); 
     229        for (var i:uint = 0; i < _a.length; i++) { 
     230          cb.copyPixels(_a[i].bitmapData, rect, new Point(0, _height * i)); 
     231          info.push(_a[i].to_object); 
    236232        } 
    237       }; 
     233        var image:ByteArray = PNGEncoder.encode(_combinedBitmapData); 
     234        var layers_image:ByteArray = PNGEncoder.encode(cb); 
     235        if (!image || !layers_image) { 
     236          throw new Error(); 
     237        } 
     238        return { 
     239          'image': image, 
     240          'layers_image': layers_image, 
     241          'info': { 
     242            'width': _width, 
     243            'height': _height, 
     244            'layer_infos': info 
     245          } 
     246        };         
     247      } catch (e:Error) { 
     248        throw new Error('投稿用にレイヤーを連結するのに失敗しました。使っていないアプリケーションを終了して、再度投稿をお試しください。'); 
     249      } 
     250      return null; // for avoiding compiler bug 
    238251    } 
    239252