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

Side by Side Diff: src/effects/SkBitmapSource.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 * Copyright 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 "SkBitmapSource.h" 8 #include "SkBitmapSource.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 SkPaint paint; 77 SkPaint paint;
78 78
79 // Subtract off the integer component of the translation (will be applied in loc, below). 79 // Subtract off the integer component of the translation (will be applied in loc, below).
80 dstRect.offset(-SkIntToScalar(dstIRect.fLeft), -SkIntToScalar(dstIRect.fTop) ); 80 dstRect.offset(-SkIntToScalar(dstIRect.fLeft), -SkIntToScalar(dstIRect.fTop) );
81 paint.setXfermodeMode(SkXfermode::kSrc_Mode); 81 paint.setXfermodeMode(SkXfermode::kSrc_Mode);
82 // FIXME: this probably shouldn't be necessary, but drawBitmapRect asserts 82 // FIXME: this probably shouldn't be necessary, but drawBitmapRect asserts
83 // None filtering when it's translate-only 83 // None filtering when it's translate-only
84 paint.setFilterQuality( 84 paint.setFilterQuality(
85 fSrcRect.width() == dstRect.width() && fSrcRect.height() == dstRect.heig ht() ? 85 fSrcRect.width() == dstRect.width() && fSrcRect.height() == dstRect.heig ht() ?
86 kNone_SkFilterQuality : fFilterQuality); 86 kNone_SkFilterQuality : fFilterQuality);
87 canvas.drawBitmapRect(fBitmap, &fSrcRect, dstRect, &paint, SkCanvas::kStrict _SrcRectConstraint); 87 canvas.drawBitmapRect(fBitmap, fSrcRect, dstRect, &paint, SkCanvas::kStrict_ SrcRectConstraint);
88 88
89 *result = device.get()->accessBitmap(false); 89 *result = device.get()->accessBitmap(false);
90 offset->fX = dstIRect.fLeft; 90 offset->fX = dstIRect.fLeft;
91 offset->fY = dstIRect.fTop; 91 offset->fY = dstIRect.fTop;
92 92
93 return true; 93 return true;
94 } 94 }
95 95
96 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const { 96 void SkBitmapSource::computeFastBounds(const SkRect&, SkRect* dst) const {
97 *dst = fDstRect; 97 *dst = fDstRect;
98 } 98 }
99 99
100 #ifndef SK_IGNORE_TO_STRING 100 #ifndef SK_IGNORE_TO_STRING
101 void SkBitmapSource::toString(SkString* str) const { 101 void SkBitmapSource::toString(SkString* str) const {
102 str->appendf("SkBitmapSource: ("); 102 str->appendf("SkBitmapSource: (");
103 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ", 103 str->appendf("src: (%f,%f,%f,%f) dst: (%f,%f,%f,%f) ",
104 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m, 104 fSrcRect.fLeft, fSrcRect.fTop, fSrcRect.fRight, fSrcRect.fBotto m,
105 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto m); 105 fDstRect.fLeft, fDstRect.fTop, fDstRect.fRight, fDstRect.fBotto m);
106 str->appendf("bitmap: (%d,%d)", 106 str->appendf("bitmap: (%d,%d)",
107 fBitmap.width(), fBitmap.height()); 107 fBitmap.width(), fBitmap.height());
108 str->append(")"); 108 str->append(")");
109 } 109 }
110 #endif 110 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698