国产精品高清免费在线视频-亚洲精品午夜福利一区-91成人精品国产免费男男-噼里啪啦日本一区二区

上海啟嘟渡科技商貿(mào)有限公司
SEARCH

與我們合作

我們專(zhuān)注提供互聯(lián)網(wǎng)一站式服務(wù),助力企業(yè)品牌宣傳多平臺(tái)多途徑導(dǎo)流量。
主營(yíng)業(yè)務(wù):網(wǎng)站建設(shè)、移動(dòng)端微信小程序開(kāi)發(fā)、營(yíng)銷(xiāo)推廣、基礎(chǔ)網(wǎng)絡(luò)、品牌形象策劃等

您也可通過(guò)下列途徑與我們?nèi)〉寐?lián)系:

微 信: wxyunyingzhe

手 機(jī): 15624122141

郵 箱:

如何優(yōu)化activity的加載速度

更新時(shí)間:2025-01-10 13:47:44

android 為了提高滾動(dòng)等各方面的繪制速度,可以為每一個(gè)view建立一個(gè)緩存,使用 View.buildDrawingCache為自己的view 建立相應(yīng)的緩存,

這 個(gè)所謂的緩存,實(shí)際上就是一個(gè)Bitmap對(duì)象。只是 這個(gè) bitmap 對(duì)象可以有多種格式而已,如

Bitmap.Config.ARGB_8888;

Bitmap.Config.ARGB_4444;

Bitmap.Config.ARGB_8888;

Bitmap.Config.ARGB_8888;

Bitmap.Config.RGB_565;

默認(rèn)的格式是Bitmap.Config.ARGB_8888.,但大多數(shù)嵌入式設(shè)備使用的顯示格式都是Bitmap.Config.RGB_565. 對(duì)于后者, 并沒(méi)有

alpha 值,所以繪制的時(shí)候不需要計(jì)算alpha合成,速遞當(dāng)讓快些。其次,RGB_565可以直接使用優(yōu)化了的memcopy函數(shù),效率相對(duì)高出許多。

所以, 在用buildDrawingCache建立緩存時(shí),可以使用RGB_565格式。但是如何制定這個(gè)格式呢 ?buildDrawingCache有兩個(gè)版本, buildDrawingCache(boolean)和buildDrawingCache()。并沒(méi)有任何參數(shù)可以設(shè)置rgb格式,看看源碼先:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 publicvoid buildDrawingCache(boolean autoScale){if((mPrivateFlags & DRAWING_CACHE_VALID)==0||(autoScale ?(mDrawingCache

==null|| mDrawingCache.get()==null):(mUnscaledDrawingCache ==null|| mUnscaledDrawingCache.get()==null))){if(ViewDebug.TRACE_HIERARCHY){ ViewDebug.trace(this, ViewDebug.HierarchyTraceType.BUILD_CACHE);}if(Config.DEBUG&& ViewDebug.profileDrawing){ EventLog.writeEvent(60002, hashCode());}int width = mRight - mLeft;int height = mBottom - mTop;final AttachInfo attachInfo = mAttachInfo;finalboolean scalingRequired = attachInfo !=null&& attachInfo.mScalingRequired;if(autoScale && scalingRequired){ width =(int)((width * attachInfo.mApplicationScale)+ 0.5f); height =(int)((height * attachInfo.mApplicationScale)+ 0.5f);}finalint drawingCacheBackgroundColor = mDrawingCacheBackgroundColor;finalboolean opaque = drawingCacheBackgroundColor !=0||(mBGDrawable !=null&& mBGDrawable.getOpacity()== PixelFormat.OPAQUE);if(width // Projected bitmap size in bytes ViewConfiguration.get(mContext).getScaledMaximumDrawingCacheSize())){ destroyDrawingCache();return;}boolean clear =true; Bitmap bitmap = autoScale ?(mDrawingCache ==null?null: mDrawingCache.get()):(mUnscaledDrawingCache ==null?null: mUnscaledDrawingCache.get());if(bitmap

==null|| bitmap.getWidth()!= width || bitmap.getHeight()!= height){ Bitmap.Config quality;if(!opaque){switch(mViewFlags & DRAWING_CACHE_QUALITY_MASK){case DRAWING_CACHE_QUALITY_AUTO: quality = Bitmap.Config.ARGB_8888;break;case DRAWING_CACHE_QUALITY_LOW: quality = Bitmap.Config.ARGB_4444;break;case DRAWING_CACHE_QUALITY_HIGH: quality = Bitmap.Config.ARGB_8888;break;default: quality = Bitmap.Config.ARGB_8888;break;}}else{ quality = Bitmap.Config.RGB_565;}// Try to cleanup memoryif(bitmap !=null) bitmap.recycle();try{ bitmap = Bitmap.createBitmap(width, height, quality); bitmap.setDensity(getResources().getDisplayMetrics().densityDpi);if(autoScale){ mDrawingCache =new SoftReference(bitmap);}else{ mUnscaledDrawingCache =new SoftReference(bitmap);}}catch(OutOfMemoryError e){// If there is not enough memory to create the bitmap cache, just// ignore the issue as bitmap caches are not required to draw the// view hierarchyif(autoScale){ mDrawingCache =null;}else{ mUnscaledDrawingCache =null;}return;} clear = drawingCacheBackgroundColor !=0;}Canvas canvas;if(attachInfo !=null){ canvas = attachInfo.mCanvas;if(canvas

==null){ canvas =newCanvas();} canvas.setBitmap(bitmap);// Temporarily clobber the cached Canvas in case one of our children// is also using a drawing cache. Without this, the children would// steal the canvas by attaching their own bitmap to it and bad, bad// thing would happen (invisible views, corrupted drawings, etc.) attachInfo.mCanvas=null;}else{// This case should hopefully never or seldom happen canvas =newCanvas(bitmap);}if(clear){ bitmap.eraseColor(drawingCacheBackgroundColor);} computeScroll();finalint restoreCount = canvas.save();if(autoScale && scalingRequired){finalfloat scale = attachInfo.mApplicationScale; canvas.scale(scale, scale);} canvas.translate(-mScrollX, -mScrollY); mPrivateFlags |= DRAWN;// Fast path for layouts with no backgroundsif((mPrivateFlags & SKIP_DRAW)== SKIP_DRAW){if(ViewDebug.TRACE_HIERARCHY){ ViewDebug.trace(this, ViewDebug.HierarchyTraceType.DRAW);} mPrivateFlags &= ~DIRTY_MASK; dispatchDraw(canvas);}else{ draw(canvas);} canvas.restoreToCount(restoreCount);if(attachInfo !=null){// Restore the cached Canvas for our siblings attachInfo.mCanvas= canvas;} mPrivateFlags |= DRAWING_CACHE_VALID;}}

停止即為不過(guò),但是主板也有故障嫌疑的C3:內(nèi)存問(wèn)題D3、D4:此都為內(nèi)存問(wèn)題,但是主板內(nèi)存插槽也有可能

多重隨機(jī)標(biāo)簽

猜你喜歡文章

QQ客服 電話咨詢(xún)
亚洲综合精品天堂夜夜| 午夜视频成人在线观看| 欧美日韩国产福利在线观看| 国内精品偷拍视频久久| 国产又粗又猛又长又大| 久久热麻豆国产精品视频| 欧美中文字幕日韩精品| 欧美日韩国产综合特黄| 欧美一区二区在线日韩| 99久久人妻精品免费一区| 久久久精品区二区三区| 日本欧美三级中文字幕| 女同伦理国产精品久久久| 亚洲美女国产精品久久| 超薄肉色丝袜脚一区二区| 欧美日韩综合综合久久久| 免费性欧美重口味黄色| av在线免费观看一区二区三区| 人妻少妇系列中文字幕| 亚洲男人的天堂久久a| 97人妻精品一区二区三区男同 | 一区二区三区日韩中文| 亚洲专区中文字幕在线| 国产免费操美女逼视频| 精产国品一二三区麻豆| 加勒比系列一区二区在线观看 | 成人午夜免费观看视频| 一区二区三区亚洲国产| 成年午夜在线免费视频| 国产又粗又长又大高潮视频| 欧美日韩国产精品第五页| 久久热九九这里只有精品| 色老汉在线视频免费亚欧| 91麻豆视频国产一区二区| 欧美日韩在线视频一区| 国内午夜精品视频在线观看| 久久99一本色道亚洲精品| 亚洲一区二区三区有码| 日本丁香婷婷欧美激情| 日本91在线观看视频| 在线观看欧美视频一区|