}
void RecordingCanvas::drawPaint(const SkPaint& paint) {
+ const ClipBase* clip = getRecordedClip();
+ // if there's no current clip, draw a big rect and hope we cover the eventual clip bounds
+ Rect bounds = clip ? clip->rect : Rect(-10000, -10000, 10000, 10000);
addOp(alloc().create_trivial<RectOp>(
- mState.getRenderTargetClipBounds(), // OK, since we've not passed transform
+ bounds,
Matrix4::identity(),
- getRecordedClip(),
+ clip,
refPaint(&paint)));
}
#include <RecordedOp.h>
#include <RecordingCanvas.h>
#include <tests/common/TestUtils.h>
+#include <utils/Color.h>
namespace android {
namespace uirenderer {
ASSERT_EQ(3, count);
}
+TEST(RecordingCanvas, drawColor) {
+ auto dl = TestUtils::createDisplayList<RecordingCanvas>(200, 200, [](RecordingCanvas& canvas) {
+ canvas.drawColor(Color::Black, SkXfermode::kSrcOver_Mode);
+ });
+
+ ASSERT_EQ(1u, dl->getOps().size()) << "Must be exactly one op";
+ auto op = *(dl->getOps()[0]);
+ EXPECT_EQ(RecordedOpId::RectOp, op.opId);
+ EXPECT_EQ(nullptr, op.localClip);
+ EXPECT_TRUE(op.unmappedBounds.contains(Rect(-1000, -1000, 1000, 1000)))
+ << "no clip, unmappedBounds should resolve to be much larger than DL bounds";
+}
+
TEST(RecordingCanvas, backgroundAndImage) {
auto dl = TestUtils::createDisplayList<RecordingCanvas>(100, 200, [](RecordingCanvas& canvas) {
SkBitmap bitmap;