Add overrides to SkAndroidSDKCanvas, update SkHwuiRenderer
We can not call android::uirenderer::DisplayListCanvas::reset()
after the object has been constructed (due to an assert), so remove
that call. Add two missing overrides to SkAndroidSDKCanvas:
onDrawAtlas() and onDrawImageNine().
BUG=skia:4216
R=djsollen@google.com
patch from issue 1377533003 at patchset 20001 (http://crrev.com/1377533003#ps20001)
Review URL: https://codereview.chromium.org/1369923003
diff --git a/src/utils/android/SkAndroidSDKCanvas.cpp b/src/utils/android/SkAndroidSDKCanvas.cpp
index 5106473..e6f802f 100644
--- a/src/utils/android/SkAndroidSDKCanvas.cpp
+++ b/src/utils/android/SkAndroidSDKCanvas.cpp
@@ -248,12 +248,34 @@
}
void SkAndroidSDKCanvas::onDrawPicture(const SkPicture* picture,
- const SkMatrix* matrix,
- const SkPaint* paint) {
+ const SkMatrix* matrix,
+ const SkPaint* paint) {
FILTER_PTR(paint);
fProxyTarget->drawPicture(picture, matrix, filteredPaint);
}
+void SkAndroidSDKCanvas::onDrawAtlas(const SkImage* atlas,
+ const SkRSXform xform[],
+ const SkRect tex[],
+ const SkColor colors[],
+ int count,
+ SkXfermode::Mode mode,
+ const SkRect* cullRect,
+ const SkPaint* paint) {
+ FILTER_PTR(paint);
+ fProxyTarget->drawAtlas(atlas, xform, tex, colors, count, mode, cullRect,
+ filteredPaint);
+}
+
+void SkAndroidSDKCanvas::onDrawImageNine(const SkImage* image,
+ const SkIRect& center,
+ const SkRect& dst,
+ const SkPaint* paint) {
+ FILTER_PTR(paint);
+ fProxyTarget->drawImageNine(image, center, dst, filteredPaint);
+}
+
+
void SkAndroidSDKCanvas::onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) {
fProxyTarget->drawDrawable(drawable, matrix);
}
diff --git a/src/utils/android/SkAndroidSDKCanvas.h b/src/utils/android/SkAndroidSDKCanvas.h
index 73da861..08b73f1 100644
--- a/src/utils/android/SkAndroidSDKCanvas.h
+++ b/src/utils/android/SkAndroidSDKCanvas.h
@@ -75,6 +75,11 @@
void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, const SkPaint*,
SrcRectConstraint) override;
void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*);
+ void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[],
+ const SkColor[], int count, SkXfermode::Mode,
+ const SkRect* cull, const SkPaint*) override;
+ void onDrawImageNine(const SkImage*, const SkIRect& center,
+ const SkRect& dst, const SkPaint*) override;
// PASS THROUGH
diff --git a/src/utils/android/SkHwuiRenderer.cpp b/src/utils/android/SkHwuiRenderer.cpp
index 4493be6..064801f 100644
--- a/src/utils/android/SkHwuiRenderer.cpp
+++ b/src/utils/android/SkHwuiRenderer.cpp
@@ -61,7 +61,6 @@
}
SkCanvas* SkHwuiRenderer::prepareToDraw() {
- this->canvas->reset(size.width(), size.height());
this->canvas->clipRect(0, 0, this->size.width(), this->size.height(),
SkRegion::Op::kReplace_Op);
return this->canvas->asSkCanvas();