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

Unified Diff: src/c/sk_surface.cpp

Issue 1272713005: flag to use const& instead of const* for src-rect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: src/c/sk_surface.cpp
diff --git a/src/c/sk_surface.cpp b/src/c/sk_surface.cpp
index 1e676ffe7c1a7020abe19ae4cf011a0f192cde42..84a9c541c2331161ef681b07510aadc25c5ddff3 100644
--- a/src/c/sk_surface.cpp
+++ b/src/c/sk_surface.cpp
@@ -162,10 +162,6 @@ static const SkRect& AsRect(const sk_rect_t& crect) {
return reinterpret_cast<const SkRect&>(crect);
}
-static const SkRect* AsRect(const sk_rect_t* crect) {
- return reinterpret_cast<const SkRect*>(crect);
-}
-
static const SkPath& AsPath(const sk_path_t& cpath) {
return reinterpret_cast<const SkPath&>(cpath);
}
@@ -399,7 +395,16 @@ void sk_canvas_draw_image(sk_canvas_t* ccanvas, const sk_image_t* cimage, float
void sk_canvas_draw_image_rect(sk_canvas_t* ccanvas, const sk_image_t* cimage,
const sk_rect_t* csrcR, const sk_rect_t* cdstR,
const sk_paint_t* cpaint) {
- AsCanvas(ccanvas)->drawImageRect(AsImage(cimage), AsRect(csrcR), AsRect(*cdstR), AsPaint(cpaint));
+ SkCanvas* canvas = AsCanvas(ccanvas);
+ const SkImage* image = AsImage(cimage);
+ const SkRect& dst = AsRect(*cdstR);
+ const SkPaint* paint = AsPaint(cpaint);
+
+ if (csrcR) {
+ canvas->drawImageRect(image, AsRect(*csrcR), dst, paint);
+ } else {
+ canvas->drawImageRect(image, dst, paint);
+ }
}
void sk_canvas_draw_picture(sk_canvas_t* ccanvas, const sk_picture_t* cpicture,

Powered by Google App Engine
This is Rietveld 408576698