aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PictureTest.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@google.com>2018-01-27 17:30:04 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-27 17:30:15 +0000
commit88d90714fad0fed2739fb8c5f90fe814c8a274ef (patch)
tree85d26395c1fbcdd21ca0e2029b022862ca09fe79 /tests/PictureTest.cpp
parentfc20008819f39e1504aa572e28c56e83e14bff79 (diff)
Revert "hide picture virtuals (no public callers)"
This reverts commit 8005bff7e631a269f0dfaae93ff9963dc0e5ff39. Reason for revert: hwui, flutter, and headless blink in G3 all still using these. Original change's description: > hide picture virtuals (no public callers) > > This prepares the way for a clean impl of a "placeholder" picture that never unrolls > > Bug: skia: > Change-Id: I3b5785c5c94432b54e9a7dc280b2a6e716592473 > Reviewed-on: https://skia-review.googlesource.com/100260 > Commit-Queue: Mike Reed <reed@google.com> > Reviewed-by: Mike Klein <mtklein@chromium.org> TBR=mtklein@chromium.org,mtklein@google.com,reed@google.com Change-Id: I385789dd420588ea9a9390c8a44c6ecb96c7f358 No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/100880 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Klein <mtklein@google.com>
Diffstat (limited to 'tests/PictureTest.cpp')
-rw-r--r--tests/PictureTest.cpp25
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 4eeec35497..714338f9d1 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -19,7 +19,7 @@
#include "SkMD5.h"
#include "SkMiniRecorder.h"
#include "SkPaint.h"
-#include "SkPicturePriv.h"
+#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkPixelRef.h"
#include "SkRectPriv.h"
@@ -446,7 +446,7 @@ static void test_cull_rect_reset(skiatest::Reporter* reporter) {
canvas->drawRect(bounds, paint);
canvas->drawRect(bounds, paint);
sk_sp<SkPicture> p(recorder.finishRecordingAsPictureWithCull(bounds));
- const SkBigPicture* picture = SkPicturePriv::AsBigPicture(p.get());
+ const SkBigPicture* picture = p->asSkBigPicture();
REPORTER_ASSERT(reporter, picture);
SkRect finalCullRect = picture->cullRect();
@@ -813,3 +813,24 @@ DEF_TEST(Picture_UpdatedCull_2, r) {
REPORTER_ASSERT(r, pic->cullRect() == SkRectPriv::MakeLargest());
}
+DEF_TEST(Picture_RecordsFlush, r) {
+ SkPictureRecorder recorder;
+
+ auto canvas = recorder.beginRecording(SkRect::MakeWH(100,100));
+ for (int i = 0; i < 10; i++) {
+ canvas->clear(0);
+ for (int j = 0; j < 10; j++) {
+ canvas->drawRect(SkRect::MakeXYWH(i*10,j*10,10,10), SkPaint());
+ }
+ canvas->flush();
+ }
+
+ // Did we record the flushes?
+ auto pic = recorder.finishRecordingAsPicture();
+ REPORTER_ASSERT(r, pic->approximateOpCount() == 120); // 10 clears, 100 draws, 10 flushes
+
+ // Do we serialize and deserialize flushes?
+ auto skp = pic->serialize();
+ auto back = SkPicture::MakeFromData(skp->data(), skp->size());
+ REPORTER_ASSERT(r, back->approximateOpCount() == pic->approximateOpCount());
+}