diff options
| author | Derek Sollenberger <djsollen@google.com> | 2014-06-23 14:13:53 -0400 |
|---|---|---|
| committer | Derek Sollenberger <djsollen@google.com> | 2014-07-21 12:08:57 -0400 |
| commit | 8872b38ef403cc2c44aca07d392f5e9426fd7f54 (patch) | |
| tree | bf2d134eb1ec42d790fe0515c1672787e136b38c /core/jni/android/graphics/Picture.cpp | |
| parent | 09afc2e4ea4f22dc1ef439244f6f0f1572e5a676 (diff) | |
| download | frameworks_base-8872b38ef403cc2c44aca07d392f5e9426fd7f54.zip frameworks_base-8872b38ef403cc2c44aca07d392f5e9426fd7f54.tar.gz frameworks_base-8872b38ef403cc2c44aca07d392f5e9426fd7f54.tar.bz2 | |
Separate Canvas JNI code from the implementation.
This introduces Canvas.h which is a pure virtual interface that
is intended to be used by both Skia and HWUI implementation. To help
stage this transition this CL only introduces the interface and Skia
implementation. The interface is not intended to be final and will
undoubtedly go through iterations in both style and location as we
look to introduce the HWUI implementation.
BUG:15672762
Change-Id: Ibaccdddb87d3b9358f4f0c1d317ead5282d4ee16
Diffstat (limited to 'core/jni/android/graphics/Picture.cpp')
| -rw-r--r-- | core/jni/android/graphics/Picture.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/core/jni/android/graphics/Picture.cpp b/core/jni/android/graphics/Picture.cpp index bc0c25f..d214575 100644 --- a/core/jni/android/graphics/Picture.cpp +++ b/core/jni/android/graphics/Picture.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ +#include "Canvas.h" #include "Picture.h" -#include "SkCanvas.h" #include "SkStream.h" namespace android { @@ -36,12 +36,13 @@ Picture::Picture(const Picture* src) { } } -SkCanvas* Picture::beginRecording(int width, int height) { +Canvas* Picture::beginRecording(int width, int height) { mPicture.reset(NULL); mRecorder.reset(new SkPictureRecorder); mWidth = width; mHeight = height; - return mRecorder->beginRecording(width, height, NULL, 0); + SkCanvas* canvas = mRecorder->beginRecording(width, height, NULL, 0); + return Canvas::create_canvas(canvas); } void Picture::endRecording() { @@ -93,14 +94,14 @@ void Picture::serialize(SkWStream* stream) const { } } -void Picture::draw(SkCanvas* canvas) { +void Picture::draw(Canvas* canvas) { if (NULL != mRecorder.get()) { this->endRecording(); SkASSERT(NULL != mPicture.get()); } if (NULL != mPicture.get()) { // TODO: remove this const_cast once pictures are immutable - const_cast<SkPicture*>(mPicture.get())->draw(canvas); + const_cast<SkPicture*>(mPicture.get())->draw(canvas->getSkCanvas()); } } |
