Add internal Canvas save flags
Skia's SkCanvas::SaveFlags are being deprecated. This CL introduces
the equivalent android::SaveFlags, converts all internal clients to
the new enum, and switches the saveLayer glue to the
SaveLayerRec-based API.
Change-Id: Icb1785f4e7c0f652b1f04b34a1e3ccb063c408f3
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 6f8d627..18c713a 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -19,6 +19,7 @@
#include "AnimationContext.h"
#include "Caches.h"
+#include "Canvas.h"
#include "DeferredLayerUpdater.h"
#include "EglManager.h"
#include "LayerUpdateQueue.h"
@@ -394,7 +395,7 @@
backdropBounds.doIntersect(targetBounds);
// Check if we have to draw something on the left side ...
if (targetBounds.left < contentBounds.left) {
- mCanvas->save(SkCanvas::kClip_SaveFlag);
+ mCanvas->save(SaveFlags::Clip);
if (mCanvas->clipRect(targetBounds.left, targetBounds.top,
contentBounds.left, targetBounds.bottom,
SkRegion::kIntersect_Op)) {
@@ -407,7 +408,7 @@
// ... or on the right side ...
if (targetBounds.right > contentBounds.right &&
!targetBounds.isEmpty()) {
- mCanvas->save(SkCanvas::kClip_SaveFlag);
+ mCanvas->save(SaveFlags::Clip);
if (mCanvas->clipRect(contentBounds.right, targetBounds.top,
targetBounds.right, targetBounds.bottom,
SkRegion::kIntersect_Op)) {
@@ -420,7 +421,7 @@
// ... or at the top ...
if (targetBounds.top < contentBounds.top &&
!targetBounds.isEmpty()) {
- mCanvas->save(SkCanvas::kClip_SaveFlag);
+ mCanvas->save(SaveFlags::Clip);
if (mCanvas->clipRect(targetBounds.left, targetBounds.top, targetBounds.right,
contentBounds.top,
SkRegion::kIntersect_Op)) {
@@ -433,7 +434,7 @@
// ... or at the bottom.
if (targetBounds.bottom > contentBounds.bottom &&
!targetBounds.isEmpty()) {
- mCanvas->save(SkCanvas::kClip_SaveFlag);
+ mCanvas->save(SaveFlags::Clip);
if (mCanvas->clipRect(targetBounds.left, contentBounds.bottom, targetBounds.right,
targetBounds.bottom, SkRegion::kIntersect_Op)) {
mCanvas->drawRenderNode(node.get(), outBounds);
@@ -442,7 +443,7 @@
}
} else if (layer == 1) { // Content
// It gets cropped against the bounds of the backdrop to stay inside.
- mCanvas->save(SkCanvas::kClip_SaveFlag | SkCanvas::kMatrix_SaveFlag);
+ mCanvas->save(SaveFlags::MatrixClip);
// We shift and clip the content to match its final location in the window.
const float left = mContentDrawBounds.left;