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 "SkDevice.h" | 8 #include "SkDevice.h" |
9 #include "SkDeviceProperties.h" | 9 #include "SkDeviceProperties.h" |
10 #include "SkDraw.h" | 10 #include "SkDraw.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 SkFAIL("unhandled positioning mode"); | 158 SkFAIL("unhandled positioning mode"); |
159 } | 159 } |
160 | 160 |
161 if (drawFilter) { | 161 if (drawFilter) { |
162 // A draw filter may change the paint arbitrarily, so we must re-see
d in this case. | 162 // A draw filter may change the paint arbitrarily, so we must re-see
d in this case. |
163 runPaint = paint; | 163 runPaint = paint; |
164 } | 164 } |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
| 168 #include "SkImage_Base.h" |
| 169 |
| 170 void SkBaseDevice::drawImage(const SkDraw& draw, const SkImage* image, SkScalar
x, SkScalar y, |
| 171 const SkPaint& paint) { |
| 172 // Default impl : turns everything into raster bitmap |
| 173 SkBitmap bm; |
| 174 if (as_IB(image)->getROPixels(&bm)) { |
| 175 this->drawBitmap(draw, bm, SkMatrix::MakeTrans(x, y), paint); |
| 176 } |
| 177 } |
| 178 |
| 179 void SkBaseDevice::drawImageRect(const SkDraw& draw, const SkImage* image, const
SkRect* src, |
| 180 const SkRect& dst, const SkPaint& paint) { |
| 181 // Default impl : turns everything into raster bitmap |
| 182 SkBitmap bm; |
| 183 if (as_IB(image)->getROPixels(&bm)) { |
| 184 this->drawBitmapRect(draw, bm, src, dst, paint, SkCanvas::DrawBitmapRect
Flags(0)); |
| 185 } |
| 186 } |
| 187 |
168 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt
es, int x, int y) { | 188 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt
es, int x, int y) { |
169 #ifdef SK_DEBUG | 189 #ifdef SK_DEBUG |
170 SkASSERT(info.width() > 0 && info.height() > 0); | 190 SkASSERT(info.width() > 0 && info.height() > 0); |
171 SkASSERT(dstP); | 191 SkASSERT(dstP); |
172 SkASSERT(rowBytes >= info.minRowBytes()); | 192 SkASSERT(rowBytes >= info.minRowBytes()); |
173 SkASSERT(x >= 0 && y >= 0); | 193 SkASSERT(x >= 0 && y >= 0); |
174 | 194 |
175 const SkImageInfo& srcInfo = this->imageInfo(); | 195 const SkImageInfo& srcInfo = this->imageInfo(); |
176 SkASSERT(x + info.width() <= srcInfo.width()); | 196 SkASSERT(x + info.width() <= srcInfo.width()); |
177 SkASSERT(y + info.height() <= srcInfo.height()); | 197 SkASSERT(y + info.height() <= srcInfo.height()); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry() | 379 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry() |
360 || this->onShouldDisableLCD(paint)) { | 380 || this->onShouldDisableLCD(paint)) { |
361 | 381 |
362 flags &= ~SkPaint::kLCDRenderText_Flag; | 382 flags &= ~SkPaint::kLCDRenderText_Flag; |
363 flags |= SkPaint::kGenA8FromLCD_Flag; | 383 flags |= SkPaint::kGenA8FromLCD_Flag; |
364 } | 384 } |
365 | 385 |
366 return flags; | 386 return flags; |
367 } | 387 } |
368 | 388 |
OLD | NEW |