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

Side by Side Diff: src/utils/debugger/SkDrawCommand.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 unified diff | Download patch
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkDrawCommand.h" 10 #include "SkDrawCommand.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 yScale *= input.height() / (float) input.width(); 124 yScale *= input.height() / (float) input.width();
125 } else { 125 } else {
126 xScale *= input.width() / (float) input.height(); 126 xScale *= input.width() / (float) input.height();
127 } 127 }
128 128
129 SkRect dst = SkRect::MakeXYWH(SK_Scalar1, SK_Scalar1, 129 SkRect dst = SkRect::MakeXYWH(SK_Scalar1, SK_Scalar1,
130 xScale * input.width(), 130 xScale * input.width(),
131 yScale * input.height()); 131 yScale * input.height());
132 132
133 canvas->clear(0xFFFFFFFF); 133 canvas->clear(0xFFFFFFFF);
134 canvas->drawBitmapRect(input, dst); 134 canvas->drawBitmapRect(input, dst, nullptr);
135 135
136 if (srcRect) { 136 if (srcRect) {
137 SkRect r = SkRect::MakeLTRB(srcRect->fLeft * xScale + SK_Scalar1, 137 SkRect r = SkRect::MakeLTRB(srcRect->fLeft * xScale + SK_Scalar1,
138 srcRect->fTop * yScale + SK_Scalar1, 138 srcRect->fTop * yScale + SK_Scalar1,
139 srcRect->fRight * xScale + SK_Scalar1, 139 srcRect->fRight * xScale + SK_Scalar1,
140 srcRect->fBottom * yScale + SK_Scalar1); 140 srcRect->fBottom * yScale + SK_Scalar1);
141 SkPaint p; 141 SkPaint p;
142 p.setColor(SK_ColorRED); 142 p.setColor(SK_ColorRED);
143 p.setStyle(SkPaint::kStroke_Style); 143 p.setStyle(SkPaint::kStroke_Style);
144 144
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 fInfo.push(SkObjectParser::RectToString(*src, "Src: ")); 345 fInfo.push(SkObjectParser::RectToString(*src, "Src: "));
346 } 346 }
347 fInfo.push(SkObjectParser::RectToString(dst, "Dst: ")); 347 fInfo.push(SkObjectParser::RectToString(dst, "Dst: "));
348 if (paint) { 348 if (paint) {
349 fInfo.push(SkObjectParser::PaintToString(*paint)); 349 fInfo.push(SkObjectParser::PaintToString(*paint));
350 } 350 }
351 fInfo.push(SkObjectParser::IntToString(fConstraint, "Constraint: ")); 351 fInfo.push(SkObjectParser::IntToString(fConstraint, "Constraint: "));
352 } 352 }
353 353
354 void SkDrawBitmapRectCommand::execute(SkCanvas* canvas) const { 354 void SkDrawBitmapRectCommand::execute(SkCanvas* canvas) const {
355 canvas->drawBitmapRect(fBitmap, this->srcRect(), fDst, fPaintPtr, fConstrain t); 355 canvas->legacy_drawBitmapRect(fBitmap, this->srcRect(), fDst, fPaintPtr, fCo nstraint);
356 } 356 }
357 357
358 bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const { 358 bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const {
359 render_bitmap(canvas, fBitmap, this->srcRect()); 359 render_bitmap(canvas, fBitmap, this->srcRect());
360 return true; 360 return true;
361 } 361 }
362 362
363 SkDrawImageCommand::SkDrawImageCommand(const SkImage* image, SkScalar left, SkSc alar top, 363 SkDrawImageCommand::SkDrawImageCommand(const SkImage* image, SkScalar left, SkSc alar top,
364 const SkPaint* paint) 364 const SkPaint* paint)
365 : INHERITED(kDrawImage_OpType) 365 : INHERITED(kDrawImage_OpType)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 if (src) { 398 if (src) {
399 fSrc.set(*src); 399 fSrc.set(*src);
400 } 400 }
401 401
402 if (paint) { 402 if (paint) {
403 fPaint.set(*paint); 403 fPaint.set(*paint);
404 } 404 }
405 } 405 }
406 406
407 void SkDrawImageRectCommand::execute(SkCanvas* canvas) const { 407 void SkDrawImageRectCommand::execute(SkCanvas* canvas) const {
408 canvas->drawImageRect(fImage, fSrc.getMaybeNull(), fDst, fPaint.getMaybeNull (), fConstraint); 408 canvas->legacy_drawImageRect(fImage, fSrc.getMaybeNull(), fDst, fPaint.getMa ybeNull(), fConstraint);
409 } 409 }
410 410
411 bool SkDrawImageRectCommand::render(SkCanvas* canvas) const { 411 bool SkDrawImageRectCommand::render(SkCanvas* canvas) const {
412 SkAutoCanvasRestore acr(canvas, true); 412 SkAutoCanvasRestore acr(canvas, true);
413 canvas->clear(0xFFFFFFFF); 413 canvas->clear(0xFFFFFFFF);
414 414
415 xlate_and_scale_to_bounds(canvas, fDst); 415 xlate_and_scale_to_bounds(canvas, fDst);
416 416
417 this->execute(canvas); 417 this->execute(canvas);
418 return true; 418 return true;
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 947
948 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { 948 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) {
949 fUserMatrix = userMatrix; 949 fUserMatrix = userMatrix;
950 } 950 }
951 951
952 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { 952 void SkSetMatrixCommand::execute(SkCanvas* canvas) const {
953 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); 953 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix);
954 canvas->setMatrix(temp); 954 canvas->setMatrix(temp);
955 } 955 }
956 956
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698