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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 void SkBaseDevice::initForRootLayer(SkPixelGeometry geo) { | 85 void SkBaseDevice::initForRootLayer(SkPixelGeometry geo) { |
86 // For now we don't expect to change the geometry for the root-layer, but we
make the call | 86 // For now we don't expect to change the geometry for the root-layer, but we
make the call |
87 // anyway to document logically what is going on. | 87 // anyway to document logically what is going on. |
88 // | 88 // |
89 fLeakyProperties->setPixelGeometry(CreateInfo::AdjustGeometry(this->imageInf
o(), | 89 fLeakyProperties->setPixelGeometry(CreateInfo::AdjustGeometry(this->imageInf
o(), |
90 kPossible_Tile
Usage, | 90 kPossible_Tile
Usage, |
91 geo)); | 91 geo)); |
92 } | 92 } |
93 | 93 |
94 SkSurface* SkBaseDevice::newSurface(const SkImageInfo&, const SkSurfaceProps&) {
return NULL; } | |
95 | |
96 const void* SkBaseDevice::peekPixels(SkImageInfo*, size_t*) { return NULL; } | |
97 | |
98 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, | 94 void SkBaseDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, |
99 const SkRRect& inner, const SkPaint& paint) { | 95 const SkRRect& inner, const SkPaint& paint) { |
100 SkPath path; | 96 SkPath path; |
101 path.addRRect(outer); | 97 path.addRRect(outer); |
102 path.addRRect(inner); | 98 path.addRRect(inner); |
103 path.setFillType(SkPath::kEvenOdd_FillType); | 99 path.setFillType(SkPath::kEvenOdd_FillType); |
104 | 100 |
105 const SkMatrix* preMatrix = NULL; | 101 const SkMatrix* preMatrix = NULL; |
106 const bool pathIsMutable = true; | 102 const bool pathIsMutable = true; |
107 this->drawPath(draw, path, paint, preMatrix, pathIsMutable); | 103 this->drawPath(draw, path, paint, preMatrix, pathIsMutable); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } | 210 } |
215 | 211 |
216 bool SkBaseDevice::onWritePixels(const SkImageInfo&, const void*, size_t, int, i
nt) { | 212 bool SkBaseDevice::onWritePixels(const SkImageInfo&, const void*, size_t, int, i
nt) { |
217 return false; | 213 return false; |
218 } | 214 } |
219 | 215 |
220 bool SkBaseDevice::onReadPixels(const SkImageInfo&, void*, size_t, int x, int y)
{ | 216 bool SkBaseDevice::onReadPixels(const SkImageInfo&, void*, size_t, int x, int y)
{ |
221 return false; | 217 return false; |
222 } | 218 } |
223 | 219 |
224 void* SkBaseDevice::accessPixels(SkImageInfo* info, size_t* rowBytes) { | |
225 SkImageInfo tmpInfo; | |
226 size_t tmpRowBytes; | |
227 if (NULL == info) { | |
228 info = &tmpInfo; | |
229 } | |
230 if (NULL == rowBytes) { | |
231 rowBytes = &tmpRowBytes; | |
232 } | |
233 return this->onAccessPixels(info, rowBytes); | |
234 } | |
235 | |
236 void* SkBaseDevice::onAccessPixels(SkImageInfo* info, size_t* rowBytes) { | |
237 return NULL; | |
238 } | |
239 | |
240 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
kMatrix*, | 220 bool SkBaseDevice::EXPERIMENTAL_drawPicture(SkCanvas*, const SkPicture*, const S
kMatrix*, |
241 const SkPaint*) { | 221 const SkPaint*) { |
242 // The base class doesn't perform any accelerated picture rendering | 222 // The base class doesn't perform any accelerated picture rendering |
243 return false; | 223 return false; |
244 } | 224 } |
245 | 225 |
| 226 bool SkBaseDevice::accessPixels(SkPixmap* pmap) { |
| 227 SkPixmap tempStorage; |
| 228 if (NULL == pmap) { |
| 229 pmap = &tempStorage; |
| 230 } |
| 231 return this->onAccessPixels(pmap); |
| 232 } |
| 233 |
| 234 bool SkBaseDevice::peekPixels(SkPixmap* pmap) { |
| 235 SkPixmap tempStorage; |
| 236 if (NULL == pmap) { |
| 237 pmap = &tempStorage; |
| 238 } |
| 239 return this->onPeekPixels(pmap); |
| 240 } |
| 241 |
246 ////////////////////////////////////////////////////////////////////////////////
////////// | 242 ////////////////////////////////////////////////////////////////////////////////
////////// |
247 | 243 |
248 static void morphpoints(SkPoint dst[], const SkPoint src[], int count, | 244 static void morphpoints(SkPoint dst[], const SkPoint src[], int count, |
249 SkPathMeasure& meas, const SkMatrix& matrix) { | 245 SkPathMeasure& meas, const SkMatrix& matrix) { |
250 SkMatrix::MapXYProc proc = matrix.getMapXYProc(); | 246 SkMatrix::MapXYProc proc = matrix.getMapXYProc(); |
251 | 247 |
252 for (int i = 0; i < count; i++) { | 248 for (int i = 0; i < count; i++) { |
253 SkPoint pos; | 249 SkPoint pos; |
254 SkVector tangent; | 250 SkVector tangent; |
255 | 251 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry() | 374 if (kUnknown_SkPixelGeometry == fLeakyProperties->pixelGeometry() |
379 || this->onShouldDisableLCD(paint)) { | 375 || this->onShouldDisableLCD(paint)) { |
380 | 376 |
381 flags &= ~SkPaint::kLCDRenderText_Flag; | 377 flags &= ~SkPaint::kLCDRenderText_Flag; |
382 flags |= SkPaint::kGenA8FromLCD_Flag; | 378 flags |= SkPaint::kGenA8FromLCD_Flag; |
383 } | 379 } |
384 | 380 |
385 return flags; | 381 return flags; |
386 } | 382 } |
387 | 383 |
OLD | NEW |