コード例 #1
0
ファイル: PictureDrawable.cs プロジェクト: hakeemsm/XobotOS
		public override void draw(android.graphics.Canvas canvas)
		{
			if (mPicture != null)
			{
				android.graphics.Rect bounds = getBounds();
				canvas.save();
				canvas.clipRect(bounds);
				canvas.translate(bounds.left, bounds.top);
				canvas.drawPicture(mPicture);
				canvas.restore();
			}
		}
コード例 #2
0
ファイル: TargetDrawable.cs プロジェクト: hakeemsm/XobotOS
		public virtual void draw(android.graphics.Canvas canvas)
		{
			if (mDrawable == null)
			{
				return;
			}
			canvas.save(android.graphics.Canvas.MATRIX_SAVE_FLAG);
			canvas.translate(mTranslationX, mTranslationY);
			canvas.scale(mScaleX, mScaleY);
			canvas.translate(-0.5f * getWidth(), -0.5f * getHeight());
			mDrawable.setAlpha((int)Sharpen.Util.Round(mAlpha * 255f));
			mDrawable.draw(canvas);
			canvas.restore();
		}
コード例 #3
0
ファイル: AbsSeekBar.cs プロジェクト: hakeemsm/XobotOS
		protected internal override void onDraw(android.graphics.Canvas canvas)
		{
			lock (this)
			{
				base.onDraw(canvas);
				if (mThumb != null)
				{
					canvas.save();
					// Translate the padding. For the x, we need to allow the thumb to
					// draw in its extra space
					canvas.translate(mPaddingLeft - mThumbOffset, mPaddingTop);
					mThumb.draw(canvas);
					canvas.restore();
				}
			}
		}
コード例 #4
0
ファイル: ViewGroup.cs プロジェクト: hakeemsm/XobotOS
		/// <summary>Draw one child of this View Group.</summary>
		/// <remarks>
		/// Draw one child of this View Group. This method is responsible for getting
		/// the canvas in the right state. This includes clipping, translating so
		/// that the child's scrolled origin is at 0, 0, and applying any animation
		/// transformations.
		/// </remarks>
		/// <param name="canvas">The canvas on which to draw the child</param>
		/// <param name="child">Who to draw</param>
		/// <param name="drawingTime">The time at which draw is occuring</param>
		/// <returns>True if an invalidate() was issued</returns>
		protected internal virtual bool drawChild(android.graphics.Canvas canvas, android.view.View
			 child, long drawingTime)
		{
			bool more = false;
			int cl = child.mLeft;
			int ct = child.mTop;
			int cr = child.mRight;
			int cb = child.mBottom;
			bool childHasIdentityMatrix = child.hasIdentityMatrix();
			int flags = mGroupFlags;
			if ((flags & FLAG_CLEAR_TRANSFORMATION) == FLAG_CLEAR_TRANSFORMATION)
			{
				mChildTransformation.clear();
				mGroupFlags &= ~FLAG_CLEAR_TRANSFORMATION;
			}
			android.view.animation.Transformation transformToApply = null;
			android.view.animation.Transformation invalidationTransform;
			android.view.animation.Animation a = child.getAnimation();
			bool concatMatrix = false;
			bool scalingRequired = false;
			bool caching;
			int layerType = mDrawLayers ? child.getLayerType() : LAYER_TYPE_NONE;
			bool hardwareAccelerated = canvas.isHardwareAccelerated();
			if ((flags & FLAG_CHILDREN_DRAWN_WITH_CACHE) == FLAG_CHILDREN_DRAWN_WITH_CACHE ||
				 (flags & FLAG_ALWAYS_DRAWN_WITH_CACHE) == FLAG_ALWAYS_DRAWN_WITH_CACHE)
			{
				caching = true;
				if (mAttachInfo != null)
				{
					scalingRequired = mAttachInfo.mScalingRequired;
				}
			}
			else
			{
				caching = (layerType != LAYER_TYPE_NONE) || hardwareAccelerated;
			}
			if (a != null)
			{
				bool initialized = a.isInitialized();
				if (!initialized)
				{
					a.initialize(cr - cl, cb - ct, getWidth(), getHeight());
					a.initializeInvalidateRegion(0, 0, cr - cl, cb - ct);
					child.onAnimationStart();
				}
				more = a.getTransformation(drawingTime, mChildTransformation, scalingRequired ? mAttachInfo
					.mApplicationScale : 1f);
				if (scalingRequired && mAttachInfo.mApplicationScale != 1f)
				{
					if (mInvalidationTransformation == null)
					{
						mInvalidationTransformation = new android.view.animation.Transformation();
					}
					invalidationTransform = mInvalidationTransformation;
					a.getTransformation(drawingTime, invalidationTransform, 1f);
				}
				else
				{
					invalidationTransform = mChildTransformation;
				}
				transformToApply = mChildTransformation;
				concatMatrix = a.willChangeTransformationMatrix();
				if (more)
				{
					if (!a.willChangeBounds())
					{
						if ((flags & (FLAG_OPTIMIZE_INVALIDATE | FLAG_ANIMATION_DONE)) == FLAG_OPTIMIZE_INVALIDATE)
						{
							mGroupFlags |= FLAG_INVALIDATE_REQUIRED;
						}
						else
						{
							if ((flags & FLAG_INVALIDATE_REQUIRED) == 0)
							{
								// The child need to draw an animation, potentially offscreen, so
								// make sure we do not cancel invalidate requests
								mPrivateFlags |= DRAW_ANIMATION;
								invalidate(cl, ct, cr, cb);
							}
						}
					}
					else
					{
						if (mInvalidateRegion == null)
						{
							mInvalidateRegion = new android.graphics.RectF();
						}
						android.graphics.RectF region = mInvalidateRegion;
						a.getInvalidateRegion(0, 0, cr - cl, cb - ct, region, invalidationTransform);
						// The child need to draw an animation, potentially offscreen, so
						// make sure we do not cancel invalidate requests
						mPrivateFlags |= DRAW_ANIMATION;
						int left = cl + (int)region.left;
						int top = ct + (int)region.top;
						invalidate(left, top, left + (int)(region.width() + .5f), top + (int)(region.height
							() + .5f));
					}
				}
			}
			else
			{
				if ((flags & FLAG_SUPPORT_STATIC_TRANSFORMATIONS) == FLAG_SUPPORT_STATIC_TRANSFORMATIONS)
				{
					bool hasTransform = getChildStaticTransformation(child, mChildTransformation);
					if (hasTransform)
					{
						int transformType = mChildTransformation.getTransformationType();
						transformToApply = transformType != android.view.animation.Transformation.TYPE_IDENTITY
							 ? mChildTransformation : null;
						concatMatrix = (transformType & android.view.animation.Transformation.TYPE_MATRIX
							) != 0;
					}
				}
			}
			concatMatrix |= !childHasIdentityMatrix;
			// Sets the flag as early as possible to allow draw() implementations
			// to call invalidate() successfully when doing animations
			child.mPrivateFlags |= DRAWN;
			if (!concatMatrix && canvas.quickReject(cl, ct, cr, cb, android.graphics.Canvas.EdgeType
				.BW) && (child.mPrivateFlags & DRAW_ANIMATION) == 0)
			{
				return more;
			}
			float alpha = child.getAlpha();
			// Bail out early if the view does not need to be drawn
			if (alpha <= android.view.ViewConfiguration.ALPHA_THRESHOLD && (child.mPrivateFlags
				 & ALPHA_SET) == 0 && !(child is android.view.SurfaceView))
			{
				return more;
			}
			if (hardwareAccelerated)
			{
				// Clear INVALIDATED flag to allow invalidation to occur during rendering, but
				// retain the flag's value temporarily in the mRecreateDisplayList flag
				child.mRecreateDisplayList = (child.mPrivateFlags & INVALIDATED) == INVALIDATED;
				child.mPrivateFlags &= ~INVALIDATED;
			}
			child.computeScroll();
			int sx = child.mScrollX;
			int sy = child.mScrollY;
			android.view.DisplayList displayList = null;
			android.graphics.Bitmap cache = null;
			bool hasDisplayList = false;
			if (caching)
			{
				if (!hardwareAccelerated)
				{
					if (layerType != LAYER_TYPE_NONE)
					{
						layerType = LAYER_TYPE_SOFTWARE;
						child.buildDrawingCache(true);
					}
					cache = child.getDrawingCache(true);
				}
				else
				{
					switch (layerType)
					{
						case LAYER_TYPE_SOFTWARE:
						{
							child.buildDrawingCache(true);
							cache = child.getDrawingCache(true);
							break;
						}

						case LAYER_TYPE_NONE:
						{
							// Delay getting the display list until animation-driven alpha values are
							// set up and possibly passed on to the view
							hasDisplayList = child.canHaveDisplayList();
							break;
						}
					}
				}
			}
			bool hasNoCache = cache == null || hasDisplayList;
			bool offsetForScroll = cache == null && !hasDisplayList && layerType != LAYER_TYPE_HARDWARE;
			int restoreTo = canvas.save();
			if (offsetForScroll)
			{
				canvas.translate(cl - sx, ct - sy);
			}
			else
			{
				canvas.translate(cl, ct);
				if (scalingRequired)
				{
					// mAttachInfo cannot be null, otherwise scalingRequired == false
					float scale = 1.0f / mAttachInfo.mApplicationScale;
					canvas.scale(scale, scale);
				}
			}
			if (transformToApply != null || alpha < 1.0f || !child.hasIdentityMatrix())
			{
				if (transformToApply != null || !childHasIdentityMatrix)
				{
					int transX = 0;
					int transY = 0;
					if (offsetForScroll)
					{
						transX = -sx;
						transY = -sy;
					}
					if (transformToApply != null)
					{
						if (concatMatrix)
						{
							// Undo the scroll translation, apply the transformation matrix,
							// then redo the scroll translate to get the correct result.
							canvas.translate(-transX, -transY);
							canvas.concat(transformToApply.getMatrix());
							canvas.translate(transX, transY);
							mGroupFlags |= FLAG_CLEAR_TRANSFORMATION;
						}
						float transformAlpha = transformToApply.getAlpha();
						if (transformAlpha < 1.0f)
						{
							alpha *= transformToApply.getAlpha();
							mGroupFlags |= FLAG_CLEAR_TRANSFORMATION;
						}
					}
					if (!childHasIdentityMatrix)
					{
						canvas.translate(-transX, -transY);
						canvas.concat(child.getMatrix());
						canvas.translate(transX, transY);
					}
				}
				if (alpha < 1.0f)
				{
					mGroupFlags |= FLAG_CLEAR_TRANSFORMATION;
					if (hasNoCache)
					{
						int multipliedAlpha = (int)(255 * alpha);
						if (!child.onSetAlpha(multipliedAlpha))
						{
							int layerFlags = android.graphics.Canvas.HAS_ALPHA_LAYER_SAVE_FLAG;
							if ((flags & FLAG_CLIP_CHILDREN) == FLAG_CLIP_CHILDREN || layerType != LAYER_TYPE_NONE)
							{
								layerFlags |= android.graphics.Canvas.CLIP_TO_LAYER_SAVE_FLAG;
							}
							if (layerType == LAYER_TYPE_NONE)
							{
								int scrollX = hasDisplayList ? 0 : sx;
								int scrollY = hasDisplayList ? 0 : sy;
								canvas.saveLayerAlpha(scrollX, scrollY, scrollX + cr - cl, scrollY + cb - ct, multipliedAlpha
									, layerFlags);
							}
						}
						else
						{
							// Alpha is handled by the child directly, clobber the layer's alpha
							child.mPrivateFlags |= ALPHA_SET;
						}
					}
				}
			}
			else
			{
				if ((child.mPrivateFlags & ALPHA_SET) == ALPHA_SET)
				{
					child.onSetAlpha(255);
					child.mPrivateFlags &= ~ALPHA_SET;
				}
			}
			if ((flags & FLAG_CLIP_CHILDREN) == FLAG_CLIP_CHILDREN)
			{
				if (offsetForScroll)
				{
					canvas.clipRect(sx, sy, sx + (cr - cl), sy + (cb - ct));
				}
				else
				{
					if (!scalingRequired || cache == null)
					{
						canvas.clipRect(0, 0, cr - cl, cb - ct);
					}
					else
					{
						canvas.clipRect(0, 0, cache.getWidth(), cache.getHeight());
					}
				}
			}
			if (hasDisplayList)
			{
				displayList = child.getDisplayList();
				if (!displayList.isValid())
				{
					// Uncommon, but possible. If a view is removed from the hierarchy during the call
					// to getDisplayList(), the display list will be marked invalid and we should not
					// try to use it again.
					displayList = null;
					hasDisplayList = false;
				}
			}
			if (hasNoCache)
			{
				bool layerRendered = false;
				if (layerType == LAYER_TYPE_HARDWARE)
				{
					android.view.HardwareLayer layer = child.getHardwareLayer();
					if (layer != null && layer.isValid())
					{
						child.mLayerPaint.setAlpha((int)(alpha * 255));
						((android.view.HardwareCanvas)canvas).drawHardwareLayer(layer, 0, 0, child.mLayerPaint
							);
						layerRendered = true;
					}
					else
					{
						int scrollX = hasDisplayList ? 0 : sx;
						int scrollY = hasDisplayList ? 0 : sy;
						canvas.saveLayer(scrollX, scrollY, scrollX + cr - cl, scrollY + cb - ct, child.mLayerPaint
							, android.graphics.Canvas.HAS_ALPHA_LAYER_SAVE_FLAG | android.graphics.Canvas.CLIP_TO_LAYER_SAVE_FLAG
							);
					}
				}
				if (!layerRendered)
				{
					if (!hasDisplayList)
					{
						// Fast path for layouts with no backgrounds
						if ((child.mPrivateFlags & SKIP_DRAW) == SKIP_DRAW)
						{
							child.mPrivateFlags &= ~DIRTY_MASK;
							child.dispatchDraw(canvas);
						}
						else
						{
							child.draw(canvas);
						}
					}
					else
					{
						child.mPrivateFlags &= ~DIRTY_MASK;
						((android.view.HardwareCanvas)canvas).drawDisplayList(displayList, cr - cl, cb - 
							ct, null);
					}
				}
			}
			else
			{
				if (cache != null)
				{
					child.mPrivateFlags &= ~DIRTY_MASK;
					android.graphics.Paint cachePaint;
					if (layerType == LAYER_TYPE_NONE)
					{
						cachePaint = mCachePaint;
						if (alpha < 1.0f)
						{
							cachePaint.setAlpha((int)(alpha * 255));
							mGroupFlags |= FLAG_ALPHA_LOWER_THAN_ONE;
						}
						else
						{
							if ((flags & FLAG_ALPHA_LOWER_THAN_ONE) == FLAG_ALPHA_LOWER_THAN_ONE)
							{
								cachePaint.setAlpha(255);
								mGroupFlags &= ~FLAG_ALPHA_LOWER_THAN_ONE;
							}
						}
					}
					else
					{
						cachePaint = child.mLayerPaint;
						cachePaint.setAlpha((int)(alpha * 255));
					}
					canvas.drawBitmap(cache, 0.0f, 0.0f, cachePaint);
				}
			}
			canvas.restoreToCount(restoreTo);
			if (a != null && !more)
			{
				if (!hardwareAccelerated && !a.getFillAfter())
				{
					child.onSetAlpha(255);
				}
				finishAnimatingView(child, a);
			}
			if (more && hardwareAccelerated)
			{
				// invalidation is the trigger to recreate display lists, so if we're using
				// display lists to render, force an invalidate to allow the animation to
				// continue drawing another frame
				invalidate(true);
				if (a.hasAlpha() && (child.mPrivateFlags & ALPHA_SET) == ALPHA_SET)
				{
					// alpha animations should cause the child to recreate its display list
					child.invalidate(true);
				}
			}
			child.mRecreateDisplayList = false;
			return more;
		}
コード例 #5
0
ファイル: ShapeDrawable.cs プロジェクト: hakeemsm/XobotOS
		public override void draw(android.graphics.Canvas canvas)
		{
			android.graphics.Rect r = getBounds();
			android.graphics.Paint paint = mShapeState.mPaint;
			int prevAlpha = paint.getAlpha();
			paint.setAlpha(modulateAlpha(prevAlpha, mShapeState.mAlpha));
			if (mShapeState.mShape != null)
			{
				// need the save both for the translate, and for the (unknown) Shape
				int count = canvas.save();
				canvas.translate(r.left, r.top);
				onDraw(mShapeState.mShape, canvas, paint);
				canvas.restoreToCount(count);
			}
			else
			{
				canvas.drawRect(r, paint);
			}
			// restore
			paint.setAlpha(prevAlpha);
		}
コード例 #6
0
ファイル: DrawableHolder.cs プロジェクト: hakeemsm/XobotOS
		/// <summary>Draw this object to the canvas using the properties defined in this class.
		/// 	</summary>
		/// <remarks>Draw this object to the canvas using the properties defined in this class.
		/// 	</remarks>
		/// <param name="canvas">canvas to draw into</param>
		public virtual void draw(android.graphics.Canvas canvas)
		{
			float threshold = 1.0f / 256.0f;
			// contribution less than 1 LSB of RGB byte
			if (mAlpha <= threshold)
			{
				// don't bother if it won't show up
				return;
			}
			canvas.save(android.graphics.Canvas.MATRIX_SAVE_FLAG);
			canvas.translate(mX, mY);
			canvas.scale(mScaleX, mScaleY);
			canvas.translate(-0.5f * getWidth(), -0.5f * getHeight());
			mDrawable.setAlpha((int)Sharpen.Util.Round(mAlpha * 255f));
			mDrawable.draw(canvas);
			canvas.restore();
		}
コード例 #7
0
		public override void draw(android.graphics.Canvas canvas)
		{
			base.draw(canvas);
			if (mEdgeGlowLeft != null)
			{
				int scrollX = mScrollX;
				if (!mEdgeGlowLeft.isFinished())
				{
					int restoreCount = canvas.save();
					int height = getHeight() - mPaddingTop - mPaddingBottom;
					canvas.rotate(270);
					canvas.translate(-height + mPaddingTop, System.Math.Min(0, scrollX));
					mEdgeGlowLeft.setSize(height, getWidth());
					if (mEdgeGlowLeft.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
				if (!mEdgeGlowRight.isFinished())
				{
					int restoreCount = canvas.save();
					int width = getWidth();
					int height = getHeight() - mPaddingTop - mPaddingBottom;
					canvas.rotate(90);
					canvas.translate(-mPaddingTop, -(System.Math.Max(getScrollRange(), scrollX) + width
						));
					mEdgeGlowRight.setSize(height, width);
					if (mEdgeGlowRight.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
			}
		}
コード例 #8
0
ファイル: ScrollView.cs プロジェクト: hakeemsm/XobotOS
		public override void draw(android.graphics.Canvas canvas)
		{
			base.draw(canvas);
			if (mEdgeGlowTop != null)
			{
				int scrollY = mScrollY;
				if (!mEdgeGlowTop.isFinished())
				{
					int restoreCount = canvas.save();
					int width = getWidth() - mPaddingLeft - mPaddingRight;
					canvas.translate(mPaddingLeft, System.Math.Min(0, scrollY));
					mEdgeGlowTop.setSize(width, getHeight());
					if (mEdgeGlowTop.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
				if (!mEdgeGlowBottom.isFinished())
				{
					int restoreCount = canvas.save();
					int width = getWidth() - mPaddingLeft - mPaddingRight;
					int height = getHeight();
					canvas.translate(-width + mPaddingLeft, System.Math.Max(getScrollRange(), scrollY
						) + height);
					canvas.rotate(180, width, 0);
					mEdgeGlowBottom.setSize(width, height);
					if (mEdgeGlowBottom.draw(canvas))
					{
						invalidate();
					}
					canvas.restoreToCount(restoreCount);
				}
			}
		}
コード例 #9
0
ファイル: FastScroller.cs プロジェクト: hakeemsm/XobotOS
		public virtual void draw(android.graphics.Canvas canvas)
		{
			if (mState == STATE_NONE)
			{
				// No need to draw anything
				return;
			}
			int y = mThumbY;
			int viewWidth = mList.getWidth();
			android.widget.FastScroller.ScrollFade scrollFade = mScrollFade;
			int alpha = -1;
			if (mState == STATE_EXIT)
			{
				alpha = scrollFade.getAlpha();
				if (alpha < android.widget.FastScroller.ScrollFade.ALPHA_MAX / 2)
				{
					mThumbDrawable.setAlpha(alpha * 2);
				}
				int left = 0;
				switch (mPosition)
				{
					case android.view.View.SCROLLBAR_POSITION_DEFAULT:
					case android.view.View.SCROLLBAR_POSITION_RIGHT:
					{
						left = viewWidth - (mThumbW * alpha) / android.widget.FastScroller.ScrollFade.ALPHA_MAX;
						break;
					}

					case android.view.View.SCROLLBAR_POSITION_LEFT:
					{
						left = -mThumbW + (mThumbW * alpha) / android.widget.FastScroller.ScrollFade.ALPHA_MAX;
						break;
					}
				}
				mThumbDrawable.setBounds(left, 0, left + mThumbW, mThumbH);
				mChangedBounds = true;
			}
			if (mTrackDrawable != null)
			{
				android.graphics.Rect thumbBounds = mThumbDrawable.getBounds();
				int left = thumbBounds.left;
				int halfThumbHeight = (thumbBounds.bottom - thumbBounds.top) / 2;
				int trackWidth = mTrackDrawable.getIntrinsicWidth();
				int trackLeft = (left + mThumbW / 2) - trackWidth / 2;
				mTrackDrawable.setBounds(trackLeft, halfThumbHeight, trackLeft + trackWidth, mList
					.getHeight() - halfThumbHeight);
				mTrackDrawable.draw(canvas);
			}
			canvas.translate(0, y);
			mThumbDrawable.draw(canvas);
			canvas.translate(0, -y);
			// If user is dragging the scroll bar, draw the alphabet overlay
			if (mState == STATE_DRAGGING && mDrawOverlay)
			{
				if (mOverlayPosition == OVERLAY_AT_THUMB)
				{
					int left = 0;
					switch (mPosition)
					{
						case android.view.View.SCROLLBAR_POSITION_DEFAULT:
						case android.view.View.SCROLLBAR_POSITION_RIGHT:
						default:
						{
							left = System.Math.Max(0, mThumbDrawable.getBounds().left - mThumbW - mOverlaySize
								);
							break;
						}

						case android.view.View.SCROLLBAR_POSITION_LEFT:
						{
							left = System.Math.Min(mThumbDrawable.getBounds().right + mThumbW, mList.getWidth
								() - mOverlaySize);
							break;
						}
					}
					int top = System.Math.Max(0, System.Math.Min(y + (mThumbH - mOverlaySize) / 2, mList
						.getHeight() - mOverlaySize));
					android.graphics.RectF pos = mOverlayPos;
					pos.left = left;
					pos.right = pos.left + mOverlaySize;
					pos.top = top;
					pos.bottom = pos.top + mOverlaySize;
					if (mOverlayDrawable != null)
					{
						mOverlayDrawable.setBounds((int)pos.left, (int)pos.top, (int)pos.right, (int)pos.
							bottom);
					}
				}
				mOverlayDrawable.draw(canvas);
				android.graphics.Paint paint = mPaint;
				float descent = paint.descent();
				android.graphics.RectF rectF = mOverlayPos;
				android.graphics.Rect tmpRect = mTmpRect;
				mOverlayDrawable.getPadding(tmpRect);
				int hOff = (tmpRect.right - tmpRect.left) / 2;
				int vOff = (tmpRect.bottom - tmpRect.top) / 2;
				canvas.drawText(mSectionText, (int)(rectF.left + rectF.right) / 2 - hOff, (int)(rectF
					.bottom + rectF.top) / 2 + mOverlaySize / 4 - descent - vOff, paint);
			}
			else
			{
				if (mState == STATE_EXIT)
				{
					if (alpha == 0)
					{
						// Done with exit
						setState(STATE_NONE);
					}
					else
					{
						if (mTrackDrawable != null)
						{
							mList.invalidate(viewWidth - mThumbW, 0, viewWidth, mList.getHeight());
						}
						else
						{
							mList.invalidate(viewWidth - mThumbW, y, viewWidth, y + mThumbH);
						}
					}
				}
			}
		}
コード例 #10
0
ファイル: ImageView.cs プロジェクト: hakeemsm/XobotOS
		protected internal override void onDraw(android.graphics.Canvas canvas)
		{
			base.onDraw(canvas);
			if (mDrawable == null)
			{
				return;
			}
			// couldn't resolve the URI
			if (mDrawableWidth == 0 || mDrawableHeight == 0)
			{
				return;
			}
			// nothing to draw (empty bounds)
			if (mDrawMatrix == null && mPaddingTop == 0 && mPaddingLeft == 0)
			{
				mDrawable.draw(canvas);
			}
			else
			{
				int saveCount = canvas.getSaveCount();
				canvas.save();
				if (mCropToPadding)
				{
					int scrollX = mScrollX;
					int scrollY = mScrollY;
					canvas.clipRect(scrollX + mPaddingLeft, scrollY + mPaddingTop, scrollX + mRight -
						 mLeft - mPaddingRight, scrollY + mBottom - mTop - mPaddingBottom);
				}
				canvas.translate(mPaddingLeft, mPaddingTop);
				if (mDrawMatrix != null)
				{
					canvas.concat(mDrawMatrix);
				}
				mDrawable.draw(canvas);
				canvas.restoreToCount(saveCount);
			}
		}