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

Side by Side Diff: src/image/SkImagePriv.cpp

Issue 19729007: Add SkImage->draw() call with src and dst rects. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkImagePriv.h" 8 #include "SkImagePriv.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkPicture.h" 10 #include "SkPicture.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 canvas->saveLayer(&bounds, paint); 134 canvas->saveLayer(&bounds, paint);
135 canvas->translate(x, y); 135 canvas->translate(x, y);
136 } else if (x || y) { 136 } else if (x || y) {
137 canvas->save(); 137 canvas->save();
138 canvas->translate(x, y); 138 canvas->translate(x, y);
139 } 139 }
140 140
141 canvas->drawPicture(*picture); 141 canvas->drawPicture(*picture);
142 canvas->restoreToCount(saveCount); 142 canvas->restoreToCount(saveCount);
143 } 143 }
144
145 void SkImagePrivDrawPicture(SkCanvas* canvas, SkPicture* picture,
Justin Novosad 2013/07/18 21:54:37 You need to write a good test for this function.
146 SkRect src, SkRect dst, const SkPaint* paint) {
147 int saveCount = canvas->getSaveCount();
Justin Novosad 2013/07/18 21:54:37 No need for this call. This value is returned by s
148
149 canvas->clipRect(src);
Justin Novosad 2013/07/18 21:54:37 Bug: This clip does not get undone. Also I think
150 canvas->saveLayer(&dst, paint);
reed1 2013/07/19 14:03:45 Why saveLayer instead of just save?
151 canvas->translate(dst.x(), dst.y());
Justin Novosad 2013/07/18 21:54:37 This is not the right transform to map src to dst.
reed1 2013/07/19 14:03:45 SkMatrix has a mapRectToRect helper function you c
152
153 canvas->drawPicture(*picture);
154 canvas->restoreToCount(saveCount);
155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698