| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 void SkBaseDevice::drawImage(const SkDraw& draw, const SkImage* image, SkScalar
x, SkScalar y, | 147 void SkBaseDevice::drawImage(const SkDraw& draw, const SkImage* image, SkScalar
x, SkScalar y, |
| 148 const SkPaint& paint) { | 148 const SkPaint& paint) { |
| 149 // Default impl : turns everything into raster bitmap | 149 // Default impl : turns everything into raster bitmap |
| 150 SkBitmap bm; | 150 SkBitmap bm; |
| 151 if (as_IB(image)->getROPixels(&bm)) { | 151 if (as_IB(image)->getROPixels(&bm)) { |
| 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 // Default impl : turns everything into raster bitmap | 159 // Default impl : turns everything into raster bitmap |
| 159 SkBitmap bm; | 160 SkBitmap bm; |
| 160 if (as_IB(image)->getROPixels(&bm)) { | 161 if (as_IB(image)->getROPixels(&bm)) { |
| 161 this->drawBitmapRect(draw, bm, src, dst, paint, SkCanvas::kNone_DrawBitm
apRectFlag); | 162 this->drawBitmapRect(draw, bm, src, dst, paint, (SK_VIRTUAL_CONSTRAINT_T
YPE)constraint); |
| 162 } | 163 } |
| 163 } | 164 } |
| 164 | 165 |
| 165 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, |
| 166 const SkRect& dst, const SkPaint& paint) { | 167 const SkRect& dst, const SkPaint& paint) { |
| 167 SkNinePatchIter iter(image->width(), image->height(), center, dst); | 168 SkNinePatchIter iter(image->width(), image->height(), center, dst); |
| 168 | 169 |
| 169 SkRect srcR, dstR; | 170 SkRect srcR, dstR; |
| 170 while (iter.next(&srcR, &dstR)) { | 171 while (iter.next(&srcR, &dstR)) { |
| 171 this->drawImageRect(draw, image, &srcR, dstR, paint); | 172 this->drawImageRect(draw, image, &srcR, dstR, paint, SkCanvas::kStrict_S
rcRectConstraint); |
| 172 } | 173 } |
| 173 } | 174 } |
| 174 | 175 |
| 175 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, |
| 176 const SkRect& dst, const SkPaint& paint) { | 177 const SkRect& dst, const SkPaint& paint) { |
| 177 SkNinePatchIter iter(bitmap.width(), bitmap.height(), center, dst); | 178 SkNinePatchIter iter(bitmap.width(), bitmap.height(), center, dst); |
| 178 | 179 |
| 179 SkRect srcR, dstR; | 180 SkRect srcR, dstR; |
| 180 while (iter.next(&srcR, &dstR)) { | 181 while (iter.next(&srcR, &dstR)) { |
| 181 this->drawBitmapRect(draw, bitmap, &srcR, dstR, paint, SkCanvas::kNone_D
rawBitmapRectFlag); | 182 this->drawBitmapRect(draw, bitmap, &srcR, dstR, paint, |
| 183 (SK_VIRTUAL_CONSTRAINT_TYPE)SkCanvas::kStrict_SrcRe
ctConstraint); |
| 182 } | 184 } |
| 183 } | 185 } |
| 184 | 186 |
| 185 void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR
SXform xform[], | 187 void SkBaseDevice::drawAtlas(const SkDraw& draw, const SkImage* atlas, const SkR
SXform xform[], |
| 186 const SkRect tex[], const SkColor colors[], int cou
nt, | 188 const SkRect tex[], const SkColor colors[], int cou
nt, |
| 187 SkXfermode::Mode mode, const SkPaint& paint) { | 189 SkXfermode::Mode mode, const SkPaint& paint) { |
| 188 SkPath path; | 190 SkPath path; |
| 189 path.setIsVolatile(true); | 191 path.setIsVolatile(true); |
| 190 | 192 |
| 191 for (int i = 0; i < count; ++i) { | 193 for (int i = 0; i < count; ++i) { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() | 409 if (kUnknown_SkPixelGeometry == fSurfaceProps.pixelGeometry() |
| 408 || this->onShouldDisableLCD(paint)) { | 410 || this->onShouldDisableLCD(paint)) { |
| 409 | 411 |
| 410 flags &= ~SkPaint::kLCDRenderText_Flag; | 412 flags &= ~SkPaint::kLCDRenderText_Flag; |
| 411 flags |= SkPaint::kGenA8FromLCD_Flag; | 413 flags |= SkPaint::kGenA8FromLCD_Flag; |
| 412 } | 414 } |
| 413 | 415 |
| 414 return flags; | 416 return flags; |
| 415 } | 417 } |
| 416 | 418 |
| OLD | NEW |