Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: src/core/SkCanvasDrawable.cpp

Issue 736583004: allow pictures to have a full bounds (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use new roundOut Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/core/SkCanvasDrawable.cpp
diff --git a/src/core/SkCanvasDrawable.cpp b/src/core/SkCanvasDrawable.cpp
index 0065d430f900b5be411a167e1ee572185bcc66c5..e0120f0bb1128bfbb3d258d5674e4987ac01af2a 100644
--- a/src/core/SkCanvasDrawable.cpp
+++ b/src/core/SkCanvasDrawable.cpp
@@ -23,9 +23,22 @@ static int32_t next_generation_id() {
SkCanvasDrawable::SkCanvasDrawable() : fGenerationID(0) {}
+static void draw_bbox(SkCanvas* canvas, const SkRect& r) {
+ SkPaint paint;
+ paint.setStyle(SkPaint::kStroke_Style);
+ paint.setColor(0xFFFF7088);
+ canvas->drawRect(r, paint);
+ canvas->drawLine(r.left(), r.top(), r.right(), r.bottom(), paint);
+ canvas->drawLine(r.left(), r.bottom(), r.right(), r.top(), paint);
+}
+
void SkCanvasDrawable::draw(SkCanvas* canvas) {
SkAutoCanvasRestore acr(canvas, true);
this->onDraw(canvas);
+
+ if (false) {
+ draw_bbox(canvas, this->getBounds());
f(malita) 2014/11/19 15:02:27 This could be a debugger option. (I'm planning to
mtklein 2014/11/19 15:16:00 This SGTM. This would be pretty easy to do with a
+ }
}
SkPicture* SkCanvasDrawable::newPictureSnapshot(SkBBHFactory* bbhFactory, uint32_t recordFlags) {
@@ -52,8 +65,13 @@ void SkCanvasDrawable::notifyDrawingChanged() {
#include "SkPictureRecorder.h"
SkPicture* SkCanvasDrawable::onNewPictureSnapshot(SkBBHFactory* bbhFactory, uint32_t recordFlags) {
- const SkRect bounds = this->getBounds();
SkPictureRecorder recorder;
- this->draw(recorder.beginRecording(bounds.width(), bounds.height(), bbhFactory, recordFlags));
+
+ const SkRect bounds = this->getBounds();
+ SkCanvas* canvas = recorder.beginRecording(bounds, bbhFactory, recordFlags);
+ this->draw(canvas);
+ if (false) {
+ draw_bbox(canvas, bounds);
+ }
return recorder.endRecording();
}
« samplecode/SampleArc.cpp ('K') | « src/core/SkCanvas.cpp ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698