aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-11-19 06:59:41 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-11-19 06:59:41 -0800
commit7e76bff26e7c74902841ca4f607eb0b24a833a4a (patch)
treecb2f55b88a3ec2b3838dc9003808af03b6700e1d /samplecode
parentec03a4608025106ea3f21353865c7d302c0a13c6 (diff)
allow pictures to have a full bounds
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleArc.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/samplecode/SampleArc.cpp b/samplecode/SampleArc.cpp
index a44eeb59ba..ecea90bf3f 100644
--- a/samplecode/SampleArc.cpp
+++ b/samplecode/SampleArc.cpp
@@ -37,6 +37,27 @@ static void testparse() {
SkParsePath::ToSVGString(p2, &str2);
}
+#include "SkPictureRecorder.h"
+static void test_pictbounds(SkCanvas* canvas) {
+ SkRect r = SkRect::MakeXYWH(100, 50, 100, 100);
+ SkPictureRecorder recorder;
+ {
+ SkCanvas* c = recorder.beginRecording(r, NULL, 0);
+ c->drawOval(r, SkPaint());
+
+ SkIRect ir;
+ c->getClipDeviceBounds(&ir);
+ SkDebugf("devbounds [%d %d %d %d]\n", ir.left(), ir.top(), ir.right(), ir.bottom());
+
+ SkASSERT(!c->quickReject(r));
+ }
+ SkPicture* pic = recorder.endRecording();
+
+ canvas->drawPicture(pic);
+ SkASSERT(pic->cullRect() == r);
+ pic->unref();
+}
+
class ArcsView : public SampleView {
class MyDrawable : public SkCanvasDrawable {
SkRect fR;
@@ -176,6 +197,8 @@ protected:
}
virtual void onDrawContent(SkCanvas* canvas) {
+ if (true) { test_pictbounds(canvas); return; }
+
fDrawable->setSweep(SampleCode::GetAnimScalar(SkIntToScalar(360)/24,
SkIntToScalar(360)));