Ejemplo n.º 1
0
ECode CPicture::Draw(
    /* [in] */ ICanvas* canvas)
{
    Boolean is = FALSE;
    if (canvas->IsHardwareAccelerated(&is), is) {
        // throw new IllegalArgumentException(
        //         "Picture playback is only supported on software canvas.");
        return E_ILLEGAL_ARGUMENT_EXCEPTION;
    }

    if (mRecordingCanvas != NULL) {
        EndRecording();
    }
    NativeDraw(((Canvas*)canvas)->mNativeCanvas,
            mNativePicture);
    return NOERROR;
}
Ejemplo n.º 2
0
ECode NinePatch::Draw(
    /* [in] */ ICanvas* canvas,
    /* [in] */ IRectF* location)
{
    Boolean isAccelerated;
    canvas->IsHardwareAccelerated(&isAccelerated);
    if (!isAccelerated) {
        return NativeDraw(((Canvas*)canvas->Probe(EIID_Canvas))->mNativeCanvas,
            location, ((CBitmap*)mBitmap.Get())->Ni(), mChunk.Get(),
            mPaint != NULL ? ((Paint*)mPaint->Probe(EIID_Paint))->mNativePaint : 0,
            ((Canvas*)canvas->Probe(EIID_Canvas))->mDensity,
            ((CBitmap*)mBitmap.Get())->mDensity);
    }
    else {
        return canvas->DrawPatch(mBitmap, *mChunk, location, mPaint);
    }
}