aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2014-07-13 12:00:50 -0400
committerGravatar Robert Phillips <robertphillips@google.com>2014-07-13 12:00:50 -0400
commitcfaeec446d06058cacef068b09f58ae2c78338fa (patch)
tree885fb54026165b28a172c210c8b843226d3b7c72 /tests
parentdd528967fc3eea54c8d10937b0100192d0722f4e (diff)
Remove Skia's use of the default SkPicture constructor and multi-clone
This cannot be landed until (Chrome: Switch to one-at-a-time SkPicture::clone interface - https://codereview.chromium.org/380323002/) has landed. R=mtklein@google.com TBR=reed@google.com Review URL: https://codereview.chromium.org/388833003
Diffstat (limited to 'tests')
-rw-r--r--tests/GpuLayerCacheTest.cpp15
-rw-r--r--tests/PictureTest.cpp10
2 files changed, 14 insertions, 11 deletions
diff --git a/tests/GpuLayerCacheTest.cpp b/tests/GpuLayerCacheTest.cpp
index d6371e1657..02917e475f 100644
--- a/tests/GpuLayerCacheTest.cpp
+++ b/tests/GpuLayerCacheTest.cpp
@@ -10,6 +10,7 @@
#include "GrContext.h"
#include "GrContextFactory.h"
#include "GrLayerCache.h"
+#include "SkPictureRecorder.h"
#include "Test.h"
static const int kNumLayers = 5;
@@ -54,11 +55,13 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
return;
}
- SkPicture picture;
+ SkPictureRecorder recorder;
+ recorder.beginRecording(1, 1);
+ SkAutoTUnref<const SkPicture> picture(recorder.endRecording());
GrLayerCache cache(context);
- create_layers(reporter, &cache, picture);
+ create_layers(reporter, &cache, *picture);
// Lock the layers making them all 512x512
GrTextureDesc desc;
@@ -67,7 +70,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
desc.fConfig = kSkia8888_GrPixelConfig;
for (int i = 0; i < kNumLayers; ++i) {
- GrCachedLayer* layer = cache.findLayer(&picture, i);
+ GrCachedLayer* layer = cache.findLayer(picture, i);
REPORTER_ASSERT(reporter, NULL != layer);
bool foundInCache = cache.lock(layer, desc);
@@ -91,14 +94,14 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
// Unlock the textures
for (int i = 0; i < kNumLayers; ++i) {
- GrCachedLayer* layer = cache.findLayer(&picture, i);
+ GrCachedLayer* layer = cache.findLayer(picture, i);
REPORTER_ASSERT(reporter, NULL != layer);
cache.unlock(layer);
}
for (int i = 0; i < kNumLayers; ++i) {
- GrCachedLayer* layer = cache.findLayer(&picture, i);
+ GrCachedLayer* layer = cache.findLayer(picture, i);
REPORTER_ASSERT(reporter, NULL != layer);
#if USE_ATLAS
@@ -118,7 +121,7 @@ DEF_GPUTEST(GpuLayerCache, reporter, factory) {
// Free them all SkGpuDevice-style. This will not free up the
// atlas' texture but will eliminate all the layers.
- cache.purge(&picture);
+ cache.purge(picture);
REPORTER_ASSERT(reporter, GetNumLayers::NumLayers(&cache) == 0);
// TODO: add VRAM/resource cache check here
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index a4dc7d7102..cc5d880297 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1521,12 +1521,12 @@ static void test_hierarchical(skiatest::Reporter* reporter) {
static void test_gen_id(skiatest::Reporter* reporter) {
- SkPicture empty;
+ SkPictureRecorder recorder;
+ recorder.beginRecording(0, 0);
+ SkAutoTUnref<SkPicture> empty(recorder.endRecording());
// Empty pictures should still have a valid ID
- REPORTER_ASSERT(reporter, empty.uniqueID() != SK_InvalidGenID);
-
- SkPictureRecorder recorder;
+ REPORTER_ASSERT(reporter, empty->uniqueID() != SK_InvalidGenID);
SkCanvas* canvas = recorder.beginRecording(1, 1);
canvas->drawARGB(255, 255, 255, 255);
@@ -1535,7 +1535,7 @@ static void test_gen_id(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, hasData->uniqueID() != SK_InvalidGenID);
// both pictures should have different ids
- REPORTER_ASSERT(reporter, hasData->uniqueID() != empty.uniqueID());
+ REPORTER_ASSERT(reporter, hasData->uniqueID() != empty->uniqueID());
}
DEF_TEST(Picture, reporter) {