skia2/tests/PictureShaderTest.cpp
fmalita b5f7826c51 Explicit tile bounds for SkPictureShader
The integer picture size is not granular enough to allow precise tiling
in arbitrary coordinate systems. This CL adds an optional tile bounds
float rect param to control the tile size and location.

(this also allows tile spacing emulation for picture
shaders).

R=reed@google.com, robertphillips@google.com

Author: fmalita@chromium.org

Review URL: https://codereview.chromium.org/437393003
2014-08-06 13:07:15 -07:00

27 lines
894 B
C++

/*
* Copyright 2014 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkPicture.h"
#include "SkPictureRecorder.h"
#include "SkShader.h"
#include "Test.h"
// Test that attempting to create a picture shader with a NULL picture or
// empty picture returns NULL.
DEF_TEST(PictureShader_empty, reporter) {
SkShader* shader = SkShader::CreatePictureShader(NULL,
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
REPORTER_ASSERT(reporter, NULL == shader);
SkPictureRecorder factory;
factory.beginRecording(0, 0, NULL, 0);
SkAutoTUnref<SkPicture> picture(factory.endRecording());
shader = SkShader::CreatePictureShader(picture.get(),
SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, NULL, NULL);
REPORTER_ASSERT(reporter, NULL == shader);
}