| 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 | |
| 188 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt
es, int x, int y) { | 168 bool SkBaseDevice::readPixels(const SkImageInfo& info, void* dstP, size_t rowByt
es, int x, int y) { |
| 189 #ifdef SK_DEBUG | 169 #ifdef SK_DEBUG |
| 190 SkASSERT(info.width() > 0 && info.height() > 0); | 170 SkASSERT(info.width() > 0 && info.height() > 0); |
| 191 SkASSERT(dstP); | 171 SkASSERT(dstP); |
| 192 SkASSERT(rowBytes >= info.minRowBytes()); | 172 SkASSERT(rowBytes >= info.minRowBytes()); |
| 193 SkASSERT(x >= 0 && y >= 0); | 173 SkASSERT(x >= 0 && y >= 0); |
| 194 | 174 |
| 195 const SkImageInfo& srcInfo = this->imageInfo(); | 175 const SkImageInfo& srcInfo = this->imageInfo(); |
| 196 SkASSERT(x + info.width() <= srcInfo.width()); | 176 SkASSERT(x + info.width() <= srcInfo.width()); |
| 197 SkASSERT(y + info.height() <= srcInfo.height()); | 177 SkASSERT(y + info.height() <= srcInfo.height()); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry() | 359 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry() |
| 380 || this->onShouldDisableLCD(paint)) { | 360 || this->onShouldDisableLCD(paint)) { |
| 381 | 361 |
| 382 flags &= ~SkPaint::kLCDRenderText_Flag; | 362 flags &= ~SkPaint::kLCDRenderText_Flag; |
| 383 flags |= SkPaint::kGenA8FromLCD_Flag; | 363 flags |= SkPaint::kGenA8FromLCD_Flag; |
| 384 } | 364 } |
| 385 | 365 |
| 386 return flags; | 366 return flags; |
| 387 } | 367 } |
| 388 | 368 |
| OLD | NEW |