Create libgfx, starting with FloatRect
Creates libgfx, the future home of everything currently in libui and
libgui, which will be rigorously checked with -Weverything (with a few
common-sense exceptions) and clang-tidy and formatted using the included
.clang-format file.
Starts by moving FloatRect out of services/surfaceflinger since it will
be used by other libgfx primitives later.
Test: m
Change-Id: I5045ac089020e6ee380e81e8735117c500264b37
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index c7d37a5..22d01ae 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -377,10 +377,10 @@
return reduce(win, activeTransparentRegion);
}
-FloatRect Layer::computeCrop(const sp<const DisplayDevice>& hw) const {
+gfx::FloatRect Layer::computeCrop(const sp<const DisplayDevice>& hw) const {
// the content crop is the area of the content that gets scaled to the
// layer's size.
- FloatRect crop(getContentCrop());
+ gfx::FloatRect crop = getContentCrop().toFloatRect();
// the crop is the area of the window that gets cropped, but not
// scaled in any ways.
@@ -585,7 +585,7 @@
hwcInfo.displayFrame = transformedFrame;
}
- FloatRect sourceCrop = computeCrop(displayDevice);
+ gfx::FloatRect sourceCrop = computeCrop(displayDevice);
error = hwcLayer->setSourceCrop(sourceCrop);
if (error != HWC2::Error::None) {
ALOGE("[%s] Failed to set source crop [%.3f, %.3f, %.3f, %.3f]: "
@@ -2179,7 +2179,7 @@
const Rect& frame = hwcInfo.displayFrame;
result.appendFormat("%4d %4d %4d %4d | ", frame.left, frame.top,
frame.right, frame.bottom);
- const FloatRect& crop = hwcInfo.sourceCrop;
+ const gfx::FloatRect& crop = hwcInfo.sourceCrop;
result.appendFormat("%6.1f %6.1f %6.1f %6.1f\n", crop.left, crop.top,
crop.right, crop.bottom);