OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkColorFilter.h" | 8 #include "SkColorFilter.h" |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint); | 152 this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint); |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 void SkBaseDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const
SkRect* src, | 156 void SkBaseDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const
SkRect* src, |
157 const SkRect& dst, const SkPaint& paint, | 157 const SkRect& dst, const SkPaint& paint, |
158 SkCanvas::SrcRectConstraint constraint) { | 158 SkCanvas::SrcRectConstraint constraint) { |
159 // Default impl : turns everything into raster bitmap | 159 // Default impl : turns everything into raster bitmap |
160 SkBitmap bm; | 160 SkBitmap bm; |
161 if (as_IB(image)->getROPixels(&bm)) { | 161 if (as_IB(image)->getROPixels(&bm)) { |
162 this->drawBitmapRect(draw, bm, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_T
YPE)constraint); | 162 this->drawBitmapRect(draw, bm, src, dst, paint, constraint); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 void SkBaseDevice::drawImageNine(const SkDraw& draw, const SkImage* image, const
SkIRect& center, | 166 void SkBaseDevice::drawImageNine(const SkDraw& draw, const SkImage* image, const
SkIRect& center, |
167 const SkRect& dst, const SkPaint& paint) { | 167 const SkRect& dst, const SkPaint& paint) { |
168 SkNinePatchIter iter(image->width(), image->height(), center, dst); | 168 SkNinePatchIter iter(image->width(), image->height(), center, dst); |
169 | 169 |
170 SkRect srcR, dstR; | 170 SkRect srcR, dstR; |
171 while (iter.next(&srcR, &dstR)) { | 171 while (iter.next(&srcR, &dstR)) { |
172 this->drawImageRect(draw, image, &srcR, dstR, paint, SkCanvas::kStrict_S
rcRectConstraint); | 172 this->drawImageRect(draw, image, &srcR, dstR, paint, SkCanvas::kStrict_S
rcRectConstraint); |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 void SkBaseDevice::drawBitmapNine(const SkDraw& draw, const SkBitmap& bitmap, co
nst SkIRect& center, | 176 void SkBaseDevice::drawBitmapNine(const SkDraw& draw, const SkBitmap& bitmap, co
nst SkIRect& center, |
177 const SkRect& dst, const SkPaint& paint) { | 177 const SkRect& dst, const SkPaint& paint) { |
178 SkNinePatchIter iter(bitmap.width(), bitmap.height(), center, dst); | 178 SkNinePatchIter iter(bitmap.width(), bitmap.height(), center, dst); |
179 | 179 |
180 SkRect srcR, dstR; | 180 SkRect srcR, dstR; |
181 while (iter.next(&srcR, &dstR)) { | 181 while (iter.next(&srcR, &dstR)) { |
182 this->drawBitmapRect(draw, bitmap, &srcR, dstR, paint, | 182 this->drawBitmapRect(draw, bitmap, &srcR, dstR, paint, SkCanvas::kStrict
_SrcRectConstraint); |
183 (SK_VIRTUAL_CONSTRAINT_TYPE)SkCanvas::kStrict_SrcRe
ctConstraint); | |
184 } | 183 } |
185 } | 184 } |
186 | 185 |
187 void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR
SXform xform[], | 186 void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR
SXform xform[], |
188 const SkRect tex[], const SkColor colors[], int cou
nt, | 187 const SkRect tex[], const SkColor colors[], int cou
nt, |
189 SkXfermode::Mode mode, const SkPaint& paint) { | 188 SkXfermode::Mode mode, const SkPaint& paint) { |
190 SkPath path; | 189 SkPath path; |
191 path.setIsVolatile(true); | 190 path.setIsVolatile(true); |
192 | 191 |
193 for (int i = 0; i < count; ++i) { | 192 for (int i = 0; i < count; ++i) { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() | 408 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() |
410 || this->onShouldDisableLCD(paint)) { | 409 || this->onShouldDisableLCD(paint)) { |
411 | 410 |
412 flags &= ~SkPaint::kLCDRenderText_Flag; | 411 flags &= ~SkPaint::kLCDRenderText_Flag; |
413 flags |= SkPaint::kGenA8FromLCD_Flag; | 412 flags |= SkPaint::kGenA8FromLCD_Flag; |
414 } | 413 } |
415 | 414 |
416 return flags; | 415 return flags; |
417 } | 416 } |
418 | 417 |
OLD | NEW |